@vzn/vx 0.0.645 → 0.0.648

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 (186) hide show
  1. package/README.md +39 -50
  2. package/launcher.cjs +9 -2
  3. package/launcher.sh +2 -2
  4. package/package.json +5 -5
  5. package/schemas/cache.json +5 -5
  6. package/schemas/error.json +1 -1
  7. package/schemas/info.json +16 -2
  8. package/schemas/last.json +127 -5
  9. package/schemas/plan.json +28 -2
  10. package/schemas/show.json +10 -1
  11. package/skills/vx/SKILL.md +19 -3
  12. package/src/bin.ts +54 -13
  13. package/src/cache/archive.ts +324 -23
  14. package/src/cache/cache.ts +330 -65
  15. package/src/cache/git-inputs.ts +274 -97
  16. package/src/cache/index.ts +7 -2
  17. package/src/cache/inputs.ts +515 -83
  18. package/src/cache/key-fold.ts +15 -6
  19. package/src/cache/layer.ts +74 -11
  20. package/src/cache/layered-cache.ts +154 -59
  21. package/src/cache/linked-inputs.ts +1 -1
  22. package/src/cache/output-index.ts +44 -14
  23. package/src/cache/plugin-cache.ts +49 -23
  24. package/src/cache/remote-hits.ts +72 -0
  25. package/src/cache/remote-lane.ts +100 -15
  26. package/src/cache/run-history.ts +77 -23
  27. package/src/cache/run-store.ts +11 -10
  28. package/src/cache/schema.ts +42 -6
  29. package/src/cache/tar-stream.ts +5 -0
  30. package/src/cache/umask.ts +1 -2
  31. package/src/cli/cache.ts +58 -27
  32. package/src/cli/completions.ts +12 -5
  33. package/src/cli/core-alias.ts +5 -2
  34. package/src/cli/docs.ts +42 -16
  35. package/src/cli/help.ts +62 -25
  36. package/src/cli/index.ts +79 -45
  37. package/src/cli/info.ts +12 -6
  38. package/src/cli/init.ts +222 -34
  39. package/src/cli/last.ts +443 -47
  40. package/src/cli/lock.ts +197 -52
  41. package/src/cli/plan-format.ts +91 -49
  42. package/src/cli/plugin-commands.ts +160 -11
  43. package/src/cli/plugin-templates.ts +13 -13
  44. package/src/cli/registry.ts +209 -0
  45. package/src/cli/run.ts +111 -41
  46. package/src/cli/select.ts +148 -49
  47. package/src/cli/show.ts +59 -16
  48. package/src/cli/task-verb.ts +16 -6
  49. package/src/cli/upgrade.ts +155 -54
  50. package/src/cli/watch-cycle.ts +10 -5
  51. package/src/cli/watch-filter.ts +71 -3
  52. package/src/cli/watch-fs.ts +22 -6
  53. package/src/cli/watch-judge.ts +48 -6
  54. package/src/cli/watch.ts +163 -42
  55. package/src/cli/why.ts +211 -73
  56. package/src/cli/workspace-config.ts +54 -15
  57. package/src/config.ts +13 -1
  58. package/src/exec/env.ts +7 -2
  59. package/src/exec/executor.ts +262 -15
  60. package/src/exec/index.ts +8 -2
  61. package/src/exec/kill-tree.ts +15 -0
  62. package/src/exec/local-executor.ts +1 -1
  63. package/src/exec/proc-sample.ts +70 -6
  64. package/src/exec/runner.ts +256 -53
  65. package/src/exec/sandbox-binds.ts +7 -3
  66. package/src/exec/sandbox-paths.ts +1 -1
  67. package/src/exec/sandbox-runtime.ts +222 -28
  68. package/src/exec/sandbox-violations.ts +52 -20
  69. package/src/graph/critical-path.ts +79 -0
  70. package/src/graph/default-build.ts +19 -0
  71. package/src/graph/definition.ts +38 -0
  72. package/src/graph/folds.ts +38 -5
  73. package/src/graph/index.ts +4 -1
  74. package/src/graph/priorities.ts +74 -8
  75. package/src/graph/scheduler.ts +326 -65
  76. package/src/graph/task-graph.ts +228 -35
  77. package/src/handoff.ts +97 -9
  78. package/src/history/failure-mode.ts +6 -3
  79. package/src/history/history.ts +268 -50
  80. package/src/history/index.ts +2 -0
  81. package/src/history/metrics.ts +142 -45
  82. package/src/index.ts +42 -10
  83. package/src/orchestrator/admission.ts +10 -6
  84. package/src/orchestrator/affected-tasks.ts +11 -6
  85. package/src/orchestrator/deferred-outputs.ts +2 -0
  86. package/src/orchestrator/doctor.ts +134 -42
  87. package/src/orchestrator/execute-args.ts +6 -0
  88. package/src/orchestrator/execute-task.ts +155 -42
  89. package/src/orchestrator/fingerprint-watch.ts +1 -1
  90. package/src/orchestrator/graph-memo.ts +140 -0
  91. package/src/orchestrator/graph-stage.ts +18 -1
  92. package/src/orchestrator/held-servers.ts +86 -0
  93. package/src/orchestrator/hit-restore.ts +227 -122
  94. package/src/orchestrator/index.ts +20 -3
  95. package/src/orchestrator/local-floor.ts +198 -0
  96. package/src/orchestrator/local-shortcircuit.ts +51 -8
  97. package/src/orchestrator/lockfile-claim.ts +96 -16
  98. package/src/orchestrator/miss-save.ts +52 -12
  99. package/src/orchestrator/options.ts +8 -6
  100. package/src/orchestrator/output-host.ts +43 -14
  101. package/src/orchestrator/output-log.ts +90 -10
  102. package/src/orchestrator/persistent-task.ts +97 -28
  103. package/src/orchestrator/persistent.ts +16 -4
  104. package/src/orchestrator/placement.ts +257 -14
  105. package/src/orchestrator/plan.ts +64 -7
  106. package/src/orchestrator/plugin-host.ts +230 -40
  107. package/src/orchestrator/plugin.ts +150 -37
  108. package/src/orchestrator/prepare.ts +178 -32
  109. package/src/orchestrator/projects.ts +65 -40
  110. package/src/orchestrator/remote-prefetch.ts +119 -25
  111. package/src/orchestrator/run-artifacts.ts +95 -32
  112. package/src/orchestrator/run-context.ts +39 -41
  113. package/src/orchestrator/run-failures.ts +65 -23
  114. package/src/orchestrator/run-id.ts +6 -3
  115. package/src/orchestrator/run-keys.ts +300 -0
  116. package/src/orchestrator/run-live.ts +294 -0
  117. package/src/orchestrator/run-lock.ts +13 -7
  118. package/src/orchestrator/run-records.ts +35 -23
  119. package/src/orchestrator/run-report.ts +3 -3
  120. package/src/orchestrator/run-steps.ts +58 -22
  121. package/src/orchestrator/run-stop.ts +22 -5
  122. package/src/orchestrator/run.ts +409 -79
  123. package/src/orchestrator/sandbox-fix.ts +7 -5
  124. package/src/orchestrator/sandbox-request.ts +78 -22
  125. package/src/orchestrator/shell-verdict.ts +5 -5
  126. package/src/orchestrator/signals.ts +26 -1
  127. package/src/orchestrator/stable-keys.ts +92 -8
  128. package/src/orchestrator/steps.ts +2 -2
  129. package/src/orchestrator/task-artifacts.ts +206 -0
  130. package/src/orchestrator/task-hash.ts +89 -14
  131. package/src/orchestrator/task-log-buffer.ts +72 -36
  132. package/src/orchestrator/task-process.ts +22 -0
  133. package/src/orchestrator/telemetry-host.ts +24 -3
  134. package/src/orchestrator/telemetry.ts +113 -38
  135. package/src/orchestrator/upstream.ts +15 -0
  136. package/src/report/events.ts +32 -13
  137. package/src/report/forecast.ts +36 -35
  138. package/src/report/framed-output.ts +173 -46
  139. package/src/report/index.ts +1 -0
  140. package/src/report/logger.ts +217 -186
  141. package/src/report/path-links.ts +12 -4
  142. package/src/report/plain-output.ts +13 -5
  143. package/src/report/status-line.ts +94 -46
  144. package/src/report/summary.ts +174 -38
  145. package/src/report/terminal-signals.ts +13 -2
  146. package/src/settings.ts +14 -6
  147. package/src/util/bun-version.ts +4 -1
  148. package/src/util/colors.ts +20 -3
  149. package/src/util/config-frame.ts +41 -4
  150. package/src/{graph → util}/dependency-spec.ts +22 -13
  151. package/src/util/edit-distance.ts +13 -1
  152. package/src/util/env-flag.ts +9 -0
  153. package/src/util/errors.ts +59 -3
  154. package/src/util/essential-env.ts +57 -0
  155. package/src/util/git-ignored.ts +1 -1
  156. package/src/util/hash.ts +35 -0
  157. package/src/util/hide-env.ts +45 -5
  158. package/src/util/index.ts +22 -5
  159. package/src/util/num.ts +8 -0
  160. package/src/util/paths.ts +121 -21
  161. package/src/util/report.ts +6 -1
  162. package/src/util/secret-mask.ts +62 -1
  163. package/src/util/secrets.ts +7 -2
  164. package/src/util/size.ts +11 -3
  165. package/src/util/tail.ts +6 -1
  166. package/src/util/timing.ts +13 -1
  167. package/src/util/ui.ts +65 -4
  168. package/src/util/which.ts +1 -1
  169. package/src/util/write-file.ts +67 -0
  170. package/src/workspace/affected.ts +710 -107
  171. package/src/workspace/bracket-literal.ts +84 -0
  172. package/src/workspace/canonical-dir.ts +37 -0
  173. package/src/workspace/config-bytecode.ts +282 -0
  174. package/src/workspace/config-eval.ts +29 -8
  175. package/src/workspace/config-imports.ts +199 -58
  176. package/src/workspace/config-schema.ts +242 -39
  177. package/src/workspace/filter.ts +37 -8
  178. package/src/workspace/index.ts +11 -2
  179. package/src/workspace/json-data.ts +3 -4
  180. package/src/workspace/lockfile.ts +57 -8
  181. package/src/workspace/migration.ts +72 -49
  182. package/src/workspace/package-graph.ts +5 -4
  183. package/src/workspace/project-loader.ts +314 -47
  184. package/src/workspace/repo-id.ts +1 -1
  185. package/src/workspace/workspace.ts +176 -33
  186. package/src/cli/foreign-flags.ts +0 -727
package/src/bin.ts CHANGED
@@ -25,11 +25,28 @@ async function main(): Promise<void> {
25
25
  // ~7 ms, half of this verb (2026-10-02). A reader gone (EPIPE) is no
26
26
  // failure of the line.
27
27
  // Handed off, it says which vx ran and which one handed it the call.
28
- const from = process.env['VX_HANDED_OFF']
28
+ const from = process.env['VX_HANDED_OFF'] || undefined
29
29
  const where = from === undefined ? '' : ` (${vxPath()}, handed off from ${from})`
30
- await Bun.write(Bun.stdout, `vx ${(await import('./version.js')).VERSION}${where}\n`).catch(
31
- () => {},
32
- )
30
+ // Painted as every other line; piped, the same words a script reads.
31
+ // Decided here, not by util's `detectColors`: the util barrel was the
32
+ // 20 ms above, and `node:tty` 17 ms; fd 1 as a character device is the
33
+ // TTY answer. A CI's log is not painted for this one line.
34
+ const [{ VERSION }, { fstatSync }] = await Promise.all([
35
+ import('./version.js'),
36
+ import('node:fs'),
37
+ ])
38
+ const env = process.env
39
+ const on = env['NO_COLOR']
40
+ ? false
41
+ : env['FORCE_COLOR'] !== undefined
42
+ ? env['FORCE_COLOR'] !== '0' && env['FORCE_COLOR'] !== 'false'
43
+ : env['TERM'] !== 'dumb' && fstatSync(1).isCharacterDevice()
44
+ const sgr = (code: string, text: string): string =>
45
+ on ? `\x1b[${code}m${text}\x1b[0m` : text
46
+ await Bun.write(
47
+ Bun.stdout,
48
+ `${sgr('1', 'vx')} ${sgr('38;2;6;182;212', VERSION)}${where === '' ? '' : sgr('2', where)}\n`,
49
+ ).catch(() => {})
33
50
  settled = true
34
51
  return
35
52
  }
@@ -39,7 +56,7 @@ async function main(): Promise<void> {
39
56
  // package, a workspace or project config — resolves to THIS core, not to
40
57
  // a second copy from node_modules (core-alias.ts says why and what it
41
58
  // costs). Registered before any verb runs; the façade loads on first use.
42
- registerCoreAlias(() => import('./index.js') as Promise<Record<string, unknown>>)
59
+ registerCoreAlias(() => require('./index.js') as Record<string, unknown>)
43
60
  const code = await run(argv)
44
61
  // Not `process.exit` here: Bun drops what a pipe has not yet taken
45
62
  // when it follows a large write (300 KB written, 64 KiB delivered;
@@ -64,15 +81,19 @@ async function main(): Promise<void> {
64
81
  // A plugin's failure quotes what it was told (a remote's reply, a
65
82
  // header), and a config's own throw is its author's text: a secret in
66
83
  // either reached stderr whole (L-11).
67
- const say = (line: string): void => void process.stderr.write(maskedLine(line))
84
+ const say = (line: string): void =>
85
+ void process.stderr.write(
86
+ `${ui.tagged('error', maskedLine(line), detectColors(process.stderr))}\n`,
87
+ )
68
88
  // UserError (workspace not found, cycle, config invalid, ...) —
69
89
  // print the message only; the stack is noise the user can't act
70
90
  // on. Everything else gets the full stack so internal bugs are
71
91
  // debuggable.
72
92
  if (isUserError(err)) {
73
- // A message that names its verb (`vx why: …`) is that verb's; any
74
- // other is the verb typed. A config refusal shows its line.
75
- const named = /^(vx [a-z][\w-]*): /.exec(err.message)
93
+ // A message that names its verb (`vx why: …`, a plugin's `vx dte
94
+ // worker: …`) is that verb's; any other is the verb typed. A config
95
+ // refusal shows its line.
96
+ const named = /^(vx [a-z][\w-]*(?: [a-z][\w-]*)?): /.exec(err.message)
76
97
  const typed = /^[a-z][\w-]*$/.test(argv[0] ?? '') ? `vx ${argv[0]}` : 'vx'
77
98
  const block = refusalNotice(
78
99
  named?.[1] ?? typed,
@@ -87,8 +108,7 @@ async function main(): Promise<void> {
87
108
  // the verb's write, which the reader cannot act on either.
88
109
  say(`vx: ${err.message} — ${fsRefusalHint(err)}\n`)
89
110
  } else {
90
- const message = err instanceof Error ? (err.stack ?? err.message) : String(err)
91
- say(`vx: ${message}\n`)
111
+ say(`vx: ${withCauses(err)}\n`)
92
112
  }
93
113
  // A verb asked for JSON answers JSON on a refusal too: an agent reading
94
114
  // stdout got nothing to parse, and only prose on stderr to branch on.
@@ -126,6 +146,26 @@ async function exitOnceFlushed(): Promise<void> {
126
146
  process.stderr.end(ended)
127
147
  }
128
148
 
149
+ /**
150
+ * An error's stack, then each `cause` under it: a config or plugin that
151
+ * wraps a failure (`new Error(msg, { cause })`) put the reason there, and
152
+ * the stack alone printed only the wrapper. Bounded, and a cause seen
153
+ * before ends the chain.
154
+ */
155
+ function withCauses(err: unknown): string {
156
+ const text = (e: unknown): string =>
157
+ e instanceof Error ? (e.stack ?? `${e.name}: ${e.message}`) : String(e)
158
+ let out = text(err)
159
+ const seen = new Set<unknown>([err])
160
+ let at = err instanceof Error ? err.cause : undefined
161
+ for (let depth = 0; at !== undefined && at !== null && !seen.has(at) && depth < 8; depth++) {
162
+ seen.add(at)
163
+ out += `\nCaused by: ${at instanceof Error ? text(at) : Bun.inspect(at)}`
164
+ at = at instanceof Error ? at.cause : undefined
165
+ }
166
+ return out
167
+ }
168
+
129
169
  // The loop drained while the verb was still pending: something it awaits
130
170
  // can never settle (a plugin hook whose promise is never resolved), and
131
171
  // with no exit code set Bun exits 0 — a run whose task failed reported
@@ -134,8 +174,9 @@ async function exitOnceFlushed(): Promise<void> {
134
174
  process.on('beforeExit', () => {
135
175
  if (settled) return
136
176
  settled = true
137
- process.stderr.write(
138
- 'vx: the run stopped before it finished: something it awaited can never settle (a plugin hook?)\n',
177
+ ;(require('./util/index.js') as typeof import('./util/index.js')).ui.say(
178
+ 'error',
179
+ 'vx: the run stopped before it finished: something it awaited can never settle (a plugin hook?)',
139
180
  )
140
181
  process.exitCode = 1
141
182
  })