@vzn/vx 0.0.631 → 0.0.633
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -18
- package/docs/caching.md +2247 -0
- package/docs/cli.md +3214 -0
- package/docs/execution.md +708 -0
- package/docs/features.md +172 -0
- package/docs/patterns.md +219 -0
- package/docs/schema.md +2137 -0
- package/docs/security.md +209 -0
- package/package.json +14 -5
- package/schemas/cache.json +24 -0
- package/schemas/docs.json +28 -0
- package/schemas/error.json +23 -0
- package/schemas/info.json +147 -0
- package/schemas/init.json +57 -0
- package/schemas/last.json +188 -0
- package/schemas/lock.json +21 -0
- package/schemas/plan.json +88 -0
- package/schemas/show.json +124 -0
- package/schemas/summary.json +133 -0
- package/schemas/why.json +168 -0
- package/skills/vx/SKILL.md +89 -0
- package/src/bin.ts +9 -0
- package/src/cache/archive.ts +153 -51
- package/src/cache/cache.ts +542 -137
- package/src/cache/chained-cache.ts +9 -0
- package/src/cache/inputs.ts +5 -0
- package/src/cache/layer.ts +10 -5
- package/src/cache/layered-cache.ts +4 -0
- package/src/cache/schema.ts +44 -17
- package/src/cache/tar-stream.ts +204 -66
- package/src/cache/zstd.ts +1 -1
- package/src/cli/cache.ts +14 -14
- package/src/cli/docs-corpus.ts +21 -0
- package/src/cli/docs-text.d.ts +5 -0
- package/src/cli/docs.ts +167 -0
- package/src/cli/foreign-flags.ts +1 -1
- package/src/cli/help.ts +42 -7
- package/src/cli/index.ts +25 -11
- package/src/cli/info.ts +38 -9
- package/src/cli/init.ts +131 -24
- package/src/cli/last.ts +54 -3
- package/src/cli/lock.ts +43 -15
- package/src/cli/plan-format.ts +23 -1
- package/src/cli/plugin-commands.ts +3 -0
- package/src/cli/plugin-templates.ts +1 -1
- package/src/cli/run.ts +40 -21
- package/src/cli/show.ts +10 -7
- package/src/cli/upgrade.ts +19 -7
- package/src/cli/watch.ts +7 -2
- package/src/cli/why.ts +14 -40
- package/src/exec/runner.ts +27 -10
- package/src/graph/scheduler.ts +36 -0
- package/src/graph/task-graph.ts +4 -4
- package/src/index.ts +22 -5
- package/src/orchestrator/admission.ts +29 -1
- package/src/orchestrator/affected-tasks.ts +87 -18
- package/src/orchestrator/doctor.ts +14 -1
- package/src/orchestrator/execute-task.ts +149 -64
- package/src/orchestrator/failure-mode.ts +5 -3
- package/src/orchestrator/framed-output.ts +17 -3
- package/src/orchestrator/index.ts +11 -0
- package/src/orchestrator/logger.ts +57 -6
- package/src/orchestrator/metrics.ts +76 -4
- package/src/orchestrator/miss-reason.ts +3 -5
- package/src/orchestrator/miss-save.ts +6 -5
- package/src/orchestrator/options.ts +12 -0
- package/src/orchestrator/output-log.ts +14 -1
- package/src/orchestrator/path-links.ts +79 -0
- package/src/orchestrator/plan.ts +20 -3
- package/src/orchestrator/plugin.ts +7 -0
- package/src/orchestrator/prepare.ts +14 -4
- package/src/orchestrator/projects.ts +2 -2
- package/src/orchestrator/run-artifacts.ts +18 -2
- package/src/orchestrator/run-failures.ts +192 -0
- package/src/orchestrator/run-records.ts +10 -8
- package/src/orchestrator/run.ts +87 -22
- package/src/orchestrator/task-hash.ts +4 -4
- package/src/orchestrator/terminal-signals.ts +16 -0
- package/src/orchestrator/upstream.ts +65 -10
- package/src/util/errors.ts +55 -1
- package/src/util/index.ts +3 -0
- package/src/util/secret-mask.ts +13 -1
- package/src/util/verbs.ts +1 -0
- package/src/workspace/config-schema.ts +10 -8
- package/src/workspace/migration.ts +30 -3
- package/src/workspace/workspace.ts +1 -0
package/docs/cli.md
ADDED
|
@@ -0,0 +1,3214 @@
|
|
|
1
|
+
# CLI reference
|
|
2
|
+
|
|
3
|
+
The `vx` binary is the user-facing entry point. The implementation is
|
|
4
|
+
intentionally simple: a hand-rolled argv parser (no commander / yargs)
|
|
5
|
+
in `src/cli/index.ts` dispatches to per-subcommand handlers under
|
|
6
|
+
`src/cli/<name>.ts`. The flag surface is aligned with
|
|
7
|
+
[Turborepo's `turbo run`](https://turborepo.com/docs/reference/run)
|
|
8
|
+
so existing Turbo users can swap in with minimal muscle-memory churn.
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
# Standalone binary via npm (no Bun required on target):
|
|
12
|
+
npm install -g @vzn/vx
|
|
13
|
+
|
|
14
|
+
# From source (Bun ≥ 1.4):
|
|
15
|
+
bun src/bin.ts --version
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Below that floor vx still runs, and `vx info`'s `bun` row says so, because
|
|
19
|
+
what an older Bun breaks is the ANSWER, not the start: a large `--format json`
|
|
20
|
+
write is truncated mid-stream, no task reports what it used, and a config
|
|
21
|
+
syntax error surfaces as an internal error rather than the usual message.
|
|
22
|
+
[`modules/util-bun-version.md`](./modules/util-bun-version.md) has the
|
|
23
|
+
measurements and why the verdict lives on that row rather than on stderr. The
|
|
24
|
+
released binary carries its own Bun and the row never says it.
|
|
25
|
+
|
|
26
|
+
## Top-level shape
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
# Core
|
|
30
|
+
vx run [OPTIONS] [TASK | PKG#TASK ...] [-- forwarded-args...]
|
|
31
|
+
vx watch [OPTIONS] TASK [-- forwarded-args...]
|
|
32
|
+
vx cache prune [--older-than <duration>] [--max-size <size>] [--dry-run] [--format pretty|json] [--cache-dir <path>]
|
|
33
|
+
vx lock [--check] [--format pretty|json]
|
|
34
|
+
vx init [--dry [--format pretty|json]] [--force] [--mjs] [--native|--keep] [--plugin <seam>]
|
|
35
|
+
vx show [PROJECT[#TASK] | TASK] [--filter <pattern>] [--affected[=<ref>]] [--format pretty|json]
|
|
36
|
+
vx info [--format pretty|json] [--cache-dir <path>]
|
|
37
|
+
vx why (TASK | PKG#TASK) [--run RUNID] [--format pretty|json] [--cache-dir <path>]
|
|
38
|
+
vx last [RUNID] [--list[=N]] [--failed] [--log <task>] [--format pretty|json] [--cache-dir <path>]
|
|
39
|
+
vx upgrade [TAG] # self-update a compiled binary
|
|
40
|
+
vx docs <query> [--limit N] [--format pretty|json]
|
|
41
|
+
vx completions bash|zsh|fish
|
|
42
|
+
|
|
43
|
+
# Meta
|
|
44
|
+
vx # in a workspace, vx --help; outside one, says so and exits 1
|
|
45
|
+
vx help [VERB]
|
|
46
|
+
vx --help, -h
|
|
47
|
+
vx version
|
|
48
|
+
vx --version
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Each verb's lines are the usage lines `vx <verb> --help` prints, word
|
|
52
|
+
for word (`tests/cli-help-synopsis.test.ts`); the flags a verb accepts
|
|
53
|
+
are read from that line.
|
|
54
|
+
|
|
55
|
+
Multiple positional tasks run in one orchestrator invocation with a
|
|
56
|
+
shared task graph: `vx run build lint test` fans out all three across
|
|
57
|
+
the resolved project scope. Anchored entries (`pkg#task`) target a
|
|
58
|
+
specific project; bare entries follow the usual scope rules
|
|
59
|
+
(default = the cwd project; broaden with `--all` / `--filter` /
|
|
60
|
+
`--affected`). The cwd project is the deepest member holding the
|
|
61
|
+
directory, a member reached through a link (`packages/b -> ../ext/b`)
|
|
62
|
+
included.
|
|
63
|
+
|
|
64
|
+
**Every requested name must resolve.** If any positional matches no
|
|
65
|
+
project in scope, the run refuses to start — `vx run: no projects
|
|
66
|
+
declare task(s): <name>.` on stderr, a run and `--dry` / `--graph` alike
|
|
67
|
+
(a run printed it to stdout until 2026-10-03), exit 1, with `Did you mean <task>?` when a
|
|
68
|
+
declared task (or, for `pkg#task`, a runnable spec) is within two edits,
|
|
69
|
+
and with no name that near, what exists: `Tasks: build, test.`, `No
|
|
70
|
+
project is named zzz; projects: a, b.`, or `a's tasks: build, test.`
|
|
71
|
+
(M-56),
|
|
72
|
+
and with `Only projects outside the selection declare <name> — pass
|
|
73
|
+
--all, or --filter to pick them.` when the run was scoped (the cwd's
|
|
74
|
+
project, a `--filter`) and a project outside the scope declares it
|
|
75
|
+
— even when the other names resolved fine. A bare name declared by only SOME projects is normal and stays
|
|
76
|
+
green; the guard fires only when a name matched nowhere. So a CI job
|
|
77
|
+
running `vx run lint test typecheck` goes red the day `typecheck` is
|
|
78
|
+
renamed, instead of silently running two of three. Under a scope a git
|
|
79
|
+
diff chose (`--affected`, a `[ref]` filter) a bare name is judged against
|
|
80
|
+
the whole workspace instead, since which projects hold it depends on what
|
|
81
|
+
changed: `vx run test --affected` after a commit that changed only a
|
|
82
|
+
project without `test` exits 0 with `No affected project declares
|
|
83
|
+
task(s): test.`, and a name no project declares is still refused (item
|
|
84
|
+
1024). A change that reaches no requested task exits 0 with `Nothing
|
|
85
|
+
affected: the change reaches no test task.` A diff that touched no project stops before that check:
|
|
86
|
+
`nothing affected since <ref>` on stderr, exit 0, a typo unseen.
|
|
87
|
+
|
|
88
|
+
(No `-V` for version; `vx --version` only — matches Turbo.)
|
|
89
|
+
|
|
90
|
+
`vx <verb> --help` (and `-h`, and `vx help <verb>`) prints this reference
|
|
91
|
+
cut to that core verb — its usage lines and sections, then
|
|
92
|
+
`Full reference: vx help` —
|
|
93
|
+
and every argument error points at it. `vx help <name>` for a name that
|
|
94
|
+
is no verb here (core, a plugin's, or a moved one) is refused as
|
|
95
|
+
`vx <name>` is: one line, a guess when one is close, exit 1.
|
|
96
|
+
Past a `--` the flag belongs to the command being run, so
|
|
97
|
+
`vx run build -- --help` forwards it to the task instead. A plugin verb
|
|
98
|
+
owns its own arguments, `--help` included.
|
|
99
|
+
|
|
100
|
+
## `vx run`
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
vx run [OPTIONS] [TASK | PKG#TASK ...] [-- forwarded-args...]
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Run the named task(s). By default only the project containing the
|
|
107
|
+
current working directory is selected — `dependsOn` still expands so
|
|
108
|
+
the project's upstream workspace deps run too. Override with `--all`,
|
|
109
|
+
`--filter`, `--affected`, or an explicit `pkg#task`.
|
|
110
|
+
|
|
111
|
+
If no task name is given:
|
|
112
|
+
|
|
113
|
+
- **In a TTY** — an interactive picker lists every `pkg#task` entry
|
|
114
|
+
across the workspace (only the selected projects' under `--filter` /
|
|
115
|
+
`--affected`; `--affected` selecting nothing exits `0` as a run does), prints `description` next to each, prompts
|
|
116
|
+
for a number, runs the chosen one. The menu and prompt go to stderr,
|
|
117
|
+
so `vx run > out.txt` still asks on the terminal. Ctrl-C at the prompt exits `130`
|
|
118
|
+
as an interrupted run does; Ctrl-D exits `1` with `no task picked`.
|
|
119
|
+
A workspace with no task exits `1` naming how to declare one (under
|
|
120
|
+
`tasks` in a vx.config, or `vx init`).
|
|
121
|
+
- **Not a TTY** — exits `1` with
|
|
122
|
+
`missing task name (stdin is not a TTY, so no picker; tasks here: build, test)`,
|
|
123
|
+
naming the cwd project's tasks, else every project's (twelve, then
|
|
124
|
+
`and N more`); outside a workspace it reads `vx run <task>, e.g. vx run build`.
|
|
125
|
+
- **Under `--format json` or `--dry=json`**, on a terminal too — the
|
|
126
|
+
same refusal (`a JSON answer opens no picker; …`), with the
|
|
127
|
+
`VX_E_USAGE` error document on stdout: a program cannot pick.
|
|
128
|
+
|
|
129
|
+
Exit codes:
|
|
130
|
+
|
|
131
|
+
| Code | When |
|
|
132
|
+
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
133
|
+
| `0` | Every task finished `success` or `cache-hit` (local or remote); or `--affected` left no project that declares the task. |
|
|
134
|
+
| `1` | At least one task ended `failed` or `skipped`; a persistent task exited non-zero after it was ready; a task name no project declares; or parse/setup error. |
|
|
135
|
+
| `130` / `143` / `129` | Interrupted (SIGINT / SIGTERM / SIGHUP): each task's process group (the task and what it forked) gets vx's signal once (a SIGHUP as a SIGTERM), `VX_KILL_GRACE_MS` (2 s) to go, then SIGKILL; a second signal skips the grace. vx then dies of the signal, so a shell script running it stops too (a run that handed a task the terminal exits with the code, so the terminal is restored). |
|
|
136
|
+
|
|
137
|
+
A task runs in its own session, so a terminal's Ctrl-C reaches vx alone,
|
|
138
|
+
and each task hears it once: from vx, as SIGINT.
|
|
139
|
+
|
|
140
|
+
Installed from npm, `vx` is a Node launcher. On Node 22.15 or later it
|
|
141
|
+
replaces itself with the binary (`process.execve`), so every signal
|
|
142
|
+
reaches vx directly. On older Node it runs the binary and waits for it:
|
|
143
|
+
a signal sent to the launcher alone (`kill`, a process manager) is
|
|
144
|
+
passed to the binary, and a terminal's Ctrl-C already reaches both, so
|
|
145
|
+
the launcher does not send it twice.
|
|
146
|
+
|
|
147
|
+
A reader that leaves does not change the code. `vx run build | head -1`
|
|
148
|
+
closes the pipe after one line; the run still finishes, saves what it
|
|
149
|
+
built and releases its lock, and exits with its own verdict — the
|
|
150
|
+
output after that point goes nowhere (`EPIPE`, on stdout or stderr, is
|
|
151
|
+
not an error vx reports). Before 2026-09-16 the same pipeline died with
|
|
152
|
+
a stack and exit 1 after its task had succeeded.
|
|
153
|
+
|
|
154
|
+
### Selection
|
|
155
|
+
|
|
156
|
+
| Form | Effect |
|
|
157
|
+
| ----------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
158
|
+
| (default) | The project that contains cwd. Errors if cwd is not inside a project. |
|
|
159
|
+
| `pkg#task` | Just that project. |
|
|
160
|
+
| `//#task` | The root project's task (Turbo's spelling; the root is a project, D-39). |
|
|
161
|
+
| `--all` | Every project that declares the task. |
|
|
162
|
+
| `--filter <pat>` (repeatable) | pnpm-style filter DSL (see below). |
|
|
163
|
+
| `--affected[=<base>]` | The tasks a git change reaches: the ones it touches and those whose `dependsOn` closure holds one. |
|
|
164
|
+
|
|
165
|
+
Combining: every include (`--filter <pat>`, `--affected`) is taken
|
|
166
|
+
first and every `!` exclude after them all, as pnpm does, so an
|
|
167
|
+
exclude removes what any include added, whichever side of it it sits
|
|
168
|
+
(items 955, 979). The union holds for tasks too: `--affected --filter
|
|
169
|
+
other` runs other's tasks whether or not the change reaches them
|
|
170
|
+
(X-10). `--all` with a filter is the filter's selection:
|
|
171
|
+
the filters refine it rather than being overridden by it
|
|
172
|
+
(`--all --filter '!docs'` is everything but docs).
|
|
173
|
+
|
|
174
|
+
### Filter DSL (`--filter`)
|
|
175
|
+
|
|
176
|
+
The full DSL lives in `src/workspace/filter.ts`; this is the user-
|
|
177
|
+
facing summary.
|
|
178
|
+
|
|
179
|
+
A filter that matches nothing refuses the run (`no projects matched
|
|
180
|
+
filter(s): …`) with `Did you mean <name>?` when a project name is within
|
|
181
|
+
two edits, or when exactly one scoped project's name after its `/` is
|
|
182
|
+
(`--filter vx-mcp` hints `@vzn/vx-mcp`), and `Projects: a, b` otherwise
|
|
183
|
+
(M-56). A list names eight, then a count. An unmatched `tag:` filter
|
|
184
|
+
hints the nearest tag instead (`Did you mean tag:scope:web?`), else
|
|
185
|
+
lists the tags. When every pattern matched and an exclusion took back
|
|
186
|
+
all of it, the refusal names the exclusion instead (`no projects
|
|
187
|
+
selected: !app excluded every project the other filters matched`).
|
|
188
|
+
|
|
189
|
+
| Form | Meaning |
|
|
190
|
+
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
191
|
+
| `<pattern>` | Match by package name. `*` matches any characters, including `/`. A pattern matching no package may leave out the scope, as pnpm reads it (`cart` is `@nx-example/cart` when one package carries it). One holding a `/` outside a scope that matches no package is a directory, as Nx's `--projects` reads it (`apps/*` is `./apps/*`). |
|
|
192
|
+
| `./<dir>` | The package at `<dir>` alone, as Turbo and pnpm read it (`.` is the root project); a `<dir>` that is no package matches the packages under it (relative to workspace root; D-43). |
|
|
193
|
+
| `{<dir>}` | Same as `./<dir>`. |
|
|
194
|
+
| `./<glob>` | A glob over root-relative project dirs: `./packages/*` (direct children), `{apps/**}` (nested too; a trailing `**` matches zero dirs, so `./packages/kit/**` holds kit itself, as pnpm and Turbo read it). A path that names a project dir literally is read literally first, so `./packages/[abc]` is that directory. |
|
|
195
|
+
| `.` | The root project alone, when the root is a project (D-39); otherwise the packages under the root, i.e. every package, not the one you are standing in. |
|
|
196
|
+
| `//` | The root project alone, Turbo's name for it; matches nothing when the root is no project (D-46). |
|
|
197
|
+
| `tag:<pattern>` | The projects whose config `tags` hold a match, as Nx's `tag:` reads them (`*` as in a name). Takes every operator a name takes: `!tag:x`, `...tag:x`, `tag:x^...`, `tag:x[main]`. Nx's `--projects tag:x` aliases it. |
|
|
198
|
+
| `<pattern>...` | Match + all transitive dependencies (see below what an edge is). |
|
|
199
|
+
| `...<pattern>` | Match + all transitive dependents. |
|
|
200
|
+
| `<pattern>^...` | Only the transitive dependencies, excluding the matched package itself. |
|
|
201
|
+
| `...^<pattern>` | Only the transitive dependents, excluding the matched package itself. |
|
|
202
|
+
| `...<pattern>...` | Match + its dependents + the dependencies of all of them, as Turbo selects (`...db...` takes the packages the apps that use db build on). |
|
|
203
|
+
| `<sel>[<ref>]` | The packages `<sel>` (a name pattern or `{<dir>}`) selects that changed since `<ref>`, as Turbo and pnpm read `@scope/*[main]` (D-44). |
|
|
204
|
+
| `<sel>...[<ref>]` | The packages `<sel>` selects that changed since `<ref>` or depend on one that did; no dependency is added (Turbo: `@acme/api...[HEAD]` is api when only its dependency changed). |
|
|
205
|
+
| `!<pattern>` | Exclude packages matching `<pattern>`, from everything the includes select, in any order. |
|
|
206
|
+
| `[<git-ref>]` | Projects whose files changed since `<git-ref>` (`main`, `HEAD~5`, …). |
|
|
207
|
+
|
|
208
|
+
An edge is a `package.json` workspace dependency (`dependencies`,
|
|
209
|
+
`devDependencies`, `peerDependencies`, `optionalDependencies`; a peer
|
|
210
|
+
that would close a cycle counts for selection only, see
|
|
211
|
+
`modules/package-graph.md`) — an entry the package manager links to a
|
|
212
|
+
workspace package, not one whose key merely names it:
|
|
213
|
+
`"shared": "^1.0.0"` beside a local `shared@2.0.0` is a registry
|
|
214
|
+
dependency and no edge, and `"luigi": "workspace:../waluigi"` is an
|
|
215
|
+
edge to `waluigi` (the rule: `modules/package-graph.md` § Which entries
|
|
216
|
+
are edges) — OR a
|
|
217
|
+
cross-project `dependsOn` entry (`e2e`'s `test: { dependsOn:
|
|
218
|
+
['app#build'] }` makes `e2e` a dependent of `app`). The task graph knows
|
|
219
|
+
both, so selection follows both: `vx run test --filter '...app'` runs
|
|
220
|
+
`e2e#test` even though `e2e` has no manifest dependency on `app`. There
|
|
221
|
+
is no `implicitDependencies` field — declare the edge where the task
|
|
222
|
+
needs it.
|
|
223
|
+
|
|
224
|
+
A filter that names no project (`...`, a bare `!`) is refused, and one
|
|
225
|
+
whose pattern matched but whose walk selected nothing says what it
|
|
226
|
+
matched: `no projects selected: filter "...^core" matched core, and no
|
|
227
|
+
project depends on it` (item 1030).
|
|
228
|
+
|
|
229
|
+
Examples:
|
|
230
|
+
|
|
231
|
+
```sh
|
|
232
|
+
vx run build --filter @scope/* # all packages under @scope
|
|
233
|
+
vx run build --filter app... # app and its transitive deps
|
|
234
|
+
vx run build --filter ...util # util and everything depending on it
|
|
235
|
+
vx run build --filter app^... # only app's deps (not app)
|
|
236
|
+
vx run build --filter '*' --filter '!docs' # everything except docs
|
|
237
|
+
vx run build --filter '[origin/main]' # projects with files changed since main
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### `--affected[=<base>]`
|
|
241
|
+
|
|
242
|
+
Run the task only in projects whose files changed since `<base>`.
|
|
243
|
+
|
|
244
|
+
- `--affected` (no value) uses the workspace's `affectedBase` when it
|
|
245
|
+
names one (`nx()` and `turbo()` set it from `NX_BASE` / nx.json's
|
|
246
|
+
`defaultBase` and `TURBO_SCM_BASE`, `turbo()` on GitHub Actions from
|
|
247
|
+
the pull request's base or the push's `before`, as Turbo does;
|
|
248
|
+
[schema](schema.md)), else
|
|
249
|
+
`origin/HEAD`; without one (actions/checkout sets none, nor does a
|
|
250
|
+
repo with no remote), the first of `origin/main`, `origin/master`,
|
|
251
|
+
`main`, `master` that is not HEAD itself, as Turbo and Nx compare with
|
|
252
|
+
`main` (D-93); else `HEAD~1`. A clone with neither — a
|
|
253
|
+
CI checkout at `fetch-depth: 1` — has no base at all, and vx says so
|
|
254
|
+
(`--affected has no base here … a shallow clone?`) instead of failing
|
|
255
|
+
on a `HEAD~1` nobody typed. And when the base IS the commit you are
|
|
256
|
+
on (a single-branch clone whose `origin/HEAD` is the branch under
|
|
257
|
+
test), the `nothing affected since <ref>` note says the ref is HEAD
|
|
258
|
+
itself and names the two bases you probably meant
|
|
259
|
+
(`--affected=origin/main`, `--affected=HEAD~1`).
|
|
260
|
+
- Without git on PATH, every shape is one line — `vx requires git:
|
|
261
|
+
failed to spawn 'git' … Install git and re-run` — the same the input
|
|
262
|
+
enumeration prints; a minimal image met a stack here before
|
|
263
|
+
(2026-09-16). Outside a git work tree every shape says `vx requires
|
|
264
|
+
git: <root> is not inside a git work tree`, as a plain run does, and a
|
|
265
|
+
repository with no commit yet says so, not "a shallow clone?" (X-52).
|
|
266
|
+
- `--affected=<ref>` uses the given git ref. A value that is empty or
|
|
267
|
+
starts with `-` is refused before git sees it: the ref is an argument,
|
|
268
|
+
never a shell command, and an option-like one (`--output=<path>`)
|
|
269
|
+
would be a real `git diff` option. A range (`HEAD~1..HEAD`,
|
|
270
|
+
`main...feature`) is refused there too, naming the base to pass
|
|
271
|
+
alone — `ranges are not supported — pass the base alone ("HEAD~1")`
|
|
272
|
+
— because the other end is always the working tree; `<base>...HEAD`,
|
|
273
|
+
Turbo's CI spelling, is read as `<base>`, since vx diffs from the merge
|
|
274
|
+
base to a working tree that holds HEAD (D-117). Its two-dot `<base>..HEAD` diffs from
|
|
275
|
+
`<base>` itself, not the merge base. An exclusion (`^main`) is refused
|
|
276
|
+
the same way, naming `main`. A ref that does
|
|
277
|
+
not exist is `git ref "<ref>" did not resolve`; in a shallow clone (CI's
|
|
278
|
+
one-commit checkout) it adds that the clone is shallow and how to fetch
|
|
279
|
+
the history (`git fetch --unshallow`, `fetch-depth: 0`). A ref naming
|
|
280
|
+
a path inside a commit (`main:packages`) is refused, naming the commit
|
|
281
|
+
to pass: its paths lack the prefix, so the diff would select the wrong
|
|
282
|
+
projects. A root tree (`main^{tree}`) is still a base.
|
|
283
|
+
- A member whose directory is a symlink to a place elsewhere under the
|
|
284
|
+
workspace root (`packages/b -> ../ext/b`) is selected by a change at
|
|
285
|
+
that real place too: git names the files where they live, not by the
|
|
286
|
+
link (item 1079). A link to a directory outside the root is outside
|
|
287
|
+
git's view, and a change there selects nothing.
|
|
288
|
+
- The diff runs from the **merge base** of the ref and `HEAD`, not from
|
|
289
|
+
the ref itself, so a branch whose base has moved on sees only its own
|
|
290
|
+
changes — never the files other people landed on `main` since it
|
|
291
|
+
forked (Turbo and Nx do the same). Refs with no common ancestor diff
|
|
292
|
+
from the ref.
|
|
293
|
+
|
|
294
|
+
**It selects the tasks the change reaches (owner, 2026-10-04).** A
|
|
295
|
+
change seeds tasks in the projects it touches:
|
|
296
|
+
|
|
297
|
+
- a cached task when a changed path is one of its declared inputs
|
|
298
|
+
(`files`, `workspaceFiles`), or a changed submodule or embedded
|
|
299
|
+
repository is one its `workspaceFiles` may reach into (git reports it
|
|
300
|
+
as one path; a glob whose fixed prefix is above or inside it counts);
|
|
301
|
+
- every task of a project whose `package.json` or `vx.config.*`
|
|
302
|
+
changed, or that holds a changed path no cached task of its declares
|
|
303
|
+
(vx cannot prove that path re-keys nothing), or that holds a changed
|
|
304
|
+
submodule or embedded repository (git reports it as one path, and no
|
|
305
|
+
task's globs can say whether they reach inside), or that a lockfile
|
|
306
|
+
claim, a manifest edge at the base or a config import names;
|
|
307
|
+
- an uncached task when a changed path lies in its project or the
|
|
308
|
+
project is reached whole; a root file another task of its declares
|
|
309
|
+
(`workspaceFiles`) is no change there. A group seeds nothing.
|
|
310
|
+
|
|
311
|
+
A requested task runs when its `dependsOn` closure holds a seeded task,
|
|
312
|
+
so a change reaches another project only along a task edge. With
|
|
313
|
+
`app#test` behind `^build`, an edit to `ui/src/button.ts` that
|
|
314
|
+
`ui#build`'s inputs read runs `ui`'s tasks and `app#test`; an edit to
|
|
315
|
+
`ui/src/button.test.ts` that only `ui#test` reads runs `ui#test` alone,
|
|
316
|
+
and `app#lint`, which depends on nothing, never runs for a change in
|
|
317
|
+
`ui`. A `pkg#task` you name runs whatever the diff. This is the edge
|
|
318
|
+
the cache key folds (a cached `app#test` with no edge to `ui` never
|
|
319
|
+
sees `ui`'s files either). A project that declares no `build` gets one
|
|
320
|
+
keyed on all its files (`schema.md`), so any change there reaches a
|
|
321
|
+
dependant behind `^build`; a package `^name` passes through for want of a
|
|
322
|
+
config reaches it the same way.
|
|
323
|
+
The graph is the one a `graph` plugin leaves: an edge or an input it
|
|
324
|
+
adds reaches a task as a declared one does, and a task it marks
|
|
325
|
+
requested runs whatever the diff. With such a plugin every project is a
|
|
326
|
+
candidate once the diff touched anything, and its hook sees every
|
|
327
|
+
candidate task before the selection prunes the graph.
|
|
328
|
+
Nx 23.3 (`NX_LEGACY_AFFECTED=false`) and Turbo
|
|
329
|
+
(`affectedUsingTaskInputs`) select tasks the same way, behind flags.
|
|
330
|
+
|
|
331
|
+
Until 2026-09-16 the sugar was the changed-only `[<base>]` form (item
|
|
332
|
+
287), and until 2026-10-04 it took every task of every manifest
|
|
333
|
+
dependent, which the filter forms still do:
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
vx run test --affected # the tasks the change reaches
|
|
337
|
+
vx run test --filter '...[main]' # what changed + every dependent project
|
|
338
|
+
vx run test --filter '[main]' # only the projects that changed
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Its candidate projects are `--filter '...[<base>]'`'s; both are resolved by
|
|
342
|
+
`src/workspace/affected.ts`, which unions `git diff` against `<base>`
|
|
343
|
+
with `git ls-files --others` so a brand-new untracked source file counts
|
|
344
|
+
as a change (input hashing sees it, so `--affected` must too). A
|
|
345
|
+
project inside a submodule or an embedded repository is selected when
|
|
346
|
+
git reports that repository changed — a dirty or moved submodule
|
|
347
|
+
(`vendor/sub`), an untracked embedded repository (`vendor/nested/`):
|
|
348
|
+
the workspace repository sees the nested one as a single path (`git
|
|
349
|
+
diff --raw`'s gitlink mode, 160000, on either side names one), so a change inside is a
|
|
350
|
+
change to it, and every project under it is selected, the project that
|
|
351
|
+
holds it included. A repository's own request to hide submodules from a diff
|
|
352
|
+
(`diff.ignoreSubmodules`, `submodule.<name>.ignore`) does not apply:
|
|
353
|
+
the key sees the change whatever git is told to show.
|
|
354
|
+
`vx-lock.json` is filtered out of the changed set — a `vx lock`
|
|
355
|
+
re-write never marks every project affected.
|
|
356
|
+
|
|
357
|
+
**A lockfile change selects everything.** The root lockfiles,
|
|
358
|
+
`pnpm-workspace.yaml`, `.yarnrc.yml`, `.npmrc`, `bunfig.toml` and the patches `bun.lock` names are folded into the [workspace
|
|
359
|
+
fingerprint](./caching.md), which is part of _every_ task's cache key —
|
|
360
|
+
so a `bun install` / `pnpm update` invalidates the whole cache. Those
|
|
361
|
+
files sit at the workspace root and belong to no project, so mapping
|
|
362
|
+
changed paths to project directories would select nothing; `--affected`
|
|
363
|
+
widens to every project instead, for the same reason it unions in
|
|
364
|
+
untracked files. Only the ROOT copies count: a lockfile vendored inside
|
|
365
|
+
a package is not hashed and selects just that package. A lockfile a
|
|
366
|
+
plugin CLAIMS (`VxPlugin.fingerprint`, e.g. `pnpm-lock.yaml` under
|
|
367
|
+
`@vzn/vx-lockfile`) is the exception on both sides: the key folds what the
|
|
368
|
+
plugin says per project, so `--affected` asks the plugin which projects
|
|
369
|
+
the change touches — given the bytes at the base ref and in the working
|
|
370
|
+
tree — and selects those; only a plugin that cannot tell widens.
|
|
371
|
+
|
|
372
|
+
**A dropped edge selects its dependent.** A package the change deleted
|
|
373
|
+
(its `package.json` was there at the base and is gone) is no project
|
|
374
|
+
now, so its paths map to nothing; and one whose `version` or `name`
|
|
375
|
+
moved may no longer satisfy what a dependent declares (`lib: ^1.0.0`
|
|
376
|
+
after a bump to 2.0.0). Either drops an edge the dependent's key folded,
|
|
377
|
+
while today's graph shows no dependent to walk to. So the package graph
|
|
378
|
+
is built again over the changed manifests as the base had them, and
|
|
379
|
+
every project whose workspace dependencies differ is selected, and so
|
|
380
|
+
is a project whose task names a removed or renamed package in
|
|
381
|
+
`dependsOn: ['lib#build']`, an edge the package graph cannot see
|
|
382
|
+
(item 1085). An edit to the root manifest's `workspaces` selects every project:
|
|
383
|
+
which packages left the workspace is a discovery at the base.
|
|
384
|
+
|
|
385
|
+
**A new nested project selects the project above it.** A project's
|
|
386
|
+
inputs stop at every project below it, so a `package.json` that makes
|
|
387
|
+
an existing directory a project re-keys the project that held it; the
|
|
388
|
+
change maps to the new project alone, so the one above it is selected
|
|
389
|
+
too. "New" is judged at the base: no manifest there, or one with no
|
|
390
|
+
`name`.
|
|
391
|
+
|
|
392
|
+
**A workspace config change selects everything.** An edit to
|
|
393
|
+
`vx.workspace.*`, or to a file it imports by relative specifier, selects
|
|
394
|
+
every project: the `config` and `project` stages its plugins install
|
|
395
|
+
shape every resolved config, so the edit can re-key any task, and
|
|
396
|
+
selection cannot tell which. It is not in the fingerprint (a key moves
|
|
397
|
+
only when a stage's output does). A root file a plugin's stages read
|
|
398
|
+
without importing it is seen when the plugin CLAIMS it
|
|
399
|
+
(`VxPlugin.fingerprint`): `turbo()` claims `turbo.json` and
|
|
400
|
+
`turbo.jsonc`, `nx()` claims `nx.json`, and an edit asks the claimant,
|
|
401
|
+
which answers every project (item 961).
|
|
402
|
+
|
|
403
|
+
**A file your config IMPORTS selects that project.** vx hashes the
|
|
404
|
+
resolved config, so a shared preset a `vx.config.*` imports is part of
|
|
405
|
+
the cache key — and selection follows the same rule. Editing
|
|
406
|
+
`shared/preset.ts` selects every project whose config imports it,
|
|
407
|
+
directly or through another shared file, even though the file belongs
|
|
408
|
+
to no project and no `workspaceFiles` glob names it. The scan is
|
|
409
|
+
STATIC (nothing is evaluated) and follows RELATIVE specifiers, and a
|
|
410
|
+
bare one the nearest tsconfig maps through `paths` or `baseUrl`; any
|
|
411
|
+
other bare specifier is a package, and a lockfile change already selects
|
|
412
|
+
everything. It crosses project boundaries as the evaluation does: a
|
|
413
|
+
config importing `../../packages/lib/preset.ts` is selected when
|
|
414
|
+
`preset.ts` or a file it imports inside `lib` changes. Import your
|
|
415
|
+
helpers by bare specifier to opt out. See
|
|
416
|
+
[`docs/modules/config-imports.md`](./modules/config-imports.md).
|
|
417
|
+
|
|
418
|
+
**Nothing changed exits 0.** When the selection comes only from
|
|
419
|
+
`--affected` / `[<ref>]` and resolves to zero projects, vx prints
|
|
420
|
+
`nothing affected since <ref>` and exits 0 — a docs-only commit must not
|
|
421
|
+
fail `vx run lint test build --affected=origin/main`. When the diff
|
|
422
|
+
did match and an exclusion or an empty walk took it all back, the exit-0
|
|
423
|
+
note says that instead (`no projects selected: !app excluded every
|
|
424
|
+
project the other filters matched`), never that nothing changed. A name or path
|
|
425
|
+
pattern that matches nothing is still an error (a probable typo), and a
|
|
426
|
+
pattern that matches nothing alongside one that matched is warned about
|
|
427
|
+
on stderr.
|
|
428
|
+
|
|
429
|
+
**An empty selection never cancels an anchored task.** Project scope
|
|
430
|
+
applies to bare names only, so `vx run app#deploy build
|
|
431
|
+
--affected=origin/main` with nothing changed still runs `app#deploy`
|
|
432
|
+
(vx notes `nothing affected since <ref> — running app#deploy only` on
|
|
433
|
+
stderr). Only a bare-name-only invocation short-circuits to exit 0.
|
|
434
|
+
With only `pkg#task` names the scope goes unused, but `--filter` and
|
|
435
|
+
`--affected` are still resolved: a pattern that matches nothing or a ref
|
|
436
|
+
git does not know refuses the run as it does beside a bare name.
|
|
437
|
+
|
|
438
|
+
### Argument forwarding (`--`)
|
|
439
|
+
|
|
440
|
+
Anything after `--` is forwarded (shell-quoted) to the task's
|
|
441
|
+
`exec.command`:
|
|
442
|
+
|
|
443
|
+
```sh
|
|
444
|
+
vx run test -- --watch # underlying test runner sees "--watch"
|
|
445
|
+
vx run build -- --sourcemap # build command gets "--sourcemap"
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
They are appended to the command's last line (trailing blank lines are
|
|
449
|
+
dropped first, so a multi-line command's closing newline does not run
|
|
450
|
+
them as a command of their own), or before a `#` comment still
|
|
451
|
+
open there (`echo args: # show` gets them; with comment-only lines
|
|
452
|
+
below a commented line, before the earliest). A heredoc's body and
|
|
453
|
+
terminator are not command lines: `cat <<X … X` gets them on the
|
|
454
|
+
`cat <<X` line (X-12). A `<<X` in a comment or in quotes opens no
|
|
455
|
+
heredoc, and a quote in a body opens no string (X-110). A persistent task gets
|
|
456
|
+
them too, with or without a `readyWhen`.
|
|
457
|
+
|
|
458
|
+
Forwarded args are folded into the cache key — different args produce
|
|
459
|
+
different cache entries. They scope to user-requested tasks only;
|
|
460
|
+
dependsOn-pulled deps don't see them (so upstream cache identity
|
|
461
|
+
stays clean). A frame's `$ <command>` line shows the command as it
|
|
462
|
+
ran, so a requested task's carries the args and a dependency's does
|
|
463
|
+
not.
|
|
464
|
+
A group (a task with no command) takes none, so a request that names
|
|
465
|
+
only groups is refused (`args after \`--\` reach no task`) rather
|
|
466
|
+
than run with the args unheard.
|
|
467
|
+
|
|
468
|
+
### Flags
|
|
469
|
+
|
|
470
|
+
| Flag | Type | Default | Description |
|
|
471
|
+
| ---------------------------------- | -------------- | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
472
|
+
| `--filter <pattern>` | repeatable | (none) | pnpm-style filter DSL (see above). `--filter=<pattern>` form too. |
|
|
473
|
+
| `--all` | boolean | off | Select every project that declares the task. |
|
|
474
|
+
| `--affected[=<base>]` | optional value | off | Select the tasks a change since `<base>` reaches: the ones it touches and those whose `dependsOn` closure holds one (default `affectedBase`, else `origin/HEAD`, else `main` or `master`, else `HEAD~1`); candidates are `--filter "...[<base>]"`'s. |
|
|
475
|
+
| `--exclude-dependencies[=<names>]` | optional value | off | Drop `dependsOn` edges. No value = all (just the requested task runs; a group's members run as the group); comma-list = drop only those names, each of which some project must declare (a typo is refused with the nearest name, item 1026). An edge to a task the run schedules anyway (`--all` requests it) stays, so the two still run in order, and so does the order through a dropped task: with `gen` dropped from `test → gen → build` and `build` requested, `test` still waits for `build`. An empty `=` value is a parse error (ambiguous — see below). A dropped dependency does not run but is still keyed, so every key is the one a full run derives; a task keyed on one may hit but does not save (`caching.md` step 10). |
|
|
476
|
+
| `--concurrency <n>` | int or `<n>%` | cores, capped by the cgroup quota | Maximum parallel tasks that EXECUTE; confirmed cache-hit restores are disk work and run on their own lane, up to twice this. `1` serializes both; `50%` is half the CPUs (rounded, never below 1; over 100% is allowed for I/O-bound work). `--concurrency=<n>` form too. |
|
|
477
|
+
| `--no-cache` | boolean | off | Disable caching entirely (no reads, no writes); output globs are NOT cleaned. |
|
|
478
|
+
| `--force` | boolean | off | Re-execute everything (skip cache reads) but still REFRESH the cache (writes stay on). Output globs are cleaned (so the saved snapshot is clean). |
|
|
479
|
+
| `--cache <spec>` | value | all axes on | Per-layer read/write control. See below. An EMPTY spec (`--cache=`) is a parse error — it applied nothing and left every axis on; pass `--no-cache` to disable them all. |
|
|
480
|
+
| `--cache-dir <path>` | value | workspace `cacheDir` / `~/.vx/<id>/cache` | Cache directory override, resolved relative to cwd (absolute paths used as-is). Beats the `defineWorkspace({ cacheDir })` field, `VX_CACHE_DIR` and the default; like them, the directory then holds the whole cache, shared through no store, for every cache the run opens — the config-evaluation cache that `--affected` owners, the picker and the watch sweep read included, so the workspace's default dir is not created beside it. A per-run knob — never folded into a cache key. `--cache-dir=<path>` form too; the space form rejects a value starting with `-`. A directory this user cannot write into fails the run before any task with `cache directory <path> is not writable (EACCES: …)` — every run records its history there. |
|
|
481
|
+
| `--retry <n>` | value | `0` | Re-run a failed task up to `n` more times; never a persistent one. Run-level default only: a task's own `exec.retries` wins (even an explicit `0`). Never affects cache keys. `--retry=<n>` form too. |
|
|
482
|
+
| `--continue[=<mode>]` | value | `deps-ok` | What a failed task takes down with it. `never` stops dispatch on the first failure; `deps-ok` (default) skips only its dependents; `always` (bare `--continue`) runs dependents anyway. See § Failure propagation. |
|
|
483
|
+
| `--timeout <ms>` | positive int | none | Default per-task timeout for tasks without their own `exec.timeout`. Sits above `VX_TASK_TIMEOUT` + workspace `timeout`; per-task `exec.timeout` always wins. A runaway task is killed + `failed`. Never affects cache keys. `--timeout=<ms>` form too. |
|
|
484
|
+
| `--frozen` | boolean | off | Load configs from `vx-lock.json` instead of evaluating (CI) — the run's, and the ones `--affected` owners and the picker select from. See § `--frozen`. |
|
|
485
|
+
| `--output-logs <mode>` | value | flow-derived | `full` \| `errors-only` \| `hash-only` \| `none` — explicit output override. See § `--output-logs`. `--output-logs=<mode>` form too. |
|
|
486
|
+
| `--download <mode>` | value | `all` | `all` \| `toplevel` \| `none` — where a REMOTELY-executed task's outputs land. `none` leaves them in the remote CAS and fetches lazily, only when a locally-placed task needs them. Never affects cache keys. See § `--download`. `--download=<mode>` form too. |
|
|
487
|
+
| `--verbosity <n>` | int (0+) | `0` | `1` or more prints a per-task table (groups left out) after the framed blocks, above the footer. `--verbosity=<n>` form too. |
|
|
488
|
+
| `--dry[=text\|json]` | optional value | off | Print the task graph + predicted cache hit/miss; skip execution. `VX_TIMING=1` prints the stage table here as it does for a run. |
|
|
489
|
+
| `--graph[=<path>]` | optional value | off | Emit Graphviz DOT (stdout if no path, its directory made if missing); skip execution. A path it cannot write is one line and exit 1. |
|
|
490
|
+
| `--format <fmt>` | value | `pretty` | `json` prints the `--summarize` document on stdout when the run ends and moves every other line to stderr ([Machine-readable output](#machine-readable-output)). `--format=<fmt>` form too. |
|
|
491
|
+
| `--summarize[=<path>]` | optional value | off | Write per-run JSON to `<cacheDir>/runs/<run_id>.json` (or the explicit path). |
|
|
492
|
+
| `--profile[=<path>]` | optional value | off (`profile.json` when set) | Write Chrome-trace JSON of the run's wallclock spans. |
|
|
493
|
+
| `--tag <k=v>` | repeatable | (none) | Label this invocation. Recorded on the run's `invocations` row so dashboards can filter runs. `--tag=k=v` form too. |
|
|
494
|
+
| `--report[=markdown]` | optional value | off | At the end of the run, print a markdown run report to stdout, above the footer. Only `markdown` is supported (`json` is reserved). |
|
|
495
|
+
| `--report-file <path>` | value | off | After the run, APPEND the same markdown report to `<path>`, making its directory as the other output paths do. Use this for `$GITHUB_STEP_SUMMARY` — redirecting stdout captures the whole run log too. `--report-file=<path>` form too. |
|
|
496
|
+
|
|
497
|
+
Mutual exclusion:
|
|
498
|
+
|
|
499
|
+
- `--dry` and `--graph` — both skip execution; pick one.
|
|
500
|
+
- `--dry` or `--graph` with `--summarize`, `--profile`, `--report` or
|
|
501
|
+
`--report-file` — each needs a real run to write about. `--report` and
|
|
502
|
+
`--report-file` were accepted and silently wrote nothing until item 992.
|
|
503
|
+
|
|
504
|
+
Unknown flags are a parse error (`unknown flag: --foo`), naming the
|
|
505
|
+
nearest flag the verb accepts when one is within two edits
|
|
506
|
+
(`unknown flag: --concurency (did you mean --concurrency?)`). Every verb
|
|
507
|
+
does this against its own usage line and `--help`: `vx info --formt`
|
|
508
|
+
hints `--format`, `vx lock --chek` hints `--check`, `vx upgrade --hlp`
|
|
509
|
+
hints `--help`, and `--json` on a verb that takes `--format` hints
|
|
510
|
+
`--format json`. `vx version` takes no word, so `vx version --hlp` is
|
|
511
|
+
refused (exit 1) where it once printed the version.
|
|
512
|
+
|
|
513
|
+
A task typed where the verb goes (`turbo build`, `nx build app`) is
|
|
514
|
+
refused with the `vx run` that runs it: `vx build` names
|
|
515
|
+
`vx run build --all` from the root and `vx run build` inside a project,
|
|
516
|
+
`vx build app` names `vx run build --filter app`, and `vx app#build`
|
|
517
|
+
names `vx run app#build`. A typo of a task (`vx biuld`) names the task
|
|
518
|
+
and the same `vx run`, unless a verb is as close (`vx rnu` hints `run`).
|
|
519
|
+
The default `build` is no declared task, so it is no hint: where it is
|
|
520
|
+
the only `build`, `vx build` is an unknown command.
|
|
521
|
+
It stays a refusal: a plugin verb of the same
|
|
522
|
+
name is the verb, and would change what `vx build` means the day one
|
|
523
|
+
was declared.
|
|
524
|
+
|
|
525
|
+
**Optional-value flags take their value with `=` only.** `--affected`,
|
|
526
|
+
`--exclude-dependencies`, `--dry`, `--graph`, `--summarize`, `--profile`,
|
|
527
|
+
and `--report` are all valid bare, so a following word is
|
|
528
|
+
read as a task name (a `--graph` word ending `.svg`, `.png`, `.json`
|
|
529
|
+
and the like is refused, see § Turbo and Nx flags) — `vx run --affected build` means "run
|
|
530
|
+
`build`, affected scope", and there is no way to tell that apart from
|
|
531
|
+
"`build` is the git base". Write `--graph=out.dot` or
|
|
532
|
+
`--affected=origin/main`. Getting it wrong is loud, not silent: the value
|
|
533
|
+
becomes a positional that matches no project, so the run refuses to
|
|
534
|
+
start (see "Every requested name must resolve" above).
|
|
535
|
+
|
|
536
|
+
`--exclude-dependencies=` with an EMPTY value is rejected rather than
|
|
537
|
+
guessed — "drop every edge" and "drop none" are both plausible readings.
|
|
538
|
+
Pass bare `--exclude-dependencies` for the first, omit the flag for the
|
|
539
|
+
second.
|
|
540
|
+
|
|
541
|
+
Value flags (`--filter`, `--concurrency`, `--output-logs`,
|
|
542
|
+
`--verbosity`, `--cache-dir`, `--report-file`, …)
|
|
543
|
+
accept both `--flag value` and `--flag=value`. In the space form,
|
|
544
|
+
`--cache-dir` and `--report-file` reject a value
|
|
545
|
+
starting with `-`: that is always a swallowed flag (an unquoted empty
|
|
546
|
+
shell variable), never a path or task id. Use the `=` form for a literal
|
|
547
|
+
leading dash.
|
|
548
|
+
|
|
549
|
+
**Numeric flags take a plain decimal integer.** `--concurrency`,
|
|
550
|
+
`--timeout`, `--retry` and `--verbosity` reject hex (`0x10`), exponent
|
|
551
|
+
(`1e3`), fractional (`2.7`), signed (`+4`) and space-padded forms, plus
|
|
552
|
+
anything past `2^53` (it would parse to a number you did not type).
|
|
553
|
+
These all used to be silently reinterpreted — `--concurrency 0x10` ran
|
|
554
|
+
16 workers.
|
|
555
|
+
|
|
556
|
+
An empty `=` value means "no value" on four flags, which then act like
|
|
557
|
+
their bare forms: `--profile=` writes `profile.json`, `--summarize=`
|
|
558
|
+
writes `<cacheDir>/runs/<run_id>.json`, `--graph=` prints to stdout and
|
|
559
|
+
`--affected=` uses the default base. Every other flag refuses an empty
|
|
560
|
+
value: `--dry=`, `--report=`, `--continue=` and
|
|
561
|
+
`--exclude-dependencies=` as well as the ones with no bare form
|
|
562
|
+
(`--retry=`, `--timeout=`, `--cache-dir=`, `--filter=`, `--cache=`).
|
|
563
|
+
|
|
564
|
+
#### Cache control: `--cache`, `--no-cache`, `--force`
|
|
565
|
+
|
|
566
|
+
The cache has four independent axes — **localRead**, **localWrite**,
|
|
567
|
+
**remoteRead**, **remoteWrite** — and the three flags above resolve
|
|
568
|
+
them in this precedence order:
|
|
569
|
+
|
|
570
|
+
1. Start with every axis **on** (the default).
|
|
571
|
+
2. Apply each `--cache=<spec>` segment (the base).
|
|
572
|
+
3. If `--no-cache` was passed, force **all four off**.
|
|
573
|
+
4. If `--force` was passed, force **both reads off** (writes stay
|
|
574
|
+
whatever the base / `--cache` left them).
|
|
575
|
+
|
|
576
|
+
A spec that names a remote axis (`remote:r`, `remote:w`, `remote:rw`)
|
|
577
|
+
in a workspace whose plugins supply no remote layer gets one status
|
|
578
|
+
line saying so — the axes are inert without a layer to serve them, and
|
|
579
|
+
a CI job that believes it is filling a shared cache should be told.
|
|
580
|
+
|
|
581
|
+
So `--no-cache` always wins over `--force`. The common cases:
|
|
582
|
+
|
|
583
|
+
- `--no-cache` → nothing reads, nothing writes, and declared output
|
|
584
|
+
globs are left untouched (you're debugging; vx won't manage your
|
|
585
|
+
tree).
|
|
586
|
+
- `--force` → re-execute every task (reads off) but still write fresh
|
|
587
|
+
artifacts to both layers (writes on). Output globs ARE cleaned
|
|
588
|
+
before each task so the saved snapshot is clean. This is the "rebuild
|
|
589
|
+
and refresh the cache" flag.
|
|
590
|
+
|
|
591
|
+
`--cache=<spec>` is a comma-separated list of `<layer>:<flags>`
|
|
592
|
+
segments. `layer` is `local` or `remote`; `flags` is any subset of `r`
|
|
593
|
+
(read) and `w` (write), order-independent and possibly empty. A
|
|
594
|
+
**mentioned** layer is set EXACTLY to its flags; an **unmentioned**
|
|
595
|
+
layer keeps its current value. Both `--cache=<spec>` and the space form
|
|
596
|
+
`--cache <spec>` are accepted.
|
|
597
|
+
|
|
598
|
+
| Spec | Effect |
|
|
599
|
+
| --------------------------- | ------------------------------------------------------- |
|
|
600
|
+
| `--cache=local:rw,remote:r` | remote read-only (won't upload); local full |
|
|
601
|
+
| `--cache=local:r` | local read-only; remote untouched (still full) |
|
|
602
|
+
| `--cache=remote:` | remote fully off; local untouched |
|
|
603
|
+
| `--cache=local:,remote:rw` | don't touch the local cache, but still upload to remote |
|
|
604
|
+
|
|
605
|
+
`local:` means "don't serve hits out of the pre-existing local cache" —
|
|
606
|
+
a remote hit is still delivered (the artifact has to land on disk to be
|
|
607
|
+
extracted), it just never short-circuits the remote read.
|
|
608
|
+
|
|
609
|
+
Combine with `--force` for "re-execute and refresh only the remote":
|
|
610
|
+
`--cache=local: --force` (local off, reads off, remote write-only).
|
|
611
|
+
|
|
612
|
+
Invalid layers/flags are a parse error
|
|
613
|
+
(`invalid --cache layer 'disk'`, `invalid --cache flag 'x'`, …).
|
|
614
|
+
|
|
615
|
+
### Output
|
|
616
|
+
|
|
617
|
+
What a run prints is derived from the run's intent (its "flow"),
|
|
618
|
+
unless explicitly overridden:
|
|
619
|
+
|
|
620
|
+
- **FOCUSED** — no selection flag was passed. The user is running
|
|
621
|
+
"their" task; cwd and task count are irrelevant to the
|
|
622
|
+
classification.
|
|
623
|
+
- **BROAD** — the invocation used `--all`, `--filter`, or
|
|
624
|
+
`--affected`. The user asked about a swath of the workspace and
|
|
625
|
+
wants news, not output.
|
|
626
|
+
- **CI** — the `CI` env var is truthy (`CI=0` / `CI=false` don't
|
|
627
|
+
count). Wins over the flow.
|
|
628
|
+
|
|
629
|
+
Reported task lines share one column grid —
|
|
630
|
+
`<glyph> <time> <status> <cache> <name>` — with two orthogonal axes:
|
|
631
|
+
the glyph SHAPE encodes the cache axis, the glyph COLOR (and the
|
|
632
|
+
status word) the task axis.
|
|
633
|
+
|
|
634
|
+
| Glyph | Cache axis | Status word |
|
|
635
|
+
| ----- | -------------------------- | ----------- |
|
|
636
|
+
| `⏺` | miss — the task ran | success |
|
|
637
|
+
| `►` | fresh (up-to-date) | success |
|
|
638
|
+
| `⇢` | restored from local cache | success |
|
|
639
|
+
| `⇣` | restored from remote | success |
|
|
640
|
+
| `◼` | failed | failed |
|
|
641
|
+
| `⊘` | skipped (blocked upstream) | skipped |
|
|
642
|
+
| `▸` | persistent (dev server) | running |
|
|
643
|
+
|
|
644
|
+
A live WORKER row carries no glyph: the ticking elapsed time leads it,
|
|
645
|
+
which is the motion the run has instead of a spinner.
|
|
646
|
+
|
|
647
|
+
Per-task visibility by outcome. Each cell is the SHAPE of what prints —
|
|
648
|
+
`silent`, `one-liner`, `frame`, or a conditional; the table is pinned to
|
|
649
|
+
the renderer by `tests/output-doc-drift.test.ts`, so the vocabulary is
|
|
650
|
+
fixed:
|
|
651
|
+
|
|
652
|
+
| Outcome | focused (requested task) | focused (dependency) | broad | CI / `full` |
|
|
653
|
+
| ---------------------- | ------------------------ | ------------------------- | ------------------------- | ---------------------------- |
|
|
654
|
+
| executed | frame | silent | one-liner | frame |
|
|
655
|
+
| restored-local/-remote | frame | silent | silent | frame, or one-liner if quiet |
|
|
656
|
+
| up-to-date | frame | silent | silent | frame, or one-liner if quiet |
|
|
657
|
+
| failed | frame | one-liner + frame replays | one-liner + frame replays | frame |
|
|
658
|
+
| skipped | one-liner | one-liner | one-liner | one-liner |
|
|
659
|
+
|
|
660
|
+
What the shapes mean in each column:
|
|
661
|
+
|
|
662
|
+
- **focused, requested task.** The frame is LIVE when it is the only
|
|
663
|
+
requested task: `┌─` prints at task start, the command's output (or a
|
|
664
|
+
hit's replayed stdout) streams raw between the brackets, `└─` closes
|
|
665
|
+
it. With several requested tasks the same frame is buffered and
|
|
666
|
+
emitted atomically (see below). Every outcome that ran or was cached
|
|
667
|
+
gets one — including an `up-to-date` hit, whose frame carries the
|
|
668
|
+
`$ cmd` line so a requested task looks the same whether it ran or not.
|
|
669
|
+
- **skipped** is the exception: it never started, so no frame was opened,
|
|
670
|
+
and it produced nothing a frame could hold. The one-liner says
|
|
671
|
+
everything, the blocker included (`⊘ skipped app#deploy • blocked by
|
|
672
|
+
lib#build`; a fail-fast skip, which nothing blocked, carries no
|
|
673
|
+
suffix). Every view that lists tasks prints it, a dependency's
|
|
674
|
+
included: nothing prints below the footer. `--report` reads the same fact into the status cell,
|
|
675
|
+
`skipped (blocked by lib#build)`.
|
|
676
|
+
- **`frame, or one-liner if quiet`** — a cache hit with stored stdout is
|
|
677
|
+
worth a frame (the output is the point); a hit with nothing to replay
|
|
678
|
+
compresses to one line, which is what keeps a 2000-task warm run
|
|
679
|
+
readable.
|
|
680
|
+
- **`one-liner + frame replays`** — the `◼ … failed` line prints
|
|
681
|
+
immediately; the full frame is held and replayed at run end.
|
|
682
|
+
|
|
683
|
+
When a dependency fails mid-run, the stream gets ONE permanent
|
|
684
|
+
`◼ … failed miss <id>` line and the run continues; **all full failure
|
|
685
|
+
frames replay together at run end**, right above the summary, and are
|
|
686
|
+
never capped.
|
|
687
|
+
|
|
688
|
+
The end-of-run summary always prints; cache-hit counts that broad
|
|
689
|
+
mode silences per-task surface there. A focused `vx run test` is meant
|
|
690
|
+
to feel like running the test command directly — same output, just
|
|
691
|
+
faster.
|
|
692
|
+
|
|
693
|
+
**Groups are transparent folders.** A group task (no `exec`, just
|
|
694
|
+
`dependsOn`) has no output of its own, so running one focused —
|
|
695
|
+
`vx run build` where `build` chains `build.bun` which chains
|
|
696
|
+
`build.bun.darwin-arm64` … — surfaces the **real tasks** it stands for
|
|
697
|
+
and shows them like requested tasks. The walk descends through nested
|
|
698
|
+
groups but never leaves the requested project (`^`/cross-project deps
|
|
699
|
+
aren't surfaced) and never goes past a real task into its own deps.
|
|
700
|
+
The requested count for the live-vs-buffered decision counts the
|
|
701
|
+
surfaced tasks: one real task streams live, several buffer into atomic
|
|
702
|
+
blocks. (Surfacing is display-only — it does not make those tasks
|
|
703
|
+
"requested", so `--` `forwardArgs` still go only to what you named.)
|
|
704
|
+
|
|
705
|
+
Live streaming applies only when there is exactly **one** requested
|
|
706
|
+
task. Live open/close framing assumes a single task owns the terminal
|
|
707
|
+
between its open (`┌─`) and close (`└─`) lines — with two requested
|
|
708
|
+
tasks running concurrently their frames would interleave into garbage.
|
|
709
|
+
So when more than one task is requested (`vx run build test`), each
|
|
710
|
+
requested task instead **buffers** its output and renders as a single
|
|
711
|
+
atomic block at completion. The shapes are the ones in the table above —
|
|
712
|
+
anything that ran or was cached gets a full frame, `up-to-date`
|
|
713
|
+
included; only `skipped` is a one-liner. The blocks are blank-line
|
|
714
|
+
separated and never interleave. A single `vx run test` keeps the
|
|
715
|
+
live-stream experience unchanged.
|
|
716
|
+
|
|
717
|
+
On an interactive terminal (TTY stdout, not CI) a status region
|
|
718
|
+
tracks the run live. Top to bottom:
|
|
719
|
+
|
|
720
|
+
1. **A blank separator line** — keeps the live region visually apart
|
|
721
|
+
from the completed-task scrollback above it.
|
|
722
|
+
2. **Pinned persistent tasks** — `▸ <id> running` for every persistent
|
|
723
|
+
task that became ready. The pin lives until run end, so it is the
|
|
724
|
+
visible evidence the dev server is still alive. After the summary,
|
|
725
|
+
a requested persistent task keeps vx in the foreground, with the
|
|
726
|
+
persistent tasks it depends on, until it — or, with several, the
|
|
727
|
+
first of them — exits (one kept only as a dependency that exits 0,
|
|
728
|
+
a daemon that forked and returned, does not end it); the rest still up are then torn
|
|
729
|
+
down (SIGTERM, `VX_KILL_GRACE_MS`, SIGKILL), one status line names
|
|
730
|
+
the task and its code (`vx: app#dev exited with code 1; stopping 1
|
|
731
|
+
other persistent task`), and a non-zero exit makes the run exit 1
|
|
732
|
+
and is what `vx last` records.
|
|
733
|
+
A Ctrl-C prints no such line: the server ended because it was
|
|
734
|
+
stopped, and vx exits 130. A run with a failure elsewhere (a task
|
|
735
|
+
failed or skipped, a server never ready or crashed) holds nothing: it
|
|
736
|
+
stops its servers and exits 1, unless `--continue=always`; `vx watch`
|
|
737
|
+
keeps its server through a failed cycle. While vx holds them, what
|
|
738
|
+
the servers write streams below the summary a line at a time under
|
|
739
|
+
each one's id (`app#dev │ Local: http://localhost:5173`), except
|
|
740
|
+
under `--output-logs errors-only`, `hash-only` or `none`; a single
|
|
741
|
+
requested server in the focused flow streams raw from its frame.
|
|
742
|
+
3. **Worker rows** — one per worker slot (sized
|
|
743
|
+
`min(concurrency, 10)`), no glyph and no spinner: the live ticking
|
|
744
|
+
elapsed time leads (` 568ms running <id>`). A task stays in
|
|
745
|
+
its row for its whole life; idle rows hold their place dimmed, so
|
|
746
|
+
nothing ever jumps; overflow shows as `+k more`. A second in, a row
|
|
747
|
+
says what waits on it: `critical path` (yellow) on the running task
|
|
748
|
+
the longest unfinished chain waits on, by the same p50s as the
|
|
749
|
+
forecast below and only while two or more run, and a dim
|
|
750
|
+
`blocks N`, its unfinished dependents direct and transitive.
|
|
751
|
+
4. **The live summary section** — the SAME meters the final footer
|
|
752
|
+
prints (`tasks` + `cache` bars with legends, `time`), filling in as
|
|
753
|
+
the run progresses, under a bare `vx` wordmark rule. A second in,
|
|
754
|
+
the `time` row adds what is left (`time 1.41s · ~3s left`): each
|
|
755
|
+
unfinished task's executed p50 from local history, the longer of
|
|
756
|
+
the longest unfinished chain and that work spread over the
|
|
757
|
+
workers, a running task's spent time taken off its own. It says
|
|
758
|
+
nothing when history knows none of what is left, or once a running
|
|
759
|
+
task is 25% past its p50. A run that ends inside the second never
|
|
760
|
+
reads history for it, and the final summary never shows it.
|
|
761
|
+
|
|
762
|
+
In a terminal known to read them, the region also sends zero-width
|
|
763
|
+
escapes: tab or taskbar progress (OSC 9;4: Ghostty, iTerm2 3.6+,
|
|
764
|
+
Windows Terminal, ConEmu), filling by the forecast or else by tasks
|
|
765
|
+
done, red once a task fails, and cleared when the region goes; and a
|
|
766
|
+
run of 10 s or more ends with a desktop notification (OSC 9: Ghostty,
|
|
767
|
+
iTerm2, WezTerm), `vx: 12 tasks done` or `vx: 1 of 12 tasks failed`.
|
|
768
|
+
The terminal is named by `TERM_PROGRAM` (or `WT_SESSION`,
|
|
769
|
+
`ConEmuPID`); any other, tmux included, gets neither, since there
|
|
770
|
+
OSC 9 may itself be a notification.
|
|
771
|
+
|
|
772
|
+
In a terminal known to open OSC 8 links (Ghostty, iTerm2 3.1+, WezTerm,
|
|
773
|
+
VS Code, Windows Terminal, kitty, Konsole, VTE terminals; never inside
|
|
774
|
+
tmux or screen), a failed task's frame links each path that names a
|
|
775
|
+
file in the task's project, `src/a.ts:12:5` or `src/a.ts(12,5)`, to
|
|
776
|
+
that file, so a click from the workspace root opens the right one. The
|
|
777
|
+
text is the task's output unchanged; a successful task's frame is never
|
|
778
|
+
linked.
|
|
779
|
+
|
|
780
|
+
The region is redrawn in place (cursor-up + clear; not a TUI — no
|
|
781
|
+
alternate screen) and erased before the final summary prints. In the
|
|
782
|
+
focused flow it only lives while dependencies run; it disappears for
|
|
783
|
+
good the moment the requested task starts streaming.
|
|
784
|
+
|
|
785
|
+
Redraw cost is bounded: task events force a redraw, but forced
|
|
786
|
+
redraws within 30 ms of the last draw coalesce into a single
|
|
787
|
+
trailing draw when the floor expires (the final state always lands).
|
|
788
|
+
On a 3,270-task warm run this cuts ~6.7 MB of redraw ANSI to ~20 KB.
|
|
789
|
+
|
|
790
|
+
Identity coloring: every `project#task` renders its project half in
|
|
791
|
+
a stable hue hashed from the project name (same project = same color
|
|
792
|
+
in every run and every surface) and its task half in a fixed pink —
|
|
793
|
+
both deliberately outside the status palette, so an id can never
|
|
794
|
+
read as an outcome.
|
|
795
|
+
|
|
796
|
+
On GitHub Actions (`GITHUB_ACTIONS` truthy, full output mode), each
|
|
797
|
+
task's block is wrapped in `::group::<id> (<outcome> <duration>)` /
|
|
798
|
+
`::endgroup::` so it collapses in the log viewer. Failed tasks stay
|
|
799
|
+
pre-expanded and emit an `::error title=<id>::failed (exit N)`
|
|
800
|
+
annotation instead (above 128 the label names the signal:
|
|
801
|
+
`failed (exit 137, 128 + SIGKILL)`, a timeout its reason,
|
|
802
|
+
`failed (timed out, exit 143)`, a persistent task that never became
|
|
803
|
+
ready its reason, and a sandboxed task its violation count, as every
|
|
804
|
+
surface labels a failure). In every output mode there, a task's own
|
|
805
|
+
text (a frame, a server's output since ready) is fenced in
|
|
806
|
+
`::stop-commands::`, so a line it prints never becomes a workflow
|
|
807
|
+
command.
|
|
808
|
+
|
|
809
|
+
### `--output-logs <mode>`
|
|
810
|
+
|
|
811
|
+
Explicit override; always beats the flow and CI defaults. `full`
|
|
812
|
+
(frames for executed work, one-liners for quiet cache hits),
|
|
813
|
+
`errors-only` (only failed tasks print, a server that died on its
|
|
814
|
+
own after ready included, with what it wrote since; the CI noise
|
|
815
|
+
budget),
|
|
816
|
+
`hash-only` (one line per task — outcome word, task id, cache key — and
|
|
817
|
+
no log output at all; the run's audit trail of which key each task
|
|
818
|
+
resolved to, Turbo parity), `none` (no per-task output). The
|
|
819
|
+
end-of-run summary always prints.
|
|
820
|
+
|
|
821
|
+
### Failure propagation — `--continue`
|
|
822
|
+
|
|
823
|
+
`--continue[=never|deps-ok|always]` controls what a failed task takes
|
|
824
|
+
down with it:
|
|
825
|
+
|
|
826
|
+
- **`deps-ok`** (default): the failure's transitive dependents are
|
|
827
|
+
skipped; independent siblings keep running. A server that dies after
|
|
828
|
+
it became ready is a failure to its dependents not yet started,
|
|
829
|
+
including those that reach it through a group.
|
|
830
|
+
- **`never`**: fail fast — the first failure stops dispatch. In-flight
|
|
831
|
+
tasks finish their attempt and start no retry; everything not yet started (cache restores
|
|
832
|
+
included) completes as skipped. A server that dies after it became
|
|
833
|
+
ready stops dispatch the same way.
|
|
834
|
+
- **`always`** (bare `--continue`): dependents run even when an
|
|
835
|
+
upstream failed — to surface every failure in one pass. A task
|
|
836
|
+
downstream of a failure (directly, or through successes built on it)
|
|
837
|
+
runs and cleans its outputs as usual but is **never saved**: under
|
|
838
|
+
pure-input hashing its key is the one a healthy run derives, while its
|
|
839
|
+
bytes were built on a partial tree, so caching it would hand the next
|
|
840
|
+
clean run a stale hit. A server that died after it became ready is
|
|
841
|
+
such a failure to what starts after its death. A cache hit still
|
|
842
|
+
restores (that artifact came from a healthy run), and the next run
|
|
843
|
+
without the failure rebuilds the rest.
|
|
844
|
+
|
|
845
|
+
The mode is the local scheduler's: a task a plugin executor runs
|
|
846
|
+
elsewhere is one dispatch, failed or not, like any other.
|
|
847
|
+
|
|
848
|
+
### `--download <mode>`
|
|
849
|
+
|
|
850
|
+
Where a **remotely-executed** task's outputs land. `all` (default)
|
|
851
|
+
downloads every task's outputs to this machine as it completes —
|
|
852
|
+
today's behaviour, byte for byte. `toplevel` brings home only the tasks
|
|
853
|
+
you actually asked for — including the real tasks behind a requested
|
|
854
|
+
group — and leaves intermediates remote. `none` leaves
|
|
855
|
+
them in the remote CAS
|
|
856
|
+
and fetches them **lazily**: only when a locally-placed task in the
|
|
857
|
+
same run actually needs them (Bazel calls this "build without the
|
|
858
|
+
bytes"). A CI job that only wants the verdict moves no output bytes at
|
|
859
|
+
all.
|
|
860
|
+
|
|
861
|
+
Locally-executed tasks always write in place and ignore the flag, and
|
|
862
|
+
`exec.remote: 'only'` still means never — `--download` cannot override
|
|
863
|
+
it in either direction. **It never affects a cache key**: transfer
|
|
864
|
+
tuning cannot change what a command produces.
|
|
865
|
+
|
|
866
|
+
One safety gate: a task whose outputs another task's `cache.inputs`
|
|
867
|
+
globs could read on disk is silently kept eager, because deferring it
|
|
868
|
+
would make that key depend on whether the bytes arrived. A task with no
|
|
869
|
+
`cache` that a cached task depends on counts as reading its whole
|
|
870
|
+
project (C-16). `--dry` reports
|
|
871
|
+
how many tasks would keep their outputs remote and names each downgrade,
|
|
872
|
+
so a run that defers nothing says why. A run in which any task declares a
|
|
873
|
+
`cache.inputs.runtime` / `workspaceRuntime` command defers **nothing**:
|
|
874
|
+
a shell command's reads cannot be bounded, so vx cannot prove it will
|
|
875
|
+
not read a deferred output (the same reason vx refuses to infer inputs
|
|
876
|
+
by tracing). When bytes are fetched later, vx saves an ordinary
|
|
877
|
+
cache entry for them, so the next run is a plain local hit.
|
|
878
|
+
|
|
879
|
+
## Planning mode (`--dry`, `--graph`)
|
|
880
|
+
|
|
881
|
+
Both flags short-circuit execution. They build the full task graph,
|
|
882
|
+
compute every task's cache key, and probe the cache to predict the
|
|
883
|
+
hit/miss outcome. Against a remote cache the probe is a lightweight
|
|
884
|
+
existence check — planning never downloads or ingests artifacts.
|
|
885
|
+
|
|
886
|
+
```
|
|
887
|
+
$ vx run ci --dry
|
|
888
|
+
would run:
|
|
889
|
+
◉ @vzn/vx#format-check cache hit (local) 02bfe8a9
|
|
890
|
+
◉ @vzn/vx#lint cache hit (local) d66cfed2
|
|
891
|
+
▶ @vzn/vx#test cache miss — would exec 68595e49 ~72.64s
|
|
892
|
+
|
|
893
|
+
3 task(s) planned, 2 cache hits (2 local), 1 would run.
|
|
894
|
+
predicted: ~72.64s wall · ~72.64s total execution
|
|
895
|
+
```
|
|
896
|
+
|
|
897
|
+
**Time prediction.** A would-run task with recorded history shows its
|
|
898
|
+
typical executed duration (`~p50` over its recent non-hit runs in the
|
|
899
|
+
local `cache.db`). The footer predicts the run: `wall` is the longest dependency
|
|
900
|
+
chain of would-run cost (cache hits restore near-instantly and count
|
|
901
|
+
as 0), `total execution` is the sum across would-run tasks. Tasks with
|
|
902
|
+
no history count as 0 and are called out (`N tasks without history
|
|
903
|
+
(+?)`) — the totals are honest lower bounds. The footer is omitted
|
|
904
|
+
when nothing would run or when no would-run task has history.
|
|
905
|
+
|
|
906
|
+
**Placement.** When the workspace's plugins supply more than one
|
|
907
|
+
executor, each row carries the one the task would land on (`@spy-remote`;
|
|
908
|
+
`@local` for the floor; `@noop` for an `exec.remote: 'only'` task no
|
|
909
|
+
remote accepts, which the run would skip rather than run here) and the
|
|
910
|
+
JSON object carries it as `executor`. With one executor there is
|
|
911
|
+
nothing to choose and the column is absent, except `@noop`, which a
|
|
912
|
+
remote-only task carries whatever the count; it costs nothing in the
|
|
913
|
+
prediction. If an executor hook throws
|
|
914
|
+
or returns something that is not an executor, the plan still prints —
|
|
915
|
+
`--dry` never fails over a label — but says so on the status line, in
|
|
916
|
+
the plugin's name: `[vx] placement not shown — plugin 'x' … (the run
|
|
917
|
+
would refuse on it)`.
|
|
918
|
+
|
|
919
|
+
Status legend:
|
|
920
|
+
|
|
921
|
+
| Symbol | Meaning |
|
|
922
|
+
| ------ | ------------------------------------------------------------------------------------------ |
|
|
923
|
+
| `◉` | cache hit (local) — entry already in `<cacheDir>/` |
|
|
924
|
+
| `↓` | cache hit (remote) — entry would be fetched from the layer |
|
|
925
|
+
| `▶` | cache miss — task would execute (under `--force` too: nothing is read, what runs is saved) |
|
|
926
|
+
| `·` | no-cache — task opts out (no `cache` block, or `--no-cache`) |
|
|
927
|
+
| `∅` | `@noop` — task would not run anywhere |
|
|
928
|
+
| `−` | not started — a server you did not request whose every dependant restores a local hit |
|
|
929
|
+
| `○` | group task (suppressed in human view; in DOT + JSON) |
|
|
930
|
+
|
|
931
|
+
`--dry=json` emits the same data as a structured object, alone on stdout
|
|
932
|
+
(a stage's warnings go to stderr); `schemas/plan.json` is its JSON
|
|
933
|
+
Schema, held like the read verbs' (see Machine-readable output):
|
|
934
|
+
|
|
935
|
+
```json
|
|
936
|
+
{
|
|
937
|
+
"tasks": [
|
|
938
|
+
{
|
|
939
|
+
"id": "@vzn/vx#lint",
|
|
940
|
+
"project": "@vzn/vx",
|
|
941
|
+
"task": "lint",
|
|
942
|
+
"description": "oxlint with tsgolint-backed type-aware checks",
|
|
943
|
+
"hash": "d66cfed2...",
|
|
944
|
+
"cacheStatus": "hit-local",
|
|
945
|
+
"deps": [],
|
|
946
|
+
"p50Ms": 72640
|
|
947
|
+
}
|
|
948
|
+
],
|
|
949
|
+
"predicted": { "wallMs": 0, "workMs": 0, "unknownCount": 0, "criticalPath": [] }
|
|
950
|
+
}
|
|
951
|
+
```
|
|
952
|
+
|
|
953
|
+
Every task with history carries `p50Ms`, hits included (only the text
|
|
954
|
+
view's `~p50` is limited to tasks that would run); `predicted` counts
|
|
955
|
+
would-run tasks only and is present whenever local history was
|
|
956
|
+
readable. Its `criticalPath` names the would-run tasks with history on
|
|
957
|
+
the chain `wallMs` measures, dependencies first: the tasks to speed up
|
|
958
|
+
to shorten the run.
|
|
959
|
+
|
|
960
|
+
**Why a task is affected.** Under `--affected`, each requested task the
|
|
961
|
+
diff kept gets a line, and its JSON object an `affected` reason:
|
|
962
|
+
|
|
963
|
+
```
|
|
964
|
+
$ vx run build lint --affected=main --dry
|
|
965
|
+
▶ app#build cache miss — would exec …
|
|
966
|
+
affected: packages/lib/src/a.ts changed (an input), via lib#build
|
|
967
|
+
· lib#lint no-cache …
|
|
968
|
+
affected: packages/lib/src/a.ts changed (in its project)
|
|
969
|
+
```
|
|
970
|
+
|
|
971
|
+
`kind` is `input` (a changed `file` is a declared input), `project` (its
|
|
972
|
+
project changed and the task reads it whole: an uncached task, or no
|
|
973
|
+
single `file` for a lockfile claim, a manifest edge or a config import),
|
|
974
|
+
`package` (a `^` edge passes a changed `project` with no such task),
|
|
975
|
+
`named` (`pkg#task` beside a bare task) or `selected` (another filter
|
|
976
|
+
selected its project). `via` is the `dependsOn` chain, nearest first, to
|
|
977
|
+
the task the change reached. A dependency the kept tasks pull in carries
|
|
978
|
+
none. The reasons are gathered only for a plan; a run pays nothing.
|
|
979
|
+
|
|
980
|
+
`--graph` prints Graphviz DOT (stdout by default; `--graph=path`
|
|
981
|
+
writes a file):
|
|
982
|
+
|
|
983
|
+
```
|
|
984
|
+
vx run ci --graph | dot -Tsvg > graph.svg
|
|
985
|
+
vx run ci --graph=graph.dot
|
|
986
|
+
```
|
|
987
|
+
|
|
988
|
+
Node `fillcolor` varies by predicted status (green = local hit,
|
|
989
|
+
sky-blue = remote hit, orange = miss, gray = no-cache, fuchsia =
|
|
990
|
+
group, white = not started). Edges are unstyled.
|
|
991
|
+
|
|
992
|
+
## Run artifacts (`--summarize`, `--profile`)
|
|
993
|
+
|
|
994
|
+
Both flags add a side-effect after a real run completes. Errors
|
|
995
|
+
writing the artifact are surfaced via `vx: failed to write …` but
|
|
996
|
+
don't change the run's exit code — the run already happened.
|
|
997
|
+
|
|
998
|
+
### `--summarize[=<path>]`
|
|
999
|
+
|
|
1000
|
+
Writes a per-run JSON file; `schemas/summary.json` is its JSON Schema:
|
|
1001
|
+
|
|
1002
|
+
```json
|
|
1003
|
+
{
|
|
1004
|
+
"runId": "01a0e3ef-206c-708d-95bf-c2b07211adf6",
|
|
1005
|
+
"ok": true,
|
|
1006
|
+
"exitCode": 0,
|
|
1007
|
+
"startedAt": "2026-09-27T17:34:54.572Z",
|
|
1008
|
+
"endedAt": "2026-09-27T17:34:54.586Z",
|
|
1009
|
+
"totalMs": 14.123643,
|
|
1010
|
+
"savedMs": 9,
|
|
1011
|
+
"tasks": [
|
|
1012
|
+
{
|
|
1013
|
+
"id": "a#build",
|
|
1014
|
+
"project": "a",
|
|
1015
|
+
"task": "build",
|
|
1016
|
+
"status": "cache-hit",
|
|
1017
|
+
"exitCode": 0,
|
|
1018
|
+
"durationMs": 3,
|
|
1019
|
+
"hash": "48007ccadd42ed7d",
|
|
1020
|
+
"storedDurationMs": 9,
|
|
1021
|
+
"storedCpuMs": 2.059,
|
|
1022
|
+
"wallclockStartNs": "9456491",
|
|
1023
|
+
"wallclockEndNs": "12902888"
|
|
1024
|
+
}
|
|
1025
|
+
],
|
|
1026
|
+
"aborted": [],
|
|
1027
|
+
"summary": {
|
|
1028
|
+
"successful": 1,
|
|
1029
|
+
"failed": 0,
|
|
1030
|
+
"skipped": 0,
|
|
1031
|
+
"cachedLocal": 1,
|
|
1032
|
+
"restoredLocal": 0,
|
|
1033
|
+
"restoredRemote": 0,
|
|
1034
|
+
"upToDate": 1,
|
|
1035
|
+
"cachedRemote": 0,
|
|
1036
|
+
"aborted": 0,
|
|
1037
|
+
"total": 1
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
```
|
|
1041
|
+
|
|
1042
|
+
`runId` is a UUIDv7. Default path: `<cacheDir>/runs/<run_id>.json`. hrtime fields are
|
|
1043
|
+
strings (bigints serialized as strings) to preserve ns precision
|
|
1044
|
+
through JSON. `cpuMs` / `peakRssBytes` are what the task's own
|
|
1045
|
+
execution used and appear on executed rows only (`peakRssBytes` only
|
|
1046
|
+
when the task's peak rose above vx's own footprint — a lighter task's
|
|
1047
|
+
figure would be vx's, handed back by the kernel; a Linux sandboxed task
|
|
1048
|
+
reports neither, since what bwrap's pid namespace used never reaches vx);
|
|
1049
|
+
`restored` appears on a hit only: `true` when its outputs were restored,
|
|
1050
|
+
`false` when they were already up to date. A hit's `durationMs`
|
|
1051
|
+
is the restore it cost, and what the PRODUCING execution used rides the
|
|
1052
|
+
artifact and appears under its own keys, `storedDurationMs` /
|
|
1053
|
+
`storedCpuMs` / `storedPeakRssBytes` (the work the hit skipped) — a
|
|
1054
|
+
remote worker's peak is never presented as this run's. `savedMs` is
|
|
1055
|
+
their sum over the hits, the footer's `saved` as a number. `admissionHeldMs` appears on a row
|
|
1056
|
+
only when an `admit` policy (a plugin's — `@vzn/vx-schedule-history`
|
|
1057
|
+
packs learned reservations) refused the task while a worker was free:
|
|
1058
|
+
the wait from that first refusal to its dispatch, the plugin's hand on
|
|
1059
|
+
the run. The footer's `info` row sums the waits, task-seconds:
|
|
1060
|
+
`admit held 3 tasks, 4.2s in all` (85 held tasks can read 4783s beside
|
|
1061
|
+
a 160 s run).
|
|
1062
|
+
|
|
1063
|
+
**`ok` / `exitCode`** are the run's verdict — the same value the CLI
|
|
1064
|
+
exits with: a stopping signal's code (130 for Ctrl-C), and with a kept
|
|
1065
|
+
server, its exit (the file is written again when the server ends). Gate on these rather than re-deriving a pass from the
|
|
1066
|
+
buckets: a run can be red without a single failed task (see `aborted`).
|
|
1067
|
+
|
|
1068
|
+
**`tasks[]` and `summary` describe the same population**, so
|
|
1069
|
+
`tasks.length === summary.total` always holds. Group tasks (no `exec`)
|
|
1070
|
+
are in neither — they do no work.
|
|
1071
|
+
|
|
1072
|
+
**`aborted[]`** lists tasks whose attempt ended while the run was
|
|
1073
|
+
stopping (Ctrl-C, a signal to vx), with their exit code, and tasks the stop reached before they started, with
|
|
1074
|
+
exit 1, `durationMs: 0` and no `wallclockStartNs`. Neither joins an
|
|
1075
|
+
outcome bucket or `total`, but they make the run red, so they are
|
|
1076
|
+
listed separately and counted as `summary.aborted`.
|
|
1077
|
+
|
|
1078
|
+
**`noCache: true`** marks a task no cache answered for: it declares no
|
|
1079
|
+
`cache` block (it executes every run by design), or the run's `--cache`
|
|
1080
|
+
read and wrote nothing (`--no-cache`), so a hit rate should leave it out
|
|
1081
|
+
of the denominator. The key is present only when true; every other row is
|
|
1082
|
+
unchanged. Its `hash` is still set: dependents fold it.
|
|
1083
|
+
|
|
1084
|
+
**`notReady`** is present only on a failed persistent task: why it never
|
|
1085
|
+
became ready — `timeout` (the readiness deadline fired; `exitCode` is
|
|
1086
|
+
the kill's, 143 or 137 after the grace, and 143 for a server that
|
|
1087
|
+
traps the TERM and exits 0, as an ordinary timeout's),
|
|
1088
|
+
`exited` (the child exited first; `exitCode` is then its own) or `spawn`
|
|
1089
|
+
(the spawn itself failed). Every label reads it, `failed (never ready:
|
|
1090
|
+
timed out, exit 143)`. A server the run's stop (a Ctrl-C) killed while it started is
|
|
1091
|
+
`aborted`, not failed, as any task the stop kills; so is one that
|
|
1092
|
+
became ready only after the stop.
|
|
1093
|
+
|
|
1094
|
+
**`sandboxViolations`** is present only on a sandboxed task with a
|
|
1095
|
+
SANDBOX VIOLATIONS section — the count of its denials (vx's own notes
|
|
1096
|
+
there count none), and the reason the task failed (its exit is forced to 1
|
|
1097
|
+
when it was 0); every label counts it, `failed (exit 1, 2 sandbox
|
|
1098
|
+
violations)`.
|
|
1099
|
+
|
|
1100
|
+
**`timedOut: true`** is present only on a `failed` row vx's own
|
|
1101
|
+
`timeout` killed: its exit is the shell's 143, and every label reads
|
|
1102
|
+
`failed (timed out, exit 143)` rather than a signal.
|
|
1103
|
+
|
|
1104
|
+
**`blockedBy`** is present only on a `skipped` row: the id of the failed
|
|
1105
|
+
(or aborted) task at the root of what blocked it, through any chain of
|
|
1106
|
+
skips between — what the skipped row prints, for a script.
|
|
1107
|
+
A fail-fast skip has none.
|
|
1108
|
+
|
|
1109
|
+
**`flaky: { passes, failures, attempts }`** is present only on a task
|
|
1110
|
+
this run proved flaky (its row's `flaky` note, typed): `passes` and
|
|
1111
|
+
`failures` count the outcomes on record for this exact `hash`, this run
|
|
1112
|
+
included, and `attempts` is what this run took. A consumer gating on
|
|
1113
|
+
`status: "failed"` can tell a break (no `flaky` key) from a flake
|
|
1114
|
+
without reading the history. Every other row is byte-identical.
|
|
1115
|
+
|
|
1116
|
+
**`durationMs` is always what THIS run spent on the task.** For a cache
|
|
1117
|
+
hit that is the probe + restore, not the exec time the entry was stored
|
|
1118
|
+
with — so it is small even for an expensive task. The work a hit
|
|
1119
|
+
_skipped_ is a different number; `--report`'s "N saved" is the surface
|
|
1120
|
+
that reports it.
|
|
1121
|
+
|
|
1122
|
+
### `--profile[=<path>]`
|
|
1123
|
+
|
|
1124
|
+
Writes a Chrome-trace JSON of every task's wallclock span. Open in
|
|
1125
|
+
`chrome://tracing` or https://ui.perfetto.dev.
|
|
1126
|
+
|
|
1127
|
+
```json
|
|
1128
|
+
{
|
|
1129
|
+
"traceEvents": [
|
|
1130
|
+
{
|
|
1131
|
+
"name": "@vzn/vx#lint",
|
|
1132
|
+
"cat": "success",
|
|
1133
|
+
"ph": "X",
|
|
1134
|
+
"ts": 12345,
|
|
1135
|
+
"dur": 4321,
|
|
1136
|
+
"pid": 1,
|
|
1137
|
+
"tid": 1,
|
|
1138
|
+
"args": {
|
|
1139
|
+
"exitCode": 0,
|
|
1140
|
+
"hash": "...",
|
|
1141
|
+
"cpuMs": 123,
|
|
1142
|
+
"peakRssBytes": 45678
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
]
|
|
1146
|
+
}
|
|
1147
|
+
```
|
|
1148
|
+
|
|
1149
|
+
Each project gets a distinct `tid` so concurrent tasks across packages
|
|
1150
|
+
render on separate lanes. `ts` and `dur` are microseconds derived
|
|
1151
|
+
from the per-task `hrtime.bigint()` spans the runner captures.
|
|
1152
|
+
`cat` carries the task's final status (`success`, `cache-hit`,
|
|
1153
|
+
`cache-hit-remote`, `failed`).
|
|
1154
|
+
|
|
1155
|
+
Default path: `profile.json` (cwd-relative).
|
|
1156
|
+
|
|
1157
|
+
### `--report[=markdown]`
|
|
1158
|
+
|
|
1159
|
+
At the end of a real run, prints a markdown run report to **stdout**,
|
|
1160
|
+
just above the footer: nothing prints below the footer. The report
|
|
1161
|
+
itself is machine-clean. One header line of
|
|
1162
|
+
totals plus a table, one row per task:
|
|
1163
|
+
|
|
1164
|
+
```markdown
|
|
1165
|
+
## vx run — passed
|
|
1166
|
+
|
|
1167
|
+
**3 tasks** · 3 success · 0 failed · 2 cached (1 up-to-date, 1 restored) · 1.23s total · 2.65s saved
|
|
1168
|
+
|
|
1169
|
+
| Task | Status | Cache | Duration |
|
|
1170
|
+
| --------- | ------- | ---------- | -------- |
|
|
1171
|
+
| web#build | success | miss | 1.23s |
|
|
1172
|
+
| web#test | success | local | 5ms |
|
|
1173
|
+
| api#test | success | up-to-date | 3ms |
|
|
1174
|
+
```
|
|
1175
|
+
|
|
1176
|
+
`Status` is the task outcome (`success` / `failed (exit N)`, with the
|
|
1177
|
+
signal an exit above 128 stands for, `failed (exit 137, 128 + SIGKILL)`,
|
|
1178
|
+
or a timeout's reason, `failed (timed out, exit 143)`, a persistent
|
|
1179
|
+
task's `never ready: …`, or a sandboxed task's violation count, or
|
|
1180
|
+
`skipped`, naming what blocked it: `skipped (blocked by lib#build)`);
|
|
1181
|
+
`Cache` is its provenance (`miss` / `no-cache` for a task no cache
|
|
1182
|
+
answered for — no `cache` block, or a `--no-cache` / `--cache=local:` run —
|
|
1183
|
+
which never consulted one / `local` / `remote` / `up-to-date` /
|
|
1184
|
+
`—`). A stopped run (a Ctrl-C teardown) reads `## vx run — interrupted`,
|
|
1185
|
+
and its tasks keep the terminal's words: one the signal killed is
|
|
1186
|
+
`aborted` with its time so far, one the stop reached before it ran is
|
|
1187
|
+
`not run` with no time. Neither joins the counts; the header names them
|
|
1188
|
+
after the total, `not counted: 1 aborted, 1 not run`, so a red report
|
|
1189
|
+
with no failing row still says why. Group tasks (no `exec`) get neither — they are not
|
|
1190
|
+
work, and the header's counts match the terminal summary and
|
|
1191
|
+
`--summarize` exactly.
|
|
1192
|
+
|
|
1193
|
+
The two durations in the header mean different things, and the
|
|
1194
|
+
distinction is the point:
|
|
1195
|
+
|
|
1196
|
+
- **`N total`** sums `Duration` over the tasks that actually EXECUTED,
|
|
1197
|
+
an aborted task's time so far included — the time this run spent.
|
|
1198
|
+
- **`N saved`** sums the exec times the cache hits SKIPPED, read from
|
|
1199
|
+
each entry as it was stored (above, 2.01s and 640ms). It is
|
|
1200
|
+
deliberately not the hits' `Duration` column, which is the restore
|
|
1201
|
+
they cost this run: summing that reported a task taking 2.01s cold
|
|
1202
|
+
as "6ms saved".
|
|
1203
|
+
|
|
1204
|
+
Only `markdown` is supported today (`json` is reserved; a bad value is a
|
|
1205
|
+
parse error). Built purely from the run's outcomes after it returns — it
|
|
1206
|
+
adds zero cost when both flags are absent.
|
|
1207
|
+
|
|
1208
|
+
### `--report-file <path>`
|
|
1209
|
+
|
|
1210
|
+
Writes the same markdown report to a file instead of (or as well as)
|
|
1211
|
+
stdout, and is the form to use for a CI step summary:
|
|
1212
|
+
|
|
1213
|
+
```sh
|
|
1214
|
+
vx run ci --report-file="$GITHUB_STEP_SUMMARY"
|
|
1215
|
+
```
|
|
1216
|
+
|
|
1217
|
+
**Do not redirect stdout for this.** The report itself is machine-clean,
|
|
1218
|
+
but stdout is not vx's alone — the status logger writes frames, meter
|
|
1219
|
+
bars and `::group::` workflow commands to the same stream, so
|
|
1220
|
+
`--report=markdown >> "$GITHUB_STEP_SUMMARY"` puts the entire run log
|
|
1221
|
+
into the step summary above the table.
|
|
1222
|
+
|
|
1223
|
+
The report is **appended**, never truncated: `$GITHUB_STEP_SUMMARY` is a
|
|
1224
|
+
shared, append-only file that other steps in the same job also write to,
|
|
1225
|
+
so overwriting it would silently discard their content. Passing both
|
|
1226
|
+
flags writes the report to stdout AND appends it to the file. A run
|
|
1227
|
+
stopped by Ctrl-C or SIGTERM still writes both, its stopped tasks
|
|
1228
|
+
`aborted`. A write
|
|
1229
|
+
failure is reported (`vx: failed to write report to …`) but does not
|
|
1230
|
+
change the exit code — the run already happened, the same contract
|
|
1231
|
+
`--summarize` and `--profile` follow.
|
|
1232
|
+
|
|
1233
|
+
### `--tag <k=v>`
|
|
1234
|
+
|
|
1235
|
+
Labels the invocation. Repeatable; `--tag=k=v` form too. The pair is
|
|
1236
|
+
split on the **first** `=`, so values may contain `=` (e.g. a URL). An
|
|
1237
|
+
empty key is a parse error. Tags are recorded on the run's
|
|
1238
|
+
`invocations` row so dashboards can filter runs by label, and reach
|
|
1239
|
+
telemetry as `vx.tag.<key>`; a secret value in one is masked there as
|
|
1240
|
+
in the task's output (see [Masking](./schema.md)).
|
|
1241
|
+
|
|
1242
|
+
## Sandbox
|
|
1243
|
+
|
|
1244
|
+
Sandbox isolation is opt-in **per task** via an `exec.sandbox` block in
|
|
1245
|
+
the task's config — there is no `--sandbox` CLI flag. See
|
|
1246
|
+
[`modules/sandbox-runtime.md`](./modules/sandbox-runtime.md) for the
|
|
1247
|
+
full reference.
|
|
1248
|
+
|
|
1249
|
+
```ts
|
|
1250
|
+
// vx.config.ts
|
|
1251
|
+
export default {
|
|
1252
|
+
tasks: {
|
|
1253
|
+
build: {
|
|
1254
|
+
exec: {
|
|
1255
|
+
command: 'tsc',
|
|
1256
|
+
sandbox: {
|
|
1257
|
+
allow: {
|
|
1258
|
+
read: ['.'],
|
|
1259
|
+
write: ['dist/**'],
|
|
1260
|
+
},
|
|
1261
|
+
},
|
|
1262
|
+
},
|
|
1263
|
+
cache: { inputs: { files: ['src/**'] }, outputs: { files: ['dist/**'] } },
|
|
1264
|
+
},
|
|
1265
|
+
},
|
|
1266
|
+
}
|
|
1267
|
+
```
|
|
1268
|
+
|
|
1269
|
+
The grants are the task's whole permission surface — nothing is derived
|
|
1270
|
+
from `cache`, and the only thing core adds is `node_modules` plus the
|
|
1271
|
+
workspace packages linked there, never a link back to the task's own
|
|
1272
|
+
project (npm and Yarn link that too). For a task that declares `cache`
|
|
1273
|
+
a linked package is granted only when its key folds a task of that
|
|
1274
|
+
package; declaring `cache` narrows core's grant and widens nothing.
|
|
1275
|
+
Enforcement anchors at the workspace root (a task never leaves its
|
|
1276
|
+
project); only denials inside the project, or under a withheld linked
|
|
1277
|
+
package, are reported.
|
|
1278
|
+
|
|
1279
|
+
Policy: **fail on violation.** Any task that touches a path it didn't
|
|
1280
|
+
declare either fails naturally (Linux: `ENOENT` from bwrap's
|
|
1281
|
+
mount-namespace hide) or is flagged via the macOS violation store
|
|
1282
|
+
and forced to exit non-zero. No cache is written for a failed task.
|
|
1283
|
+
"Didn't declare" means the grants, which on Linux are wider than they
|
|
1284
|
+
read: a file-shaped write grant is bound as its whole directory, so
|
|
1285
|
+
every file beside it is readable without a violation — `schema.md`
|
|
1286
|
+
§ `exec.sandbox` has the shape and the remedy (outputs in a
|
|
1287
|
+
subdirectory).
|
|
1288
|
+
|
|
1289
|
+
`vx run` arms the sandbox runtime when a task that declares
|
|
1290
|
+
`exec.sandbox` is about to execute; a cache hit needs none. If the
|
|
1291
|
+
platform cannot host it (Linux needs `bwrap`, `socat` and `rg` on PATH;
|
|
1292
|
+
macOS, `sandbox-exec`), that task fails with one line, `sandbox not
|
|
1293
|
+
available: <reason>`, and never runs unsandboxed. Tasks without a
|
|
1294
|
+
sandbox run as usual, and the failure's dependents follow `--continue`.
|
|
1295
|
+
|
|
1296
|
+
## `vx watch`
|
|
1297
|
+
|
|
1298
|
+
```
|
|
1299
|
+
vx watch [OPTIONS] TASK [-- forwarded-args...]
|
|
1300
|
+
```
|
|
1301
|
+
|
|
1302
|
+
Run the named task, then re-run it on every filesystem change in the
|
|
1303
|
+
projects in scope. Press `Ctrl+C` to stop.
|
|
1304
|
+
|
|
1305
|
+
```sh
|
|
1306
|
+
vx watch test # cwd project; re-test on changes
|
|
1307
|
+
vx watch test --all # every project that declares `test`
|
|
1308
|
+
vx watch lint --filter '@scope/*' # filtered scope
|
|
1309
|
+
vx watch build -- --sourcemap # forwarded args carry through every cycle
|
|
1310
|
+
```
|
|
1311
|
+
|
|
1312
|
+
### Lifecycle
|
|
1313
|
+
|
|
1314
|
+
1. **Initial run.** Same code path as `vx run` — same scope resolution,
|
|
1315
|
+
same task graph, same cache behaviour. The line `vx watch: initial
|
|
1316
|
+
run...` precedes it.
|
|
1317
|
+
2. **Watch loop.** After the initial run finishes (or once it waits only
|
|
1318
|
+
on a server's readiness, X-139), the directory of
|
|
1319
|
+
every project a cycle can run — the scope (the bare tasks' scope
|
|
1320
|
+
plus each `pkg#task`'s own project; only those when every task is
|
|
1321
|
+
anchored) plus its transitive dependencies, the closure `--filter 'app...'` walks, cross-project
|
|
1322
|
+
`dependsOn` edges included — is watched recursively, less any project
|
|
1323
|
+
nested inside it, with a config or not (a root project's key leaves a nested
|
|
1324
|
+
project's files out, so an edit there is no cycle; X-42, X-57). The workspace root is
|
|
1325
|
+
watched (non-recursively) for lockfile / `pnpm-workspace.yaml`
|
|
1326
|
+
changes and for an edit to `vx.workspace.*` — the one root file that
|
|
1327
|
+
shapes a run (plugins, `config` stage, concurrency) without being any
|
|
1328
|
+
task's input; the cycle after it re-evaluates the file. A `.gitignore`
|
|
1329
|
+
there or in a package glob's directory is a cycle too: inputs are
|
|
1330
|
+
gitignore-aware, so it changes what keys read (X-136). A file a
|
|
1331
|
+
config imports by relative path from outside the watched projects (a
|
|
1332
|
+
shared preset) is watched too, and its edit is a cycle that re-reads
|
|
1333
|
+
the configs; so is one inside a project, which re-reads the set as the
|
|
1334
|
+
config's own edit does (WD-14). A file the workspace config imports is loaded once per
|
|
1335
|
+
process, so its edit is named with the restart it needs rather than
|
|
1336
|
+
run stale (item 949). An import whose file is gone stays on the list
|
|
1337
|
+
by the name it would have, so its return is a cycle (X-133). The directory
|
|
1338
|
+
each `<dir>/*` package glob names (`packages/` for `packages/*`) is
|
|
1339
|
+
watched for members coming and going: a package added while the watch
|
|
1340
|
+
runs is a cycle that runs it, and its directory is watched from before
|
|
1341
|
+
that cycle runs, so an edit made during it queues (X-138); a removed one is dropped. An edit to the glob list itself (the
|
|
1342
|
+
root `package.json`'s `workspaces`, `pnpm-workspace.yaml`) re-reads
|
|
1343
|
+
the set, so a glob added there is watched from the cycle it triggers
|
|
1344
|
+
(item 1018). A base, or a directory a config imports from, removed and made
|
|
1345
|
+
again (a checkout that restores `packages/`) is heard from its nearest directory that exists, and a
|
|
1346
|
+
watch whose directory was replaced is armed again (an OS watch holds
|
|
1347
|
+
the deleted one; `watch-recreated-dirs.test.ts`). Under `--filter` or `--affected` the scope is the one
|
|
1348
|
+
resolved at start, and a new package joins it only as a dependency of
|
|
1349
|
+
it; a glob of another shape (`apps/**`) has no such directory, so a
|
|
1350
|
+
package added under it waits for a restart. A task's own declared outputs (`cache.outputs.files`,
|
|
1351
|
+
`outputs.workspaceFiles`; a plugin's `project` stage counts, as in
|
|
1352
|
+
a run) never trigger a re-run — a cycle that writes `dist/` is not
|
|
1353
|
+
an edit, nor is the `dist` directory itself coming and going (a
|
|
1354
|
+
literal entry covers its whole tree, as in the schema), unless some
|
|
1355
|
+
task reads the path as an input (an in-place formatter's `src/**`
|
|
1356
|
+
output still leaves a `build` reading `src/**` watching it, item 946;
|
|
1357
|
+
a task's own outputs are no input of it, so a `turbo()` task reading
|
|
1358
|
+
`**/*` does not re-run on its own `dist/`; only the tasks the run
|
|
1359
|
+
reaches through `dependsOn` are asked, so an unwatched `lint` reading
|
|
1360
|
+
`**/*` beside `vx watch build` asks nothing) — and neither do `node_modules`,
|
|
1361
|
+
`.git` or the cache directory. A write the task did NOT declare (a
|
|
1362
|
+
task with no `cache` block declares nothing) is caught by state,
|
|
1363
|
+
judged once the bytes have settled: a file whose bytes and mode did
|
|
1364
|
+
not change since the loop last saw it is not an edit (a `chmod` is one,
|
|
1365
|
+
as the key reads the executable bit), nor is a directory
|
|
1366
|
+
whose entries (names and sizes) did not, nor a path that stayed
|
|
1367
|
+
gone; a symlink is its target string, as the key folds it, so a
|
|
1368
|
+
retarget is an edit; a path the loop has never judged is an edit only if it was
|
|
1369
|
+
modified after the watchers went live (macOS delivers the initial
|
|
1370
|
+
run's own writes after the arm; the later of the path's mtime and
|
|
1371
|
+
ctime says which side of it a path belongs to, so a file moved in
|
|
1372
|
+
with an old mtime by `mv`, `cp -p` or `tar x` still counts, and a
|
|
1373
|
+
symlink's own times are read, never its target's), and a
|
|
1374
|
+
path git did not list at the arm that is gone again (vim's `4913`
|
|
1375
|
+
write probe, a lock file) is no edit; and
|
|
1376
|
+
nothing is judged while a cycle runs — its
|
|
1377
|
+
own writes are mid-flight, a `dist` deleted and not yet rebuilt is
|
|
1378
|
+
a state the tree will not keep — so paths that land mid-run are
|
|
1379
|
+
judged together one debounce window after it ends, an edit made
|
|
1380
|
+
meanwhile included. A task that writes into its own project,
|
|
1381
|
+
`rm -rf dist && tsc` included, costs one extra cycle instead of
|
|
1382
|
+
re-running forever — when the bytes it leaves are the same. A file
|
|
1383
|
+
it rewrites with DIFFERENT bytes every run (a pid file, a
|
|
1384
|
+
timestamped log) is either git-ignored — a git-ignored path never
|
|
1385
|
+
starts a cycle, since no cache key can see it (a user's edit to one
|
|
1386
|
+
still does in a project with a task that has a command and no cache,
|
|
1387
|
+
which reads what it likes, item 947, outside any project nested
|
|
1388
|
+
in it) — or declared an
|
|
1389
|
+
output, or the loop re-runs on it; after three such cycles in a row
|
|
1390
|
+
watch names the path and the remedy, once, and keeps going. A dev
|
|
1391
|
+
server the last cycle left running counts as that cycle for as long
|
|
1392
|
+
as it runs, so a log it rewrites in its project is named too, with
|
|
1393
|
+
`.gitignore` as the remedy (a persistent task declares no outputs;
|
|
1394
|
+
item 948). A file git tracks is never blamed on the server: three
|
|
1395
|
+
saves of a source file are the user's (WD-7). When any project's config declares
|
|
1396
|
+
`cache.inputs.workspaceFiles`, the per-project watchers are swapped
|
|
1397
|
+
for ONE recursive root watcher (boundaries are off for those globs,
|
|
1398
|
+
so a root-relative glob can name a file anywhere). That watcher
|
|
1399
|
+
hears every write in the tree and keeps only the ones a key can
|
|
1400
|
+
see: a path inside a project's directory, a fingerprint file at the
|
|
1401
|
+
root, or a match of a declared `workspaceFiles` glob. A log written
|
|
1402
|
+
at the root, a `coverage/` or `.turbo/` tree, an editor's scratch
|
|
1403
|
+
file are dropped before the trigger — so `vx watch … > build.log`
|
|
1404
|
+
inside the repo settles instead of feeding itself a cycle per line
|
|
1405
|
+
of its own output. `vx watch: watching …` is
|
|
1406
|
+
printed only after every watcher has reported a probe file written
|
|
1407
|
+
under it (`.vx-watch-probe`, re-written on a short backoff until its
|
|
1408
|
+
event arrives, then removed): on macOS a directory watcher can return
|
|
1409
|
+
before its event stream is live, and an edit in that gap is silently
|
|
1410
|
+
lost — so the line is a promise, not a hope. A probe is never an
|
|
1411
|
+
edit, at any depth: another watcher's, seen under a nested project,
|
|
1412
|
+
ran a cycle (and restarted a dev server) with no edit made (item
|
|
1413
|
+
1016). A
|
|
1414
|
+
watcher whose probe is not heard within 2 s is replaced by a poller
|
|
1415
|
+
that checks every 250 ms, with the notice `vx watch: <dir>: no OS
|
|
1416
|
+
watch events within 2000 ms; polling every 250 ms instead`.
|
|
1417
|
+
3. **On change.** The triggering path is logged
|
|
1418
|
+
(`vx watch: <project> <relpath>; re-running...`): the first changed
|
|
1419
|
+
path that still exists, so an editor's temporary file renamed away
|
|
1420
|
+
names nothing; a deletion names the cycle when nothing else changed. The
|
|
1421
|
+
orchestrator is invoked again with the same options, save one: the
|
|
1422
|
+
`--affected` diff is read once, for the initial run. A later cycle
|
|
1423
|
+
runs the requested task in every project of the scope fixed at start,
|
|
1424
|
+
and the cache keys decide what executes (the startup diff, asked
|
|
1425
|
+
again, kept an edit made since out of every cycle). Events arriving
|
|
1426
|
+
while a run is in flight queue and drain after the current cycle.
|
|
1427
|
+
Re-runs are debounced ~150ms after the last event, and wait at most
|
|
1428
|
+
1 s after the first, so a writer that never pauses holds no edit back.
|
|
1429
|
+
4. **Exit.** `SIGINT` (Ctrl+C) exits 0; once the cycle in flight is down, `vx watch: stopped` is the last line.
|
|
1430
|
+
|
|
1431
|
+
### Path filtering
|
|
1432
|
+
|
|
1433
|
+
Always ignored (no re-trigger):
|
|
1434
|
+
|
|
1435
|
+
- `node_modules/`, `.git/`, `.vx/` anywhere in the path.
|
|
1436
|
+
- A path git ignores (`git check-ignore`, asked once per debounce
|
|
1437
|
+
window, never per event): invisible to every cache key — inputs are
|
|
1438
|
+
tracked + untracked-not-ignored — so a cycle it started could change
|
|
1439
|
+
nothing. A tracked file that matches a pattern is not ignored, by
|
|
1440
|
+
git's own rule; outside a repository nothing is.
|
|
1441
|
+
- Files ending in `.tsbuildinfo` or `~` (editor swap files).
|
|
1442
|
+
- The run's **resolved cache directory**, wherever it is. `.vx/` covers the
|
|
1443
|
+
default, but `defineWorkspace({ cacheDir })` and `--cache-dir` can put it
|
|
1444
|
+
anywhere; watching it would let vx's own cache writes trigger the next
|
|
1445
|
+
cycle, which writes again — a loop that never settles.
|
|
1446
|
+
|
|
1447
|
+
Everything else triggers a cycle. We deliberately don't filter events
|
|
1448
|
+
against per-task `cache.inputs.files` — the cache hash is the source
|
|
1449
|
+
of truth. A change to an irrelevant file produces a cache-hit run
|
|
1450
|
+
(typically tens of ms); the cost is much smaller than the engineering
|
|
1451
|
+
cost of a per-event glob match.
|
|
1452
|
+
|
|
1453
|
+
### How changes are seen
|
|
1454
|
+
|
|
1455
|
+
One recursive OS watcher (`fs.watch`) per project directory in scope,
|
|
1456
|
+
plus the workspace root for the fingerprint files. Each watcher must
|
|
1457
|
+
prove it delivers: a directory whose watcher reports nothing within
|
|
1458
|
+
2 s of the probe is polled every 250 ms instead, with a one-line
|
|
1459
|
+
notice on stderr (`no OS watch events within 2000 ms; polling every
|
|
1460
|
+
250 ms instead`). Where the watcher is known not to deliver — a sandbox
|
|
1461
|
+
without FSEvents access on macOS, a network mount, a container bind —
|
|
1462
|
+
`VX_WATCH_POLL=1` polls from the start and skips the 2 s probe; the loop
|
|
1463
|
+
says so once (`vx watch: polling every 250 ms (VX_WATCH_POLL)`). A
|
|
1464
|
+
watcher the OS refuses for its watch limit (`ENOSPC`, `EMFILE`) is
|
|
1465
|
+
polled too, with a notice naming the limit to raise. The
|
|
1466
|
+
poller walks the same tree the event filter keeps: the always-ignored
|
|
1467
|
+
segments and the run's declared output containers are never sampled.
|
|
1468
|
+
It samples each file's later clock of mtime and ctime, so a replacement
|
|
1469
|
+
that carries the old file's mtime (`cp -p`, `rsync -a`, a `mv`) is an
|
|
1470
|
+
edit to it as it is to the OS watcher.
|
|
1471
|
+
|
|
1472
|
+
### Workspace fingerprint changes
|
|
1473
|
+
|
|
1474
|
+
Edits to a lockfile (`pnpm-lock.yaml`, `bun.lock`, …) or
|
|
1475
|
+
`pnpm-workspace.yaml` at the root invalidate every task's cache key
|
|
1476
|
+
via the [workspace fingerprint](./caching.md#cache-key-derivation).
|
|
1477
|
+
Watch mode hears those because it watches the workspace root
|
|
1478
|
+
(non-recursively). A lockfile a plugin claims still triggers a cycle,
|
|
1479
|
+
and so does any other root file a plugin claims (`turbo.json` under
|
|
1480
|
+
`turbo()`, item 961), a plugin added to the workspace config mid-watch
|
|
1481
|
+
included from the cycle that loads it; the keys then decide which
|
|
1482
|
+
projects actually re-run. Under `vx watch --frozen` every cycle's configs come from
|
|
1483
|
+
`vx-lock.json`, so a config edit alone changes no command, and a re-lock
|
|
1484
|
+
(`vx lock`) is a cycle that re-reads the watched set (item 971).
|
|
1485
|
+
|
|
1486
|
+
### Constraints
|
|
1487
|
+
|
|
1488
|
+
The following flags are rejected (parser exits 1 before the initial
|
|
1489
|
+
run):
|
|
1490
|
+
|
|
1491
|
+
- `--dry` / `--graph` — those skip execution; nothing to watch.
|
|
1492
|
+
- `--summarize` / `--profile` — would overwrite their target per cycle.
|
|
1493
|
+
- `--report` / `--report-file` / `--verbosity <n>` (n > 0) / `--format json` — all
|
|
1494
|
+
format ONE run's result; a watch loop has no single run to report. (`--verbosity 0`
|
|
1495
|
+
is accepted: it asks for what watch already prints.)
|
|
1496
|
+
|
|
1497
|
+
A requested persistent task (`exec.persistent`, a dev server) starts
|
|
1498
|
+
once and stays up across cycles; each cycle re-runs what it depends on,
|
|
1499
|
+
as the cache keys decide. So `vx watch dev`, with `dev` depending on
|
|
1500
|
+
`^build`, rebuilds only the libraries an edit reaches on the way to the
|
|
1501
|
+
app and leaves the server running; the dev tool's own reload picks up
|
|
1502
|
+
what was rebuilt. What the server writes keeps printing. It restarts
|
|
1503
|
+
only when its own task config (or the args forwarded to it) changed, or
|
|
1504
|
+
when it died: the old one is stopped first (the kill grace, then
|
|
1505
|
+
SIGKILL), so the two never hold one port. One that dies while watch
|
|
1506
|
+
idles is said (`vx: app#dev exited with code 3`); the next change
|
|
1507
|
+
starts it again. A cycle in which a task the server depends on fails
|
|
1508
|
+
stops it. An edit while a cycle waits only on a server that has not
|
|
1509
|
+
printed its `readyWhen` line stops that cycle and starts the next, so a
|
|
1510
|
+
fix reaches a server stuck before ready, in the initial run too.
|
|
1511
|
+
Stopping watch stops the server too. A one-shot task (`vx watch build`)
|
|
1512
|
+
re-runs itself and what it depends on.
|
|
1513
|
+
|
|
1514
|
+
### Exit codes
|
|
1515
|
+
|
|
1516
|
+
- `0` — clean Ctrl+C / SIGTERM exit. A cycle in flight is torn down
|
|
1517
|
+
first — its children, and the dev server held between cycles, get the
|
|
1518
|
+
signal watch received (a Ctrl-C as SIGINT; a SIGTERM or SIGHUP as SIGTERM),
|
|
1519
|
+
`VX_KILL_GRACE_MS` (2 s), then SIGKILL — and the process leaves only
|
|
1520
|
+
once it has returned, so a CI cancellation never orphans a task.
|
|
1521
|
+
Also `0`, with no watch, when `--affected` selects nothing: watch
|
|
1522
|
+
prints `vx watch: nothing affected since <ref>` and exits as `vx run`
|
|
1523
|
+
does.
|
|
1524
|
+
- `1` — parser error, missing scope, or a task name no project in
|
|
1525
|
+
scope declares: the initial run refuses it as `vx run` does, with the
|
|
1526
|
+
same `Did you mean` hint, and watch exits rather than re-run the
|
|
1527
|
+
refusal on every change.
|
|
1528
|
+
|
|
1529
|
+
A cycle that throws — a `vx.config.*` that does not parse — prints
|
|
1530
|
+
`vx watch: cycle failed: <reason>` and watch keeps watching, the initial
|
|
1531
|
+
run included, so saving the fix re-runs (item 1017).
|
|
1532
|
+
|
|
1533
|
+
Re-run cycles whose orchestrator returns `{ ok: false }` do NOT exit
|
|
1534
|
+
the watch loop — a failed cycle just prints the framed FAILED block
|
|
1535
|
+
and waits for the next change. This matches `turbo watch` / `nx
|
|
1536
|
+
watch`.
|
|
1537
|
+
|
|
1538
|
+
## `vx cache prune`
|
|
1539
|
+
|
|
1540
|
+
Evict old or oversized cache entries. Operates on the entries and
|
|
1541
|
+
`<hash>.tar.zst` artifacts of the store the workspace's index records
|
|
1542
|
+
(`~/.vx/<id>/cache`, shared by every checkout of the repository), or of
|
|
1543
|
+
`<cacheDir>` itself when the workspace names one (`cacheDir`,
|
|
1544
|
+
`VX_CACHE_DIR`, `--cache-dir`).
|
|
1545
|
+
|
|
1546
|
+
`prune` is the only `vx cache` subcommand: the statistics other runners
|
|
1547
|
+
put under a `cache` verb — the directory, the entry count, the size —
|
|
1548
|
+
are part of [`vx info`](#vx-info), and `vx cache stats`, `list`, `ls`,
|
|
1549
|
+
`clean`, `gc`, `purge` and their neighbours say so (`list` also names
|
|
1550
|
+
`vx last --list`) rather than printing a bare "unknown subcommand".
|
|
1551
|
+
|
|
1552
|
+
```
|
|
1553
|
+
vx cache prune --older-than <duration> # Drop entries last used before now - duration (up to 1h slack).
|
|
1554
|
+
vx cache prune --max-size <size> # After age-based pruning, evict LRU until under <size>.
|
|
1555
|
+
vx cache prune ... --dry-run # Say what either policy would reap; delete nothing.
|
|
1556
|
+
vx cache prune ... --format json # { dryRun, evicted, bytesFreed, orphans, orphanBytes }
|
|
1557
|
+
vx cache prune ... --cache-dir <path> # The cache a run with the same flag uses.
|
|
1558
|
+
```
|
|
1559
|
+
|
|
1560
|
+
At least one of `--older-than` / `--max-size` is required. Both may
|
|
1561
|
+
be combined: age-based eviction runs first, then LRU eviction if the
|
|
1562
|
+
total is still over the size cap. The same policy runs unattended at
|
|
1563
|
+
the end of every run when `vx.workspace.ts` declares
|
|
1564
|
+
`cacheRetention: { olderThan, maxSize }` (same spellings; see
|
|
1565
|
+
[schema](./schema.md)).
|
|
1566
|
+
|
|
1567
|
+
After eviction, prune sweeps the cache directory for **orphans**: a
|
|
1568
|
+
`<hash>.tar.zst` the index has no row for (a `SCHEMA_VERSION` bump
|
|
1569
|
+
drops every table and leaves the artifacts behind, as a deleted
|
|
1570
|
+
`cache.db` does) and a `<hash>.tar.zst.tmp-*` a save that crashed never
|
|
1571
|
+
renamed. A run that asks for an orphan's key indexes it again from its
|
|
1572
|
+
bytes and hits; one no task asks for again is only reclaimed here. The
|
|
1573
|
+
policy judges a row-less artifact as it judges an entry, by its file
|
|
1574
|
+
time plus an hour (a hit renews a file time over an hour old): another
|
|
1575
|
+
vx version sharing the store may still use it. A temp goes once it is an
|
|
1576
|
+
hour old; nothing younger than an hour is taken. Only the names vx writes are taken:
|
|
1577
|
+
`<hash>` is the key's 16 lowercase hex digits and the temp suffix is
|
|
1578
|
+
the one a save makes, so a `release.tar.zst` beside the index in a
|
|
1579
|
+
`cacheDir` you share is never touched (item 968). The converse, an
|
|
1580
|
+
index row whose artifact is gone (deleted by hand), is dropped by the
|
|
1581
|
+
same prune, and its bytes count toward neither `--max-size` nor the
|
|
1582
|
+
evicted total: they are on no disk, and counting them evicted real
|
|
1583
|
+
entries to make room for them (item 975). A row used within the hour
|
|
1584
|
+
is kept until a later prune, but its bytes are left out all the same
|
|
1585
|
+
(item 1081). The sweep runs on every prune, under
|
|
1586
|
+
either flag, and reports separately from the policy's evictions. A
|
|
1587
|
+
workspace's `cacheRetention` runs it too, at the end of a run, at most
|
|
1588
|
+
once an hour even when nothing the index holds is due (the policy sums
|
|
1589
|
+
index rows, so orphans alone never make it due).
|
|
1590
|
+
|
|
1591
|
+
Both flags take either form: `--older-than 30d` or `--older-than=30d`.
|
|
1592
|
+
|
|
1593
|
+
**Duration units**: `s`, `m`, `h`, `d`, case-insensitive. Examples:
|
|
1594
|
+
`30d`, `24h`, `60m`, `30s`, `30D`.
|
|
1595
|
+
|
|
1596
|
+
**Size units**: `K`, `M`, `G`, `T` (powers of 1024), case-insensitive.
|
|
1597
|
+
Optional `B` suffix is accepted. Examples: `500M`, `1G`, `100K`, `2T`,
|
|
1598
|
+
`500MB`, `1gb`. A bare number is refused here: `--max-size 10` would
|
|
1599
|
+
read as ten bytes and evict nearly everything, and nobody means that —
|
|
1600
|
+
write `10G`, or `10B` when bytes really are the unit.
|
|
1601
|
+
|
|
1602
|
+
**A zero bound is rejected.** `--max-size 0` and `--older-than 0d` would
|
|
1603
|
+
evict every entry in the cache, which is far more often a
|
|
1604
|
+
computed-to-zero retention than an intent — and no flag combination
|
|
1605
|
+
expresses "wipe the cache" (running with neither flag is an error, not a
|
|
1606
|
+
full prune). Delete the cache store `vx info` names when that is really
|
|
1607
|
+
what you want: the entries live there, not in the workspace's `.vx`.
|
|
1608
|
+
|
|
1609
|
+
```
|
|
1610
|
+
$ vx cache prune --older-than 30d
|
|
1611
|
+
Pruned 42 entries (1.3 GB freed)
|
|
1612
|
+
|
|
1613
|
+
$ vx cache prune --older-than 7d --max-size 500M
|
|
1614
|
+
Pruned 18 entries (320 MB freed)
|
|
1615
|
+
|
|
1616
|
+
$ vx cache prune --older-than 30d # after a SCHEMA_VERSION bump
|
|
1617
|
+
Pruned 0 entries (0 B freed), reaped 42 orphaned artifacts (1.3 GB)
|
|
1618
|
+
|
|
1619
|
+
$ vx cache prune --older-than 30d --dry-run
|
|
1620
|
+
Would prune 42 entries (1.3 GB), would reap 3 orphaned artifacts (12 MB)
|
|
1621
|
+
```
|
|
1622
|
+
|
|
1623
|
+
`--dry-run` picks the victims under the same policy and counts the
|
|
1624
|
+
orphans the sweep would take, then returns without touching the index
|
|
1625
|
+
or the directory; the real prune with the same flags reaps exactly what
|
|
1626
|
+
it named (an in-flight save aside). On an index an earlier vx wrote,
|
|
1627
|
+
which the real prune resets first, it reads the index as that reset
|
|
1628
|
+
leaves it: the shared store's entries still face the policy, and every
|
|
1629
|
+
artifact in the workspace's own directory is row-less, judged by the
|
|
1630
|
+
policy on its file time (item 1083).
|
|
1631
|
+
|
|
1632
|
+
A prune that deletes waits for a `vx run` on the same workspace to
|
|
1633
|
+
finish first (the run's lock; it says `[vx] waiting for another vx run
|
|
1634
|
+
(pid N) on this workspace to finish…` after a second), so it never
|
|
1635
|
+
evicts what that run is restoring. One started by a task of that run
|
|
1636
|
+
is refused instead: the run holds the lock until the task ends. A run it cannot see — another
|
|
1637
|
+
workspace sharing the `--cache-dir` — survives a prune anyway: an
|
|
1638
|
+
artifact that vanishes before its restore is a miss, and the task runs
|
|
1639
|
+
([caching](./caching.md#concurrent-runs)).
|
|
1640
|
+
|
|
1641
|
+
Exit codes:
|
|
1642
|
+
|
|
1643
|
+
- `0` — pruning completed (zero or more entries evicted). A workspace
|
|
1644
|
+
that never ran has no cache: `Pruned 0 entries (0 B freed)`, and
|
|
1645
|
+
nothing is created.
|
|
1646
|
+
- `1` — parse error, missing policy, or workspace-discovery error.
|
|
1647
|
+
|
|
1648
|
+
`vx cache prune` resolves the workspace root from cwd and honors a
|
|
1649
|
+
`defineWorkspace({ cacheDir })` override — it prunes the same
|
|
1650
|
+
directory a run would use. `--cache-dir <path>` (cwd-relative, as on
|
|
1651
|
+
`vx run`) names another one, so a run that wrote elsewhere can be
|
|
1652
|
+
pruned there.
|
|
1653
|
+
|
|
1654
|
+
## `--frozen` (run flag)
|
|
1655
|
+
|
|
1656
|
+
`vx run ... --frozen` loads configs from the committed `vx-lock.json`
|
|
1657
|
+
instead of evaluating them — CI reproducibility mode. Plain `vx run`
|
|
1658
|
+
always evaluates live (a byte hash can't see a config's import
|
|
1659
|
+
closure, so silently consuming the lock locally would risk stale
|
|
1660
|
+
freezes). `--frozen` errors only when no lock exists or a project
|
|
1661
|
+
is missing from it — it performs NO staleness checks of its own:
|
|
1662
|
+
run `vx lock --check` first in the pipeline; that audit re-evaluates
|
|
1663
|
+
everything, making any per-run re-check redundant.
|
|
1664
|
+
|
|
1665
|
+
## `vx lock`
|
|
1666
|
+
|
|
1667
|
+
Freeze every project's **resolved** config into `vx-lock.json` at the
|
|
1668
|
+
workspace root. Configs are programs; `vx lock` evaluates them in the
|
|
1669
|
+
current environment and stores the post-evaluation objects plus a
|
|
1670
|
+
content hash of each config file. "Every project" is the set a run
|
|
1671
|
+
sees, a plugin's `discover` stage included (X-143).
|
|
1672
|
+
|
|
1673
|
+
```
|
|
1674
|
+
vx lock # Evaluate all vx.config.* now; write vx-lock.json.
|
|
1675
|
+
vx lock --check # Audit: hash checks + full re-evaluation vs the lock. Exit 1 on drift.
|
|
1676
|
+
vx lock --check --format json # The audit as {upToDate, audited, notAudited, problems}.
|
|
1677
|
+
```
|
|
1678
|
+
|
|
1679
|
+
Plain runs ALWAYS evaluate live — the lock's existence changes
|
|
1680
|
+
nothing. Only `vx run --frozen` consumes it: configs come from the
|
|
1681
|
+
lock with no evaluation and no staleness checks of its own (frozen-env
|
|
1682
|
+
semantics: env reads in a config keep their lock-time values; a
|
|
1683
|
+
project absent from the lock, a locked project whose config file is
|
|
1684
|
+
gone (X-144) or a missing lock is a hard error).
|
|
1685
|
+
|
|
1686
|
+
`--check` is the audit: it reports changed config files via the
|
|
1687
|
+
stored hashes AND re-evaluates every config in the current
|
|
1688
|
+
environment, `Bun.deepEquals`-comparing against the frozen objects —
|
|
1689
|
+
catching eval-time env and import-closure drift that byte hashes
|
|
1690
|
+
cannot see. The CI recipe is `vx lock --check && vx run … --frozen`.
|
|
1691
|
+
`--format json` prints the audit as one document
|
|
1692
|
+
(`schemas/lock.json`, exit code unchanged; a missing lock is one of
|
|
1693
|
+
its `problems`); it answers `--check` only.
|
|
1694
|
+
Full design: `docs/design/config-lock-2026-06.md`. A lock written by a
|
|
1695
|
+
1.x vx stays valid for every later 1.x (`tests/contract-lockfile.test.ts`).
|
|
1696
|
+
|
|
1697
|
+
A project with no `vx.config.*` — its tasks from a plugin's `project`
|
|
1698
|
+
stage (`turbo()` from `@vzn/vx-migrate`), or none at all — has nothing
|
|
1699
|
+
to freeze: the lock records nothing for it, `--check` does not audit
|
|
1700
|
+
it, and `--frozen` still loads its tasks live. Both verbs say how many
|
|
1701
|
+
such projects the workspace has (`locked 0 project configs →
|
|
1702
|
+
vx-lock.json (2 projects have no vx.config; their tasks are never
|
|
1703
|
+
frozen)`), so an empty lock on a plugin-only workspace never reads like
|
|
1704
|
+
an audit.
|
|
1705
|
+
|
|
1706
|
+
The lock is committed, so `vx lock` refuses to write one that holds a
|
|
1707
|
+
secret: a config that evaluated to the value of a secret-named variable
|
|
1708
|
+
(or one a task lists in `exec.env.secret`), say
|
|
1709
|
+
`` `--token ${process.env.API_TOKEN}` ``. It names each place
|
|
1710
|
+
(`a: tasks.deploy.exec.command holds $API_TOKEN`) and writes nothing.
|
|
1711
|
+
Masking it instead would freeze a `***` that `--frozen` runs. Let the
|
|
1712
|
+
shell expand it: `$API_TOKEN` in the command, the name in
|
|
1713
|
+
`exec.env.passThrough` (L-42).
|
|
1714
|
+
|
|
1715
|
+
Exit codes:
|
|
1716
|
+
|
|
1717
|
+
- `0` — lock written / lock is up to date.
|
|
1718
|
+
- `1` — parse error, workspace-discovery error, missing lock
|
|
1719
|
+
(`--check` without one), any drift (every mismatched project is
|
|
1720
|
+
listed on stderr), or a secret value the lock would hold.
|
|
1721
|
+
|
|
1722
|
+
## Releasing (maintainers)
|
|
1723
|
+
|
|
1724
|
+
Releases are on demand. Dispatching `auto-release.yml` releases a
|
|
1725
|
+
commit on `main` whose CI went green: the `sha` input, or by default the
|
|
1726
|
+
newest such commit; one CI did not pass on is refused. Claude dispatches
|
|
1727
|
+
it at least once a day when `main` has changes, after merging that
|
|
1728
|
+
release's blog post (`.claude/skills/release/SKILL.md`), and shares the
|
|
1729
|
+
post on Bluesky. The workflow tags the commit with the next version and
|
|
1730
|
+
creates the GitHub release, both from the Conventional Commits since the
|
|
1731
|
+
last tag (`scripts/release-notes.ts`, run by the `release.auto` task,
|
|
1732
|
+
`scripts/auto-release.ts`). The release is created as a draft: this
|
|
1733
|
+
repo's releases are immutable and take assets only before they are
|
|
1734
|
+
published, so `release.yml` publishes it after its last upload. The version: below 0.1.0 always a
|
|
1735
|
+
patch (cutting 0.1.0 is the owner's, by hand); then before 1.0 a `feat`
|
|
1736
|
+
or a breaking change (`type!:`, a `BREAKING CHANGE:` footer) is a minor
|
|
1737
|
+
(`v0.4.2` → `v0.5.0`) and anything else a patch (`v0.4.3`); from 1.0 a
|
|
1738
|
+
breaking change is a major. The notes: breaking changes first, then
|
|
1739
|
+
`feat`, `fix` and `perf`, the rest counted. It then
|
|
1740
|
+
dispatches `release.yml` (with `tag`) and
|
|
1741
|
+
`npm.yml` (with `version` and `ref`). A release made with the workflow
|
|
1742
|
+
token fires no `release` event in other workflows, which is why the two
|
|
1743
|
+
are dispatched rather than triggered. A commit is released only when the
|
|
1744
|
+
last release is its ancestor, so an older tree never gets a higher
|
|
1745
|
+
version, and one that already carries a `v*` tag is a no-op.
|
|
1746
|
+
|
|
1747
|
+
A version can still be cut by hand: push its tag (say `v1.0.0`),
|
|
1748
|
+
create a draft release for it, and dispatch `release.yml` (`tag`) and
|
|
1749
|
+
`npm.yml` (`version`, `ref`); the next auto-release continues from it.
|
|
1750
|
+
|
|
1751
|
+
A GitHub release publishes everything: `release.yml` builds the four
|
|
1752
|
+
binaries, proves the darwin ones on macOS (re-signed ad hoc only where
|
|
1753
|
+
macOS refuses one) and attaches them; `npm.yml`
|
|
1754
|
+
builds the twelve npm packages (`@vzn/vx`, one per platform, and the
|
|
1755
|
+
seven plugin packages) and publishes them with **npm trusted
|
|
1756
|
+
publishing** — the job's OIDC token
|
|
1757
|
+
is exchanged for a short-lived credential and provenance is attached,
|
|
1758
|
+
so no long-lived npm token exists anywhere. Both publish loops skip a
|
|
1759
|
+
package already on the registry, so a re-run (`npm publish` →
|
|
1760
|
+
_Run workflow_ with the version) resumes where it stopped. That dispatch
|
|
1761
|
+
also takes a `ref`: it runs the workflow from the default branch against
|
|
1762
|
+
the code that ref names, so a release whose publish died on a workflow
|
|
1763
|
+
bug is completed by the FIXED workflow building the tag's own source
|
|
1764
|
+
(`version: 0.0.20`, `ref: v0.0.20`) — re-running the failed run itself
|
|
1765
|
+
would replay the broken file, which is pinned to the tag.
|
|
1766
|
+
|
|
1767
|
+
Every step of the three workflows past the setup (checkout, Bun, Node,
|
|
1768
|
+
`bun install`, the runner action) is one vx task: CI runs no command of
|
|
1769
|
+
its own (owner, 2026-10-03), and `tests/workflow-runner.unsafe.test.ts`
|
|
1770
|
+
holds it. The tasks are `@vzn/vx`'s `release.*`, all uncached and in no
|
|
1771
|
+
`ci` graph:
|
|
1772
|
+
|
|
1773
|
+
| Task | Does |
|
|
1774
|
+
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1775
|
+
| `release.stamp` | writes `VX_RELEASE_VERSION` into `packages/vx/package.json`, the manifest the binary inlines |
|
|
1776
|
+
| `release.npm` | checks npm can publish with provenance (>= 11.5.1, `sigstore` loads); else installs npm into `dist/npm-cli/` |
|
|
1777
|
+
| `release.prove.<os>` | launches the host's binary (re-signed only if macOS refuses it) and asserts `vx <version>`; on darwin, launches both (x64 under Rosetta) |
|
|
1778
|
+
| `release.assemble.<os>` | emits the platform packages under `dist/npm` (linux: also `@vzn/vx` and the plugins) |
|
|
1779
|
+
| `release.publish.<os>` | `npm publish --provenance` each in order, skipping one the registry holds |
|
|
1780
|
+
| `release.upload.<os>` | attaches `dist/vx-<os>-*` the draft release lacks; darwin's then publishes it |
|
|
1781
|
+
| `release.auto` | decides the version, creates the draft release with its notes, dispatches the two workflows |
|
|
1782
|
+
|
|
1783
|
+
The version reaches them as `VX_RELEASE_VERSION` (the tag or the
|
|
1784
|
+
dispatch input) and each refuses one that is not a version. Every one
|
|
1785
|
+
is sandboxed: the publish is granted the registry, the OIDC token host
|
|
1786
|
+
and Sigstore, the GitHub-Actions variables npm reads, and `~/.npm`;
|
|
1787
|
+
`release.auto` reads `.git` and reaches `api.github.com` with `GH_TOKEN`;
|
|
1788
|
+
`release.upload.<os>` reaches it and `uploads.github.com`.
|
|
1789
|
+
A dispatch with `ref` builds that ref's code, so it must hold these tasks.
|
|
1790
|
+
|
|
1791
|
+
All Linux jobs go through `.github/actions/vx-runner` before any
|
|
1792
|
+
`vx run`: every task in this repo declares `exec.sandbox`, and a
|
|
1793
|
+
declared sandbox whose runtime is missing is a hard error, not a
|
|
1794
|
+
downgrade — the compile tasks fail in 0 ms saying which of bubblewrap,
|
|
1795
|
+
socat and ripgrep is absent. v0.0.20 shipped its darwin packages and
|
|
1796
|
+
then stopped exactly there.
|
|
1797
|
+
|
|
1798
|
+
One-time setup, per package, on npmjs.com → package → Settings →
|
|
1799
|
+
Trusted Publisher → GitHub Actions: owner `vznjs`, repository `vx`,
|
|
1800
|
+
workflow `npm.yml`, environment left blank. Do this for `@vzn/vx`,
|
|
1801
|
+
`@vzn/vx-darwin-x64`, `@vzn/vx-darwin-arm64`, `@vzn/vx-linux-x64`,
|
|
1802
|
+
`@vzn/vx-linux-arm64` and the seven plugins: `@vzn/vx-ci`,
|
|
1803
|
+
`@vzn/vx-lockfile`, `@vzn/vx-mcp`, `@vzn/vx-migrate`, `@vzn/vx-otel`,
|
|
1804
|
+
`@vzn/vx-reapi` and `@vzn/vx-schedule-history`.
|
|
1805
|
+
|
|
1806
|
+
Each platform package carries `LICENSE` and `THIRD_PARTY_NOTICES.txt`:
|
|
1807
|
+
the binary embeds Bun and npm code whose licenses must travel with it.
|
|
1808
|
+
The GitHub release carries the same file as an asset beside the binaries.
|
|
1809
|
+
`tests/dependency-licenses.unsafe.test.ts` holds every published package's
|
|
1810
|
+
production dependency closure to permissive licenses (MIT, ISC, BSD,
|
|
1811
|
+
Apache-2.0, 0BSD, or a dual license offering one).
|
|
1812
|
+
After a dependency or Bun bump, `bun packages/vx/scripts/third-party-notices.ts`
|
|
1813
|
+
regenerates the notices; `tests/third-party-notices.unsafe.test.ts`
|
|
1814
|
+
fails until it does.
|
|
1815
|
+
|
|
1816
|
+
The plugins ship as the TypeScript source Bun runs, at the release's
|
|
1817
|
+
version, with `@vzn/vx` as a peer on the same minor (`^<version>`).
|
|
1818
|
+
`scripts/build-npm.ts --only=plugins` emits every public workspace
|
|
1819
|
+
package other than `@vzn/vx`, so a new plugin package is published
|
|
1820
|
+
without a workflow edit, and `tests/build-npm.unsafe.test.ts` holds the
|
|
1821
|
+
set. If npm will not add a trusted publisher to a name that has never
|
|
1822
|
+
been published, publish that plugin once by hand from an owner's
|
|
1823
|
+
account (`npm publish dist/npm-plugins/plugins/<dir> --access public`
|
|
1824
|
+
after a `build-npm.ts <version> --only=plugins --out=dist/npm-plugins`
|
|
1825
|
+
build), then add the publisher. Then
|
|
1826
|
+
delete the `NPM_TOKEN` repository secret:
|
|
1827
|
+
the workflow no longer reads it, and npm restricts classic tokens for
|
|
1828
|
+
direct publishing (the `E401 token is invalid` that stopped v0.0.17).
|
|
1829
|
+
Every `uses:` in both workflows is pinned to a commit SHA with the
|
|
1830
|
+
version in a comment; bump the SHA and the comment together.
|
|
1831
|
+
|
|
1832
|
+
## `vx upgrade`
|
|
1833
|
+
|
|
1834
|
+
Self-update the compiled binary in place: asks the GitHub release API
|
|
1835
|
+
for this platform's asset and the SHA-256 digest it publishes,
|
|
1836
|
+
downloads the asset, verifies the digest, and atomically replaces the
|
|
1837
|
+
running executable (`vx upgrade TAG` pins a specific release; default
|
|
1838
|
+
latest; a second tag is refused, not dropped). A download that does not match the digest replaces nothing —
|
|
1839
|
+
`the download did not match the release's SHA-256 … nothing replaced` —
|
|
1840
|
+
and a release that publishes no digest for the asset is refused before
|
|
1841
|
+
the download. The digest comes from the same API as the asset, so it
|
|
1842
|
+
proves the transfer, not who built the bytes: every release binary also
|
|
1843
|
+
carries a Sigstore-signed build-provenance attestation, checked with
|
|
1844
|
+
`gh attestation verify vx-<target> --repo vznjs/vx`. Named
|
|
1845
|
+
`upgrade` per CLI convention (`bun upgrade`, `deno upgrade`). Refuses
|
|
1846
|
+
when running from source — use `git pull` — and when the binary is
|
|
1847
|
+
npm's: an npm install runs the platform package's compiled binary
|
|
1848
|
+
under `node_modules`, and a rename over that file lasts until the next
|
|
1849
|
+
`npm install` puts the version npm knows back, so `vx upgrade` there
|
|
1850
|
+
says `this vx was installed by npm … Update with: npm install -g
|
|
1851
|
+
@vzn/vx@latest`. A host it cannot reach (no route, a proxy that is
|
|
1852
|
+
down) is one line — `could not reach api.github.com to read the
|
|
1853
|
+
release (…) — check the network or the proxy and re-run` — never a
|
|
1854
|
+
stack; so is a release document cut after the headers arrived or not
|
|
1855
|
+
JSON (a captive portal's page served with a 200): `could not read the
|
|
1856
|
+
release from api.github.com (…) — nothing replaced; …`, and an asset
|
|
1857
|
+
download cut the same way: `could not download the release asset from
|
|
1858
|
+
github.com (…) — nothing replaced; …`. A binary whose directory this
|
|
1859
|
+
user cannot write (a root-owned `/usr/local/bin`) is refused before the
|
|
1860
|
+
download: `cannot write to <dir> (EACCES), where this vx lives — nothing
|
|
1861
|
+
downloaded; re-run as a user who can (sudo vx upgrade), …`. The new binary
|
|
1862
|
+
keeps the old one's mode (and, as root, its owner), and must answer
|
|
1863
|
+
`--version` before the upgrade reports it installed: one that does not
|
|
1864
|
+
start on this machine — or does not answer within 10 s — is swapped back
|
|
1865
|
+
for the previous vx, and the command exits 1 saying so (item 1097). On the version it already is
|
|
1866
|
+
it says `already at <version>` and downloads nothing; a second tag is
|
|
1867
|
+
refused rather than ignored; and GitHub's hourly API limit for an
|
|
1868
|
+
unauthenticated address is named, with its reset time, instead of a
|
|
1869
|
+
bare `(403)` (item 1098).
|
|
1870
|
+
|
|
1871
|
+
Exit codes: `0` the new binary installed, or already at that version;
|
|
1872
|
+
`1` anything refused or swapped back: from source, from npm, a host it
|
|
1873
|
+
cannot reach, a directory it cannot write, a digest that does not match,
|
|
1874
|
+
a binary that does not start.
|
|
1875
|
+
|
|
1876
|
+
## `vx init`
|
|
1877
|
+
|
|
1878
|
+
In a Turbo or Nx repo (a `turbo.json`, `turbo.jsonc` or `nx.json` at
|
|
1879
|
+
the root) it runs `@vzn/vx-migrate`, so `vx init` is the one command
|
|
1880
|
+
(owner, 2026-10-08): the installed one, else this vx's version through
|
|
1881
|
+
`bun x` (`BUN_BE_BUN=1` makes the compiled binary that runtime). It asks a
|
|
1882
|
+
terminal native (a `vx.config.ts` per package, the default) or keep;
|
|
1883
|
+
`--native` or `--keep` answer it, and without a terminal it is native.
|
|
1884
|
+
`--dry`, `--format`, `--force` and `--mjs` pass through.
|
|
1885
|
+
|
|
1886
|
+
`vx init --dry --format json` prints the plan as one JSON document
|
|
1887
|
+
(`schemas/init.json`), nothing written: `files` (each path and its
|
|
1888
|
+
whole text), `kept`, `replaced`, `todos` (a reason and its tasks),
|
|
1889
|
+
`notes` and `next`. In a Turbo or Nx repo it is `@vzn/vx-migrate`'s
|
|
1890
|
+
plan. `--format json` without `--dry`, or with `--plugin`, is refused
|
|
1891
|
+
(`VX_E_USAGE`).
|
|
1892
|
+
Run again after the native migration (a workspace file that declares
|
|
1893
|
+
neither `turbo()` nor `nx()`, and project configs), it says vx is already
|
|
1894
|
+
set up and prints the next step, exit 0, without starting
|
|
1895
|
+
`@vzn/vx-migrate`; `--force` regenerates the files.
|
|
1896
|
+
|
|
1897
|
+
`vx init --keep` writes `vx.workspace.ts` declaring `turbo()` or `nx()`
|
|
1898
|
+
from `@vzn/vx-migrate` and nothing else: those read the repo's own
|
|
1899
|
+
config live, so no task is copied — a temporary start until
|
|
1900
|
+
`vx init --native` writes native config. `--native` or `--keep` in any
|
|
1901
|
+
other repo is refused. The `next:` line is one command:
|
|
1902
|
+
install what the file imports and is missing, with the manager the
|
|
1903
|
+
lockfile names (at the workspace root: pnpm's `-w`, Yarn 1's `-W`,
|
|
1904
|
+
which Yarn Berry lacks), then run the config's `build` (else its first task).
|
|
1905
|
+
An existing workspace file is kept and named unless it already
|
|
1906
|
+
declares the plugin; `--force` replaces it. When the repo shows a remote
|
|
1907
|
+
cache — turbo.json's `remoteCache`, a `.turbo/config.json` naming a
|
|
1908
|
+
team or token (`turbo link` writes it), or a line setting `TURBO_TOKEN` /
|
|
1909
|
+
`NX_SELF_HOSTED_REMOTE_CACHE_SERVER` (`NAME:` or `NAME=`, not a comment)
|
|
1910
|
+
in `.github/workflows/*`, `.gitlab-ci.yml` or `.circleci/config.yml`,
|
|
1911
|
+
and turbo.json does not say `remoteCache.enabled: false` — it
|
|
1912
|
+
declares `turboCache()` / `nxCache()` beside the runner and names the
|
|
1913
|
+
file that showed it (a kept file lacking it is told to add it); the
|
|
1914
|
+
plugin is inert where its variable is unset. An nx.json that connects
|
|
1915
|
+
Nx Cloud (`nxCloudId`, `nxCloudAccessToken`, the `nx-cloud` runner) is
|
|
1916
|
+
named instead: vx does not speak its wire, so runs cache locally.
|
|
1917
|
+
|
|
1918
|
+
Anywhere else it scaffolds a workspace that comes from nowhere: one `vx.config.ts` per
|
|
1919
|
+
package from its `package.json` scripts, plus a `vx.workspace.ts` of
|
|
1920
|
+
`{ plugins: [] }`: running and caching here are the floor, so it
|
|
1921
|
+
declares no executor or cache, and the file carries no comment (it is
|
|
1922
|
+
the user's). `@vzn/vx-migrate` takes the
|
|
1923
|
+
same `--dry` / `--force` flags but reads a runner's config (turbo, nx);
|
|
1924
|
+
package.json scripts are `init`'s. A workspace with no scripts at
|
|
1925
|
+
all still gets the workspace file, a printed example config, and the
|
|
1926
|
+
next command to run. A root
|
|
1927
|
+
`package.json` with no `workspaces` field is single-project mode, and
|
|
1928
|
+
when `packages/*/package.json` files sit below it unreached, both
|
|
1929
|
+
`init` and a run that finds no config say so instead ("package.json
|
|
1930
|
+
declares no workspaces … Add "workspaces": ["packages/*"] to
|
|
1931
|
+
package.json and re-run") rather than "no scripts" or "run vx init". A
|
|
1932
|
+
workspace whose globs match no `package.json` gets a note naming them
|
|
1933
|
+
(M-42); a nameless member, or two sharing a name, is matched and
|
|
1934
|
+
named on its own line instead (M-46). When such skipped scripts are all there
|
|
1935
|
+
is, the report opens `no package.json scripts became tasks.` rather than
|
|
1936
|
+
saying there are none (M-59). When `pnpm-workspace.yaml` lists the
|
|
1937
|
+
members and the root `package.json`'s `workspaces` lists other globs,
|
|
1938
|
+
the note names the unread list (M-51): pnpm reads only the yaml, while
|
|
1939
|
+
bun, npm and yarn read `package.json`. With
|
|
1940
|
+
no `package.json` here or above, `init` says to create one (`bun init` or
|
|
1941
|
+
`npm init -y`) first. Every
|
|
1942
|
+
generated config is typed for the editor through
|
|
1943
|
+
`import type { ProjectConfig } from '@vzn/vx/config'` and `satisfies
|
|
1944
|
+
ProjectConfig` — a type-only import Bun erases, so the file loads in a
|
|
1945
|
+
workspace that runs the `vx` binary without the package installed. The
|
|
1946
|
+
workspace file takes the same form (`satisfies WorkspaceConfig`). A
|
|
1947
|
+
runtime `import { defineWorkspace } from '@vzn/vx'` costs nothing extra
|
|
1948
|
+
since 2026-09-10: the running `vx` serves its own core to that
|
|
1949
|
+
specifier (bin.ts registers the alias), so a config or a plugin package
|
|
1950
|
+
never loads a second copy, and a workspace that runs the binary needs
|
|
1951
|
+
no `@vzn/vx` installed for it — the type-only form is still what the
|
|
1952
|
+
scaffold writes, because it types the same with no import to resolve
|
|
1953
|
+
in an editor without the package. A workspace that imports a PLUGIN
|
|
1954
|
+
package at runtime without having installed it is told so, and to
|
|
1955
|
+
install its dependencies. `--mjs` writes the same objects as `vx.config.mjs` and
|
|
1956
|
+
`vx.workspace.mjs`, with no type import and no `satisfies`: a package whose
|
|
1957
|
+
own `tsconfig` includes every `.ts` under it compiles a `vx.config.ts`
|
|
1958
|
+
into its dist (TanStack/query's `tsc --build`, 2026-09-11), and an
|
|
1959
|
+
`.mjs` is outside that include. `@vzn/vx-migrate` takes the same flag.
|
|
1960
|
+
|
|
1961
|
+
Each script becomes a task with its command verbatim. `build` gets
|
|
1962
|
+
`dependsOn: ['^build']` (a `build` that only delegates, `pnpm run
|
|
1963
|
+
compile`, is a group, and the edge goes on the script that does the
|
|
1964
|
+
work) and **no cache block** — under a
|
|
1965
|
+
`TODO(vx-migrate)` showing the block to add with the package's real
|
|
1966
|
+
inputs and outputs. A task without a cache block always runs; a block
|
|
1967
|
+
with EMPTY outputs is not "uncached" but a no-output task that hits on
|
|
1968
|
+
unchanged inputs and skips the build with nothing to restore (a deleted
|
|
1969
|
+
`dist` stays deleted under a green `up-to-date` run — what `init`
|
|
1970
|
+
generated until 2026-09-04), and a guessed `dist/**` would restore the
|
|
1971
|
+
wrong tree for every package that writes elsewhere. The block the TODO
|
|
1972
|
+
shows names `dist/**`, or the default output of the framework the command
|
|
1973
|
+
runs: `.next/**` minus `!.next/cache/**` for `next build`, `.output/**`
|
|
1974
|
+
for Nuxt, `build/**` for Remix, React Router, Create React App and
|
|
1975
|
+
Docusaurus, `public/**` for Gatsby, `storybook-static/**` for Storybook;
|
|
1976
|
+
for any other command, the directory it names with `--outDir` / `--out-dir`
|
|
1977
|
+
/ `-d`, else the ones it cleans first (`del-cli distribution`, `rimraf lib
|
|
1978
|
+
types`), unless it makes one again with `mkdir` (D-90).
|
|
1979
|
+
A package in a cycle of builds (nuxt's `@nuxt/nitro-server` devDepends
|
|
1980
|
+
on `nuxt`, which depends on it; pnpm sorts it away) gets, instead of
|
|
1981
|
+
`^build`, an edge to each build outside its cycle that `^build` would
|
|
1982
|
+
reach, and a TODO to order the cycle: `^build` there refuses the run.
|
|
1983
|
+
`test` / `typecheck` wait for
|
|
1984
|
+
`build` when the package has one (`lint` reads sources and gets no
|
|
1985
|
+
edge); `dev` / `start` / `serve` / `watch` /
|
|
1986
|
+
`preview` become persistent tasks, with a TODO to add `readyWhen` when
|
|
1987
|
+
another task depends on one, and so does a watcher: a `watch` segment in the script's name (`build:watch`),
|
|
1988
|
+
a `--watch` flag, `tsc -w` / `rollup -w`, or nodemon (D-40), and a server:
|
|
1989
|
+
`serve <dir>`, `http-server`, bare `vite`, a tool's `dev` / `serve` /
|
|
1990
|
+
`start` / `preview` verb (`next start`, `netlify dev`), or a script that
|
|
1991
|
+
runs such a script of its package by name (`cross-env X=1 pnpm start`) or
|
|
1992
|
+
through a runner (`run-p web api`, `concurrently "npm:web" "npm:api"`, D-113),
|
|
1993
|
+
outside quotes and not sent to the background with `&` (D-91), read past
|
|
1994
|
+
a launcher's `--package <name>` / `-p <name>` (`pnpm dlx --package
|
|
1995
|
+
netlify-cli netlify dev`, D-112). A
|
|
1996
|
+
script whose name no task may carry (`lint#fix`, `^up`; the schema's
|
|
1997
|
+
rule, item 1000) is left out with a TODO rather than written into a
|
|
1998
|
+
config every later command refuses, and a `__proto__` script is written
|
|
1999
|
+
as a computed key, since a literal `__proto__:` sets the prototype. An
|
|
2000
|
+
existing `vx.workspace.*` in any extension the loader reads (`.mts`
|
|
2001
|
+
included) is kept, and `--force` REPLACES a package's config of another
|
|
2002
|
+
extension (`replaced:` in the report) rather than writing a second one
|
|
2003
|
+
the loader would choose between by its order (item 1033). Without
|
|
2004
|
+
`--force`, `init` never overwrites: a package that already has a vx
|
|
2005
|
+
config keeps it, untouched, the rest get theirs, and the report lists
|
|
2006
|
+
the kept ones under `kept`, so a half-adopted workspace adopts the rest
|
|
2007
|
+
(M-52). `@vzn/vx-migrate` still refuses an existing config.
|
|
2008
|
+
|
|
2009
|
+
A missing `vx.workspace.*` is not an error. A run where no package has
|
|
2010
|
+
a config fails before any task, exit 1:
|
|
2011
|
+
``vx run: no projects declare task(s): build. No package declares a vx.config — run `vx init` to write one per package from its package.json scripts.``
|
|
2012
|
+
|
|
2013
|
+
Two npm conventions are mapped rather than copied, because copying them
|
|
2014
|
+
loses behaviour. `pre<x>` / `post<x>` hooks, which npm runs around `x`
|
|
2015
|
+
without being named, are folded into `x`'s command in that order, each
|
|
2016
|
+
in its own subshell, so the chain stops at the first that fails whatever
|
|
2017
|
+
a part holds (a `;`, an `exit`), and forwarded `--` args reach `x` alone,
|
|
2018
|
+
as npm hands them to the script and not its hooks (item 905), appended
|
|
2019
|
+
as text, so no part sees them as `$1` (X-60). The
|
|
2020
|
+
command is a small shell function, `vx_script`, around the three parts;
|
|
2021
|
+
it carries a TODO saying so; a `pre<x>` with no `x` stays a task of its own, and
|
|
2022
|
+
npm's lifecycle hooks (`prepack`, `prepublishOnly`, …) are never tasks.
|
|
2023
|
+
A member with no script to run (none, or only lifecycle hooks: a
|
|
2024
|
+
types-only or config package) gets no `vx.config.ts` and is named in
|
|
2025
|
+
the report; it is still a project, and a task declared in its own
|
|
2026
|
+
`vx.config.ts` runs. A package with no `build` script whose `prepack`, `prepublishOnly`,
|
|
2027
|
+
`prepublish` or `prepare` runs a builder (`bob build`, `tsc`, `tsup`, …)
|
|
2028
|
+
is named in the report, which says to add a `build` script running it
|
|
2029
|
+
(react-navigation's twelve packages, whose root `build` is `lerna run
|
|
2030
|
+
prepack`, mapped with no build at all).
|
|
2031
|
+
Where the package's manager runs no such hooks every `pre<x>` and
|
|
2032
|
+
`post<x>` is a task of its own: Yarn 2+ (the nearest `packageManager:
|
|
2033
|
+
yarn@2+`, or a Berry `yarn.lock`, D-31; a `packageManager` naming none of npm,
|
|
2034
|
+
pnpm, yarn or bun defers to the lockfile, D-96), npm under `ignore-scripts=true`
|
|
2035
|
+
in the `.npmrc` beside its lockfile, pnpm under
|
|
2036
|
+
`enable-pre-post-scripts=false` there or `enablePrePostScripts: false` in
|
|
2037
|
+
`pnpm-workspace.yaml` (D-33). Bun and Yarn 1 run them whatever those say.
|
|
2038
|
+
Under Yarn 2+ a segment's `run <script>`, Yarn's shell builtin, is written
|
|
2039
|
+
`yarn run <script>`: vx's shell has no `run` (D-92).
|
|
2040
|
+
A Yarn 2+ repo on Plug'n'Play (no `nodeLinker: node-modules` or `pnpm` in
|
|
2041
|
+
`.yarnrc.yml`) keeps its bins in `.pnp.cjs`, where vx's PATH finds none;
|
|
2042
|
+
the report says so and names `nodeLinker: node-modules` or `yarn exec
|
|
2043
|
+
'<command>'` (D-108).
|
|
2044
|
+
A script reading `$npm_package_version`, `$npm_package_name` or
|
|
2045
|
+
`$npm_lifecycle_event`, which every manager sets and vx does not, gets
|
|
2046
|
+
them under `exec.env.define`, the first two read from an imported
|
|
2047
|
+
`package.json` so a version bump reaches them; any other `$npm_*` it
|
|
2048
|
+
reads gets a TODO (D-34). Among several packages, a workspace root
|
|
2049
|
+
script that runs the members (`pnpm -r build`, `--filter`, `-C`, pnpm's `pn` alias
|
|
2050
|
+
included (D-97), Yarn's
|
|
2051
|
+
`--cwd` and `yarn workspace <name>`, npm's `--prefix`, npm's
|
|
2052
|
+
and Yarn's workspace flags, a `cd` into or above a member, turbo, nx, lerna, `vp run`, vx itself) is not mapped
|
|
2053
|
+
(a flag counts on the package manager, or after `node <bin> run`, and not on the program it
|
|
2054
|
+
runs: berry's `yarn node -r ./setup.ts` is node's `--require`, D-81; bun's
|
|
2055
|
+
`cd test && …` enters no member, D-83),
|
|
2056
|
+
nor is one that runs such a script by name (vite's `ci-docs`: `pnpm build &&
|
|
2057
|
+
pnpm docs-build`; through `run-s` / `run-p` / `npm-run-all` or `concurrently
|
|
2058
|
+
"npm:x"` too, lexical's `ci-check`, D-95), and neither is one whose name a member's task carries, so `--all` never runs
|
|
2059
|
+
a check twice (D-45). The rest check the whole repo (`lint: oxlint .`,
|
|
2060
|
+
`test: vitest`) and become the root's own tasks in a root vx.config, when
|
|
2061
|
+
the root has a `"name"` (vx skips a nameless root's config) and no config
|
|
2062
|
+
of its own; one already there, hand-written or from an earlier
|
|
2063
|
+
`vx init`, stays as written, `--force` included, and is listed under
|
|
2064
|
+
`kept`. The report names each script left out and why
|
|
2065
|
+
(a `pre` / `post` hook goes with its script, D-85), its examples of running
|
|
2066
|
+
the members spelled by the repo's manager (`--workspaces` under npm, `yarn
|
|
2067
|
+
workspaces foreach` under Yarn 2+), and says which;
|
|
2068
|
+
with nothing mapped it names the root whenever it has a script, a member
|
|
2069
|
+
or not (pnpm's root is not), and why: its scripts run the workspace, or
|
|
2070
|
+
share a member's task name (listed), or both; it tells a root with no `"name"` to add one
|
|
2071
|
+
first (vuejs/core), naming the scripts that would then map (react, D-87), and a root whose
|
|
2072
|
+
`"name"` a member also carries to rename it, since a root config would make the
|
|
2073
|
+
workspace refuse every run for the duplicate (insomnia, D-129). A single-package repo's root is its project and maps.
|
|
2074
|
+
A lone root beside a `lerna.json` (Lerna-classic: packages listed there, not
|
|
2075
|
+
in `workspaces`) gets a note naming the `workspaces` globs to add, Lerna's
|
|
2076
|
+
`packages/*` default when it lists none (D-111).
|
|
2077
|
+
A member whose package.json has no `name` is no project; one with a
|
|
2078
|
+
script is named in the report, to be given a name (remix's
|
|
2079
|
+
`packages/component/bench`, D-106).
|
|
2080
|
+
A member's script that runs another member's work (`pnpm -C ../pinia
|
|
2081
|
+
run build`, `yarn workspace <name>`, `-r` / `--filter`, a `cd` or `-C`
|
|
2082
|
+
/ `--cwd` / `--prefix` into another member) keeps its command and gets a
|
|
2083
|
+
TODO naming that part: the graph runs that member's task once, so name it
|
|
2084
|
+
under `dependsOn` and drop it from the command (pinia). A directory inside
|
|
2085
|
+
the member or the root is no other member.
|
|
2086
|
+
A script that is nothing but `npm run <other>` (`pnpm <other>`, `yarn
|
|
2087
|
+
<other>`, `bun run <other>`, `npm test`, `npm start`) becomes a **group**
|
|
2088
|
+
over `<other>` — `dependsOn` and no command — so the graph runs and
|
|
2089
|
+
caches the target instead of a package-manager subprocess it cannot
|
|
2090
|
+
see. When `build` is such a group, the task it reaches that runs a
|
|
2091
|
+
command takes `^build` and the cache TODO, since a group has nothing
|
|
2092
|
+
to cache; it and the groups on the way drop the wait on `build` a
|
|
2093
|
+
`typecheck` or `test` would carry, since they are the build (D-16). Bare, a package manager's own command is not a script: `bun test`
|
|
2094
|
+
is Bun's test runner, `bun build` its bundler, `pnpm install` and `yarn
|
|
2095
|
+
add` the managers' verbs, so each stays a command (item 908), and so do
|
|
2096
|
+
the names each manager reserves or hands on: `pnpm docs` and `pnpm
|
|
2097
|
+
version` (npm's), `bun deploy`, `yarn check` (D-32); `pnpm test`, `yarn
|
|
2098
|
+
test` and `bun lint` do run the script. Arguments, flags or a `&&`
|
|
2099
|
+
chain make it a real command again and
|
|
2100
|
+
it is left verbatim, and so is one whose target becomes no task (a
|
|
2101
|
+
lifecycle script, or a hook folded into another script): a group over
|
|
2102
|
+
it would name a task nothing defines (D-12). A verbatim chain whose
|
|
2103
|
+
parts run this package's own scripts (`check: pnpm run build && pnpm run
|
|
2104
|
+
lint`) gets a TODO naming those parts: each ran again inside the command,
|
|
2105
|
+
beside its own task, so `vx run check` built twice (M-41). So does a
|
|
2106
|
+
part that runs them through `run-s`, `run-p` or `npm-run-all`
|
|
2107
|
+
(`build: run-p build:*`), unless the task is persistent (M-48). Its
|
|
2108
|
+
order may matter, so it is not made a group.
|
|
2109
|
+
|
|
2110
|
+
The report lists each TODO once per reason: tasks that share one are
|
|
2111
|
+
named together (the first five, then a count; the files carry each),
|
|
2112
|
+
and when no task caches it says a cache block from a TODO makes the
|
|
2113
|
+
second run a hit. Its `next:` line is a command the user can type: the
|
|
2114
|
+
runner that started vx (`npx`, `pnpm`, `yarn`, `bunx`, read from
|
|
2115
|
+
`npm_config_user_agent`) with the installed `vx` bin, else the
|
|
2116
|
+
`@vzn/vx` package (`npx` under Yarn 1, which has no `dlx`); with no
|
|
2117
|
+
runner, a bare `vx`. Outside a git work tree it starts with
|
|
2118
|
+
`git init`, and with no script mapped with declaring a task, since the
|
|
2119
|
+
run would refuse without either. It runs `build`, else the first task that
|
|
2120
|
+
neither serves (`persistent`) nor changes the repo (`clean`, `release`,
|
|
2121
|
+
`publish`, `deploy`, `version`, `format`, `fix`, …), else the first task
|
|
2122
|
+
(react-navigation was told `vx run clean --all`).
|
|
2123
|
+
|
|
2124
|
+
`vx init --plugin <seam>` writes a plugin instead: `plugins/<seam>.ts`,
|
|
2125
|
+
a small runnable plugin for that seam (`executor`, `cache`,
|
|
2126
|
+
`telemetry`, `schedule`, `admit`, `commands`, `project`, `graph`,
|
|
2127
|
+
`key`), and `plugins/<seam>.test.ts`, which drives it through `run()`
|
|
2128
|
+
(`bun test`, with `@vzn/vx` installed). It prints the line that
|
|
2129
|
+
declares it in the workspace file a run reads (`vx.workspace.ts` when
|
|
2130
|
+
there is none). The templates are TypeScript, so `--mjs` with
|
|
2131
|
+
`--plugin` is refused. An existing file is refused without
|
|
2132
|
+
`--force`; `--dry` names the files and writes nothing. The two files are
|
|
2133
|
+
`packages/vx-plugin-examples/plugins`, which the gate runs, copied into
|
|
2134
|
+
core (`src/cli/plugin-templates.ts`) and held equal by
|
|
2135
|
+
`tests/plugin-templates.unsafe.test.ts` (H-21).
|
|
2136
|
+
|
|
2137
|
+
Exit codes: `0` the files written (or, with `--dry`, printed); `1` no
|
|
2138
|
+
`package.json` here or in a parent, a file it would write already there
|
|
2139
|
+
without `--force`, or a parse error (`--mjs` with `--plugin` among them).
|
|
2140
|
+
|
|
2141
|
+
## `vx migrate`
|
|
2142
|
+
|
|
2143
|
+
Moved out of core on 2026-09-10: the Turbo and Nx mappers are
|
|
2144
|
+
`@vzn/vx-migrate`, their own package, run without a workspace file —
|
|
2145
|
+
|
|
2146
|
+
```
|
|
2147
|
+
bunx @vzn/vx-migrate # turbo.json, an Nx graph or vite-plus run.tasks → vx.config.ts
|
|
2148
|
+
bunx @vzn/vx-migrate --dry # print the generated files instead of writing
|
|
2149
|
+
bunx @vzn/vx-migrate --force # overwrite existing vx.config.* / vx-preset.ts
|
|
2150
|
+
bunx @vzn/vx-migrate --from nx # disambiguate when both runners are checked in
|
|
2151
|
+
```
|
|
2152
|
+
|
|
2153
|
+
— and `package.json` scripts are `vx init` (above). Typing `vx migrate`
|
|
2154
|
+
prints that pointer and exits 1. What the package writes reads exactly
|
|
2155
|
+
like what `vx init` writes: both hand a plan to core's migration seam
|
|
2156
|
+
(`applyMigration`, exported from `@vzn/vx`), which renders, guards
|
|
2157
|
+
against overwriting, writes and reports. The mapping rules live in the
|
|
2158
|
+
package's README.
|
|
2159
|
+
|
|
2160
|
+
## Turbo and Nx flags
|
|
2161
|
+
|
|
2162
|
+
What a Turbo, Nx or Vite Task (`vp run`) user types into `vx run` (and `vx watch`): each flag
|
|
2163
|
+
vx takes as it is (`same`), rewrites to its own spelling before the
|
|
2164
|
+
parse (`alias`), or refuses with the vx way to say it (`refuse`) —
|
|
2165
|
+
none is dropped in silence. An Nx flag's camelCase spelling (`--nxBail`,
|
|
2166
|
+
`--skipNxCache`), which Nx's parser takes and its docs print, is its
|
|
2167
|
+
kebab-case row. A `[=<bool>]` row takes `=true` (the flag bare) and `=false` (left out), as Turbo's and Nx's parsers do. `vx run-many` and `vx affected` name the
|
|
2168
|
+
`vx run` that does the same, and the other verbs a hand types from
|
|
2169
|
+
either tool name what does it here: `graph` (`--graph`), `ls`
|
|
2170
|
+
(`vx show`), `query` (`--dry=json`), `reset` (`vx cache prune`), and
|
|
2171
|
+
`daemon`, `login`, `logout`, `link` and `unlink`, which vx has no use
|
|
2172
|
+
for. Nx's `project:target` (`vx run web:build`,
|
|
2173
|
+
when `web` declares `build`) is answered with `vx run web#build`: from
|
|
2174
|
+
outside a project in place of "not inside a project", in scope as the
|
|
2175
|
+
unresolved name's `Did you mean`. A name that is no project but ends
|
|
2176
|
+
the one scoped package (`cart` for `@nx-example/cart`, as Nx names it)
|
|
2177
|
+
means that package there and in `vx build cart`. The table is `cli/foreign-flags.ts`,
|
|
2178
|
+
rendered; `tests/foreign-flags.test.ts` drives every row and holds this
|
|
2179
|
+
copy to the source.
|
|
2180
|
+
|
|
2181
|
+
| runner | flag | outcome | in vx |
|
|
2182
|
+
| ------ | ------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2183
|
+
| turbo | `--filter <v>` | same | `--filter`, the same grammar (`...[ref]`, `{dir}`, `^`, `!`) |
|
|
2184
|
+
| turbo | `-F <v>` | alias | `--filter <v>` |
|
|
2185
|
+
| turbo | `--concurrency <v>` | same | `--concurrency <n\|n%>` |
|
|
2186
|
+
| turbo | `--continue=dependencies-successful` | alias | `--continue=deps-ok` |
|
|
2187
|
+
| turbo | `--continue` | same | `--continue[=never\|deps-ok\|always]` |
|
|
2188
|
+
| turbo | `--dry-run` | alias | `--dry[=text\|json]` |
|
|
2189
|
+
| turbo | `--graph=<file>.svg\|png\|json\|html\|…` | refuse | vx writes Graphviz DOT only: `--graph=<file>.dot`, then `dot -Tsvg` |
|
|
2190
|
+
| turbo | `--graph` | same | `--graph[=<file>.dot]` |
|
|
2191
|
+
| turbo | `--force[=<bool>]` | same | `--force`: skip cache reads, keep writes |
|
|
2192
|
+
| turbo | `--affected` | same | `--affected[=<base>]` |
|
|
2193
|
+
| turbo | `--summarize[=<bool>]` | same | `--summarize[=<path>]` |
|
|
2194
|
+
| turbo | `--output-logs=new-only` | refuse | use `--output-logs=full` (a hit replays its log) or `errors-only` |
|
|
2195
|
+
| turbo | `--output-logs <v>` | same | `--output-logs full\|errors-only\|hash-only\|none` |
|
|
2196
|
+
| turbo | `--no-cache` | same | `--no-cache` reads nothing either; Turbo's (reads, no writes) is `--cache local:r,remote:r` |
|
|
2197
|
+
| turbo | `--cache <v>` | same | `--cache local:rw,remote:r` |
|
|
2198
|
+
| turbo | `--cache-dir <v>` | same | `--cache-dir <path>` |
|
|
2199
|
+
| turbo | `--profile` | same | `--profile[=<path>]` (Chrome trace) |
|
|
2200
|
+
| turbo | `--only` | alias | `--exclude-dependencies` |
|
|
2201
|
+
| turbo | `--color` | refuse | set `FORCE_COLOR=1` |
|
|
2202
|
+
| turbo | `--no-color` | refuse | set `NO_COLOR=1` |
|
|
2203
|
+
| turbo | `--heap <v>`, `--trace <v>` | refuse | use `--profile[=<path>]` for vx's own trace |
|
|
2204
|
+
| turbo | `--login <v>` | refuse | vx has no login: a remote cache is a plugin (`turboCache()` from @vzn/vx-migrate) |
|
|
2205
|
+
| turbo | `--no-update-notifier` | refuse | vx prints no update notice: drop it |
|
|
2206
|
+
| turbo | `--skip-infer` | refuse | vx runs the binary it is: drop it |
|
|
2207
|
+
| turbo | `--root-turbo-json <v>` | refuse | `turbo()` reads the `turbo.json` at the workspace root: move it there |
|
|
2208
|
+
| turbo | `--experimental-otel-*` | refuse | telemetry is a plugin: `otel()` from @vzn/vx-otel in vx.workspace.ts |
|
|
2209
|
+
| nx | `--parallel <n>` | alias | `--concurrency <n>` (`--parallel=false` is 1) |
|
|
2210
|
+
| turbo | `--parallel` | refuse | vx always honours `dependsOn`; `--concurrency <n>` sets how many run at once |
|
|
2211
|
+
| turbo | `--scope <v>` | refuse | use `--filter <pkg>` |
|
|
2212
|
+
| turbo | `--since <v>` | refuse | use `--filter '[<ref>]'` or `--affected=<ref>` |
|
|
2213
|
+
| turbo | `--remote-only[=<bool>]` | refuse | use `--cache local:,remote:rw` |
|
|
2214
|
+
| turbo | `--remote-cache-read-only[=<bool>]` | refuse | use `--cache local:rw,remote:r` |
|
|
2215
|
+
| turbo | `--anon-profile` | refuse | use `--profile[=<path>]`; vx has no redacting variant, so read it before sharing it |
|
|
2216
|
+
| turbo | `--cache-workers <v>` | refuse | vx sizes its own cache I/O: drop it |
|
|
2217
|
+
| turbo | `--cwd <v>` | refuse | run vx from that directory: `cd <dir> && vx run …` |
|
|
2218
|
+
| turbo | `--dangerously-disable-package-manager-check` | refuse | vx reads no `packageManager` field: drop it |
|
|
2219
|
+
| turbo | `--env-mode <v>` | refuse | vx passes only the variables a task declares (strict): list the rest in `exec.env.passThrough` |
|
|
2220
|
+
| turbo | `--framework-inference <v>` | refuse | under `turbo()` inference is Turbo's; take a name back with a `!` entry in the task's `env` |
|
|
2221
|
+
| turbo | `--global-deps <v>` | refuse | declare them in `cache.inputs.workspaceFiles` (under `turbo()`, turbo.json's `globalDependencies`) |
|
|
2222
|
+
| turbo | `--json` | refuse | use `--format json` for the run's result on stdout, `--dry=json` for the plan |
|
|
2223
|
+
| turbo | `--log-file` | refuse | use `--summarize[=<path>]` for the run's JSON record |
|
|
2224
|
+
| turbo | `--preflight` | refuse | set `turboCache({ preflight: true })` or `TURBO_PREFLIGHT=1` |
|
|
2225
|
+
| turbo | `--remote-cache-timeout <v>` | refuse | set `turboCache({ timeoutMs })` or `TURBO_REMOTE_CACHE_TIMEOUT` |
|
|
2226
|
+
| turbo | `--single-package` | refuse | a repo with no workspaces is one project already: drop it |
|
|
2227
|
+
| turbo | `--token <v>`, `--team <v>`, `--api <v>` | refuse | a remote cache is a plugin: `turboCache()` from @vzn/vx-migrate in vx.workspace.ts reads TURBO_TOKEN / TURBO_TEAM / TURBO_API |
|
|
2228
|
+
| turbo | `--no-daemon`, `--daemon` | refuse | vx has no daemon: drop it |
|
|
2229
|
+
| turbo | `--ui <v>`, `--log-order <v>`, `--log-prefix <v>` | refuse | vx frames each task’s output: `--output-logs <mode>` sets how much |
|
|
2230
|
+
| nx | `-t <v>`, `--targets <v>`, `--target <v>` | alias | the task names, positional: `vx run build test` |
|
|
2231
|
+
| nx | `-p <v>`, `--projects <v>` | alias | `--filter <pattern>`, one per project (`directory:<d>` is `./<d>`, `name:<n>` is `<n>`); a list opening with `!` starts from all (`--filter '*'`) |
|
|
2232
|
+
| nx | `--exclude <v>` | alias | `--filter '!<pattern>'`, one per project |
|
|
2233
|
+
| nx | `--base <v>` | alias | `--affected=<ref>` |
|
|
2234
|
+
| nx | `--head HEAD` | alias | nothing: vx compares `--affected=<base>` with the working tree |
|
|
2235
|
+
| nx | `--head <v>` | refuse | vx compares `--affected=<base>` with the working tree: check out the head first |
|
|
2236
|
+
| nx | `--skip-nx-cache[=<bool>]` | alias | `--force` |
|
|
2237
|
+
| nx | `--all` | same | `--all` |
|
|
2238
|
+
| nx | `--nx-bail[=<bool>]` | alias | `--continue=never` |
|
|
2239
|
+
| nx | `-c <v>`, `--configuration <v>` | refuse | a configuration is its own task: `vx run <target>:<configuration>` |
|
|
2240
|
+
| nx | `--output-style <v>` | refuse | use `--output-logs <mode>` |
|
|
2241
|
+
| nx | `--uncommitted`, `--untracked` | refuse | use `--affected=HEAD` (the working tree against the last commit) |
|
|
2242
|
+
| nx | `--max-parallel <v>` | alias | `--concurrency <n>` |
|
|
2243
|
+
| nx | `--exclude-task-dependencies[=<bool>]` | alias | `--exclude-dependencies` |
|
|
2244
|
+
| nx | `--skip-remote-cache[=<bool>]` | alias | `--cache local:rw,remote:` |
|
|
2245
|
+
| nx | `--verbose` | refuse | use `--verbosity <n>` (1 adds the summary table) |
|
|
2246
|
+
| nx | `--files <v>` | refuse | vx asks git what changed: `--affected=<base>` |
|
|
2247
|
+
| nx | `--batch` | refuse | vx runs one command per task: drop it |
|
|
2248
|
+
| nx | `--dte`, `--use-agents` | refuse | vx distributes nothing: drop it |
|
|
2249
|
+
| nx | `--nx-ignore-cycles` | refuse | vx refuses a task cycle by name: break it |
|
|
2250
|
+
| nx | `--runner <v>` | refuse | a remote cache is a plugin: `nxCache()` from @vzn/vx-migrate in vx.workspace.ts |
|
|
2251
|
+
| nx | `--skip-sync` | refuse | vx never runs sync generators: drop it |
|
|
2252
|
+
| nx | `--tui`, `--no-tui`, `--tui-auto-exit` | refuse | vx frames each task’s output: `--output-logs <mode>` sets how much |
|
|
2253
|
+
| nx | `--no-cloud` | refuse | vx has no cloud: drop it |
|
|
2254
|
+
| vp | `-r`, `--recursive` | alias | `--all` |
|
|
2255
|
+
| vp | `-w`, `--workspace-root` | alias | `--filter //` (the root project) |
|
|
2256
|
+
| vp | `--concurrency-limit <v>` | alias | `--concurrency <n>` |
|
|
2257
|
+
| vp | `--ignore-depends-on` | alias | `--exclude-dependencies` |
|
|
2258
|
+
| vp | `--fail-if-no-match` | alias | nothing: a filter that matches nothing already fails the run |
|
|
2259
|
+
| vp | `--log <v>` | refuse | vx frames each task’s output: `--output-logs <mode>` sets how much |
|
|
2260
|
+
| vp | `--last-details` | refuse | `vx last` prints the last run |
|
|
2261
|
+
|
|
2262
|
+
## Machine-readable output
|
|
2263
|
+
|
|
2264
|
+
`vx show`, `vx info`, `vx why`, `vx last` and `vx cache prune` take
|
|
2265
|
+
`--format json`. Each prints one JSON document whose shape is a
|
|
2266
|
+
checked-in JSON Schema (draft 2020-12) shipped with the package:
|
|
2267
|
+
`schemas/show.json`, `schemas/info.json`, `schemas/why.json`,
|
|
2268
|
+
`schemas/last.json`, `schemas/cache.json`
|
|
2269
|
+
(`node_modules/@vzn/vx/schemas/` in an install). Every object closes its
|
|
2270
|
+
key set, so a field vx adds is a schema change, never a surprise.
|
|
2271
|
+
`tests/cli-json-schemas.test.ts` holds each verb's output to its schema,
|
|
2272
|
+
each declared field to some output, and each object's keys to the
|
|
2273
|
+
source type. `tests/cli-json-doc.test.ts` holds this page to the
|
|
2274
|
+
schemas: each `{ … }` a verb's section shows is an object its schema
|
|
2275
|
+
closes with those keys, each object the verb prints whole is shown, and
|
|
2276
|
+
`vx info`'s field list is its schema's top level.
|
|
2277
|
+
|
|
2278
|
+
`vx run --format json` prints, when the run ends, the `--summarize`
|
|
2279
|
+
document (`schemas/summary.json`: `runId`, `ok`, `exitCode`, one row per
|
|
2280
|
+
task with its status, exit code and key). Everything else the run writes,
|
|
2281
|
+
the frame and the tasks' output with it, goes to stderr, so
|
|
2282
|
+
`vx run build --all --format json | jq .ok` reads only the result. It
|
|
2283
|
+
refuses `--dry` (use `--dry=json`), a bare `--graph` and
|
|
2284
|
+
`--report=markdown`, which print on stdout too.
|
|
2285
|
+
|
|
2286
|
+
### Error codes
|
|
2287
|
+
|
|
2288
|
+
A verb asked for JSON (`--format json`, `--format=json`, `--dry=json`,
|
|
2289
|
+
before any `--`) answers a refusal on stdout too, as one line that
|
|
2290
|
+
`schemas/error.json` describes: `{"ok":false,"error":{"code","message"}}`.
|
|
2291
|
+
The exit code (1) and the prose on stderr do not change. Branch on the
|
|
2292
|
+
code; the message may change.
|
|
2293
|
+
|
|
2294
|
+
| Code | When |
|
|
2295
|
+
| ---------------------- | --------------------------------------------------------------------- |
|
|
2296
|
+
| `VX_E_USAGE` | A flag, argument or selection the verb does not take. |
|
|
2297
|
+
| `VX_E_UNKNOWN_COMMAND` | No verb of that name here, core's or a declared plugin's. |
|
|
2298
|
+
| `VX_E_UNKNOWN_TASK` | No project in scope declares a requested task. |
|
|
2299
|
+
| `VX_E_UNKNOWN_PROJECT` | `vx show` names a project the workspace does not have. |
|
|
2300
|
+
| `VX_E_NO_HISTORY` | `vx why` / `vx last` find no recorded run for what they were asked. |
|
|
2301
|
+
| `VX_E_AMBIGUOUS` | `vx why <task>` matches the task in several projects; name one. |
|
|
2302
|
+
| `VX_E_CONFIG` | A `vx.config.*` or `vx.workspace.*` that does not load or is refused. |
|
|
2303
|
+
| `VX_E_CYCLE` | The task graph has a cycle. |
|
|
2304
|
+
| `VX_E_NO_WORKSPACE` | No workspace root above the working directory. |
|
|
2305
|
+
| `VX_E_CACHE_VERSION` | A reading verb met a cache index from another vx version. |
|
|
2306
|
+
| `VX_E_REFUSED` | Any other refusal (a plugin's, a check's) with no code of its own. |
|
|
2307
|
+
| `VX_E_FS` | The file system refused a write: permissions, a full disk. |
|
|
2308
|
+
| `VX_E_FDS` | Out of file descriptors. |
|
|
2309
|
+
| `VX_E_INTERNAL` | A defect in vx; stderr carries the stack. |
|
|
2310
|
+
|
|
2311
|
+
A plugin can give its refusal a code: `new UserError(message, 'MY_CODE')`.
|
|
2312
|
+
|
|
2313
|
+
**Streams.** A verb whose stdout is a product (a `--format json`
|
|
2314
|
+
document, `--dry` / `--dry=json`, `--graph`'s DOT, a completion
|
|
2315
|
+
script) writes that product alone there; a notice or warning it meets
|
|
2316
|
+
on the way (a cache index from another vx version, a plugin's warning) goes
|
|
2317
|
+
to stderr, as every refusal does. `vx run`'s stdout is the run's frame,
|
|
2318
|
+
the tasks' output it carries, except under `--format json`, where that
|
|
2319
|
+
moves to stderr. `tests/cli-streams.test.ts` holds each
|
|
2320
|
+
product verb to it under a notice.
|
|
2321
|
+
|
|
2322
|
+
## `vx show`
|
|
2323
|
+
|
|
2324
|
+
Introspect the workspace's **live resolved configs** — what a run
|
|
2325
|
+
would see right now. Configs load through the same path a run uses,
|
|
2326
|
+
plugin `config` and `project` stages included, so a package a plugin
|
|
2327
|
+
gives tasks to (`turbo()` or `nx()` from `@vzn/vx-migrate`, a
|
|
2328
|
+
temporary start toward native config) shows them; cached
|
|
2329
|
+
evaluations are served from the local cache like a run's. `vx show`
|
|
2330
|
+
never reads `vx-lock.json` (the lock is already the frozen JSON — open
|
|
2331
|
+
it directly if you want the frozen view).
|
|
2332
|
+
|
|
2333
|
+
```
|
|
2334
|
+
vx show # list every project
|
|
2335
|
+
vx show <project> # one project's resolved config (`//`: the root project's)
|
|
2336
|
+
vx show <pkg>#<task> # a single task (`//#<task>`: the root project's)
|
|
2337
|
+
vx show <task> # that task in every project declaring it
|
|
2338
|
+
vx show [<task>] --filter <p> # only the projects `vx run --filter <p>` selects
|
|
2339
|
+
vx show <task> --affected # only the projects whose <task> `vx run <task> --affected` runs
|
|
2340
|
+
vx show --affected # the run's candidates: the changed projects and their dependents
|
|
2341
|
+
vx show ... --format json # machine-readable (default: pretty)
|
|
2342
|
+
```
|
|
2343
|
+
|
|
2344
|
+
`--filter` and `--affected[=<ref>]` narrow the list, or a task's
|
|
2345
|
+
projects, as `vx run` selects: `turbo ls --affected` is
|
|
2346
|
+
`vx show --affected`, and `nx show projects --affected --with-target t`
|
|
2347
|
+
is `vx show t --affected`. Beside a task, `--affected` lists the
|
|
2348
|
+
projects whose task the run keeps: a change reaches another project
|
|
2349
|
+
only along a task edge, so a dependent whose `test` has no `^test` is
|
|
2350
|
+
not listed (X-147). With no task there is no edge to follow, and the
|
|
2351
|
+
list is the run's candidates, `--filter "...[<base>]"`'s: the changed
|
|
2352
|
+
projects and their package dependents. Beside one project or
|
|
2353
|
+
`<pkg>#<task>` they are refused.
|
|
2354
|
+
|
|
2355
|
+
Nx's spellings name these: `vx show projects` (when no project or task
|
|
2356
|
+
has that name) and `vx show project <name>` say `vx show` and
|
|
2357
|
+
`vx show <name>`.
|
|
2358
|
+
|
|
2359
|
+
No target: one line per project — name, root-relative dir, task count,
|
|
2360
|
+
and a `(no vx config)` marker for config-less packages; one whose
|
|
2361
|
+
tasks all come from plugins reads `N tasks (no vx config; from
|
|
2362
|
+
plugins)`, and one a configured project depends on reads `1 task (no
|
|
2363
|
+
vx config; default build)`: a run loads it for that dependant's
|
|
2364
|
+
`^build` (X-48). A project's `tags` follow in brackets. With `--format json`
|
|
2365
|
+
it's an array of `{ name, dir, tags: string[], tasks: string[] }`.
|
|
2366
|
+
|
|
2367
|
+
```
|
|
2368
|
+
$ vx show
|
|
2369
|
+
app packages/app 3 tasks [scope:web]
|
|
2370
|
+
bare packages/bare (no vx config)
|
|
2371
|
+
```
|
|
2372
|
+
|
|
2373
|
+
Under its header `vx show <project>` prints its `tags`.
|
|
2374
|
+
`vx show <project>` prints a block per task with every field the run
|
|
2375
|
+
reads: description, command (`(group)` for group tasks), `dependsOn`,
|
|
2376
|
+
`timeout`, `retries`, `env.passThrough` / `env.define` / `env.secret`,
|
|
2377
|
+
`remote`, `sandbox`, `persistent`, `interactive` (`yes` / `no`), and the
|
|
2378
|
+
cache block
|
|
2379
|
+
(`inputs.files` / `.workspaceFiles` / `.env` / `.tasks` / `.runtime` /
|
|
2380
|
+
`.workspaceRuntime`, `outputs.files` / `.workspaceFiles`). Fields the
|
|
2381
|
+
task does not set are not printed; a value that spans lines (a
|
|
2382
|
+
multi-line command) continues under its first line. `--format json` emits `{ name, dir,
|
|
2383
|
+
config }` with the config exactly as resolved. `vx show <pkg>#<task>`
|
|
2384
|
+
narrows to one task (`{ name, dir, task, config }` in JSON). A bare
|
|
2385
|
+
name that is no project is a task: `vx show build` prints the block
|
|
2386
|
+
from every project declaring `build` (an array of the one-task shape
|
|
2387
|
+
in JSON). The default `build` is declared by none: it counts in the
|
|
2388
|
+
list and `vx show <project>`, but `vx show build`, like
|
|
2389
|
+
`vx run build --all`, does not name it (X-145).
|
|
2390
|
+
|
|
2391
|
+
```
|
|
2392
|
+
$ vx show app#build
|
|
2393
|
+
app — packages/app
|
|
2394
|
+
|
|
2395
|
+
build
|
|
2396
|
+
description: compile the app
|
|
2397
|
+
command: tsc -b
|
|
2398
|
+
dependsOn: ^build
|
|
2399
|
+
inputs.files: src/**
|
|
2400
|
+
inputs.env: NODE_ENV
|
|
2401
|
+
outputs.files: dist/**
|
|
2402
|
+
```
|
|
2403
|
+
|
|
2404
|
+
Unknown project / task names exit `1` with the same near-miss hint
|
|
2405
|
+
every verb gives (two edits, or a partial name); a bare name that is
|
|
2406
|
+
neither reads `unknown project or task: "buidl" — did you mean build?`,
|
|
2407
|
+
and a `pkg#task` hints whole specs (`unknown task: "app#bui" — did you
|
|
2408
|
+
mean app#build?`). With nothing near, it lists what exists instead: `unknown
|
|
2409
|
+
project: "zzz"; projects: app, lib`, `; its tasks: app#build, app#test`,
|
|
2410
|
+
or `; projects and tasks: …` (M-57).
|
|
2411
|
+
|
|
2412
|
+
An empty target (`vx show ''`) is refused: omit it to list every project.
|
|
2413
|
+
|
|
2414
|
+
Exit codes: `0` success; `1` parse error or unknown target.
|
|
2415
|
+
|
|
2416
|
+
Two runs on one workspace take turns: the second waits for the first's
|
|
2417
|
+
run lock and, after a second, says `[vx] waiting for another vx run
|
|
2418
|
+
(pid N) on this workspace to finish…` (see caching.md § Concurrent
|
|
2419
|
+
runs). The lock lives in this user's own directory in the temp
|
|
2420
|
+
directory, so two runs take turns only when they are one user's and
|
|
2421
|
+
share `TMPDIR`: a `nix develop` shell sets its own.
|
|
2422
|
+
|
|
2423
|
+
Every verb: a path vx must write that this user cannot (`EACCES`,
|
|
2424
|
+
`EPERM`, `EROFS` — a read-only checkout, another user's files) or that
|
|
2425
|
+
the disk has no room for (`ENOSPC`, `EDQUOT`) exits 1 with one line
|
|
2426
|
+
naming the path, `vx: EACCES: permission denied, open '…/vx-lock.json'
|
|
2427
|
+
— a path vx must write is not writable by this user` (or `— the disk
|
|
2428
|
+
that path is on is full`), never a stack. Inside a run the task's line
|
|
2429
|
+
says the same. A process out of file descriptors (`EMFILE`, `ENFILE`;
|
|
2430
|
+
macOS starts a shell at 256) exits 1 with the error and `— the process
|
|
2431
|
+
is out of file descriptors; raise the limit (ulimit -n 4096) and re-run`.
|
|
2432
|
+
|
|
2433
|
+
## `vx info`
|
|
2434
|
+
|
|
2435
|
+
Workspace doctor — one screen of facts for bug reports and sanity
|
|
2436
|
+
checks. The task count and the sandbox row's declared count come from
|
|
2437
|
+
the same load a run uses, plugin stages included; a config that fails
|
|
2438
|
+
to load counts as zero in both rather than failing the doctor, every
|
|
2439
|
+
other project still counts as a run loads it, and the broken one is
|
|
2440
|
+
named (`12 (34 tasks · 1 config did not load)`, then a `config errors`
|
|
2441
|
+
row per config with the message `vx run` stops on):
|
|
2442
|
+
|
|
2443
|
+
```
|
|
2444
|
+
$ vx info
|
|
2445
|
+
vx: 0.0.0
|
|
2446
|
+
bun: 1.4.2
|
|
2447
|
+
git: 2.53.0
|
|
2448
|
+
git status cache: core.fsmonitor, core.untrackedCache off
|
|
2449
|
+
workspace root: /work/repo
|
|
2450
|
+
projects: 12 (34 tasks)
|
|
2451
|
+
plugins: 2 — @vzn/vx-reapi (executor, cache); @vzn/vx-otel (telemetry)
|
|
2452
|
+
workers: 2 — cgroup CPU quota 2 of 8 cores
|
|
2453
|
+
memory: 13 GB usable — cgroup limit; the machine has 16 GB
|
|
2454
|
+
cache dir: /work/repo/.vx/cache
|
|
2455
|
+
cache store: /home/me/.vx/3f2a9c1e7b4d5a60/cache
|
|
2456
|
+
cache versions: keys vx-cache-v42 · index schema v34
|
|
2457
|
+
cache entries: 42 (1.3 GB)
|
|
2458
|
+
orphans: 3 artifacts (12 MB) the index does not know — `vx cache prune` reaps them
|
|
2459
|
+
task runs (24h): 7 (5 cache hits)
|
|
2460
|
+
flaky tasks: 1 — web#test (3 of 11 runs failed on unchanged inputs)
|
|
2461
|
+
sandbox: available (9 tasks declare exec.sandbox)
|
|
2462
|
+
vx-lock.json: yes
|
|
2463
|
+
```
|
|
2464
|
+
|
|
2465
|
+
- `git` shows `(not found)` when the binary is missing; a broken
|
|
2466
|
+
project config contributes zero tasks instead of failing the
|
|
2467
|
+
printout, and the `config errors` row (present only then) names it
|
|
2468
|
+
with the loader's message — the same line `vx run` would stop on.
|
|
2469
|
+
- `git status cache`: vx runs ONE `git status` per run to find dirty
|
|
2470
|
+
and untracked files, and on a large tree that walk is the warm run's
|
|
2471
|
+
critical path. git's `core.fsmonitor` (a daemon that watches the
|
|
2472
|
+
worktree) and `core.untrackedCache` make it near-free after the first
|
|
2473
|
+
run; both are off by default, so `vx info` says when they are.
|
|
2474
|
+
- `sandbox` is the runtime probe's verdict for THIS host — one sandboxed
|
|
2475
|
+
`true`, memoized — and how many loaded tasks declare `exec.sandbox`. A
|
|
2476
|
+
declared sandbox whose runtime cannot start fails the task at run
|
|
2477
|
+
time rather than downgrading, so `unavailable — <why>; 3 tasks declare
|
|
2478
|
+
exec.sandbox and will fail` says it first: root inside a container
|
|
2479
|
+
(the runtime's seccomp helper cannot create its nested user namespace;
|
|
2480
|
+
run as a non-root user or set `sandbox.weakerWhenNested: true`), a
|
|
2481
|
+
missing bubblewrap, socat or ripgrep, a nested seatbelt on macOS.
|
|
2482
|
+
On Linux an available sandbox that cannot report the reads it denies
|
|
2483
|
+
(no `strace` on PATH, one whose `--version` fails, or one that may not
|
|
2484
|
+
attach) adds `, untraced — <why>, so the reads it denies go
|
|
2485
|
+
unreported`: the sandbox still enforces, but a task that tolerates a
|
|
2486
|
+
denied read passes and caches with no word of it. The `--format json` fact is
|
|
2487
|
+
`sandbox.untraced`, the reason or `null`.
|
|
2488
|
+
- `plugins` names every plugin `vx.workspace.*` declares and the seams
|
|
2489
|
+
each fills, in pipeline order (`config`, `discover`, `project`, `graph`, `key`,
|
|
2490
|
+
`fingerprint`, `schedule`, `admit`, `executor`, `cache`, `telemetry`,
|
|
2491
|
+
`setup`, `commands`), or `none`. It reads the declarations: a plugin
|
|
2492
|
+
that declines a task at run time still lists its seam here.
|
|
2493
|
+
- `workers` is the count a run defaults to and where it comes from:
|
|
2494
|
+
`vx.workspace.ts`'s `concurrency` when set, else the cores this
|
|
2495
|
+
process may use — the CPU count, capped by the cgroup CPU quota a
|
|
2496
|
+
container runs under (`8 — the CPU count`, `2 — cgroup CPU quota 2 of
|
|
2497
|
+
8 cores`). `memory` is what a memory-packing policy budgets
|
|
2498
|
+
(`@vzn/vx-schedule-history`): the machine's total, capped by the
|
|
2499
|
+
cgroup limit — inside a container the raw numbers are the host's,
|
|
2500
|
+
and the doctor is where to see which one a run reads.
|
|
2501
|
+
- `flaky tasks` is the standing list a run's flaky notes add to:
|
|
2502
|
+
every task whose history (30 days, what the cache keeps) holds a
|
|
2503
|
+
cache key that failed after it had passed, most failures first, with
|
|
2504
|
+
the outcomes over those keys. A cache hit counts as a pass (it
|
|
2505
|
+
replayed one), and a pass that took a retry counts too, its failed
|
|
2506
|
+
attempts counted as failures. A task with no cache block keys on its
|
|
2507
|
+
config alone, so its key says nothing about its inputs: it is never
|
|
2508
|
+
listed. A pass or a failure behind a failed dependency, in a run that
|
|
2509
|
+
continues past failures, is not its key's and counts on no key. `none` when
|
|
2510
|
+
no key did.
|
|
2511
|
+
- `task runs (24h)` counts task runs, executed and replayed alike, so
|
|
2512
|
+
the hits are a share of it: three `vx run` of two tasks are six. An
|
|
2513
|
+
invocation is what `vx last` calls a run; `vx last --list` counts
|
|
2514
|
+
those.
|
|
2515
|
+
- `cache store` is where the entries and their artifacts live: the
|
|
2516
|
+
store every workspace of this user shares (`docs/caching.md`), or
|
|
2517
|
+
`none: the cache dir holds the entries` when the workspace names its
|
|
2518
|
+
cache dir. Before a first run it is the store a run would open.
|
|
2519
|
+
- `cache entries` counts the entries and their size; with a
|
|
2520
|
+
`cacheRetention.maxSize` it reads against it (`812 (3.0 GB of 10 GB,
|
|
2521
|
+
30%)`), and a `cache retention` row says what each run's end evicts.
|
|
2522
|
+
Paths under the home directory print as `~/…`; the JSON keeps them
|
|
2523
|
+
absolute.
|
|
2524
|
+
- `cache versions` are the two constants a bug report needs and the
|
|
2525
|
+
reset notice names: the key prefix (`CACHE_VERSION`; a bump orphans
|
|
2526
|
+
every entry) and the index schema (`SCHEMA_VERSION`; a mismatch drops
|
|
2527
|
+
every table on the next open, which the run then says once).
|
|
2528
|
+
- `orphans` appears only when the cache directory holds artifacts or
|
|
2529
|
+
save temps the index has no row for, older than an hour (what a
|
|
2530
|
+
`SCHEMA_VERSION` reset leaves behind; a fresh one is a save in
|
|
2531
|
+
flight). A task that asks for one's key again indexes it and hits;
|
|
2532
|
+
the rest only `vx cache prune` reclaims, so the doctor says so.
|
|
2533
|
+
- `--format json` prints the same facts as one typed object, for a
|
|
2534
|
+
script or a bug-report template: `vx`, `bun`, `bunSupported` (false
|
|
2535
|
+
below Bun 1.4.0), `git` (null when not
|
|
2536
|
+
found), `gitStatusCache` (`{ fsmonitor, untrackedCache }`, null when
|
|
2537
|
+
git could not answer), `workspaceRoot`, `projects`, `tasks`,
|
|
2538
|
+
`configErrors` (`[{ path, message }]`, the configs that did not load,
|
|
2539
|
+
empty when all did), `plugins` (`[{ name, seams }]`), `workers` (`{ count, source, cores,
|
|
2540
|
+
cpuQuota }`, the source one of `workspace` / `cgroup` / `cores`,
|
|
2541
|
+
`cpuQuota` in cores or null), `memory` (`{ usableBytes, totalBytes,
|
|
2542
|
+
cgroupLimitBytes }`, the limit null when none binds), `cacheDir`, `cacheStore`
|
|
2543
|
+
(null when the cache dir holds the entries), `cacheVersion`,
|
|
2544
|
+
`schemaVersion`, `cacheEntries`, `cacheBytes`, `cacheRetention`
|
|
2545
|
+
(`{ olderThan, maxSize, maxBytes }`, each only when set, null when none is declared),
|
|
2546
|
+
`orphans` (`{ artifacts, bytes }`, always present), `runs24h`, `hits24h` (task
|
|
2547
|
+
runs, as the row), `restored24h` (of those hits, the ones that restored
|
|
2548
|
+
outputs; the rest found them up to date), `flakyTasks` (`[{ taskId, project, task, keys, passes, failures }]`,
|
|
2549
|
+
empty when none), `lockfile`, `sandbox` (`{ available, reason,
|
|
2550
|
+
declared, untraced }`, `declared` the count of tasks with `exec.sandbox`,
|
|
2551
|
+
`untraced` the reason denied reads go unreported or null). The
|
|
2552
|
+
pretty rows render this object;
|
|
2553
|
+
there is no second source.
|
|
2554
|
+
- `--cache-dir <path>` reads the cache a run with the same flag uses, as
|
|
2555
|
+
`vx why`, `vx last` and `vx cache prune` do.
|
|
2556
|
+
|
|
2557
|
+
Exit codes: `0` the facts printed, a config that did not load included;
|
|
2558
|
+
`1` no workspace here or above, or a parse error.
|
|
2559
|
+
|
|
2560
|
+
## `vx why`
|
|
2561
|
+
|
|
2562
|
+
Answer "why did this task re-run?" from the terminal, from the
|
|
2563
|
+
per-component input fingerprints core persists on every miss. Read-only over the local
|
|
2564
|
+
`cache.db`: no config evaluation, no re-hash.
|
|
2565
|
+
|
|
2566
|
+
```
|
|
2567
|
+
vx why (TASK | PKG#TASK) [--run RUNID] [--format pretty|json] [--cache-dir <path>]
|
|
2568
|
+
```
|
|
2569
|
+
|
|
2570
|
+
By default it compares the task's **latest** recorded run against its
|
|
2571
|
+
immediately-previous run; `--run RUNID` pins a specific run (a unique
|
|
2572
|
+
prefix of the id is enough; a task that run did not run is refused,
|
|
2573
|
+
pointing at `vx last --list`, and so is an id no run carries). History is
|
|
2574
|
+
the cache directory's, not the checkout's: worktrees that share one
|
|
2575
|
+
`--cache-dir` share one history, so the previous run may be another
|
|
2576
|
+
worktree's (its branch is in `vx last`), and its edits read as changes. Latest and
|
|
2577
|
+
previous are the order runs were recorded, not their clock: a clock that
|
|
2578
|
+
stepped back once swapped the two and diffed the edit backwards. A bare task
|
|
2579
|
+
name resolves when exactly one project ran it (several → the project
|
|
2580
|
+
the current directory is in, as `vx run` picks, else an error listing
|
|
2581
|
+
the candidates; unknown → include-match suggestions, or, with
|
|
2582
|
+
none near, a pointer to `vx last --list`, or word that nothing has run
|
|
2583
|
+
yet; after runs of only groups, which record no task row, that no run
|
|
2584
|
+
executed a task and to ask about one the group depends on, X-50).
|
|
2585
|
+
|
|
2586
|
+
A control character in a component's name (a file named with an
|
|
2587
|
+
escape or a carriage return) prints as `\xNN`, so no file name drives
|
|
2588
|
+
the terminal; `--format json` carries the name as it is.
|
|
2589
|
+
|
|
2590
|
+
An **unchanged** key has three endings, and the verdict distinguishes
|
|
2591
|
+
them rather than calling all three a re-run: the run was served from
|
|
2592
|
+
cache (nothing re-ran), it re-executed on the same key, or it recorded
|
|
2593
|
+
no cache outcome at all, in which case vx says so instead of guessing.
|
|
2594
|
+
A re-execution names its cause when the index shows one: the previous
|
|
2595
|
+
run on the key failed and saved nothing, the run did not read the cache
|
|
2596
|
+
(`--force`, or a `--cache` without read), no entry for the key was
|
|
2597
|
+
there when it ran (pruned or evicted), the previous run was not saved
|
|
2598
|
+
because it ran beside a failed task (a task run past a failed dependency
|
|
2599
|
+
under `--continue` is never cached; said ahead of a prune, and as
|
|
2600
|
+
"neither run saved it" when this run ran beside one too), or the previous run executed and no entry
|
|
2601
|
+
holds the key (its save failed, or a prune took it; a previous run whose
|
|
2602
|
+
policy wrote no cache says that instead). Otherwise, with this run's
|
|
2603
|
+
policy recorded as reading the cache, it says it cannot name the cause;
|
|
2604
|
+
only a run with no recorded policy names `--no-cache` / `--force`.
|
|
2605
|
+
|
|
2606
|
+
```
|
|
2607
|
+
$ vx why app#build
|
|
2608
|
+
app#build — run 01a1193a-7b39-75a9-870b-5c03e26d7104
|
|
2609
|
+
this run 2026-10-08T01:57:05.486Z · success · executed · key 9ef9806a9c69209e
|
|
2610
|
+
previous 2026-10-08T01:57:05.325Z · success · key e240348b20e79fd6
|
|
2611
|
+
verdict cache key changed: file packages/app/src/input.txt
|
|
2612
|
+
|
|
2613
|
+
what changed (1 component, 6 unchanged):
|
|
2614
|
+
changed file packages/app/src/input.txt 78981922613b2afb6025042ff6bd878ac1994e85 → 61780798228d17af2d34fce4cfbdf35556832472
|
|
2615
|
+
|
|
2616
|
+
what to do:
|
|
2617
|
+
file an edit re-runs by design; a file the task does not read belongs out of cache.inputs.files
|
|
2618
|
+
```
|
|
2619
|
+
|
|
2620
|
+
A changed key's verdict names what moved, kind and name, three at most
|
|
2621
|
+
and then a count (`cache key changed: env MODE`), so a key that moved
|
|
2622
|
+
only by an environment variable says so in one line; when neither
|
|
2623
|
+
entry kept its components it reads `(inputs differ)`.
|
|
2624
|
+
|
|
2625
|
+
Under the rows, `what to do` gives one line per changed kind: what
|
|
2626
|
+
moves it and how to stop a move the task does not need. An upstream
|
|
2627
|
+
row is only the carrier, so `vx why` follows each dependency that moved
|
|
2628
|
+
in the same run down to the tasks whose OWN inputs moved and prints
|
|
2629
|
+
them under `root cause`, one chain per root (five at most, then a
|
|
2630
|
+
count), and `what to do` speaks to those kinds instead:
|
|
2631
|
+
|
|
2632
|
+
```
|
|
2633
|
+
root cause:
|
|
2634
|
+
app#build ← lib#build ← file packages/lib/src/index.ts
|
|
2635
|
+
```
|
|
2636
|
+
|
|
2637
|
+
A dependency the walk cannot find in the run keeps the `upstream` line,
|
|
2638
|
+
which names the `vx why` to run next; a `config` line names the
|
|
2639
|
+
`vx show` that prints the task's config now. `--format json` carries
|
|
2640
|
+
the walk as `roots` (`chain`, `entries`).
|
|
2641
|
+
|
|
2642
|
+
A hit's line is `cache-hit · key …` (or `cache-hit-remote`): the status
|
|
2643
|
+
names the hit and its tier, so only an executed run carries the word.
|
|
2644
|
+
A skipped task never ran and derived no key: its line is `skipped · no key`.
|
|
2645
|
+
A row's kind is what the key folded: `file` (an input file, by blob
|
|
2646
|
+
id), `env` (a declared variable, by digest), `runtime` and
|
|
2647
|
+
`ws-runtime` (a declared command's output, `inputs.runtime` and
|
|
2648
|
+
`inputs.workspaceRuntime`), `forward` (the argv forwarded after `--`),
|
|
2649
|
+
`package` (the project's own `package.json`), `workspace` (the
|
|
2650
|
+
fingerprint: the lockfile and the other root manifests), `config` (the
|
|
2651
|
+
evaluated task config), `upstream` (a dependency's input key — a
|
|
2652
|
+
lockfile change moves it too, so that row rides with the
|
|
2653
|
+
fingerprint's), `plugin` (a `key` plugin's material, by name) and
|
|
2654
|
+
`format` (the key format vx itself folds: it moves only with an
|
|
2655
|
+
upgrade, and re-keys every task once, X-142).
|
|
2656
|
+
The component-level rows come from the `entry_inputs` input
|
|
2657
|
+
fingerprints persisted with each cache entry; when either side's entry
|
|
2658
|
+
is gone (pruned, or the run failed and never saved one) the verb still
|
|
2659
|
+
names the hash change and says the component diff is unavailable. When
|
|
2660
|
+
only the previous run failed, the diff is taken against the last run
|
|
2661
|
+
that saved an entry instead, and the detail line names that run. A
|
|
2662
|
+
task with no `cache` block derives a key too — it is what dependents
|
|
2663
|
+
fold — but saves no entry, so for it the verb can only report the key
|
|
2664
|
+
change and says so.
|
|
2665
|
+
`--format json` emits one machine-readable object (`{ taskId, runId,
|
|
2666
|
+
why, diff, roots }`); when the task's recorded runs predate run ids, `{ taskId,
|
|
2667
|
+
why, diff, explanation }`, `why` and `diff` null and `explanation` the
|
|
2668
|
+
latest cache entry's key.
|
|
2669
|
+
|
|
2670
|
+
Exit codes: `0` the task's run explained; `1` no recorded run of the
|
|
2671
|
+
task, a `--run` with no row for it, or a parse error.
|
|
2672
|
+
|
|
2673
|
+
## `vx prune`
|
|
2674
|
+
|
|
2675
|
+
```
|
|
2676
|
+
vx prune <project...> [--out-dir <dir>] [--docker] [--production]
|
|
2677
|
+
```
|
|
2678
|
+
|
|
2679
|
+
A plugin verb of `@vzn/vx-lockfile`: declaring `pnpm()`, `bun()`,
|
|
2680
|
+
`npm()` or `yarn()` adds it. It copies the named projects, their
|
|
2681
|
+
transitive workspace dependencies, the root manifests (workspace lists
|
|
2682
|
+
rewritten to the subset), the vx configs and each lockfile pruned to what
|
|
2683
|
+
the subset installs into `--out-dir` (default `out/`), so a Docker build
|
|
2684
|
+
installs it with a frozen lockfile; `--docker` splits `json/` (the
|
|
2685
|
+
install layer) from `full/`; `--production` leaves out a workspace
|
|
2686
|
+
package only a dev dependency reaches and strikes it from the kept
|
|
2687
|
+
manifests and lockfiles. `turbo prune`. Reference:
|
|
2688
|
+
`packages/vx-lockfile/README.md` § `vx prune`. Without the plugin, typing
|
|
2689
|
+
`vx prune` says where it comes from and exits 1. History: core verb
|
|
2690
|
+
2026-08-25, `@vzn/vx-prune` 2026-09-10, removed 2026-09-11 (it copied the
|
|
2691
|
+
lockfile unpruned), back in `@vzn/vx-lockfile` 2026-10-03.
|
|
2692
|
+
|
|
2693
|
+
## `vx stats`
|
|
2694
|
+
|
|
2695
|
+
Removed (H-19). It was an alias of `vx info`, which absorbed it, and
|
|
2696
|
+
warned on every use. Typing `vx stats` points at `vx info` and exits 1 —
|
|
2697
|
+
unless a declared plugin claims the verb through the `commands` seam.
|
|
2698
|
+
|
|
2699
|
+
## `vx last`
|
|
2700
|
+
|
|
2701
|
+
Replay a recorded run's summary from the local history — no
|
|
2702
|
+
re-execution, no cache probe, no config evaluation. With the
|
|
2703
|
+
self-hosted dashboard gone (2026-08-23), this is THE run-replay
|
|
2704
|
+
surface. A run a Ctrl-C (or SIGTERM, SIGHUP) stopped records nothing,
|
|
2705
|
+
so `vx last` still shows the run before it.
|
|
2706
|
+
|
|
2707
|
+
```
|
|
2708
|
+
vx last [RUNID] [--list[=N]] [--failed] [--log <task>] [--format pretty|json] [--cache-dir <path>]
|
|
2709
|
+
```
|
|
2710
|
+
|
|
2711
|
+
Bare `vx last` replays the most recent run: a header (verdict, command,
|
|
2712
|
+
when, duration, branch @ sha, CI, task/hit/failure counts) and a
|
|
2713
|
+
per-task table — status, id, duration, cache key, and for a task that
|
|
2714
|
+
executed, what it used (peak RSS and CPU parallelism, `312 MB · 1.4×
|
|
2715
|
+
cpu`: the runner's own record, and the number `@vzn/vx-schedule-history`
|
|
2716
|
+
reserves from; a hit spent nothing and shows nothing, and a task lighter
|
|
2717
|
+
than vx itself shows its CPU only) — failures first, each as the frame
|
|
2718
|
+
read it, `failed (exit 137)`, with the signal an exit above 128 stands
|
|
2719
|
+
for at the row's end (`128 + SIGKILL`; the shell's convention, so a
|
|
2720
|
+
command that exits 137 on its own reads the same). Where the run's
|
|
2721
|
+
footer gave a reason, the row ends with it instead: `timed out`,
|
|
2722
|
+
`never ready: exited`, `2 sandbox violations`, and for a skipped task
|
|
2723
|
+
`after lib#build failed` (the v27 columns; rows older than them read
|
|
2724
|
+
as before). Rows run failures first, then what executed or was
|
|
2725
|
+
skipped, then hits; past sixteen hits the rest fold into one line with
|
|
2726
|
+
their count (`… +980 more cache hits`) — a thousand-task warm run is a
|
|
2727
|
+
thousand rows otherwise, with the one failure a screen above the
|
|
2728
|
+
prompt — and the sixteen shown are the slowest restores, the one thing
|
|
2729
|
+
a hit's row tells. `--format json` lists every row.
|
|
2730
|
+
`vx last --list` prints the N most recent runs (default 10), one per
|
|
2731
|
+
line in aligned columns (verdict, start, run id, counts, duration,
|
|
2732
|
+
command), each run id cut to the shortest prefix no other run shares, 13 characters at least (`--list 5`
|
|
2733
|
+
and `--list=5` alike; the space form takes the next argument as the
|
|
2734
|
+
count unless it is a flag or a run id, eight hex digits at least, so
|
|
2735
|
+
`--list 1.5` is refused as a count); `vx last RUNID` replays a
|
|
2736
|
+
specific one, and the two do not combine (a word beside `--list` no run
|
|
2737
|
+
id could be is refused as an unexpected argument). `--failed` replays the latest
|
|
2738
|
+
run that failed, past any green one since, and with `--list` lists only
|
|
2739
|
+
failed runs. `--format json`
|
|
2740
|
+
emits `{ invocation, tasks }` for scripting; a failed task's row adds
|
|
2741
|
+
`output` (its output as plain text, the first 8 KiB and last 56 KiB,
|
|
2742
|
+
secrets masked) and `locations` (the existing files it names,
|
|
2743
|
+
`{ file, line?, col? }`, file absolute), so an agent reads why without
|
|
2744
|
+
the terminal. They live in `<cacheDir>/failures/<runId>.json`, the
|
|
2745
|
+
newest 50 failed runs; past those, or when the write was refused, a
|
|
2746
|
+
failed row reads `output: ''` and `locations: []`. `--log <task>`
|
|
2747
|
+
prints one task's output instead of the summary: in the latest run that
|
|
2748
|
+
recorded the task, or in RUNID's. A failed task's is the kept failure
|
|
2749
|
+
output; any other task's is its cache entry's log (the one a hit
|
|
2750
|
+
replays, masked as it was), so a passing task's log reads too, on a hit
|
|
2751
|
+
or in the run that saved it. An uncached task that passed, or a skip,
|
|
2752
|
+
kept none: stdout is empty and stderr says so, exit 0. With
|
|
2753
|
+
`--format json` it is `{ runId, taskId, status, source, output }`,
|
|
2754
|
+
`source` `'failure'`, `'cache'` or `null`. A task no run recorded is
|
|
2755
|
+
refused, exit 1; `--log` does not combine with `--list` or `--failed`. `--list --format json`
|
|
2756
|
+
an array of the same `invocation` objects, newest first. An unknown run id fails
|
|
2757
|
+
loud and points at `--list`. Before any run, every form says so
|
|
2758
|
+
(`vx last: no recorded runs yet — run something first`, exit 1; `--list`
|
|
2759
|
+
prints `no recorded runs`, exit 0), and past green runs only,
|
|
2760
|
+
`--list --failed` prints `no recorded run failed`. A run id may be typed as a unique prefix; a
|
|
2761
|
+
prefix several runs share fails and lists them. A replayed run with
|
|
2762
|
+
failures ends with the command that re-runs them (`re-run what failed:
|
|
2763
|
+
vx run app#test -- …`, with the arguments the run forwarded to the
|
|
2764
|
+
tasks that got them; a failed dependency, which never got them, gets a
|
|
2765
|
+
line of its own without them, X-140). The
|
|
2766
|
+
replayed `$ vx run …` or `$ vx watch …` line and that one keep each
|
|
2767
|
+
argument shell-quoted (`-- 'a b'`), so either pastes back as it ran (X-49).
|
|
2768
|
+
|
|
2769
|
+
`vx why`, `vx last`, `vx info` and `vx cache prune` all read the cache
|
|
2770
|
+
a run wrote, so each takes `--cache-dir <path>` with `vx run`'s rules
|
|
2771
|
+
(cwd-relative, absolute used as-is): a run that wrote its history
|
|
2772
|
+
elsewhere is replayed, explained, reported on and pruned there. Without
|
|
2773
|
+
the flag they open the workspace's cache (`defineWorkspace({ cacheDir })`
|
|
2774
|
+
or `.vx/cache`). A `--cache-dir` that is not there is refused by name
|
|
2775
|
+
(`--cache-dir .vx/cahce: no such directory`). In a workspace that never
|
|
2776
|
+
ran, `vx why`, `vx last`, `vx info`, `vx show` and `vx cache prune`
|
|
2777
|
+
(dry or not) read it as empty and create nothing (item 900, E-7, E-38).
|
|
2778
|
+
|
|
2779
|
+
Exit codes: `0` the run (or the list) printed, `--list` with no runs
|
|
2780
|
+
included; `1` no recorded run yet, a run id it has no record of, or a
|
|
2781
|
+
parse error.
|
|
2782
|
+
|
|
2783
|
+
## `vx docs`
|
|
2784
|
+
|
|
2785
|
+
`vx docs <query>` searches vx's reference with no network: `cli`,
|
|
2786
|
+
`schema`, `caching`, `execution`, `patterns`, `security` and `features`,
|
|
2787
|
+
which ship inside the package and the compiled binary. Each page is cut
|
|
2788
|
+
at its headings; a section that holds every word of the query matches,
|
|
2789
|
+
and a word in its heading ranks it above any count in its text. The best
|
|
2790
|
+
`--limit` sections (default 3) print whole, each under its page,
|
|
2791
|
+
heading and URL on the site. `--format json` prints
|
|
2792
|
+
`{query, hits: [{page, heading, url, text}]}` (`schemas/docs.json`).
|
|
2793
|
+
The guides live on the site: `https://vznjs.github.io/vx/llms.txt`
|
|
2794
|
+
indexes them.
|
|
2795
|
+
|
|
2796
|
+
Exit codes: `0` the search ran, a search with no match included (it
|
|
2797
|
+
names the pages searched); `1` a missing query or a bad flag
|
|
2798
|
+
(`VX_E_USAGE`).
|
|
2799
|
+
|
|
2800
|
+
## `vx completions`
|
|
2801
|
+
|
|
2802
|
+
Print a completion script for `bash`, `zsh` or `fish`:
|
|
2803
|
+
|
|
2804
|
+
```
|
|
2805
|
+
eval "$(vx completions bash)" # this shell
|
|
2806
|
+
vx completions zsh > ~/.zfunc/_vx # zsh, with ~/.zfunc on $fpath
|
|
2807
|
+
vx completions fish > ~/.config/fish/completions/vx.fish
|
|
2808
|
+
```
|
|
2809
|
+
|
|
2810
|
+
The script completes the verbs — core's, and the plugin verbs the
|
|
2811
|
+
workspace around the cwd declares at generation time — and every flag
|
|
2812
|
+
of each verb, read from the same help text `vx <verb> --help` prints:
|
|
2813
|
+
the verb's own Usage line, and for `run` and `watch` the run option
|
|
2814
|
+
lines, less the ones `watch` refuses. So a flag cannot be documented
|
|
2815
|
+
and not completed, nor completed and then refused: a flag another
|
|
2816
|
+
verb's line names in passing (`vx lock --check` beside `--frozen`) is
|
|
2817
|
+
not one. After a flag with a fixed value set the script offers that
|
|
2818
|
+
set: `--format` pretty or json, `--output-logs` full, errors-only,
|
|
2819
|
+
hash-only or none, `--download` all, toplevel or none — each value one
|
|
2820
|
+
the flag's parser takes (`tests/completions.test.ts` holds it). A plugin verb completes `--help` only. Task and project
|
|
2821
|
+
names are not completed (they are the workspace's, and a completion
|
|
2822
|
+
that evaluates configs on every Tab is the wrong price). The zsh script
|
|
2823
|
+
works both ways zsh loads one: from `$fpath` it completes on the first
|
|
2824
|
+
Tab (it rang the bell there until 2026-10-03 and completed on the
|
|
2825
|
+
second), and sourced it registers itself; `tests/completions-shells.test.ts`
|
|
2826
|
+
loads the script in zsh both ways and in fish where they are installed. An unknown
|
|
2827
|
+
shell is an error naming the three, and the nearest of them when one is
|
|
2828
|
+
within two edits (`got bsh). Did you mean bash?`).
|
|
2829
|
+
|
|
2830
|
+
Exit codes: `0` the script printed; `1` an unknown shell or flag.
|
|
2831
|
+
|
|
2832
|
+
## Plugin commands
|
|
2833
|
+
|
|
2834
|
+
A plugin declared in `vx.workspace.ts` can add verbs:
|
|
2835
|
+
|
|
2836
|
+
```ts
|
|
2837
|
+
import { definePlugin, type VxPlugin } from '@vzn/vx'
|
|
2838
|
+
|
|
2839
|
+
export function mcp(): VxPlugin {
|
|
2840
|
+
return definePlugin(import.meta, {
|
|
2841
|
+
commands: {
|
|
2842
|
+
mcp: {
|
|
2843
|
+
description: 'serve the run history to an AI agent over stdio',
|
|
2844
|
+
async run(argv, ctx) {
|
|
2845
|
+
// ctx.workspaceRoot, ctx.cacheDir, ctx.concurrency, ctx.warn(...)
|
|
2846
|
+
return 0 // the process exit code
|
|
2847
|
+
},
|
|
2848
|
+
},
|
|
2849
|
+
},
|
|
2850
|
+
})
|
|
2851
|
+
}
|
|
2852
|
+
```
|
|
2853
|
+
|
|
2854
|
+
The plugin's name is its package name, which `definePlugin` reads from
|
|
2855
|
+
`import.meta`; a plain object is refused when the workspace loads.
|
|
2856
|
+
|
|
2857
|
+
(`@vzn/vx-mcp` ships exactly this: declare `mcp()` and `vx mcp` serves
|
|
2858
|
+
six read-only tools to AI agents — four over the cache database, one
|
|
2859
|
+
over the resolved task catalog, one the workspace doctor's facts.
|
|
2860
|
+
`@vzn/vx-schedule-history` adds `vx history`: what it learned per task
|
|
2861
|
+
and the reservation its `admit` hook packs.) The dispatcher tries core's verbs
|
|
2862
|
+
first and consults plugins only for a word core does not know, loading
|
|
2863
|
+
the workspace config from the cwd to find them (outside a workspace the
|
|
2864
|
+
verb is simply unknown). A plugin verb that names a core verb, or one
|
|
2865
|
+
plugins of two packages both declare, is refused when the workspace
|
|
2866
|
+
loads — such a verb could never run, or would hide the other plugin's.
|
|
2867
|
+
Plugins of one package are one owner (`bun()` and `pnpm()` both carry
|
|
2868
|
+
`prune`): the first declared runs. A plugin verb's
|
|
2869
|
+
return value is the exit code, an integer 0–255 (anything else — nothing,
|
|
2870
|
+
a fraction, 256, which the OS would keep as 0 — fails naming the plugin
|
|
2871
|
+
and the verb), and a thrown `UserError` prints as
|
|
2872
|
+
cleanly as core's own. Anything else thrown fails in one line, no stack:
|
|
2873
|
+
`plugin '<p>' failed in command '<verb>': <msg>`. `vx help` lists every plugin verb under "Plugin
|
|
2874
|
+
commands", with the plugin's name.
|
|
2875
|
+
|
|
2876
|
+
An unknown verb is answered with what this workspace knows: the "did you
|
|
2877
|
+
mean" set is core's verbs AND the ones its plugins declare (the lookup
|
|
2878
|
+
that just failed already loaded them, so it costs nothing), and when
|
|
2879
|
+
nothing is close enough to guess, a second line says where a verb can
|
|
2880
|
+
come from — the verbs declared here, or that `vx.workspace.ts` is what
|
|
2881
|
+
would declare one, or that there is no workspace here at all. Core still
|
|
2882
|
+
names no package: it lists what the workspace itself declares.
|
|
2883
|
+
|
|
2884
|
+
## Environment variables vx reads
|
|
2885
|
+
|
|
2886
|
+
The variables core reads. Each is read where it applies, per call, so a
|
|
2887
|
+
value set for one invocation is that invocation's. A plugin's own (the
|
|
2888
|
+
REAPI endpoints, the GitHub token) are in its README; what a TASK sees
|
|
2889
|
+
is `exec.env` in `docs/schema.md`, and the two markers vx sets on every
|
|
2890
|
+
task are the last row.
|
|
2891
|
+
|
|
2892
|
+
| Var | Value | Default | Effect |
|
|
2893
|
+
| --------------------------------- | --------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2894
|
+
| `VX_TIMING` | any non-empty | off | Print the stage table to stderr after a run, a `--dry`, or each `vx watch` cycle (`docs/modules/timing.md`). |
|
|
2895
|
+
| `VX_TASK_TIMEOUT` | positive integer (ms) | none | The default timeout for tasks without their own `exec.timeout`, one rung below `--timeout` / `RunOptions.timeout` and one above the workspace `timeout`. Empty, non-integer or non-positive is ignored; a value past the largest timer (~24.8 days) is clamped to it, never refused. |
|
|
2896
|
+
| `VX_CACHE_DIR` | a path | none | The workspace's cache dir, relative to the workspace root, below `--cache-dir` and `vx.workspace`'s `cacheDir`. A named cache dir holds the whole cache and shares nothing; unset, entries live in the user's shared store (`docs/caching.md`). Empty is ignored; whitespace alone is refused, as `cacheDir` is. |
|
|
2897
|
+
| `VX_CACHE_SCOPE` | a `cacheScope` value | none | The run's `cacheScope` (`trusted`, `read-only`, `pr-123`), above `vx.workspace`'s and `github()`'s. Empty is ignored; a value `cacheScope` would refuse is refused before any task. |
|
|
2898
|
+
| `VX_KILL_GRACE_MS` | positive integer (ms) | 2000 | The SIGTERM → SIGKILL grace a child that ignores SIGTERM gets: on a timeout, on a signal, and at the end-of-run shutdown of persistent tasks. Out of range falls back to the default. |
|
|
2899
|
+
| `VX_READY_NOTICE_MS` | positive integer (ms) | 10000 | How long a persistent task may take to match `readyWhen` before vx says once what it waits for. Out of range falls back to the default. |
|
|
2900
|
+
| `VX_TEARDOWN_TIMEOUT_MS` | integer (ms) | 3000 | The bound on one plugin's end-of-run flush or teardown, and on its `telemetry()` setup, so a third party's I/O cannot hold the run. Out of range falls back to the default, never clamps: a bound of 24.8 days is no bound. |
|
|
2901
|
+
| `VX_CONFIG_WORKER_TIMEOUT_MS` | integer (ms) | 30000 | How long one `vx.config.ts` evaluation may take, in process or in its worker, before the load fails naming the config (a real evaluation is ~10 ms). A synchronous loop on a first load holds the thread the deadline needs, so it hangs until killed. Out of range falls back to the default. |
|
|
2902
|
+
| `VX_WATCH_POLL` | any non-empty | off | `vx watch` polls every 250 ms from the start instead of probing the OS watcher (§ `vx watch` › How changes are seen). |
|
|
2903
|
+
| `VX_RUN_WORKSPACE`, `VX_RUN_TASK` | set by vx | — | Set on every task's environment (the workspace root; `project#task`). Read back by a `vx run` a task starts: one in the same workspace is refused, since a nested run is invisible to the outer graph and a loop back to its own task forks without bound (`docs/schema.md` § `env`). |
|
|
2904
|
+
| Var | Value | Default | Effect |
|
|
2905
|
+
| --------------------------------- | --------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2906
|
+
| `VX_TIMING` | any non-empty | off | Print the stage table to stderr after a run, a `--dry`, or each `vx watch` cycle (`docs/modules/timing.md`). |
|
|
2907
|
+
| `VX_TASK_TIMEOUT` | positive integer (ms) | none | The default timeout for tasks without their own `exec.timeout`, one rung below `--timeout` / `RunOptions.timeout` and one above the workspace `timeout`. Empty, non-integer or non-positive is ignored; a value past the largest timer (~24.8 days) is clamped to it, never refused. |
|
|
2908
|
+
| `VX_CACHE_DIR` | a path | none | The workspace's cache dir, relative to the workspace root, below `--cache-dir` and `vx.workspace`'s `cacheDir`. A named cache dir holds the whole cache and shares nothing; unset, entries live in the user's shared store (`docs/caching.md`). Empty is ignored. |
|
|
2909
|
+
| `VX_CACHE_SCOPE` | a `cacheScope` value | none | The run's `cacheScope` (`trusted`, `read-only`, `pr-123`), above `vx.workspace`'s and `github()`'s. Empty is ignored; a value `cacheScope` would refuse is refused before any task. |
|
|
2910
|
+
| `VX_KILL_GRACE_MS` | positive integer (ms) | 2000 | The SIGTERM → SIGKILL grace a child that ignores SIGTERM gets: on a timeout, on a signal, and at the end-of-run shutdown of persistent tasks. Out of range falls back to the default. |
|
|
2911
|
+
| `VX_READY_NOTICE_MS` | positive integer (ms) | 10000 | How long a persistent task may take to match `readyWhen` before vx says once what it waits for. Out of range falls back to the default. |
|
|
2912
|
+
| `VX_TEARDOWN_TIMEOUT_MS` | integer (ms) | 3000 | The bound on one plugin's end-of-run flush or teardown, and on its `telemetry()` setup, so a third party's I/O cannot hold the run. Out of range falls back to the default, never clamps: a bound of 24.8 days is no bound. |
|
|
2913
|
+
| `VX_CONFIG_WORKER_TIMEOUT_MS` | integer (ms) | 30000 | How long one `vx.config.ts` evaluation may take, in process or in its worker, before the load fails naming the config (a real evaluation is ~10 ms). A synchronous loop on a first load holds the thread the deadline needs, so it hangs until killed. Out of range (0, or past 2³¹−1) falls back to the default. |
|
|
2914
|
+
| `VX_WATCH_POLL` | any non-empty | off | `vx watch` polls every 250 ms from the start instead of probing the OS watcher (§ `vx watch` › How changes are seen). |
|
|
2915
|
+
| `VX_RUN_WORKSPACE`, `VX_RUN_TASK` | set by vx | — | Set on every task's environment (the workspace root; `project#task`). Read back by a `vx run` a task starts: one in the same workspace is refused, since a nested run is invisible to the outer graph and a loop back to its own task forks without bound (`docs/schema.md` § `env`). |
|
|
2916
|
+
|
|
2917
|
+
Colors are the two conventions in § Output format › Colors (`NO_COLOR`,
|
|
2918
|
+
`FORCE_COLOR`). A truthy `CI` picks the CI output flow and
|
|
2919
|
+
`GITHUB_ACTIONS` its `::group::` framing (§ Output); the run's
|
|
2920
|
+
`invocations` row records the provider, the first truthy of
|
|
2921
|
+
`GITHUB_ACTIONS`, `GITLAB_CI`, `BUILDKITE`, `CIRCLECI`, then `CI`. Core never reads `GITHUB_STEP_SUMMARY`: `--report`
|
|
2922
|
+
prints to stdout, and `--report-file=<path>` appends to a file, so on
|
|
2923
|
+
Actions pass `--report-file="$GITHUB_STEP_SUMMARY"`. A sandboxed
|
|
2924
|
+
task's temp dir sits under `CLAUDE_CODE_TMPDIR` (else `CLAUDE_TMPDIR`,
|
|
2925
|
+
else `/tmp/claude`), the sandbox runtime's own convention
|
|
2926
|
+
(`docs/modules/sandbox-runtime.md`).
|
|
2927
|
+
|
|
2928
|
+
## Output format
|
|
2929
|
+
|
|
2930
|
+
`vx run` emits framed blocks. Stdout/stderr from each task is
|
|
2931
|
+
buffered until completion, then dumped inside the block — so
|
|
2932
|
+
concurrent tasks never interleave their lines. A lone requested task
|
|
2933
|
+
streams live instead (§ Output).
|
|
2934
|
+
|
|
2935
|
+
Frame anatomy:
|
|
2936
|
+
|
|
2937
|
+
```
|
|
2938
|
+
┌─ app#test > failed (exit 1, 1 sandbox violation)
|
|
2939
|
+
|
|
2940
|
+
$ bun test
|
|
2941
|
+
|
|
2942
|
+
├─ OUTPUT ──────────────────────────────────────────────────
|
|
2943
|
+
|
|
2944
|
+
2 pass
|
|
2945
|
+
error: expected 3, got 2
|
|
2946
|
+
1 fail
|
|
2947
|
+
|
|
2948
|
+
├─ SANDBOX VIOLATIONS (1) ──────────────────────────────────
|
|
2949
|
+
|
|
2950
|
+
write ../shared/notes.txt
|
|
2951
|
+
|
|
2952
|
+
└─ app#test ── (2.10s) failed (exit 1, 1 sandbox violation)
|
|
2953
|
+
```
|
|
2954
|
+
|
|
2955
|
+
Every section is conditional: the `$ <command>` line only for an
|
|
2956
|
+
executed task (success or failed — a hit replays its stored output and
|
|
2957
|
+
shows none), `OUTPUT` only when the task wrote something,
|
|
2958
|
+
`SANDBOX VIOLATIONS (N)` only when the sandbox recorded some or vx
|
|
2959
|
+
has a note on a failure. The
|
|
2960
|
+
header carries the outcome (`restored-local • abc12345`, `failed (exit
|
|
2961
|
+
N)`, …) and the footer repeats it after the duration. A test renders
|
|
2962
|
+
this block and checks it against this page, byte for byte.
|
|
2963
|
+
|
|
2964
|
+
`OUTPUT` holds what the task wrote in the order vx read it, so an
|
|
2965
|
+
error stays beside the test that printed it: a stderr line renders
|
|
2966
|
+
red when colour is on (a line the task coloured itself keeps its own
|
|
2967
|
+
colours, and a line takes the stream that began it); without colour
|
|
2968
|
+
the lines are the task's bytes.
|
|
2969
|
+
The two streams are two pipes, so lines written within the same
|
|
2970
|
+
instant may read stdout first; a cache hit replays the same order. A
|
|
2971
|
+
persistent task's tail after ready keeps `STDOUT (since ready)` and
|
|
2972
|
+
`STDERR (since ready)` apart: its bounded tails hold no order.
|
|
2973
|
+
|
|
2974
|
+
Frame corners and rules render dim, section labels (`├─ …`) bold in
|
|
2975
|
+
their state colour; the id keeps its identity coloring. Content lines are **raw** — no left border, no
|
|
2976
|
+
indent — so long lines wrap without colliding with frame glyphs and
|
|
2977
|
+
copy/paste yields the verbatim output. Every block (and every live
|
|
2978
|
+
frame close in focused flow) is followed by a blank line so frames
|
|
2979
|
+
never collide with the next one-liner. A persistent task's frame is
|
|
2980
|
+
marked with a cyan `▸` after `┌─`/`└─`, and its close reads `running`
|
|
2981
|
+
(the child is still alive), or `failed (exit <n>)` for a server that
|
|
2982
|
+
died on its own before the run stopped it.
|
|
2983
|
+
|
|
2984
|
+
There is **no top-of-run banner** — the run context lives in the
|
|
2985
|
+
footer. A broad run looks like:
|
|
2986
|
+
|
|
2987
|
+
```
|
|
2988
|
+
⇢ 4ms success local @vzn/vx#format-check
|
|
2989
|
+
⏺︎ 5.20s success miss @vzn/vx#test
|
|
2990
|
+
|
|
2991
|
+
─ vx 0.0.0 ───────────────────────────────────────────────────
|
|
2992
|
+
projects ▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱
|
|
2993
|
+
1 in run · 3 total
|
|
2994
|
+
tasks ▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰
|
|
2995
|
+
2 success · 2 total
|
|
2996
|
+
cache ▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰
|
|
2997
|
+
1 miss · 1 local
|
|
2998
|
+
|
|
2999
|
+
info 8 workers · local cache
|
|
3000
|
+
time 5.34s · max 5.20s · avg 5.20s · min 5.20s
|
|
3001
|
+
result 2 tasks · 1 cached (50%) · 900ms saved · 5.34s
|
|
3002
|
+
```
|
|
3003
|
+
|
|
3004
|
+
The three bars are meters: `projects` is what the run covered against
|
|
3005
|
+
the workspace, `tasks` is failed / success / skipped, `cache` is miss /
|
|
3006
|
+
no-cache / up-to-date / local / remote (a skipped task rides it too, so
|
|
3007
|
+
the two legends sum alike). The `time` spread counts executed tasks
|
|
3008
|
+
only — a hit's restore time never enters it — which is why one executed
|
|
3009
|
+
task reads as its own max, avg and min. The `result` row is the run in
|
|
3010
|
+
one line, last: tasks, cached (every hit, local or remote, over every
|
|
3011
|
+
task with a cache that ran or hit; a skipped task asked no cache) and the wall time — `3 tasks · all cached · 40ms`
|
|
3012
|
+
when nothing that could hit ran, with `N failed` after the count on a
|
|
3013
|
+
red run. A task with no `cache` block, or any task of a run whose
|
|
3014
|
+
`--cache` reads and writes nothing (`--no-cache`), could never hit, so it
|
|
3015
|
+
is counted apart (`1 task · 1 no-cache · 37ms` for `vx run dev`), as
|
|
3016
|
+
`--dry` labels it. A test renders this run and
|
|
3017
|
+
checks it against this page, byte for byte.
|
|
3018
|
+
|
|
3019
|
+
Group tasks emit no framed block by design (they aren't real tasks);
|
|
3020
|
+
running a group focused surfaces its real member tasks instead.
|
|
3021
|
+
|
|
3022
|
+
**Nothing below the footer.** The footer is the run's last word.
|
|
3023
|
+
What a run has to say about one task rides that task's row; what it
|
|
3024
|
+
says about the run (a server that died, outputs left remote, a file
|
|
3025
|
+
`--summarize` / `--profile` wrote, a history, upload, plugin or sandbox
|
|
3026
|
+
warning) prints above the footer: it prints once the run's closing work
|
|
3027
|
+
is done, the `VX_TIMING=1` table included. Cache housekeeping
|
|
3028
|
+
(`cacheRetention`) prints nothing. Only a kept server's own output
|
|
3029
|
+
follows it.
|
|
3030
|
+
|
|
3031
|
+
**Skipped rows.** A red run lists every task that never started as a
|
|
3032
|
+
row naming the failure that blocked it, so the footer's `1 skipped`
|
|
3033
|
+
always has a name above it:
|
|
3034
|
+
|
|
3035
|
+
```
|
|
3036
|
+
⊘ skipped app#build • blocked by lib#build
|
|
3037
|
+
⊘ skipped web#build • blocked by lib#build
|
|
3038
|
+
```
|
|
3039
|
+
|
|
3040
|
+
A skip's cause is followed through a chain of skips to the failure at
|
|
3041
|
+
its root; a skip with no failed upstream is fail-fast's and carries no
|
|
3042
|
+
suffix. A blocked group (a task with no command) has no row: it never
|
|
3043
|
+
starts by definition and no counter counts it.
|
|
3044
|
+
|
|
3045
|
+
**Aborted and not-run rows.** After a stop (a shutdown signal), the
|
|
3046
|
+
task list names what it cut short (`aborted`, with its time so far) and
|
|
3047
|
+
what it reached first (`not run`). Neither reached the cache:
|
|
3048
|
+
|
|
3049
|
+
```
|
|
3050
|
+
✗ 2.41s aborted app#dev
|
|
3051
|
+
◌ not run web#build
|
|
3052
|
+
◌ not run web#test
|
|
3053
|
+
```
|
|
3054
|
+
|
|
3055
|
+
The tasks legend names them outside the total, which history and
|
|
3056
|
+
telemetry share: `2 success · 2 total · not counted: 1 aborted, 2 not
|
|
3057
|
+
run`. A framed task (focused or `full`) that
|
|
3058
|
+
printed while it stopped shows its frame instead of a row.
|
|
3059
|
+
|
|
3060
|
+
**Flaky rows.** A task the run just proved nondeterministic says so
|
|
3061
|
+
in a dim note on its own row (and its frame's footer) — from the local
|
|
3062
|
+
run history alone, no service:
|
|
3063
|
+
|
|
3064
|
+
```
|
|
3065
|
+
◼︎ 4.21s failed miss app#test flaky - passed 3× before
|
|
3066
|
+
⏺︎ 12.84s success miss api#e2e flaky - failed 1× before · 2 attempts
|
|
3067
|
+
```
|
|
3068
|
+
|
|
3069
|
+
A task is flaky when its exact cache key FAILED AFTER IT HAD PASSED
|
|
3070
|
+
(this run counted; a cache hit is a pass, it replayed one), or when it
|
|
3071
|
+
needed a retry (`exec.retries` / `--retry`) this run. A failure on a
|
|
3072
|
+
key that never passed is a break and carries no note — a changed input
|
|
3073
|
+
that fails is what a red run usually means — and the first pass after
|
|
3074
|
+
only failures is a recovery (a missing tool installed), not a flake.
|
|
3075
|
+
Only tasks with a `cache` block are judged: "same inputs, red after
|
|
3076
|
+
green" is a claim
|
|
3077
|
+
only declared inputs can back, and a task without them keys on its
|
|
3078
|
+
config alone. It is judged as the task finishes, so the row carries
|
|
3079
|
+
it: zero cost for a hit or a skip, one probe of the failed-row index
|
|
3080
|
+
for a green miss; `vx info` keeps the standing list.
|
|
3081
|
+
|
|
3082
|
+
### Colors
|
|
3083
|
+
|
|
3084
|
+
ANSI truecolor (`ansi-16m`) sequences, gated by env:
|
|
3085
|
+
|
|
3086
|
+
| Var | Effect |
|
|
3087
|
+
| --------------------------- | -------------------------------------------------------- |
|
|
3088
|
+
| `NO_COLOR=…` (non-empty) | Force off. Overrides `FORCE_COLOR`. |
|
|
3089
|
+
| `FORCE_COLOR=0` / `=false` | Force off, on a TTY too. |
|
|
3090
|
+
| `FORCE_COLOR=…` (any other) | Force on — `1`, `true`, `2`, `3`, the empty string, etc. |
|
|
3091
|
+
| (neither) | On iff `stdout.isTTY`. |
|
|
3092
|
+
|
|
3093
|
+
`0` and `false` are `FORCE_COLOR`'s "off" by the convention
|
|
3094
|
+
supports-color, chalk and Node follow; until 2026-09-24 vx read every
|
|
3095
|
+
non-empty value as "on", so a CI setting `FORCE_COLOR=0` got escape
|
|
3096
|
+
sequences in its log (the bug Nx has as nx#35292). An empty `NO_COLOR`
|
|
3097
|
+
has no effect (no-color.org).
|
|
3098
|
+
|
|
3099
|
+
A task's output is a pipe, so a tool would print plain; vx sets
|
|
3100
|
+
`FORCE_COLOR=1` on every task, as Nx and Turbo do, unless the task
|
|
3101
|
+
already sees a `FORCE_COLOR` (any value, `0` included) or a non-empty
|
|
3102
|
+
`NO_COLOR`. The cache stores the coloured bytes, and wherever vx's own
|
|
3103
|
+
output is plain (a pipe, CI without `FORCE_COLOR`, `NO_COLOR`) it
|
|
3104
|
+
strips the escapes from task output, live and replayed alike, an
|
|
3105
|
+
escape cut across two chunks included (`tests/plain-output.test.ts`,
|
|
3106
|
+
`tests/cli-colors-e2e.test.ts`). A custom `log` passed to `run()` gets
|
|
3107
|
+
task output as written. A task that writes its own output to a file
|
|
3108
|
+
and wants it plain sets `env: { define: { FORCE_COLOR: '0' } }`.
|
|
3109
|
+
|
|
3110
|
+
Programmatic callers passing a custom `log` to the run options always
|
|
3111
|
+
see plain text.
|
|
3112
|
+
|
|
3113
|
+
Only a run's own output (`vx run`, `vx watch`) is painted, and the
|
|
3114
|
+
help on a terminal: headings bold, `vx <verb>` and each flag or example
|
|
3115
|
+
in cyan; `NO_COLOR` or `FORCE_COLOR=0` turns it off
|
|
3116
|
+
(`tests/help-colors.test.ts`). Every other verb (`show`, `info`, `why`,
|
|
3117
|
+
`last`, a `--dry` plan, `--graph`, `cache prune`), and the help off a
|
|
3118
|
+
terminal, prints plain text whatever `FORCE_COLOR` says, so a script
|
|
3119
|
+
that forces colour for a run's log still parses them
|
|
3120
|
+
(`tests/cli-colors-e2e.test.ts`).
|
|
3121
|
+
|
|
3122
|
+
## Remote cache (plugin-driven)
|
|
3123
|
+
|
|
3124
|
+
Core ships **no remote-cache wire client** — the remote cache is a
|
|
3125
|
+
plugin concern. A `cache` plugin composes core's `LayeredCache` over a
|
|
3126
|
+
wire client; `@vzn/vx-reapi` provides one for any Bazel REAPI server
|
|
3127
|
+
(ActionCache + CAS).
|
|
3128
|
+
|
|
3129
|
+
Reads try local first, then remote (hydrating local on remote hit),
|
|
3130
|
+
with a background prefetch pass overlapping remote GETs with
|
|
3131
|
+
execution. Writes go to local immediately; the remote upload is a
|
|
3132
|
+
fire-and-forget background task drained at end of run — failures are
|
|
3133
|
+
logged via `onRemoteError` but never fail the build.
|
|
3134
|
+
|
|
3135
|
+
For any OTHER cache server (a Turbo-wire deployment, S3-direct, …),
|
|
3136
|
+
implement core's `RemoteCacheLayer` interface in a plugin's `cache`
|
|
3137
|
+
capability — the recipe lives in the plugins guide. Embedders
|
|
3138
|
+
holding a wire client can inject it per-run via
|
|
3139
|
+
`RunOptions.remoteCache` (explicit injection wins over the plugin
|
|
3140
|
+
consult). The retired `VX_REMOTE_CACHE_*` env vars are gone.
|
|
3141
|
+
|
|
3142
|
+
## Run analytics
|
|
3143
|
+
|
|
3144
|
+
`vx info` surfaces the aggregate cache stats (entry count, total
|
|
3145
|
+
size, runs + hits in the last 24 h). For anything deeper, vx records
|
|
3146
|
+
every task to a `runs` table in `cache.db` (UUIDv7 `run_id`, hrtime
|
|
3147
|
+
wallclock spans, cpu_ms, peak RSS, status, cache_hit flag) plus one
|
|
3148
|
+
`invocations` header row per run (command, git/CI context, tags,
|
|
3149
|
+
counts). The SQLite file IS the API:
|
|
3150
|
+
|
|
3151
|
+
```sh
|
|
3152
|
+
sqlite3 .vx/cache/cache.db "
|
|
3153
|
+
SELECT project, task, status, duration_ms
|
|
3154
|
+
FROM runs
|
|
3155
|
+
WHERE run_id = (SELECT run_id FROM runs ORDER BY id DESC LIMIT 1)
|
|
3156
|
+
ORDER BY duration_ms DESC;
|
|
3157
|
+
"
|
|
3158
|
+
```
|
|
3159
|
+
|
|
3160
|
+
The schema is documented in
|
|
3161
|
+
[`caching.md` § SQLite tables](./caching.md#sqlite-tables).
|
|
3162
|
+
|
|
3163
|
+
## What's still missing vs Turbo
|
|
3164
|
+
|
|
3165
|
+
Tracked in [`comparison.md`](./comparison.md). Nothing visible from the
|
|
3166
|
+
CLI is open: `--output-logs hash-only`, `--continue=<mode>`
|
|
3167
|
+
and `--cache-dir <path>` all shipped and are documented above.
|
|
3168
|
+
Remote-cache credentials are not core CLI flags at all: core carries no
|
|
3169
|
+
HTTP cache client — a remote cache arrives through a plugin's `cache`
|
|
3170
|
+
capability, which owns its own configuration.
|
|
3171
|
+
|
|
3172
|
+
## Programmatic API
|
|
3173
|
+
|
|
3174
|
+
```ts
|
|
3175
|
+
import { run, planRun, defineProject, defineWorkspace } from '@vzn/vx'
|
|
3176
|
+
|
|
3177
|
+
const summary = await run({
|
|
3178
|
+
cwd: process.cwd(),
|
|
3179
|
+
tasks: ['build', 'test'],
|
|
3180
|
+
concurrency: 4,
|
|
3181
|
+
// Optional 4-axis cache control; omit for everything-on.
|
|
3182
|
+
cache: { localRead: true, localWrite: true, remoteRead: true, remoteWrite: true },
|
|
3183
|
+
})
|
|
3184
|
+
// summary.ok: boolean; summary.outcomes: TaskOutcome[]
|
|
3185
|
+
|
|
3186
|
+
const plan = await planRun({
|
|
3187
|
+
cwd: process.cwd(),
|
|
3188
|
+
tasks: ['build'],
|
|
3189
|
+
})
|
|
3190
|
+
// plan.tasks: PlannedTask[]
|
|
3191
|
+
```
|
|
3192
|
+
|
|
3193
|
+
Surface:
|
|
3194
|
+
|
|
3195
|
+
- `run(options)` — execute. Returns `Promise<RunSummary>`.
|
|
3196
|
+
- `planRun(options)` — predict, no execute. Returns
|
|
3197
|
+
`Promise<RunPlan>`. Used by `--dry` / `--graph`.
|
|
3198
|
+
- `prepareRun(options, log)` — the shared setup (discovery → configs →
|
|
3199
|
+
graph → cache). What an embedder builds on.
|
|
3200
|
+
- `defineProject` / `defineWorkspace` — identity helpers for type
|
|
3201
|
+
inference in user configs.
|
|
3202
|
+
- Every one of the three returns a type the façade exports, so an
|
|
3203
|
+
embedder can hold it: `RunOptions` / `RunSummary` / `TaskOutcome`,
|
|
3204
|
+
`RunPlan` / `PlannedTask`, `PreparedRun` — alongside the plugin
|
|
3205
|
+
(`VxPlugin`, `TaskExecutor`, `CacheLayer`) and telemetry
|
|
3206
|
+
(`TelemetrySink`, `RunSummaryRecord`) surfaces. See `src/index.ts`.
|
|
3207
|
+
|
|
3208
|
+
A `log: Logger` option lets embedders swap the default framed-block
|
|
3209
|
+
logger for a custom one (e.g. JSON-line emission). Custom loggers
|
|
3210
|
+
always see plain text (colors are off when a non-default logger is
|
|
3211
|
+
provided).
|
|
3212
|
+
|
|
3213
|
+
The CLI dispatcher (`run(argv)` in `src/cli/index.ts`) is not part of
|
|
3214
|
+
the public package exports; `bin.ts` calls it directly.
|