@vzn/vx 0.0.279 → 0.0.280

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.279",
3
+ "version": "0.0.280",
4
4
  "description": "A fast, correct task runner and build cache for JavaScript monorepos.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,10 +17,10 @@
17
17
  "node": ">=18"
18
18
  },
19
19
  "optionalDependencies": {
20
- "@vzn/vx-linux-x64": "0.0.279",
21
- "@vzn/vx-linux-arm64": "0.0.279",
22
- "@vzn/vx-darwin-x64": "0.0.279",
23
- "@vzn/vx-darwin-arm64": "0.0.279"
20
+ "@vzn/vx-linux-x64": "0.0.280",
21
+ "@vzn/vx-linux-arm64": "0.0.280",
22
+ "@vzn/vx-darwin-x64": "0.0.280",
23
+ "@vzn/vx-darwin-arm64": "0.0.280"
24
24
  },
25
25
  "dependencies": {
26
26
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
package/src/cli/help.ts CHANGED
@@ -61,7 +61,7 @@ export function helpText(pluginCommands: readonly string[] = []): string {
61
61
  ' foo, @scope/*, ./packages/foo, foo..., ...foo,',
62
62
  ' foo^..., !foo, [<since>]',
63
63
  ' --affected[=<base>] Sugar for --filter "...[<base>]". Default base =',
64
- ' origin/HEAD (falls back to HEAD~1).',
64
+ ' affectedBase, else origin/HEAD, else HEAD~1.',
65
65
  " pkg#task Run a specific project's task directly.",
66
66
  '',
67
67
  'Execution (for run):',
@@ -216,6 +216,9 @@ export function flagHint(verb: string, arg: string): string {
216
216
  if (!arg.startsWith('-')) return ''
217
217
  const name = arg.replace(/=.*$/, '')
218
218
  const flags = acceptedFlags(verb)
219
+ // `--json` is gh's and Nx's spelling; a verb with `--format` reads it
220
+ // there, and no edit budget reaches `--format json` from `--json`.
221
+ if (name === '--json' && flags.includes('--format')) return ' (did you mean --format json?)'
219
222
  // A flag cut short at a word (`--dry` for prune's `--dry-run`, which
220
223
  // `vx run` spells `--dry`) is too many edits away for either budget.
221
224
  const cut = flags.filter((f) => f.startsWith(`${name}-`))
package/src/cli/run.ts CHANGED
@@ -17,6 +17,7 @@ import type { ContinueMode } from '../graph/index.js'
17
17
  import { type CachePolicy, FULL_CACHE_POLICY, parseCachePolicy } from '../cache/index.js'
18
18
  import { findCwdSelection, pickTask, resolveFilters } from './select.js'
19
19
  import { nxTargetHint, taskNamesHere } from './task-verb.js'
20
+ import { loadCliWorkspace } from './workspace-config.js'
20
21
  import { MAX_TIMEOUT_MS, isUserError, parseDecimalInt, machineParallelism } from '../util/index.js'
21
22
  import { formatGraphDot, formatPlanJson, formatPlanText } from './plan-format.js'
22
23
 
@@ -464,6 +465,9 @@ export async function resolveRunOptions(
464
465
  if (parsed.affected !== undefined) {
465
466
  const root = await findWorkspaceRoot(cwd)
466
467
  let base = parsed.affected
468
+ // The workspace's `affectedBase` — or a plugin's `config` stage, from
469
+ // nx.json's `defaultBase` or `TURBO_SCM_BASE` — comes before the guess.
470
+ if (base === '') base = (await loadCliWorkspace(root)).workspaceConfig?.affectedBase ?? ''
467
471
  if (base === '') {
468
472
  try {
469
473
  base = await defaultAffectedBase(root)
package/src/config.ts CHANGED
@@ -22,6 +22,12 @@ export interface WorkspaceConfig {
22
22
  * folded into a cache key.
23
23
  */
24
24
  cacheRetention?: { olderThan?: string; maxSize?: string }
25
+ /**
26
+ * The git ref a bare `--affected` compares with (`origin/develop`).
27
+ * `--affected=<base>` overrides it. Omitted → `origin/HEAD`, else
28
+ * `HEAD~1`. Never folded into a cache key.
29
+ */
30
+ affectedBase?: string
25
31
  /**
26
32
  * Plugins registered for this workspace, consulted in this order once
27
33
  * per `vx run`: each fills any of the pipeline stages and capabilities
@@ -35,6 +35,7 @@ const WORKSPACE_FIELDS = new Set([
35
35
  'cacheDir',
36
36
  'timeout',
37
37
  'cacheRetention',
38
+ 'affectedBase',
38
39
  'plugins',
39
40
  ])
40
41
 
@@ -105,6 +106,12 @@ export function validateWorkspace(config: WorkspaceConfig, configPath: string):
105
106
  assertTimeoutInRange(config.timeout, `${configPath}: \`timeout\``)
106
107
  }
107
108
  if (config.cacheRetention !== undefined) validateRetention(config.cacheRetention, configPath)
109
+ if (config.affectedBase !== undefined) {
110
+ // A leading '-' would reach git as an option, not a ref.
111
+ if (typeof config.affectedBase !== 'string' || !/^[^-\s]\S*$/.test(config.affectedBase)) {
112
+ throw new UserError(`${configPath}: \`affectedBase\` must be a git ref like 'origin/main'`)
113
+ }
114
+ }
108
115
  if (config.plugins !== undefined) {
109
116
  if (!Array.isArray(config.plugins)) {
110
117
  throw new UserError(`${configPath}: \`plugins\` must be an array of plugin objects`)
@@ -768,7 +775,7 @@ const FOREIGN_FIELDS: ReadonlyMap<ReadonlySet<string>, Readonly<Record<string, s
768
775
  'a cache plugin in `plugins` (`turboCache()` or `nxCache()` from `@vzn/vx-migrate`)',
769
776
  parallel: '`concurrency`',
770
777
  cacheDirectory: '`cacheDir`',
771
- defaultBase: 'the base in `--affected=<base>` (default `origin/HEAD`)',
778
+ defaultBase: '`affectedBase`',
772
779
  tasksRunnerOptions: 'a cache plugin in `plugins` (`nxCache()` from `@vzn/vx-migrate`)',
773
780
  globalPassThroughEnv: '`exec.env.passThrough` on the tasks it passes to',
774
781
  },