@vzn/vx 0.0.198 → 0.0.199

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.198",
3
+ "version": "0.0.199",
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.198",
21
- "@vzn/vx-linux-arm64": "0.0.198",
22
- "@vzn/vx-darwin-x64": "0.0.198",
23
- "@vzn/vx-darwin-arm64": "0.0.198"
20
+ "@vzn/vx-linux-x64": "0.0.199",
21
+ "@vzn/vx-linux-arm64": "0.0.199",
22
+ "@vzn/vx-darwin-x64": "0.0.199",
23
+ "@vzn/vx-darwin-arm64": "0.0.199"
24
24
  },
25
25
  "dependencies": {
26
26
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
package/src/cli/run.ts CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  import type { ContinueMode } from '../graph/index.js'
17
17
  import { type CachePolicy, FULL_CACHE_POLICY, parseCachePolicy } from '../cache/index.js'
18
18
  import { findCwdProject, pickTask, resolveFilters } from './select.js'
19
- import { nxTargetHint } from './task-verb.js'
19
+ import { nxTargetHint, taskNamesHere } from './task-verb.js'
20
20
  import { MAX_TIMEOUT_MS, isUserError, parseDecimalInt, machineParallelism } from '../util/index.js'
21
21
  import { formatGraphDot, formatPlanJson, formatPlanText } from './plan-format.js'
22
22
 
@@ -555,6 +555,9 @@ export async function resolveRunOptions(
555
555
  return opts
556
556
  }
557
557
 
558
+ /** How many task names a run with no task names before `and N more`. */
559
+ const TASKS_SHOWN = 12
560
+
558
561
  export async function runCmd(args: readonly string[]): Promise<number> {
559
562
  const parsed = parseRunArgs(args)
560
563
  if (parsed.error) {
@@ -570,8 +573,15 @@ export async function runCmd(args: readonly string[]): Promise<number> {
570
573
  // explicit anchored positional.
571
574
  if (tasks.length === 0) {
572
575
  if (!process.stdin.isTTY) {
576
+ const names = await taskNamesHere(cwd)
577
+ const shown = (names ?? []).slice(0, TASKS_SHOWN)
578
+ const more = (names?.length ?? 0) - shown.length
579
+ const tasksHere =
580
+ shown.length === 0
581
+ ? 'vx run <task>, e.g. vx run build'
582
+ : `tasks here: ${shown.join(', ')}${more > 0 ? ` and ${more} more` : ''}`
573
583
  process.stderr.write(
574
- `vx run: missing task name (stdin is not a TTY, so no picker; vx run <task>, e.g. vx run build)${seeHelp('run')}\n`,
584
+ `vx run: missing task name (stdin is not a TTY, so no picker; ${tasksHere})${seeHelp('run')}\n`,
575
585
  )
576
586
  return 1
577
587
  }
@@ -43,6 +43,22 @@ export async function nxTargetHint(tasks: readonly string[], cwd: string): Promi
43
43
  return `\`${tasks.join(' ')}\` is Nx's project:target: vx run ${specs.join(' ')}`
44
44
  }
45
45
 
46
+ /**
47
+ * The task names `vx run <task>` can take here: the cwd project's, else
48
+ * every project's, sorted; null when no workspace loads. What a run with
49
+ * no task and no terminal for the picker names instead of a guess.
50
+ */
51
+ export async function taskNamesHere(cwd: string): Promise<string[] | null> {
52
+ const projects = await workspaceProjects(cwd)
53
+ if (projects === null) return null
54
+ const own = await findCwdProject(cwd)
55
+ const names = new Set<string>()
56
+ for (const p of projects.values())
57
+ if (own === null || p.name === own)
58
+ for (const t of Object.keys(p.config.tasks ?? {})) names.add(t)
59
+ return [...names].sort()
60
+ }
61
+
46
62
  async function workspaceProjects(
47
63
  cwd: string,
48
64
  ): Promise<Awaited<ReturnType<typeof loadCliProjects>> | null> {