CLI Commands
This page documents all available Spectr CLI commands and their options.
Essential Commands
Section titled “Essential Commands”List Changes and Specs
Section titled “List Changes and Specs”List all active changes and specifications:
spectr listList specifications with detailed information:
spectr list --specsspectr spec list --longOptions:
--specs- Show specifications instead of changes--long- Show detailed information--json- Machine-readable JSON output
View Details
Section titled “View Details”Display details about a specific change or spec:
spectr view <change-id>spectr view <spec-id> --type specExamples:
# View change detailsspectr view add-two-factor-auth
# View spec detailsspectr view auth --type spec
# JSON output with delta detailsspectr view add-two-factor-auth --json --deltas-onlyOptions:
--type change|spec- Specify what to view (required if ambiguous)--json- Machine-readable JSON output--deltas-only- Show only spec deltas
Validate Changes and Specs
Section titled “Validate Changes and Specs”Validate a change or specification:
spectr validate <change-id>spectr validate --strictExamples:
# Validate single changespectr validate add-two-factor-auth --strict
# Bulk validation (interactive)spectr validate
# Validate all specsspectr validate --specsOptions:
--strict- Comprehensive validation with all checks--specs- Validate specs instead of changes--no-interactive- Disable prompts
Archive a Change
Section titled “Archive a Change”Move a completed change to archive and merge specs:
spectr archive <change-id> --yesExamples:
# Interactive archivingspectr archive add-two-factor-auth
# Non-interactive (use --yes flag)spectr archive add-two-factor-auth --yes
# Archive without updating specsspectr archive add-two-factor-auth --skip-specs --yesOptions:
--yes,-y- Skip confirmation prompts--skip-specs- Archive without merging specs--no-interactive- Disable all prompts
Project Management
Section titled “Project Management”Initialize Spectr
Section titled “Initialize Spectr”Initialize a new Spectr project:
spectr init [path]Examples:
# Initialize in current directoryspectr init
# Initialize in specific directoryspectr init ./docsThis also updates the instruction markdown files in the project.
Global Options
Section titled “Global Options”Most commands support these global options:
spectr [command] [options]--help- Show command help--version- Show Spectr version--json- Output as JSON (where supported)--no-interactive- Disable interactive prompts
Interactive Mode
Section titled “Interactive Mode”Some commands support interactive mode:
# Interactive spec selectionspectr view
# Interactive validationspectr validate
# Interactive archivingspectr archiveOutput Formats
Section titled “Output Formats”Text Output (Default)
Section titled “Text Output (Default)”Human-readable text format:
spectr listOutput:
Active Changes:├─ add-two-factor-auth (created 2025-01-15)│ ├─ status: pending│ └─ affected: auth, notifications└─ update-api-versioning (created 2025-01-10)JSON Output
Section titled “JSON Output”Machine-readable JSON format:
spectr list --jsonOutput:
{ "changes": [ { "id": "add-two-factor-auth", "created": "2025-01-15T10:30:00Z", "status": "pending", "affectedSpecs": ["auth", "notifications"] } ]}Common Workflows
Section titled “Common Workflows”Create and Validate a Change
Section titled “Create and Validate a Change”# 1. Create change directory and filesmkdir -p spectr/changes/add-feature/specs/auth
# 2. Write proposal.md, tasks.md, and spec.md files
# 3. Validate the changespectr validate add-feature --strict
# 4. Fix any issues shown in validation
# 5. Validate againspectr validate add-feature --strictImplement and Archive
Section titled “Implement and Archive”# 1. Check change detailsspectr view add-feature
# 2. Implement according to tasks.md
# 3. Mark all tasks complete in tasks.md
# 4. Validate before archivingspectr validate add-feature --strict
# 5. Archive the changespectr archive add-feature --yes
# 6. Verify specs were updatedspectr validate --strictExplore Project State
Section titled “Explore Project State”# 1. List all active changesspectr list
# 2. List all specsspectr list --specs
# 3. View details of a changespectr view add-feature
# 4. View details of a specspectr view auth --type spec
# 5. Validate everythingspectr validate --strictTroubleshooting
Section titled “Troubleshooting”Command not found
Section titled “Command not found”If you get “command not found”, ensure Spectr is installed:
# Check installationwhich spectr
# Install if needed (see Installation guide)Ambiguous item
Section titled “Ambiguous item”If you get “ambiguous item” error, specify the type:
# Error: Could be change or specspectr view auth
# Solution: Specify typespectr view auth --type specPermission denied
Section titled “Permission denied”If you get permission errors when creating files:
# Check directory permissionsls -la spectr/
# Ensure you have write permissionchmod -R u+w spectr/Tips and Tricks
Section titled “Tips and Tricks”Piping JSON
Section titled “Piping JSON”Use JSON output with jq for filtering:
# Get all change IDsspectr list --json | jq '.changes[].id'
# Get specific change detailsspectr view add-feature --json | jq '.proposal'Quick Validation Loop
Section titled “Quick Validation Loop”Validate multiple times while editing:
# Watch validation resultswhile true; do clear spectr validate add-feature --strict sleep 2doneList Specs by Capability
Section titled “List Specs by Capability”# Show all specs with detailsspectr spec list --long
# Find specs matching a patternspectr spec list --json | jq '.specs[] | select(.id | contains("auth"))'