@vzn/vx 0.0.635 → 0.0.637

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.
Files changed (141) hide show
  1. package/README.md +47 -19
  2. package/docs/caching.md +222 -210
  3. package/docs/cli.md +699 -664
  4. package/docs/execution.md +67 -75
  5. package/docs/features.md +44 -40
  6. package/docs/patterns.md +31 -32
  7. package/docs/schema.md +418 -202
  8. package/docs/security.md +76 -39
  9. package/launcher.sh +43 -0
  10. package/package.json +5 -5
  11. package/schemas/cache.json +41 -19
  12. package/schemas/info.json +23 -11
  13. package/schemas/last.json +48 -2
  14. package/schemas/lock.json +1 -1
  15. package/schemas/plan.json +2 -2
  16. package/schemas/show.json +13 -4
  17. package/schemas/why.json +15 -1
  18. package/skills/vx/SKILL.md +16 -12
  19. package/src/bin.ts +17 -2
  20. package/src/cache/archive.ts +11 -0
  21. package/src/cache/cache.ts +105 -53
  22. package/src/cache/git-inputs.ts +277 -63
  23. package/src/cache/index.ts +7 -1
  24. package/src/cache/inputs.ts +125 -35
  25. package/src/cache/key-fold.ts +8 -7
  26. package/src/cache/layer.ts +8 -17
  27. package/src/cache/layered-cache.ts +16 -102
  28. package/src/cache/policy.ts +25 -29
  29. package/src/cache/run-history.ts +36 -14
  30. package/src/cache/schema.ts +21 -23
  31. package/src/cache/scoped-cache.ts +224 -0
  32. package/src/cli/cache.ts +150 -28
  33. package/src/cli/completions.ts +2 -2
  34. package/src/cli/core-alias.ts +1 -1
  35. package/src/cli/foreign-flags.ts +13 -12
  36. package/src/cli/help.ts +94 -61
  37. package/src/cli/index.ts +42 -13
  38. package/src/cli/info.ts +38 -23
  39. package/src/cli/init.ts +115 -406
  40. package/src/cli/last.ts +145 -4
  41. package/src/cli/lock.ts +333 -111
  42. package/src/cli/plan-format.ts +2 -2
  43. package/src/cli/plugin-commands.ts +5 -9
  44. package/src/cli/plugin-templates.ts +10 -10
  45. package/src/cli/run.ts +123 -144
  46. package/src/cli/select.ts +33 -39
  47. package/src/cli/show.ts +17 -19
  48. package/src/cli/task-verb.ts +2 -9
  49. package/src/cli/upgrade.ts +402 -145
  50. package/src/cli/watch-cycle.ts +9 -2
  51. package/src/cli/watch-filter.ts +33 -60
  52. package/src/cli/watch-fs.ts +29 -16
  53. package/src/cli/watch-judge.ts +12 -3
  54. package/src/cli/watch-set.ts +16 -42
  55. package/src/cli/watch.ts +188 -215
  56. package/src/cli/why.ts +28 -17
  57. package/src/cli/workspace-config.ts +31 -68
  58. package/src/config.ts +191 -71
  59. package/src/exec/env.ts +1 -31
  60. package/src/exec/executor.ts +1 -5
  61. package/src/exec/kill-tree.ts +2 -1
  62. package/src/exec/sandbox-runtime.ts +12 -1
  63. package/src/exec/sandbox-violations.ts +9 -1
  64. package/src/graph/dependency-spec.ts +1 -1
  65. package/src/graph/index.ts +1 -0
  66. package/src/graph/priorities.ts +1 -1
  67. package/src/graph/scheduler.ts +19 -7
  68. package/src/graph/task-graph.ts +44 -20
  69. package/src/handoff.ts +169 -0
  70. package/src/index.ts +25 -57
  71. package/src/orchestrator/affected-tasks.ts +7 -5
  72. package/src/orchestrator/command-windows.ts +44 -0
  73. package/src/orchestrator/deferred-outputs.ts +12 -10
  74. package/src/orchestrator/doctor.ts +98 -110
  75. package/src/orchestrator/download-policy.ts +3 -3
  76. package/src/orchestrator/events.ts +19 -3
  77. package/src/orchestrator/excluded-keys.ts +0 -2
  78. package/src/orchestrator/execute-task.ts +192 -70
  79. package/src/orchestrator/fingerprint-watch.ts +18 -15
  80. package/src/orchestrator/forecast.ts +10 -2
  81. package/src/orchestrator/framed-output.ts +8 -3
  82. package/src/orchestrator/graph-stage.ts +5 -5
  83. package/src/orchestrator/history.ts +70 -30
  84. package/src/orchestrator/hit-restore.ts +15 -3
  85. package/src/orchestrator/index.ts +18 -4
  86. package/src/orchestrator/local-shortcircuit.ts +2 -1
  87. package/src/orchestrator/lockfile-claim.ts +79 -20
  88. package/src/orchestrator/logger.ts +71 -39
  89. package/src/orchestrator/metrics.ts +71 -6
  90. package/src/orchestrator/miss-save.ts +3 -0
  91. package/src/orchestrator/options.ts +43 -28
  92. package/src/orchestrator/output-host.ts +72 -0
  93. package/src/orchestrator/plan.ts +6 -8
  94. package/src/orchestrator/plugin-host.ts +87 -63
  95. package/src/orchestrator/plugin.ts +94 -60
  96. package/src/orchestrator/prepare.ts +114 -73
  97. package/src/orchestrator/projects.ts +102 -99
  98. package/src/orchestrator/remote-prefetch.ts +2 -1
  99. package/src/orchestrator/run-context.ts +25 -6
  100. package/src/orchestrator/run-failures.ts +17 -8
  101. package/src/orchestrator/run-lock.ts +1 -1
  102. package/src/orchestrator/run-report.ts +9 -9
  103. package/src/orchestrator/run-settings.ts +48 -0
  104. package/src/orchestrator/run.ts +127 -88
  105. package/src/orchestrator/sandbox-fix.ts +39 -20
  106. package/src/orchestrator/sandbox-request.ts +84 -13
  107. package/src/orchestrator/signals.ts +1 -1
  108. package/src/orchestrator/stable-keys.ts +13 -11
  109. package/src/orchestrator/status-line.ts +48 -6
  110. package/src/orchestrator/summary.ts +46 -62
  111. package/src/orchestrator/task-hash.ts +12 -83
  112. package/src/orchestrator/telemetry.ts +3 -3
  113. package/src/settings.ts +417 -0
  114. package/src/util/errors.ts +1 -1
  115. package/src/util/essential-env.ts +31 -0
  116. package/src/util/hide-env.ts +107 -0
  117. package/src/util/index.ts +8 -2
  118. package/src/util/paths.ts +10 -0
  119. package/src/util/settle.ts +49 -30
  120. package/src/util/size.ts +23 -4
  121. package/src/util/timing.ts +3 -2
  122. package/src/util/ulid.ts +1 -1
  123. package/src/util/verbs.ts +0 -15
  124. package/src/workspace/affected.ts +77 -222
  125. package/src/workspace/config-eval.ts +15 -20
  126. package/src/workspace/config-imports.ts +78 -3
  127. package/src/workspace/config-schema.ts +251 -241
  128. package/src/workspace/dependency-rules.ts +57 -0
  129. package/src/workspace/filter.ts +2 -2
  130. package/src/workspace/fingerprint.ts +11 -121
  131. package/src/workspace/index.ts +22 -27
  132. package/src/workspace/load-reads.ts +4 -4
  133. package/src/workspace/lockfile.ts +96 -140
  134. package/src/workspace/migration.ts +242 -146
  135. package/src/workspace/package-graph.ts +30 -216
  136. package/src/workspace/project-loader.ts +80 -285
  137. package/src/workspace/repo-id.ts +2 -1
  138. package/src/workspace/workspace.ts +362 -831
  139. package/src/cache/config-evals.ts +0 -130
  140. package/src/workspace/config-cache.ts +0 -661
  141. package/src/workspace/migrate-scripts.ts +0 -1121
package/README.md CHANGED
@@ -38,10 +38,23 @@ Windows: run vx inside WSL2.
38
38
  In a git repo with a `package.json` workspace:
39
39
 
40
40
  ```sh
41
- npx vx init # a vx.config.ts per package, from its scripts
41
+ npm install -D @vzn/vx # the scope matters: npm's `vx` is an unrelated package
42
+ npx @vzn/vx init # beside turbo.json or nx.json: migrates them; else a vx.config.ts per package
43
+ npx @vzn/vx run build --all # builds in dependency order and stores the results
44
+ npx @vzn/vx run build --all # nothing changed: every task up-to-date
42
45
  ```
43
46
 
44
- Give a task a cache block, what it reads and writes:
47
+ Bun workspaces: `bun add -d @vzn/vx` and `bunx @vzn/vx` (npm refuses to run in
48
+ a repo whose `devEngines` names Bun).
49
+
50
+ Without Turbo or Nx, tasks run uncached until you declare what they read (below).
51
+
52
+ `init` prints what it wrote and anything left to decide (a `TODO`). A miss you did not expect?
53
+ `npx @vzn/vx why <task>` names the input that moved.
54
+
55
+ ### Without Turbo or Nx
56
+
57
+ `init` writes one task per package script, uncached. Cache one by saying what it reads and writes:
45
58
 
46
59
  ```ts
47
60
  // packages/app/vx.config.ts
@@ -62,15 +75,31 @@ export default defineProject({
62
75
  ```
63
76
 
64
77
  ```sh
65
- npx vx run build --all # builds, in dependency order; stores the results
66
- npx vx run build --all # nothing changed: up-to-date, in milliseconds
78
+ npx @vzn/vx run build --all # builds, in dependency order; stores the results
79
+ npx @vzn/vx run build --all # nothing changed: up-to-date, in milliseconds
67
80
  rm -rf packages/*/dist
68
- npx vx run build --all # restored from the cache, not rebuilt
81
+ npx @vzn/vx run build --all # restored from the cache, not rebuilt
69
82
  ```
70
83
 
71
84
  <img src="https://vznjs.github.io/vx/demo.svg" width="760" alt="vx run ci --all on examples/basic: cold, three tasks run; again, three up-to-date.">
72
85
 
73
- Starter: [`examples/basic`](examples/basic), run by CI on every commit.
86
+ ### When to run `vx lock`
87
+
88
+ `init` also writes `.vx/projects.lock.json`, every project's config as it evaluated.
89
+ Commit it. Every run reads its configs from the lock, so run
90
+ `npx @vzn/vx lock` and commit the lock again after you:
91
+
92
+ - edit any `vx.config.ts` or `.vx/workspace.ts`,
93
+ - update dependencies or plugins,
94
+ - change a file a config imports.
95
+
96
+ Otherwise runs keep the old configs. On CI, `vx lock --check` fails a
97
+ stale lock before any task runs.
98
+
99
+ Starters: [`examples/basic`](examples/basic), and
100
+ [`examples/ci`](examples/ci) with a GitHub Actions workflow; CI runs both
101
+ on every commit. The [CI guide](https://vznjs.github.io/vx/guides/ci/)
102
+ explains the workflow.
74
103
  More: [Quickstart](https://vznjs.github.io/vx/quickstart/) ·
75
104
  [Configure](https://vznjs.github.io/vx/guides/configure/) ·
76
105
  [CLI](packages/vx/docs/cli.md) · [every config field](packages/vx/docs/schema.md) ·
@@ -84,13 +113,13 @@ More: [Quickstart](https://vznjs.github.io/vx/quickstart/) ·
84
113
  - **Sandboxed tasks:** opt in per task; a workspace file the task did
85
114
  not declare is out of its reach, so it cannot poison the cache.
86
115
  - **Clean exits:** Ctrl-C reaps each task's process group.
87
- - **Plugins at every stage** (14 hooks, `commands` included): remote cache, remote execution, telemetry,
116
+ - **Plugins at every stage** (15 hooks, `commands` included): remote cache, remote execution, telemetry,
88
117
  CLI verbs. Core ships none and needs none.
89
118
  - **Free:** MIT. No paywall, no cloud, no account.
90
119
 
91
120
  ## Plugins
92
121
 
93
- What vx can do, not what it is limited to. Declared in `vx.workspace.ts`; without any, vx runs and caches locally.
122
+ What vx can do, not what it is limited to. Declared in `.vx/workspace.ts`; without any, vx runs and caches locally.
94
123
 
95
124
  | Package | What it adds |
96
125
  | ---------------------------------------------------------- | ----------------------------------------------------------------------------- |
@@ -99,7 +128,6 @@ What vx can do, not what it is limited to. Declared in `vx.workspace.ts`; withou
99
128
  | [`@vzn/vx-lockfile`](packages/vx-lockfile) | Key each project on its own lockfile slice: pnpm, bun, npm, yarn |
100
129
  | [`@vzn/vx-otel`](packages/vx-otel) | OpenTelemetry traces, metrics and logs, no SDK |
101
130
  | [`@vzn/vx-ci`](packages/vx-ci) | GitHub Actions job summary and Checks API |
102
- | [`@vzn/vx-mcp`](packages/vx-mcp) | `vx mcp`: an MCP server for AI coding agents that also runs tasks |
103
131
  | [`@vzn/vx-schedule-history`](packages/vx-schedule-history) | Schedule by the critical path learned from past runs |
104
132
 
105
133
  Write your own: [plugin guide](https://vznjs.github.io/vx/guides/plugins/) ·
@@ -107,10 +135,10 @@ Write your own: [plugin guide](https://vznjs.github.io/vx/guides/plugins/) ·
107
135
 
108
136
  ## Coming from Turbo or Nx
109
137
 
110
- Beside `turbo.json` or `nx.json`, `npx vx init` runs `@vzn/vx-migrate`:
138
+ Beside `turbo.json` or `nx.json`, `npx @vzn/vx init` runs `@vzn/vx-migrate`:
111
139
  it writes a `vx.config.ts` per package from `turbo.json` or the Nx graph,
112
140
  and you keep those and delete the old config. `vx init --keep` writes only
113
- a `vx.workspace.ts` that maps the old config instead: a temporary start,
141
+ a `.vx/workspace.ts` that maps the old config instead, and its lock: a temporary start,
114
142
  not a way to run the repo. The benchmark below uses native vx config.
115
143
  [Migration guide](https://vznjs.github.io/vx/guides/migrate/).
116
144
 
@@ -138,17 +166,17 @@ Every gap, and when another tool is the better pick:
138
166
 
139
167
  <!-- bench:start — generated by packages/vx-bench/update-site.ts from results.json; do not hand-edit -->
140
168
 
141
- | Time added over the ideal run, 1,601 projects, 9,603 tasks | vx | Turborepo | Nx | Vite Task |
142
- | ---------------------------------------------------------- | ----------- | ------------------------- | -------------------------- | ------------------------ |
143
- | Nothing changed | **1.07 s** | 898 ms (vx 19% slower) | 25.45 s (vx 24× faster) | 11.75 s (vx 11× faster) |
144
- | Nothing changed, outputs restored | **1.27 s** | 844 ms (vx 51% slower) | 23.82 s (vx 19× faster) | 11.83 s (vx 9.3× faster) |
145
- | Cold build | **7.07 s** | 9.15 s (vx 29% faster) | 3 min 48 s (vx 32× faster) | 8.16 s (vx 15% faster) |
146
- | Cold build: CPU the runner burns | **32.28 s** | 1 min 3 s (vx 94% faster) | 6 min 6 s (vx 11× faster) | 24.82 s (vx 30% slower) |
169
+ | Time added over the ideal run, 1,601 projects, 9,603 tasks | vx | Turborepo | Nx | Vite Task |
170
+ | ---------------------------------------------------------- | ----------- | --------- | ---------- | --------- |
171
+ | Nothing changed | **856 ms** | 855 ms | 23.22 s | 11.24 s |
172
+ | Nothing changed, outputs restored | **1.45 s** | 1.50 s | 21.64 s | 11.21 s |
173
+ | Cold build | **7.73 s** | 10.32 s | 3 min 23 s | 9.44 s |
174
+ | Cold build: CPU the runner burns | **36.42 s** | 1 min 3 s | 5 min 35 s | 25.64 s |
147
175
 
148
- Time each tool adds over the ideal run; vx N% or N× faster means that tool adds N% more or N times as much as vx.
176
+ Time each tool adds over the ideal run; lower is better.
149
177
 
150
178
  Benchmark workload: a synthetic monorepo of 1,601 projects and 9,603 tasks in 30 dependency levels, five core libraries a quarter of the projects use; build 300 ms, test and typecheck 150 ms, lint 75 ms, publish 30 ms; real repos with uneven task times will differ.
151
- Run 2026-10-09 on linux x64, 4 cores: vx at commit 3d48a981d, Turborepo 2.11.7, Nx 23.3.0, Vite Task (vite-plus) 1.1.0.
179
+ Run 2026-10-12 on linux x64, 4 cores: vx at commit 126d60a93, Turborepo 2.11.7, Nx 23.3.0, Vite Task (vite-plus) 1.1.0.
152
180
 
153
181
  Same graph, commands and concurrency: [how it is measured](https://vznjs.github.io/vx/benchmarks/).
154
182