CLI Command Reference
The SpecMarket CLI (specmarket) is your primary interface for discovering, validating, running, and publishing specs. 12 commands cover three workflows: local development, registry interaction, and account management.
Install:
npm install -g @specmarket/cliVerify:
specmarket --version
# 0.0.1Authentication
login
Authenticate with the SpecMarket registry.
specmarket login
specmarket login --token <jwt>Options:
| Flag | Description |
|---|---|
--token <jwt> | Use a pre-existing JWT (for CI/headless environments) |
Two modes:
- Interactive (default): Opens your browser to Clerk’s OAuth flow, polls for the token, and stores it locally.
- Token mode: Accepts a JWT directly — useful in CI/CD pipelines where a browser isn’t available.
Credentials are stored at ~/.specmarket/credentials.json with 0600 permissions. Tokens expire after 30 days.
logout
Clear stored credentials.
specmarket logoutRemoves ~/.specmarket/credentials.json and confirms which account was logged out.
whoami
Show the currently authenticated user.
specmarket whoamiDisplays your username, display name, role, total specs published, reputation score, and token expiry (days remaining). Falls back to cached credential info if the registry is unreachable.
Spec Lifecycle
init
Scaffold a new spec directory with all required template files.
specmarket init
specmarket init --name my-spec --path ./specs/my-specOptions:
| Flag | Description |
|---|---|
-n, --name <name> | Spec name (skips interactive prompt) |
-p, --path <path> | Target directory (defaults to spec name) |
Creates a complete spec scaffold:
my-spec/
├── spec.yaml # Configuration and metadata
├── PROMPT.md # AI prompt for execution
├── SPEC.md # Full specification document
├── SUCCESS_CRITERIA.md # Pass/fail criteria (checkboxes)
├── stdlib/
│ └── STACK.md # Technology stack requirements
└── fix_plan.md # Implementation tracking
Prompts interactively for: spec name (lowercase, hyphens only), display name, SaaS product it replaces (optional), output type, and primary stack.
validate
Check a spec directory for completeness and schema compliance.
specmarket validate <path>Checks (errors — must pass):
spec.yamlparses and conforms to the Zod schema- Required files exist and are non-empty:
PROMPT.md,SPEC.md,SUCCESS_CRITERIA.md stdlib/STACK.mdexists and is non-emptySUCCESS_CRITERIA.mdhas at least one criterion (- [ ] text)- Infrastructure block validates (if present):
default_providermatches a defined provider
Checks (warnings — informational):
- Web-app/api-service specs with no infrastructure services
- Missing
infrastructure.setup_time_minutes - Unreasonable estimates: tokens below 1,000 or above 10,000,000, cost below $0.01, time below 1 minute
specmarket validate ./my-spec
# ✓ spec.yaml valid
# ✓ PROMPT.md exists (2,340 bytes)
# ✓ SPEC.md exists (8,120 bytes)
# ✓ SUCCESS_CRITERIA.md has 12 criteria
# ⚠ No infrastructure services defined (web-app specs usually need at least a database)
# Result: VALID (1 warning)Exit codes: 0 = valid, 1 = validation error, 2 = runtime error.
run
Execute a spec locally using the Ralph Loop.
specmarket run <path-or-id> [options]Arguments:
The first argument is either a local path (./my-spec, .) or a registry identifier (@user/spec-name, @user/spec-name@1.2.0). Registry specs are downloaded automatically before execution.
Options:
| Flag | Description | Default |
|---|---|---|
--max-loops <n> | Maximum loop iterations | 50 |
--max-budget <usd> | Maximum budget in USD | 2× estimated cost |
--no-telemetry | Disable telemetry for this run | — |
--model <model> | Override AI model | Spec’s min_model |
--dry-run | Validate and show config without executing | — |
--resume <run-id> | Resume a previous run | — |
--output <dir> | Custom output directory | ~/.specmarket/runs/<id>/ |
What happens during a run:
- Spec is resolved (downloaded from registry if needed)
- Validation runs (exits with code 1 on failure)
- Security sandboxing warning is printed
- If authenticated and telemetry is enabled, you’re prompted once (first time only)
- Ralph Loop executes with a spinner showing iteration progress
- Telemetry is submitted (if opted in)
- Run summary prints: status, loop count, tokens used, cost, time, success criteria results
Stall detection: If 3 consecutive loops produce no git diff, the run is marked as stalled. If 10 consecutive loops fail the same test, the run is marked as failed.
Rate limit: 10 telemetry submissions per hour (authenticated users).
# Run a local spec
specmarket run ./my-spec
# Run from registry
specmarket run @alice/notion-clone
# Custom constraints
specmarket run ./my-spec --max-loops 100 --max-budget 10 --model claude-opus-4-5
# Preview without executing
specmarket run @alice/my-spec --dry-run
# Resume a stalled run
specmarket run @alice/my-spec --resume abc123Exit codes: 0 = success, 1 = validation error, 2 = runtime error, 3 = budget exceeded, 4 = network error, 5 = auth error.
publish
Publish a spec to the SpecMarket registry.
specmarket publish <path>Requires authentication. Run specmarket login first.
Publishing:
- Validates the spec (exits on failure)
- Creates a zip archive (excludes
node_modules,dist,.git) - Uploads to Convex file storage
- Creates or updates the registry entry with all metadata
On success, prints the spec ID and version, and suggests specmarket run @username/spec-name to test it live.
Rate limit: 5 publishes per day.
specmarket publish ./my-spec
# ✓ Validated
# ✓ Archived (42 KB)
# ✓ Published @jaiden/my-spec v1.0.0
# Run it: specmarket run @jaiden/my-specfork
Fork a published spec into your namespace.
specmarket fork <spec-id> [path]Requires authentication.
Downloads a published spec, extracts it locally, and updates spec.yaml with fork metadata (forked_from_id, forked_from_version, version reset to 1.0.0). The original spec’s forkCount is incremented.
specmarket fork @alice/notion-clone
specmarket fork @alice/notion-clone ./my-notion-forkRegistry
search
Search the SpecMarket registry.
specmarket search <query> [options]Options:
| Flag | Description | Default |
|---|---|---|
-t, --output-type <type> | Filter by output type (web-app, cli-tool, api-service, library, mobile-app) | All |
--tag <tag> | Filter by tag (repeatable, OR logic — spec must match at least one) | All |
--primary-stack <stack> | Filter by tech stack (nextjs-typescript, astro-typescript, python-fastapi, go, rust, other) | All |
--replaces-saas <name> | Filter by SaaS product being replaced (case-insensitive substring match) | All |
--min-success-rate <percent> | Minimum success rate, 0–100 (e.g., 80 for 80%) | 0 |
--max-cost <usd> | Maximum one-time build cost in USD | No limit |
--max-monthly-cost <usd> | Maximum monthly infrastructure cost in USD | No limit |
--service-category <category> | Required infrastructure category (repeatable, AND logic) | All |
--free-tier-only | Only show specs runnable entirely on free-tier infrastructure | Off |
-l, --limit <n> | Maximum results (max 50) | 20 |
Results display in a table:
┌─────────────────────┬────────────────────────┬──────────┬─────────┬──────┬────────┐
│ Name │ Description │ Replaces │ Success │ Cost │ Rating │
├─────────────────────┼────────────────────────┼──────────┼─────────┼──────┼────────┤
│ @alice/esign-basic │ Simple e-signature... │ DocuSign │ 94% │ $8 │ ★★★★☆ │
│ @bob/form-builder │ Drag-and-drop form... │ Typeform │ 87% │ $12 │ ★★★★☆ │
└─────────────────────┴────────────────────────┴──────────┴─────────┴──────┴────────┘
Rate limit: 100 requests per minute per IP (enforced server-side via /api/search).
# Basic search
specmarket search "notion clone"
# Filter by type and limit
specmarket search "database" --output-type api-service --limit 50
# Filter by tag
specmarket search "auth" --tag security --tag authentication
# Find cheap alternatives to a specific SaaS
specmarket search "forms" --replaces-saas typeform --max-cost 15
# Only show high-success specs on free infrastructure
specmarket search "dashboard" --min-success-rate 80 --free-tier-only
# Filter by stack
specmarket search "api" --primary-stack python-fastapi --max-monthly-cost 10info
Show detailed information about a spec.
specmarket info <spec-id>Displays everything about a spec: metadata, infrastructure summary (monthly cost, services, providers), community metrics (total runs, success rate, average cost, rating, fork count), creator profile, version history (last 5), and run statistics (most used model, cost distribution).
specmarket info @alice/notion-clonereport
Display a run report.
specmarket report <run-id>Looks up the run locally first (~/.specmarket/runs/<run-id>/run-report.json), then falls back to the platform (requires auth). Shows status, spec details, model, loop count, tokens, cost, time, and success criteria results.
specmarket report abc123Configuration
config
Manage CLI settings stored at ~/.specmarket/config.json.
specmarket config set <key> <value>
specmarket config get <key>
specmarket config list
specmarket config delete-telemetryConfigurable keys:
| Key | Values | Default |
|---|---|---|
telemetry | true / false | false |
default-model | Model name (e.g., claude-opus-4-5) | Spec’s min_model |
convex-url | Convex deployment URL | CONVEX_URL env or hardcoded |
delete-telemetry permanently removes all your run data from the platform. Requires authentication and confirmation. Does not affect local run artifacts.
specmarket config set telemetry true
specmarket config get default-model
specmarket config list
specmarket config delete-telemetryExit Codes
Every command exits with a code indicating what happened:
| Code | Meaning | Common Causes |
|---|---|---|
| 0 | Success | Command completed |
| 1 | Validation error | Bad spec, invalid args, schema mismatch |
| 2 | Runtime error | Loop failed, crash, unexpected error |
| 3 | Budget exceeded | Run exceeded --max-budget |
| 4 | Network error | Registry unreachable, upload failed |
| 5 | Auth error | Not logged in, token expired |
Environment Variables
| Variable | Purpose | Default |
|---|---|---|
CONVEX_URL | Convex deployment URL | Hardcoded default |
SPECMARKET_TOKEN | Alternative to specmarket login --token | None |
DEBUG | Enable debug logging (specmarket:*) | None |
Debug namespaces: specmarket:cli, specmarket:convex, specmarket:runner, specmarket:auth, specmarket:telemetry.
Related
- Getting Started — Install, find, and run your first spec
- Spec Format Reference — Complete
spec.yamlschema - Publishing Your First Spec — Creator onboarding guide
- Security & Trust — How specs are scanned and sandboxed