Skip to content

CLI Commands

This page documents all available Spectr CLI commands and their options.

List all active changes and specifications:

Terminal window
spectr list

List specifications with detailed information:

Terminal window
spectr list --specs
spectr spec list --long

Options:

  • --specs - Show specifications instead of changes
  • --long - Show detailed information
  • --json - Machine-readable JSON output

Display details about a specific change or spec:

Terminal window
spectr view <change-id>
spectr view <spec-id> --type spec

Examples:

Terminal window
# View change details
spectr view add-two-factor-auth
# View spec details
spectr view auth --type spec
# JSON output with delta details
spectr view add-two-factor-auth --json --deltas-only

Options:

  • --type change|spec - Specify what to view (required if ambiguous)
  • --json - Machine-readable JSON output
  • --deltas-only - Show only spec deltas

Validate a change or specification:

Terminal window
spectr validate <change-id>
spectr validate --strict

Examples:

Terminal window
# Validate single change
spectr validate add-two-factor-auth --strict
# Bulk validation (interactive)
spectr validate
# Validate all specs
spectr validate --specs

Options:

  • --strict - Comprehensive validation with all checks
  • --specs - Validate specs instead of changes
  • --no-interactive - Disable prompts

Move a completed change to archive and merge specs:

Terminal window
spectr archive <change-id> --yes

Examples:

Terminal window
# Interactive archiving
spectr archive add-two-factor-auth
# Non-interactive (use --yes flag)
spectr archive add-two-factor-auth --yes
# Archive without updating specs
spectr archive add-two-factor-auth --skip-specs --yes

Options:

  • --yes, -y - Skip confirmation prompts
  • --skip-specs - Archive without merging specs
  • --no-interactive - Disable all prompts

Initialize a new Spectr project:

Terminal window
spectr init [path]

Examples:

Terminal window
# Initialize in current directory
spectr init
# Initialize in specific directory
spectr init ./docs

This also updates the instruction markdown files in the project.

Most commands support these global options:

Terminal window
spectr [command] [options]
  • --help - Show command help
  • --version - Show Spectr version
  • --json - Output as JSON (where supported)
  • --no-interactive - Disable interactive prompts

Some commands support interactive mode:

Terminal window
# Interactive spec selection
spectr view
# Interactive validation
spectr validate
# Interactive archiving
spectr archive

Human-readable text format:

Terminal window
spectr list

Output:

Active Changes:
├─ add-two-factor-auth (created 2025-01-15)
│ ├─ status: pending
│ └─ affected: auth, notifications
└─ update-api-versioning (created 2025-01-10)

Machine-readable JSON format:

Terminal window
spectr list --json

Output:

{
"changes": [
{
"id": "add-two-factor-auth",
"created": "2025-01-15T10:30:00Z",
"status": "pending",
"affectedSpecs": ["auth", "notifications"]
}
]
}
Terminal window
# 1. Create change directory and files
mkdir -p spectr/changes/add-feature/specs/auth
# 2. Write proposal.md, tasks.md, and spec.md files
# 3. Validate the change
spectr validate add-feature --strict
# 4. Fix any issues shown in validation
# 5. Validate again
spectr validate add-feature --strict
Terminal window
# 1. Check change details
spectr view add-feature
# 2. Implement according to tasks.md
# 3. Mark all tasks complete in tasks.md
# 4. Validate before archiving
spectr validate add-feature --strict
# 5. Archive the change
spectr archive add-feature --yes
# 6. Verify specs were updated
spectr validate --strict
Terminal window
# 1. List all active changes
spectr list
# 2. List all specs
spectr list --specs
# 3. View details of a change
spectr view add-feature
# 4. View details of a spec
spectr view auth --type spec
# 5. Validate everything
spectr validate --strict

If you get “command not found”, ensure Spectr is installed:

Terminal window
# Check installation
which spectr
# Install if needed (see Installation guide)

If you get “ambiguous item” error, specify the type:

Terminal window
# Error: Could be change or spec
spectr view auth
# Solution: Specify type
spectr view auth --type spec

If you get permission errors when creating files:

Terminal window
# Check directory permissions
ls -la spectr/
# Ensure you have write permission
chmod -R u+w spectr/

Use JSON output with jq for filtering:

Terminal window
# Get all change IDs
spectr list --json | jq '.changes[].id'
# Get specific change details
spectr view add-feature --json | jq '.proposal'

Validate multiple times while editing:

Terminal window
# Watch validation results
while true; do
clear
spectr validate add-feature --strict
sleep 2
done
Terminal window
# Show all specs with details
spectr spec list --long
# Find specs matching a pattern
spectr spec list --json | jq '.specs[] | select(.id | contains("auth"))'