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 list```text
List specifications with detailed information:
```bashspectr list --specsspectr spec list --long```text
**Options:**
- `--specs` - Show specifications instead of changes- `--long` - Show detailed information- `--json` - Machine-readable JSON output
### View Details
Display details about a specific change or spec:
```bashspectr view <change-id>spectr view <spec-id> --type spec```text
**Examples:**
```bash# 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-only```text
**Options:**
- `--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
Validate a change or specification. Validation is always comprehensive (strictmode).
```bashspectr validate <change-id>```text
**Examples:**
```bash# Validate single changespectr validate add-two-factor-auth
# Bulk validation (interactive)spectr validate
# Validate all specsspectr validate --specs```text
**Options:**
- `--specs` - Validate specs instead of changes- `--no-interactive` - Disable prompts
### Archive a Change
Move a completed change to archive and merge specs:
```bashspectr archive <change-id> --yes```text
**Examples:**
```bash# 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 --yes```text
**Options:**
- `--yes`, `-y` - Skip confirmation prompts- `--skip-specs` - Archive without merging specs- `--no-interactive` - Disable all prompts
## Project Management
### Initialize Spectr
Initialize a new Spectr project:
```bashspectr init [path]```text
**Examples:**
```bash# Initialize in current directoryspectr init
# Initialize in specific directoryspectr init ./docs```text
This also updates the instruction markdown files in the project.
## Global Options
Most commands support these global options:
```bashspectr [command] [options]```text
- `--help` - Show command help- `--version` - Show Spectr version- `--json` - Output as JSON (where supported)- `--no-interactive` - Disable interactive prompts
## Interactive Mode
Some commands support interactive mode:
```bash# Interactive spec selectionspectr view
# Interactive validationspectr validate
# Interactive archivingspectr archive```text
## Output Formats
### Text Output (Default)
Human-readable text format:
```bashspectr list```text
Output:
```textActive Changes:├─ add-two-factor-auth (created 2025-01-15)│ ├─ status: pending│ └─ affected: auth, notifications└─ update-api-versioning (created 2025-01-10)```text
### JSON Output
Machine-readable JSON format:
```bashspectr list --json```text
Output:
```json{ "changes": [ { "id": "add-two-factor-auth", "created": "2025-01-15T10:30:00Z", "status": "pending", "affectedSpecs": ["auth", "notifications"] } ]}```text
## Common Workflows
### Create and Validate a Change
```bash# 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
# 4. Fix any issues shown in validation
# 5. Validate againspectr validate add-feature```text
### Implement and Archive
```bash# 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
# 5. Archive the changespectr archive add-feature --yes
# 6. Verify specs were updatedspectr validate```text
### Explore Project State
```bash# 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```text
## Troubleshooting
### Command not found
If you get "command not found", ensure Spectr is installed:
```bash# Check installationwhich spectr
# Install if needed (see Installation guide)```text
### Ambiguous item
If you get "ambiguous item" error, specify the type:
```bash# Error: Could be change or specspectr view auth
# Solution: Specify typespectr view auth --type spec```text
### Permission denied
If you get permission errors when creating files:
```bash# Check directory permissionsls -la spectr/
# Ensure you have write permissionchmod -R u+w spectr/```text
## Tips and Tricks
### Piping JSON
Use JSON output with `jq` for filtering:
```bash# Get all change IDsspectr list --json | jq '.changes[].id'
# Get specific change detailsspectr view add-feature --json | jq '.proposal'```text
### Quick Validation Loop
Validate multiple times while editing:
```bash# Watch validation resultswhile true; do clear spectr validate add-feature sleep 2done```text
### List Specs by Capability
```bash# Show all specs with detailsspectr spec list --long
# Find specs matching a patternspectr spec list --json | jq '.specs[] | select(.id | contains("auth"))'```text
## Further Reading
- [Creating Changes](/guides/creating-changes)- [Archiving Workflow](/guides/archiving-workflow)- [Configuration](/reference/configuration)