@vzn/vx 0.0.568 → 0.0.570

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vzn/vx",
3
- "version": "0.0.568",
3
+ "version": "0.0.570",
4
4
  "description": "The fastest task runner and build cache for JavaScript monorepos.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -21,10 +21,10 @@
21
21
  "node": ">=18"
22
22
  },
23
23
  "optionalDependencies": {
24
- "@vzn/vx-linux-x64": "0.0.568",
25
- "@vzn/vx-linux-arm64": "0.0.568",
26
- "@vzn/vx-darwin-x64": "0.0.568",
27
- "@vzn/vx-darwin-arm64": "0.0.568"
24
+ "@vzn/vx-linux-x64": "0.0.570",
25
+ "@vzn/vx-linux-arm64": "0.0.570",
26
+ "@vzn/vx-darwin-x64": "0.0.570",
27
+ "@vzn/vx-darwin-arm64": "0.0.570"
28
28
  },
29
29
  "dependencies": {
30
30
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
package/src/cli/run.ts CHANGED
@@ -10,6 +10,7 @@ import {
10
10
  outcomeLabel,
11
11
  projectOutcome,
12
12
  run as runOrchestrator,
13
+ shellQuote,
13
14
  type OutcomeView,
14
15
  type RunOptions,
15
16
  type RunResult,
@@ -649,8 +650,9 @@ export async function runCmd(args: readonly string[]): Promise<number> {
649
650
  }
650
651
  const opts = resolved
651
652
  // The raw invocation, recorded on the `invocations` row so dashboards
652
- // show what was actually run. `args` is everything after `run`.
653
- opts.command = ['vx', 'run', ...args].join(' ')
653
+ // show what was actually run. `args` is everything after `run`, quoted
654
+ // so `vx last` replays one paste-able line.
655
+ opts.command = ['vx', 'run', ...args.map(shellQuote)].join(' ')
654
656
 
655
657
  // Planning paths short-circuit execution. Both build the full task
656
658
  // graph + probe the cache; the difference is just the formatter.
package/src/exec/index.ts CHANGED
@@ -13,6 +13,7 @@ export {
13
13
  runPersistent,
14
14
  PersistentReadyError,
15
15
  withForwardArgs,
16
+ shellQuote,
16
17
  signalExitCode,
17
18
  exitSignal,
18
19
  type CaptureConfig,
@@ -106,7 +106,8 @@ function taskStdio(terminal: boolean | undefined, stdin: 'ignore' | 'pipe') {
106
106
 
107
107
  export function shellQuote(arg: string): string {
108
108
  if (arg === '') return `''`
109
- if (/^[A-Za-z0-9_\-.,/=:@%+]+$/.test(arg)) return arg
109
+ // A `#` opens a comment only at a word's start, so `app#build` stays bare.
110
+ if (/^[A-Za-z0-9_\-.,/=:@%+][A-Za-z0-9_\-.,/=:@%+#]*$/.test(arg)) return arg
110
111
  return `'${arg.replace(/'/g, `'\\''`)}'`
111
112
  }
112
113
 
@@ -21,7 +21,8 @@ export type { HeldPersistent, RunOptions, RunSummary } from './options.js'
21
21
  // reach it without importing the cache module directly.
22
22
  export { type CachePolicy, FULL_CACHE_POLICY, parseCachePolicy } from '../cache/index.js'
23
23
  // The CLI reads a recorded exit code; the runner's convention decodes it.
24
- export { exitSignal } from '../exec/index.js'
24
+ // It records its own argv quoted as the runner quotes forwarded args.
25
+ export { exitSignal, shellQuote } from '../exec/index.js'
25
26
  export { forwardedSignal } from './signals.js'
26
27
  // `vx cache prune` waits for a run on the workspace before it evicts.
27
28
  export { acquireRunLock } from './run-lock.js'
@@ -428,7 +428,31 @@ function unchangedKeyNote(
428
428
  if (createdAt !== undefined && createdAt >= this_.startedAt) {
429
429
  return 'cache key unchanged — no entry for this key was in the cache when it ran (pruned or evicted), so it executed and saved one'
430
430
  }
431
- return 'cache key unchanged — re-executed on the same key (--no-cache / --force, or unrelated)'
431
+ // The flags that skip a read were ruled out above whenever the policy was
432
+ // recorded; blaming them here named a flag the policy shows was not passed
433
+ // when the previous run's save had failed (X-46). No row records a failed
434
+ // save, only its trace: the previous run executed, succeeded, and no entry
435
+ // holds the key.
436
+ if (policy === undefined) {
437
+ return 'cache key unchanged — re-executed on the same key (--no-cache / --force, or unrelated)'
438
+ }
439
+ if (createdAt === undefined && prev.status === 'success' && prev.cacheHit === 0) {
440
+ const prevPolicy =
441
+ prev.runId === null
442
+ ? undefined
443
+ : (
444
+ db
445
+ .query('SELECT cache_policy AS p FROM invocations WHERE run_id = ?')
446
+ .get(prev.runId) as {
447
+ p: string
448
+ } | null
449
+ )?.p
450
+ if (prevPolicy !== undefined && !prevPolicy.split(',').some((a) => a === 'lW' || a === 'rW')) {
451
+ return 'cache key unchanged — the previous run on this key did not write the cache (--no-cache, or a --cache without write), so there was nothing to hit'
452
+ }
453
+ return 'cache key unchanged — the previous run on this key executed but no entry for it is in the cache (its save failed, or it was pruned since), so there was nothing to hit'
454
+ }
455
+ return 'cache key unchanged — re-executed on the same key though this run read the cache; vx cannot name the cause'
432
456
  }
433
457
 
434
458
  /**
@@ -65,6 +65,9 @@ export function secretMask(
65
65
  const add = (value: string | undefined): void => {
66
66
  if (value === undefined || value.length < MIN_SECRET_CHARS) return
67
67
  values.add(value)
68
+ // A value with a `'` reaches a printed command spelled as shellQuote
69
+ // spells it (`'\''`), which the plain value does not match (X-45).
70
+ if (value.includes("'")) values.add(value.replaceAll("'", `'\\''`))
68
71
  // A multi-line value (a PEM key) is also masked line by line, as GitHub
69
72
  // Actions does: a tool that indents or reflows it prints no copy of the
70
73
  // whole value, and every line leaked (L-36).