inspect
Inspect and analyze Xec project configuration, tasks, and resources.
Synopsisβ
xec inspect [type] [name] [options]
xec i [type] [name] [options] # Alias
Descriptionβ
The inspect
command provides comprehensive analysis and visualization of your Xec project configuration, tasks, targets, variables, scripts, commands, and system information. It offers multiple output formats and validation capabilities.
Argumentsβ
[type]
- Type of resource to inspect:all
,tasks
,targets
,vars
,scripts
,commands
,config
,system
,cache
[name]
- Specific resource name to inspect
Optionsβ
Display Optionsβ
-f, --filter <pattern>
- Filter results by pattern (regex)--format <format>
- Output format:table
,json
,yaml
,tree
(default: table)-r, --resolve
- Resolve and show interpolated values-e, --explain
- Show execution plan and details
Analysis Optionsβ
--validate
- Validate configuration and connectivity-p, --profile <name>
- Use specific profile for inspection
Examplesβ
Interactive Modeβ
# Interactive mode to browse all resources
xec inspect
# Interactive inspection with alias
xec i
Resource Type Inspectionβ
# List all tasks
xec inspect tasks
# List all configured targets
xec inspect targets
# View all variables
xec inspect vars
# Show custom scripts
xec inspect scripts
# List available commands
xec inspect commands
# Display system information
xec inspect system
# View cache information
xec inspect cache
Specific Resource Inspectionβ
# Inspect specific task with execution plan
xec inspect tasks deploy --explain
# View specific target configuration
xec inspect targets hosts.production
# Show specific variable with resolved value
xec inspect vars DATABASE_URL --resolve
# Inspect specific script
xec inspect scripts deploy.js
# View system version information
xec inspect system version
Output Formatsβ
# JSON output for automation
xec inspect tasks --format json
# YAML output for readability
xec inspect config --format yaml
# Tree view for hierarchical data
xec inspect all --format tree
# Table view with filtering
xec inspect targets --filter "production" --format table
Validation and Analysisβ
# Validate all configuration
xec inspect --validate
# Validate with specific profile
xec inspect --validate -p production
# Explain task execution plan
xec inspect tasks build --explain
# Resolve variables and show interpolated values
xec inspect vars --resolve
# Filter and resolve
xec inspect targets --filter "docker" --resolve
Inspection Typesβ
Tasksβ
Displays configured tasks with their properties:
xec inspect tasks
Output includes:
- Task name and description
- Task type (command, script, pipeline)
- Parameters and their types
- Dependencies and execution order
- Target requirements
With --explain
:
- Step-by-step execution plan
- Variable interpolation
- Target resolution
- Parameter validation
Targetsβ
Shows all configured execution targets:
xec inspect targets
Output includes:
- Target name and type (local, ssh, docker, k8s)
- Connection details (host, port, container, pod)
- Authentication configuration
- Default settings inheritance
With --validate
:
- Connectivity testing
- Authentication verification
- Target availability
Variablesβ
Displays project variables and their values:
xec inspect vars
Output includes:
- Variable name and value
- Data type (string, number, boolean, object)
- Interpolation usage detection
- Secret references
With --resolve
:
- Resolved interpolated values
- Secret value indication (masked)
- Environment variable expansion
- Expression evaluation
Scriptsβ
Lists JavaScript/TypeScript scripts in the project:
xec inspect scripts
Output includes:
- Script file path and name
- File size and modification time
- Detected description (from comments)
- Executable permissions
Commandsβ
Shows available CLI commands:
xec inspect commands
Output includes:
- Command name and type (built-in, custom)
- Description and usage
- File path (for custom commands)
- Load status and errors
Configurationβ
Displays the complete project configuration:
xec inspect config
Output includes:
- Full configuration tree
- Profile-specific overrides
- Default value inheritance
- Validation status
Systemβ
Provides system and environment information:
xec inspect system
Categories:
- Version: Xec CLI, Core, Node.js versions
- OS: Operating system, architecture, release
- Hardware: CPU, memory, disk information
- Environment: User, shell, environment variables
- Network: Network interfaces and addresses
- Tools: Installed development tools
- Project: Project-specific information
Cacheβ
Shows module cache statistics:
xec inspect cache
Output includes:
- Memory cache entries
- File cache entries
- Total cache size
- Cache directory location
Output Formatsβ
Table Format (Default)β
Structured tabular output with consistent columns:
βββββββββββββββ¬βββββββββββ¬ββββββββββββββββββββββββββ
β Name β Type β Description β
βββββββββββββββΌβββββββββββΌββββββββββββββββββββββββββ€
β build β Pipeline β Build the application β
β deploy β Script β Deploy to production β
β test β Command β Run test suite β
βββββββββββββββ΄βββββββββββ΄ββββββββββββββββββββββββββ
JSON Formatβ
Machine-readable JSON for automation:
[
{
"type": "task",
"name": "build",
"data": {
"description": "Build the application",
"steps": [...]
},
"metadata": {
"hasSteps": true,
"isPrivate": false
}
}
]
YAML Formatβ
Human-readable YAML output:
build:
description: Build the application
steps:
- name: Install dependencies
command: npm install
- name: Build
command: npm run build
metadata:
hasSteps: true
isPrivate: false
Tree Formatβ
Hierarchical tree view:
π Tasks:
ββ build (Pipeline) - Build the application
β ββ hasSteps: true
ββ deploy (Script) - Deploy to production
β ββ hasScript: true
ββ test (Command) - Run test suite
π― Targets:
ββ hosts.production (SSH) - prod.example.com:22
ββ containers.app (Docker) - container: myapp
Filteringβ
The --filter
option accepts regular expressions:
# Filter by name pattern
xec inspect tasks --filter "^deploy"
# Filter by content
xec inspect vars --filter "database"
# Case-insensitive filtering
xec inspect targets --filter "(?i)production"
# Complex pattern matching
xec inspect scripts --filter "\.(ts|js)$"
Variable Resolutionβ
The --resolve
option expands variables and expressions:
# Show resolved variable values
xec inspect vars DATABASE_URL --resolve
Before resolution:
DATABASE_URL: postgresql://user:${secret:DB_PASSWORD}@${vars.DB_HOST}/myapp
After resolution:
DATABASE_URL: postgresql://user:***@localhost/myapp
Features:
- Environment variable expansion
- Secret reference indication (masked for security)
- Variable interpolation
- Expression evaluation
- Error reporting for invalid references
Validation Modeβ
The --validate
option performs comprehensive validation:
xec inspect --validate
Validation checks:
- Configuration syntax: YAML/JSON validity
- Target connectivity: Connection testing
- Variable resolution: Reference validation
- Task definitions: Parameter and step validation
- Script existence: File availability
- Command loading: Custom command validation
Sample output:
π Running Configuration Validation...
Configuration Syntax:
β Valid
Target Connectivity:
β hosts.production - SSH connection successful
β containers.app - Container not running
Variable Resolution:
β All variables resolve correctly
Task Definitions:
β All tasks are valid
System Information Categoriesβ
Version Informationβ
xec inspect system version
- Xec CLI and Core versions
- Node.js, V8, OpenSSL versions
- Package information
Operating Systemβ
xec inspect system os
- Platform, architecture, release
- Hostname, uptime, load average
- OS-specific details (macOS, Linux, Windows)
Hardwareβ
xec inspect system hardware
- CPU count and model information
- Memory total, used, available
- Memory breakdown (macOS: wired, active, inactive)
Environmentβ
xec inspect system environment
- User information (username, UID, GID)
- Shell and environment variables
- Path configuration
- Xec-specific environment variables
Networkβ
xec inspect system network
- Network interfaces
- IP addresses (IPv4, IPv6)
- MAC addresses
Development Toolsβ
xec inspect system tools
- Installed development tools and versions
- Node.js, Bun, Deno availability
- Git, Docker, kubectl status
- Package managers (npm, yarn, pnpm)
Project Informationβ
xec inspect system project
- Working directory and project root
- Configuration file presence
- Package.json information
- Git repository status
Performance Considerationsβ
- Large configurations: Use filtering for better performance
- Remote targets: Validation mode may be slower due to connectivity tests
- System information: Hardware detection adds overhead
- Cache operations: Memory inspection is lightweight
Integration with Other Commandsβ
Pipeline Usageβ
# Export task list for processing
xec inspect tasks --format json | jq '.[] | select(.data.hasSteps) | .name'
# Get target list for automation
xec inspect targets --format json | jq -r '.[].name'
# Validate before deployment
xec inspect --validate && xec run deploy
Scriptingβ
// Get configuration in scripts
const { exec } = require('child_process');
const config = JSON.parse(
await exec('xec inspect config --format json').stdout
);
// Check if target exists
const targets = JSON.parse(
await exec('xec inspect targets --format json').stdout
);
const hasProduction = targets.some(t => t.name === 'hosts.production');
Error Handlingβ
The command provides helpful error messages:
- Invalid type: Lists available types
- Resource not found: Suggests similar names
- Validation errors: Shows detailed error context
- Permission issues: Indicates access problems
- Network errors: Reports connectivity issues
Related Commandsβ
Configurationβ
Inspection behavior can be configured:
commands:
inspect:
defaultFormat: table
showMetadata: true
resolveSecrets: false
validateConnectivity: false
systemInfo:
includeTools: true
includeNetwork: false
Exit Codesβ
0
- Success1
- General error2
- Invalid arguments3
- Resource not found4
- Validation failed5
- Permission error