Skip to content
GitHubRSS

Module reference

One markdown per module under src/; a slice or helper is documented with the module that owns it (the cache slices in cache.md, the sandbox helpers in sandbox-runtime.md), and the CLI verb parsers in docs/cli.md. Each documents:

  • Purpose — what the module exists to do.
  • Public surface — exported types + functions consumed by other modules. The seam for forks / replacements.
  • Algorithm / construction rules — how it works at a high level.
  • What it does NOT do — explicit non-features (helps prevent scope creep on future PRs).
  • Tests — where coverage lives.
  • Replacing this module — what to swap to extend or fork.

Internal helpers are not part of the contract; they can change.

For the high-level data flow, read ../architecture.md first.

FileTopic
bin.mdsrc/bin.ts — shebang entry; wires process.argv to cli run.
config.mdsrc/config.ts — public schema types + defineProject helpers.
index.mdsrc/index.ts — public package façade (re-exports only).
version.mdsrc/version.ts — the VERSION constant (cycle-free leaf).
FileTopic
cli.mdsrc/cli/index.ts — module contract: dispatcher + re-exports for tests.
src/cli/workspace-config.ts — the workspace as every verb sees it: config stage applied, cache dir, staged projects (see cli.md).
cli-run.mdsrc/cli/run.ts — the vx run parser and verb; src/cli/select.ts — scope, affected owners, picker.
cli-watch.mdsrc/cli/watch.ts — vx watch <task>: re-run on FS change; src/cli/watch-fs.ts — the OS watcher, its poller fallback, the mtime clock. src/cli/watch-filter.ts — which events matter; src/cli/watch-set.ts — what is watched; src/cli/watch-judge.ts — which settled paths are changes.
cli-cache.mdsrc/cli/cache.ts — vx cache prune, duration / size parsers.
cli-help.mdsrc/cli/help.ts — static help text; src/cli/core-alias.ts — the @vzn/vx virtual module bin.ts registers (see bin.md); src/cli/completions.ts — the vx completions script over the verb table and each verb’s help cut.
plugin-commands.mdsrc/cli/plugin-commands.ts — plugin-contributed verbs (VxPlugin.commands).
cli-format.mdsrc/cli/format.ts — formatBytes and other shared formatters.
plan-format.mdsrc/cli/plan-format.ts — plan → text / JSON / DOT.
upgrade.mdsrc/cli/upgrade.ts — vx upgrade binary self-update.

The remaining subcommand parsers — src/cli/{lock,show,info,last,why,init}.ts — are user-facing commands documented in docs/cli.md rather than as module pages; src/cli/run-id.ts resolves the run id last and why take, whole or a unique prefix; src/cli/plugin-templates.ts is the generated copy of the example plugins vx init --plugin writes. tests/doc-references.test.ts holds this index to the tree: every src/**/*.ts except the index.ts files is named here, itself or in a brace group.

FileTopic
orchestrator.mdsrc/orchestrator/{index,run}.ts — module contract + run() / planRun() entry.
src/orchestrator/run-records.ts — the runs rows, invocation header and telemetry mirror from one pass (see orchestrator.md).
src/orchestrator/persistent.ts — keep-alive selection and bounded shutdown of persistent children (see orchestrator.md).
src/orchestrator/run-lock.ts — one run at a time per workspace on this machine; runs in one process share it (see orchestrator.md).
options.mdsrc/orchestrator/options.ts — RunOptions / RunSummary declarations.
execute-task.mdsrc/orchestrator/execute-task.ts — per-task: hash → cache lookup → spawn → save.
sandbox-request.mdsrc/orchestrator/sandbox-request.ts — arming the runtime for a run; the sandbox half of an ExecuteRequest: grants, binds.
keyed-projects.mdsrc/orchestrator/keyed-projects.ts — the projects a task’s key answers for, which bound a cached task’s linked-package grant.
execute-task.md § Verdictsrc/orchestrator/shell-verdict.ts — the frame line for exit 126, 127 and 128 + n: the PATH rule, the file, the signal.
miss-save.mdsrc/orchestrator/miss-save.ts — what a miss leaves behind: resolve outputs, save, mark git.
miss-save.md § The save lanesrc/orchestrator/save-lane.ts — the bounded off-slot save queue run() drains before the upload drain.
lockfile-claim.mdsrc/orchestrator/lockfile-claim.ts — the claimant’s shell a lockfile plugin wraps its parser in, and reachDigests.
hit-restore.mdsrc/orchestrator/hit-restore.ts — what a hit leaves behind: the two proofs, clean + restore, mark git, replay stdout.
task-hash.mdsrc/orchestrator/task-hash.ts — cache-key derivation (computeTaskHash & co.).
upstream.mdsrc/orchestrator/upstream.ts — which upstream a key folds, by cache.inputs.tasks (selectFoldedDeps, one matcher for both paths).
excluded-keys.mdsrc/orchestrator/excluded-keys.ts — the key of a dependency --exclude-dependencies keeps from running, and the taint it seeds.
logger.mdsrc/orchestrator/logger.ts — default logger (flow-aware policy, frames, replay).
status-line.mdsrc/orchestrator/status-line.ts — serialized writer + dynamic bottom status line.
framed-output.mdsrc/orchestrator/framed-output.ts — ┌─ task ─┐ border helpers + one-liners.
failure-recap.mdsrc/orchestrator/failure-recap.ts — the bounded tail the run’s last block repeats for each failed task.
colors.mdsrc/orchestrator/colors.ts — ANSI gate + truecolor helpers.
summary.mdsrc/orchestrator/summary.ts — the footer: projects / tasks / cache meters, info and time rows.
plan.mdsrc/orchestrator/plan.ts — --dry / --graph planning (no exec).
placement.mdsrc/orchestrator/placement.ts — where each task runs: pins, executor order, 'only', pools, the --dry view.
signals.mdsrc/orchestrator/signals.ts — SIGINT/SIGTERM/SIGHUP forwarded, as a group signal, to every child, then exit 128+signo.
admission.mdsrc/orchestrator/admission.ts — between scheduler and task: in-flight dedup (an embedder’s registry) and continue-taint.
run-artifacts.mdsrc/orchestrator/run-artifacts.ts — --summarize JSON + --profile trace writers.
prepare.mdsrc/orchestrator/prepare.ts — shared run / planRun setup (workspace, graph, cache).
projects.mdsrc/orchestrator/projects.ts — the staged project-config load runs and vx show share.
tally.mdsrc/orchestrator/tally.ts — shared outcome tally for summary + summarize JSON.
events.mdsrc/orchestrator/events.ts — run event bus + serializable WireEvent contract.
plugin.mdsrc/orchestrator/plugin.ts — VxPlugin capabilities + installer.
plugin-host.mdsrc/orchestrator/plugin-host.ts — capability consultation + end-of-run teardown/flush.
telemetry.mdsrc/orchestrator/telemetry.ts — versioned telemetry export contract.
telemetry-host.mdsrc/orchestrator/telemetry-host.ts — sink consultation (zero-sink = zero cost).
run-context.mdsrc/orchestrator/run-context.ts — git / CI / host capture (≤1 spawn).
stable-keys.mdsrc/orchestrator/stable-keys.ts — shared stable-key derivation + stability gate.
fingerprint-watch.mdsrc/orchestrator/fingerprint-watch.ts — has a task rewritten the lockfile mid-run? Re-checked only after one that may.
download-policy.mdsrc/orchestrator/download-policy.ts — --download modes + the deferral eligibility gate.
deferred-outputs.mdsrc/orchestrator/deferred-outputs.ts — deferred-output registry + lazy materialise/converge.
local-shortcircuit.mdsrc/orchestrator/local-shortcircuit.ts — restore-ahead classify (two-tier schedule).
remote-prefetch.mdsrc/orchestrator/remote-prefetch.ts — background remote GETs (LayeredCache only).
history.mdsrc/orchestrator/history.ts — per-task duration history behind --dry predictions.
src/orchestrator/failure-mode.ts — the flakiness verdict, in one place (see history.md).
metrics.mdsrc/orchestrator/metrics.ts — run-history queries behind vx last / vx why / the MCP.
doctor.mdsrc/orchestrator/doctor.ts — the workspace doctor’s facts behind vx info and the MCP’s getWorkspaceInfo.
task-log-buffer.mdsrc/orchestrator/task-log-buffer.ts — bounded per-task log capture for telemetry sinks.
run-report.mdsrc/orchestrator/run-report.ts — --report=markdown table.
FileTopic
workspace.mdsrc/workspace/{workspace,load-reads}.ts — findWorkspaceRoot, listProjects, cacheDir; the root files a load reads once.
project-loader.mdsrc/workspace/project-loader.ts — vx.config.* / vx.workspace.* evaluation.
config-schema.mdsrc/workspace/config-schema.ts — what a config may say: the validators, every level.
src/workspace/json-data.ts — a config is JSON data: the one rule the loader, the config worker and the playground run (see config-schema.md).
package-graph.mdsrc/workspace/package-graph.ts — workspace dep graph from package.json.
filter.mdsrc/workspace/filter.ts — pnpm-style --filter DSL parser + applier.
affected.mdsrc/workspace/affected.ts — git-relative project selection.
config-imports.mdsrc/workspace/config-imports.ts — the config-import selection channel.
config-cache.mdsrc/workspace/config-cache.ts — cached evaluations of provably-pure configs.
nested-dirs.mdsrc/workspace/nested-dirs.ts — boundary set (other projects rooted under each).
fingerprint.mdsrc/workspace/fingerprint.ts — workspace fingerprint (lockfile + workspace yaml).
lockfile.mdsrc/workspace/lockfile.ts — vx-lock.json freeze / trust / audit.
migration.mdsrc/workspace/{migration,migrate-scripts}.ts — the plan → files seam vx init and @vzn/vx-migrate share; the scripts mapper.
src/workspace/config-eval.ts — fresh re-evaluation in a Worker (see project-loader.md).
FileTopic
task-graph.mdsrc/graph/task-graph.ts — TaskNode DAG builder + cycle detection.
scheduler.mdsrc/graph/scheduler.ts — parallel topological executor.
src/graph/priorities.ts — the ready-queue ranking (see scheduler.md).
dependency-spec.mdsrc/graph/dependency-spec.ts — shared Turbo/Nx micro-syntax parser.
FileTopic
cache.mdsrc/cache/cache.ts — local cache: bun:sqlite index + tar.zst artifacts.
src/cache/{layer,policy,zstd,schema,file-hashes,config-evals,output-index,run-history,key-fold}.ts — the slices Cache composes (cache.md § Files); src/cache/{archive,tar-stream}.ts — pack / scan / extract (cache.md, caching.md § Storage layout).
layered-cache.mdsrc/cache/layered-cache.ts — local + remote composition + RemoteCacheLayer seam.
inputs.mdsrc/cache/inputs.ts — glob resolution, boundary enforcement, cleanOutputs.
git-inputs.mdsrc/cache/git-inputs.ts — the git enumeration (ls-files, status, check-attr) the resolver trusts.
FileTopic
runner.mdsrc/exec/runner.ts — runCommand, runPersistent, shellQuote.
kill-tree.mdsrc/exec/kill-tree.ts — killTree: a task’s process group dies with it (timeout, signal, shutdown).
env.mdsrc/exec/env.ts — child env composition + essential allowlist.
sandbox-runtime.mdsrc/exec/sandbox-runtime.ts — runSandboxed + violation tracking via @anthropic-ai/sandbox-runtime.
src/exec/sandbox-violations.ts — strace pass, seatbelt record description, report filters (see sandbox-runtime.md).
src/exec/sandbox-binds.ts — bwrap-honourable write grants, read-grant punching, the SRT custom config.
src/exec/sandbox-paths.ts — toRealPath, absolutize, isUnderAny, unique.
executor.mdsrc/exec/executor.ts — TaskExecutor contract + selectExecutor.
src/exec/local-executor.ts — the floor: run it here (see executor.md, plugins.md).
FileTopic
plugins.mdCore ships no plugin: the floor (run here, cache here) and where plugins live (packages/vx-*).
chained-cache.mdsrc/cache/chained-cache.ts — several declared cache layers, chained in order.
FileTopic
util-paths.mdsrc/util/paths.ts — POSIX-path normaliser for stable cache keys.
util-hash.mdsrc/util/hash.ts — xxHash3 helpers shared by every key-derivation site.
util-ulid.mdsrc/util/ulid.ts — run-id generator (Bun.randomUUIDv7 wrapper).
util-errors.mdsrc/util/errors.ts — UserError class for stack-less error reporting.
timing.mdsrc/util/timing.ts — the VX_TIMING=1 stage table + per-task spans.
util-edit-distance.mdsrc/util/edit-distance.ts — the one “did you mean” rule.
util-bun-version.mdsrc/util/bun-version.ts — the Bun floor, read at run time, and what breaks below it.
util-num.mdsrc/util/num.ts — MAX_TIMEOUT_MS, clampInt, parseDecimalInt.
util-settle.mdsrc/util/settle.ts — the end-of-run settle bound for plugin teardown.
util-tail.mdsrc/util/tail.ts — head-evicting tail for a persistent task’s output.
util-secret-mask.mdsrc/util/secret-mask.ts — masks secret-named variables’ values in what vx shows.
util-which.mdsrc/util/which.ts — executablePath: a tool’s absolute path on vx’s own PATH, found once.
util-procfs.mdsrc/util/procfs.ts — procfsIsOwn: is /proc this pid namespace’s view, asked once.
util-cgroup.mdsrc/util/cgroup.ts — the cores and memory this process may use, as its cgroup bounds them.
src/util/{size,verbs}.ts — parseSize, parseDuration (cli-cache.md) and the core verb list (cli.md).
src/util/task-id.ts — splitTaskId, the first-# inverse of taskId (task-graph.md).

For the public package surface (what import('@vzn/vx') resolves to) see index.md.