Skip to main content
The xspec CLI gives you a consistent interface for building, inspecting, querying, and refactoring your requirement graph. All commands follow the same flag syntax, stream assignment, and exit-code contract so you can compose them reliably in scripts and CI pipelines.

Commands

Global flags

flag
Emit a single JSON document on stdout. For query and review export, JSON is always emitted regardless of this flag.
path
Use the specified config file instead of searching upward from the current working directory. This path is resolved relative to the filesystem, not the workspace root.

Flag syntax

  • Flags use space separation: --config path/to/xspec.json, not --config=path/to/xspec.json.
  • Each flag may appear at most once per invocation.
  • List-valued flags accept a comma-separated value: --kinds depends,embeds.

Argument conventions

All arguments that refer to workspace locations — <node>, <graph-node>, <file>, and --file — are workspace-relative paths, resolved from the workspace root regardless of your current working directory. The only exceptions are --config and --test-hold, which are resolved relative to your filesystem working directory. A node argument takes the form path#id to reference a specific node, or a bare path to reference the file root node. A graph-node argument additionally accepts code-location syntax: path, path#unit, or path#unit@N.

Output streams

  • Human-readable reports are written to stdout.
  • Usage errors and configuration errors are written to stderr.
  • When --json is active, stdout contains only the JSON document — no mixed output.
All output is byte-deterministic: running the same command twice on the same inputs produces identical bytes. When a shortest path is reported and ties exist, xspec breaks them byte-lexicographically.

Exit codes

Freshness model

build is the only command that (re)generates TypeScript modules and Markdown files. Read commands — ids, show, coverage, impact, review, and query — automatically refresh graph data if it is stale, but they never regenerate TypeScript or Markdown. If sources fail validation during an auto-refresh, read commands report the errors and exit 1. check never refreshes anything: it treats stale or orphaned derived files as findings.

Concurrency

Mutating commands (rename, move, and the review subcommands create, resolve, and split) are mutually exclusive per workspace. If a second mutating command is attempted while one is already running, it fails immediately with exit 2. Non-mutating commands can run concurrently without restriction. All file writes are atomic in effect.