CLI Reference

The CLI is available as npx antora-tracer after installing the extension.

npx antora-tracer --help
npx antora-tracer <command> --help

Global options (--config, --preset) are inherited by all commands.

completion

Generate shell completion scripts for Bash, Zsh, or Fish, or install one for the current user. Generation writes the script to standard output, so redirect it to save a copy or inspect it.

npx antora-tracer completion bash > antora-tracer-completion.bash
npx antora-tracer completion zsh > antora-tracer-completion.zsh
npx antora-tracer completion fish > antora-tracer-completion.fish
npx antora-tracer completion install bash
npx antora-tracer completion install zsh
npx antora-tracer completion install fish

Installation writes to ~/.local/share/bash-completion/completions/antora-tracer for Bash, ~/.zfunc/_antora-tracer for Zsh, and ~/.config/fish/completions/antora-tracer.fish for Fish. It prints the completion path and activation steps without editing shell startup files.

For Bash, source the installed file in the current shell; add the printed source command to ~/.bashrc yourself if you want it loaded in future sessions. For Zsh, add fpath=(~/.zfunc $fpath) and autoload -Uz compinit && compinit to ~/.zshrc, before any other compinit call. Fish automatically loads completion files from its completion directory in new sessions.

process

Process AsciiDoc files to populate the traceability graph.

npx antora-tracer process -i docs/ --preset requirements-engineering
npx antora-tracer process -i requirements.adoc --config ./traceability.yml
Option Type Description

-i, --input <path>

string (required)

Input file or directory

-o, --output <path>

string

Output directory (default: ./output)

-f, --format <format>

string

Output format: html, csv, json (default: html)

--preset <name>

string

Built-in preset name

--config <path>

string

Custom traceability YAML file

matrix

Generate traceability matrices from processed items.

npx antora-tracer matrix -i docs/ -t requirements-to-design -f html
npx antora-tracer matrix -t requirements-to-design -f csv -o matrix.csv
Option Type Description

-i, --input <path>

string

Input file to process first (optional)

-t, --type <type>

string (required)

Matrix name from your config

-f, --format <format>

string

Output format: csv, html, json (default: csv)

-o, --output <path>

string

Output file (defaults to stdout)

validate

Validate the traceability graph for dangling references (missing targets), invalid relations, duplicate item IDs, and circular references.

npx antora-tracer validate -i docs/ --preset requirements-engineering
Option Type Description

-i, --input <path>

string (required)

Input file or directory to validate

--preset <name>

string

Built-in preset

--config <path>

string

Custom traceability YAML

Exits with non-zero code if errors are found.

export neo4j

Export the graph to Neo4j-compatible formats. Supply either -i <dir> (a local directory) or a playbook path (every component and repository in the playbook).

npx antora-tracer export neo4j -i docs/ --format csv -o ./neo4j-export/
npx antora-tracer export neo4j antora-playbook.yml --format cypher -o ./neo4j-export/
Option Type Description

<playbook>

string (positional)

Antora playbook to harvest across components and repositories. Required when -i is not given.

-i, --input <path>

string

Input file or directory to process first. Required when no playbook is given.

--format <format>

string (required)

csv (nodes + relationships) or cypher (single script)

-o, --output <path>

string (required)

Output directory

stats

Display role statistics for the current graph.

npx antora-tracer stats -i docs/ --preset requirements-engineering

Output shows item counts per role and relationship counts.

Option Type Description

-i, --input <path>

string

Input file or directory to process first

--preset <name>

string

Built-in preset

--config <path>

string

Custom traceability YAML

preset list

List all available presets with descriptions.

npx antora-tracer preset list

preset show

Show a preset’s configuration details.

npx antora-tracer preset show requirements-engineering
Option Type Description

name

string (argument)

Preset name (required)

preset init

Write a preset’s traceability YAML to a file for customization.

npx antora-tracer preset init -n medical-iec62304 -o ./config/
Option Type Description

-n, --name <name>

string (required)

Preset name

-o, --output <path>

string

Output directory (default: current directory)

next-id

Get the next available sequential ID for a given prefix.

npx antora-tracer next-id --prefix REQ -i docs/
npx antora-tracer next-id --prefix TST -i test-plan.adoc
npx antora-tracer next-id --prefix REQ --local -i docs/
Option Type Description

-p, --prefix <prefix>

string (required)

ID prefix, e.g. REQ, TST, ARC

-i, --input <path>

string

Input file or directory to scan for existing IDs. Required for a local scan; ignored when a remote allocator is used.

--local

flag

Force a local scan, ignoring any configured idAllocation.

Auto-detects padding from existing IDs. If REQ-001 and REQ-002 exist, returns REQ-003. If TST-0001 exists, returns TST-0002. With no existing items matching the prefix, defaults to 3-digit padding (REQ-001).

When idAllocation.endpoint is configured, next-id requests the next ID from the allocator and prints its id verbatim. A configured-but-unreachable allocator, a non-2xx response, or a malformed body exits with an error instead of falling back to a local ID. If the configured token references an unset environment variable, remote next-id exits with an error before making the request. Pass --local to scan locally without requiring the remote token. See Configuration Reference for the idAllocation key and Run the ID allocation server for the service.

seed

Export allocator seed values for the ID allocation server. For each ID prefix found in the scanned items, it reports the numeric max+1 value as a start seed, so the server continues from existing local IDs instead of colliding at 001.

npx antora-tracer seed -i docs/
npx antora-tracer seed antora-playbook.yml

The command accepts either -i <dir> (scan a directory) or a playbook path (harvest every component and repository in the playbook).

Option Type Description

-i, --input <path>

string

Input file or directory to scan. Required when no playbook is given.

<playbook>

string (positional)

Antora playbook to harvest across components and repositories.

-o, --output <path>

string

Write the seed file instead of printing to stdout.

The output is a prefixes: map consumable directly as the server’s seed configuration:

prefixes:
  REQ:
    start: 55
    width: 3

start is max+1 — the first ID the server allocates — never the current maximum and never a formatted REQ-055 string. See Run the ID allocation server for the seeding workflow.

skills install

Copy Antora Tracer’s bundled Agent Skills to supported harness per-user directories. Without harness arguments in an interactive terminal, it prompts for a multi-select choice; with explicit harness names it installs without further prompting.

npx antora-tracer skills install
npx antora-tracer skills install pi claude codex
npx antora-tracer skills install claude --overwrite
npx antora-tracer skills install pi --dry-run

Harnesses: pi (copies to ~/.agents/skills/), claude (copies to ~/.claude/skills/), and codex (copies to ~/.codex/skills/).

The command never replaces an existing skill directory by default. Without --overwrite, conflicts are skipped in non-interactive mode and prompted individually in interactive mode.

When pi is selected, the command prints a note that installing @antora-tracer/core as a Pi package auto-discovers its skills and is the recommended approach.

Option Type Description

[harness…​]

string (variadic)

One or more supported harnesses: pi, claude, codex. When not provided in an interactive terminal, a multi-select list is displayed; in non-interactive mode explicit harness names are required.

--overwrite

flag

Replace existing skill directories without prompting. Without this flag, existing skills are never silently replaced.

--dry-run

flag

Show selected harnesses and planned actions (installs, replaces, skips) without creating directories, prompting for overwrite, or modifying files.

role-guidance

Resolve and report the authoring guidance for a role. Prints the resolved guidance page path and the ID prefix fallback:

$ antora-tracer role-guidance requirement --preset requirements-engineering
page: /path/to/guidance/requirement.adoc
idPrefix: REQ
Option Description

<role>

The role name to resolve (positional)

--content

Also output the full guidance page content

Exits non-zero with "No guidance for role" when the role has no roleGuidance entry. The idPrefix is advisory; existing project conventions win.

query

Query the traceability graph directly from the command line — no Antora build required. Parses your .adoc source files and answers one structural question per invocation.

npx antora-tracer query reverse REQ-005
npx antora-tracer query reverse REQ-005 -i docs/
npx antora-tracer query impact REQ-005 --json
npx antora-tracer query linked CHG-001 requirement -i docs/
npx antora-tracer query linked CHG-001 requirement --snapshot graph.json --json
npx antora-tracer query isolated --role requirement
npx antora-tracer query orphaned
npx antora-tracer query path TST-001 REQ-001
npx antora-tracer query siblings PRQ-004
npx antora-tracer query siblings PRQ-004 --relation validates
npx antora-tracer query siblings PRQ-004 --snapshot site-graph.json
npx antora-tracer query by-role design -i docs/
npx antora-tracer query by-role design --document explanation/architecture --context --json
npx antora-tracer query by-role requirement --snapshot site-graph.json
Option Type Description

-i, --input <path>

string

Input file or directory to scan (default: .)

--json

flag

Output machine-readable JSON instead of a table

--role <role>

string

For isolated and orphaned: filter results by role

--snapshot <path>

string

For linked, siblings, and by-role: read items and relationships from a canonical site-graph snapshot instead of scanning local AsciiDoc

linked <id> <role> follows outgoing relationships any number of edges, traversing through items of every role and excluding the start item. For a multi-source snapshot, IDs must be globally unique across included sources; use @antora-tracer/id-server seeded with antora-tracer seed antora-playbook.yml and shared allocation tenant and prefix settings.

by-role <role> lists all current (non-superseded) items of the role in document order — source file, then line — carrying each item’s ID, title, content, and source location, which is the input an abstraction-level review or LLM judge consumes. --document <path> restricts the slice to one document by path-segment suffix, so --document architecture matches explanation/architecture. --context adds a skeleton of the matched documents' other-role items (ID, title, role, line — no content), giving a judge relocation context without paying for full bodies. JSON output is { items: […​], context? }.

siblings <id> traverses relationships undirected: an item’s neighbors are both its outgoing targets and incoming sources, because every relation has a declared reverse. Two items are siblings when they connect to a common neighbor through the same relation type. Each result lists the shared neighbors that make the items siblings, plus whether the sibling is superseded — a superseded sibling is often the more interesting review signal. --relation <type> restricts discovery so that only edges of that relation type contribute, on both the queried item’s side and the sibling’s side.

For a cross-source graph, build a snapshot with antora-tracer site-graph <playbook> and pass it via --snapshot; sibling discovery then spans every source the playbook resolves. --snapshot and --input cannot be combined.

Subcommands:

Subcommand Description

reverse <id>

List every item that references <id> (inbound relationships)

linked <id> <role>

List distinct items matching <role> reachable through outgoing relationships at any distance

impact <id>

List every item transitively connected to <id>

isolated

List items with no relationships (optionally --role <role>)

orphaned

List superseded items with no incoming functional links (optionally --role <role>)

path <from> <to>

Print the shortest relationship path between two items

siblings <id>

List items sharing at least one typed neighbor with <id>, with the shared neighbors and each sibling’s supersession status (optionally --relation <type>)

by-role <role>

List all current items of a role in document order, optionally restricted to one document (--document), with skeleton relocation context (--context)

Exit codes: 0 for success (including empty results), 1 for an unknown item ID or when no path exists.

supersession

Inspect supersession relationships without an Antora build. The check subcommand reports whether an item has been superseded, its direct successors, and every functional link that still targets it and therefore requires review.

npx antora-tracer supersession check REQ-042
npx antora-tracer supersession check REQ-042 -i docs/
npx antora-tracer supersession check REQ-042 --impact
npx antora-tracer supersession check REQ-042 --json
Option Type Description

-i, --input <path>

string

Input file or directory to scan (default: .)

--json

flag

Output machine-readable JSON instead of a table

--impact

flag

Also report the transitive impact radius

The command is read-only: it never modifies source files. A superseded item is identified by an incoming supersedes relationship, not by a status attribute. History relationships (supersedes / superseded_by) are excluded from the review list.

archive

Move a superseded item’s block to the module’s parallel superseded.adoc page. The block is removed from its source file and appended to superseded.adoc in the same directory, which is created with a heading if missing.

npx antora-tracer archive REQ-129
npx antora-tracer archive REQ-129 -i docs/
Option Type Description

-i, --input <path>

string

Input file or directory to scan (default: .)

Only superseded items can be archived — a non-superseded or unknown ID is rejected with no file change.

remove

Remove an orphaned or isolated item’s block from its source file. Orphaned items (superseded, no incoming functional links) are removed after a y/N confirmation; isolated items (no relationships at all) require typing the item ID verbatim.

npx antora-tracer remove REQ-129
npx antora-tracer remove REQ-129 -i docs/
Option Type Description

-i, --input <path>

string

Input file or directory to scan (default: .)

The command previews the block before prompting. Any other item (neither orphaned nor isolated) is rejected with no file change. Git preserves history, so removal is safe once an item is orphaned.

diff

Diff two sets of AsciiDoc sources into a traceability delta. Builds two graphs (baseline and changed) and reports items added, removed, and modified, plus relationship changes on surviving items.

npx antora-tracer diff --from docs-v1 --to docs-v2
npx antora-tracer diff --from docs-v1 --to docs-v2 --json
Option Type Description

--from <path>

string

Baseline input file or directory (default: .)

--to <path>

string

Changed input file or directory (default: .)

--json

flag

Output machine-readable JSON instead of a table

Items are matched by stable ID, so the diff works with any role or relation vocabulary. A modified item lists the changed fields (title, content, role, status, attributes). Relationship changes are reported only for items that survive the diff, except supersedes history links. The command never modifies source files.

site-graph

Build the full cross-source traceability graph from an Antora playbook and emit a canonical JSON snapshot. The harvest runs Antora’s content aggregation and classification stages only — no HTML, PDF, or DOCX output is produced — so it captures items from every content source, component, and version the playbook resolves.

npx antora-tracer site-graph antora-playbook.yml --out snapshot.json
Option Type Description

<playbook>

string

Path to the Antora playbook file (positional argument)

-o, --out <path>

string

Write the snapshot to a file instead of stdout

Each item in the snapshot carries component, module, and version scope. The snapshot is versioned (format: 1) and omits per-page pubUrl fields.

Requires the optional @antora/content-aggregator, @antora/content-classifier, and @antora/playbook-builder packages.

When the playbook’s extension config sets excludeComponents, the harvest omits those components so the snapshot matches the graph the Antora build produces. The same exclusion applies to export neo4j and seed when given a playbook.

diff-graphs

Diff two JSON graph snapshots into a traceability delta without checking out either version’s sources. The snapshots are produced by site-graph (or by the extension’s per-version graph.json attachment).

npx antora-tracer diff-graphs --from v1.json --to v2.json
npx antora-tracer diff-graphs --from v1.json --to v2.json --json
Option Type Description

--from <path>

string

Baseline snapshot JSON file (required)

--to <path>

string

Changed snapshot JSON file (required)

--json

flag

Output machine-readable JSON instead of a table

Items are matched by component-qualified identity (component + version + ID), falling back to bare ID for items without a component. An unknown format value is rejected with a prompt to re-run site-graph.