Skip to content

ThothCTL Check Space Command

Overview

The thothctl check space command provides comprehensive diagnostics for space configuration and setup. This command validates space configuration, VCS settings, credentials status, and project usage to help troubleshoot space-related issues.

Command Structure

Usage: thothctl check space [OPTIONS]

  Check space configuration and diagnostics

Options:
  -s, --space-name TEXT    Name of the space to check [required]
  --help                   Show this message and exit.

Basic Usage

Check Space Configuration

thothctl check space --space-name development

This validates the specified space's configuration and provides comprehensive diagnostics.

Validation Output

The command provides professional Rich-formatted output with multiple diagnostic sections:

Space Overview

  • Space name and description
  • Configuration file status
  • Directory structure validation
  • Creation and modification timestamps

VCS Configuration

  • Version control system provider (GitHub, Azure Repos, GitLab)
  • Repository settings and authentication method
  • Configuration file validation
  • Connection status

Credentials Status

  • Authentication token availability
  • Credential file locations
  • Security status and recommendations
  • Token expiration warnings (if applicable)

Project Usage

  • List of projects using this space
  • Project count and status
  • Space utilization metrics
  • Project health indicators

Example Output

โ„น๏ธ ๐Ÿ” Checking space configuration: labvel-devsecops
                ๐ŸŒŒ Space Overview: labvel-devsecops                 
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ Property         โ”ƒ Value                                         โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ Name             โ”‚ labvel-devsecops                              โ”‚
โ”‚ Version          โ”‚ 1.0.0                                         โ”‚
โ”‚ Path             โ”‚ /home/labvel/.thothcf/spaces/labvel-devsecops โ”‚
โ”‚ Config Path      โ”‚ configs                                       โ”‚
โ”‚ Credentials Path โ”‚ credentials                                   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                        ๐Ÿ”„ VCS Configuration                         
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ Setting             โ”ƒ Value                       โ”ƒ Status        โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ Default Provider    โ”‚ github                      โ”‚ โœ… Configured โ”‚
โ”‚ Available Providers โ”‚ azure_repos, github, gitlab โ”‚ โœ… Set        โ”‚
โ”‚ VCS Path            โ”‚ vcs                         โ”‚ โœ… Set        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                    ๐Ÿ”’ Credentials Status                     
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ Type      โ”ƒ File          โ”ƒ Status       โ”ƒ Details         โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ VCS       โ”‚ vcs.enc       โ”‚ โœ… Available โ”‚ Size: 292 bytes โ”‚
โ”‚ TERRAFORM โ”‚ terraform.enc โ”‚ โŒ Missing   โ”‚ Not configured  โ”‚
โ”‚ CLOUD     โ”‚ cloud.enc     โ”‚ โŒ Missing   โ”‚ Not configured  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๐Ÿ“ Projects โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ No projects are currently using space 'labvel-devsecops'                                                                                                                                                                         โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Use Cases

Space Troubleshooting

When experiencing issues with space configuration:

thothctl check space --space-name production

This helps identify: - Missing configuration files - Invalid VCS settings - Credential issues - Project association problems

Pre-deployment Validation

Before deploying projects in a space:

thothctl check space --space-name staging

Ensures the space is properly configured and ready for project operations.

Credential Verification

To verify credential setup and security:

thothctl check space --space-name development

Shows credential status and provides security recommendations.

Configuration Validation

The command validates several configuration aspects:

Space Directory Structure

~/.thothcf/spaces/{space_name}/
โ”œโ”€โ”€ config.toml              # Space configuration
โ”œโ”€โ”€ credentials.toml         # VCS credentials
โ”œโ”€โ”€ vcs/                     # VCS-specific settings
โ”œโ”€โ”€ terraform/               # Terraform registry settings
โ””โ”€โ”€ orchestration/           # Orchestration tool settings

Configuration Files

config.toml

[space]
name = "development"
description = "Development environment space"
created_at = "2024-01-15T10:30:00Z"

[vcs]
provider = "github"
auth_method = "token"

[terraform]
registry = "registry.terraform.io"

[orchestration]
tool = "terragrunt"

credentials.toml

[github]
token = "ghp_xxxxxxxxxxxxxxxxxxxx"
username = "developer"

[azure_repos]
# Azure DevOps credentials (if applicable)

[gitlab]
# GitLab credentials (if applicable)

Error Scenarios

Space Not Found

โŒ Space 'nonexistent' does not exist
Solution: Verify space name or create the space using thothctl init space.

Missing Configuration

โš ๏ธ Configuration file missing: config.toml
Solution: Reinitialize the space or manually create the configuration file.

Invalid Credentials

โŒ GitHub Token: Invalid or expired
Solution: Update credentials using space initialization or manual configuration.

VCS Connection Issues

โŒ VCS Configuration: Connection failed
Solution: Verify network connectivity and credential validity.

Integration with Other Commands

Space Initialization

# Create a new space
thothctl init space --space-name development --vcs-provider github

# Check the newly created space
thothctl check space --space-name development

Project Creation

# Create project in space
thothctl init project --project-name my-app --space development

# Verify space configuration before project creation
thothctl check space --space-name development

Space Management

# List all spaces
thothctl list spaces

# Check specific space
thothctl check space --space-name production

# Remove space (with validation)
thothctl remove space --space-name old-space

Best Practices

  1. Regular Health Checks: Run space checks periodically to ensure configuration integrity
  2. Pre-Project Validation: Always check space configuration before creating new projects
  3. Credential Rotation: Use space checks to monitor credential status and expiration
  4. Environment Consistency: Validate space configuration across different environments
  5. Troubleshooting Workflow: Use space checks as the first step in diagnosing space-related issues

Troubleshooting

Common Issues

Permission Denied

Error: [Errno 13] Permission denied: ~/.thothcf/spaces/development
Solution: Check file permissions and ensure proper access to the ThothCTL configuration directory.

Network Connectivity

โŒ VCS Connection: Timeout
Solution: Verify network connectivity and firewall settings for VCS provider access.

Corrupted Configuration

โš ๏ธ Configuration file corrupted
Solution: Backup and recreate the space configuration or restore from a known good state.

Debugging

Enable debug mode for detailed diagnostic information:

thothctl --debug check space --space-name development

This provides: - Detailed file system operations - Network connection attempts - Configuration parsing details - Credential validation steps

Exit Codes

  • Exit Code 0: Space configuration is valid and healthy
  • Exit Code 1: Space configuration issues detected or space not found