File inventory
For a source file atspecs/AUTH.mdx, xspec produces the following files:
Derived vs durable
Derived files are fully reproducible from your source MDX files, your xspec configuration, and the journal. If a derived file is missing, corrupted, or stale, runxspec build to regenerate it. You can always trust a rebuild to produce the same bytes for the same inputs.
Durable files are written only by specific xspec commands (xspec rename, xspec move for the journal; xspec review create, xspec review resolve, etc. for sessions). They are never regenerated and must not be modified by hand. If a durable file is lost or corrupted, you must restore it from version control — there is no rebuild path.
What to commit
Journal and review sessions — non-negotiable
The journal (.xspec/journal) maps old node identities to new ones. Losing it breaks baseline comparisons for every consumer of your repository. Review sessions record work in progress that cannot be reconstructed. Both must be committed without exception.
Generated TypeScript modules and companions
The generated TypeScript module (*.xspec.ts) and its companion files (*.xspec.impl.js, *.xspec.impl.d.ts, *.xspec.impl.d.ts.map) are what downstream consumers import. Committing them means consumers can resolve ./NAME.xspec without running xspec themselves.
Running xspec check in CI proves that committed generated files match current sources. This gives you a clean two-step: commit the files, verify they are up to date in CI.
Emitted Markdown and graph.json
You have two options forspecs/**/*.md and .xspec/graph.json:
- Commit them — the same reasoning applies as for generated modules. Consumers and tooling can use them without a build step, and
xspec checkvalidates staleness. - Ignore them and rebuild in CI — add them to
.gitignoreand runxspec buildas the first CI step beforexspec check. This keeps the repository smaller at the cost of a build step on every CI run.
.gitignore for the regenerate-in-CI policy
If you choose to regenerate derived files in CI rather than committing them, use this pattern:
The pattern
*.xspec.* matches the TypeScript module and all companion files. It does not match .xspec/journal or .xspec/reviews/ because those paths do not contain .xspec. with a trailing dot.Staleness detection
xspec check compares each derived file against what xspec build would produce for the current sources. A stale file produces an error like:
14.10) identifies the xspec version that generated the file, which helps diagnose staleness caused by an xspec upgrade rather than a source edit.
Filesystem behavior
A few properties of xspec’s file I/O are worth knowing when integrating with other tooling:- Writes are atomic in effect. A partial write will not leave a file in an inconsistent state.
- Mutating commands are mutually exclusive per workspace. Two xspec processes cannot run simultaneous mutations in the same workspace directory.
- Symlinks are never followed during file discovery or when writing output. xspec operates only on real files at their canonical paths.
- No network access. xspec reads from git only where the documentation explicitly states it does (e.g.,
xspec impact --base), and never writes to git.