@vzn/vx 0.0.573 → 0.0.574
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 +5 -5
- package/src/cli/why.ts +12 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vzn/vx",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.574",
|
|
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.
|
|
25
|
-
"@vzn/vx-linux-arm64": "0.0.
|
|
26
|
-
"@vzn/vx-darwin-x64": "0.0.
|
|
27
|
-
"@vzn/vx-darwin-arm64": "0.0.
|
|
24
|
+
"@vzn/vx-linux-x64": "0.0.574",
|
|
25
|
+
"@vzn/vx-linux-arm64": "0.0.574",
|
|
26
|
+
"@vzn/vx-darwin-x64": "0.0.574",
|
|
27
|
+
"@vzn/vx-darwin-arm64": "0.0.574"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@anthropic-ai/sandbox-runtime": "^0.0.76"
|
package/src/cli/why.ts
CHANGED
|
@@ -106,7 +106,7 @@ export function parseWhyArgs(args: readonly string[]): WhyArgs {
|
|
|
106
106
|
* every recorded id (the same rule `vx run` hints with) and the hint is
|
|
107
107
|
* the runnable `project#task`; an anchored query is matched whole.
|
|
108
108
|
*/
|
|
109
|
-
function suggest(query: string, ids: readonly string[]): string {
|
|
109
|
+
function suggest(query: string, ids: readonly string[], invoked: boolean): string {
|
|
110
110
|
let hits: string[]
|
|
111
111
|
if (query.includes('#')) {
|
|
112
112
|
hits = nearMatches(query, ids)
|
|
@@ -120,9 +120,12 @@ function suggest(query: string, ids: readonly string[]): string {
|
|
|
120
120
|
}
|
|
121
121
|
if (hits.length > 0) return ` — did you mean ${hits.slice(0, 3).join(', ')}?`
|
|
122
122
|
// No near name: say where to look, or that there is nothing yet.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
// A run of only group tasks records no task row: "nothing has run" was
|
|
124
|
+
// false there, and its advice re-ran the group to the same answer.
|
|
125
|
+
if (ids.length > 0) return '; `vx last --list` shows what has run'
|
|
126
|
+
return invoked
|
|
127
|
+
? '; no recorded run executed a task (a group records none: ask about a task it depends on)'
|
|
128
|
+
: `; nothing has run here yet (vx run ${query}, then vx why)`
|
|
126
129
|
}
|
|
127
130
|
|
|
128
131
|
/**
|
|
@@ -151,8 +154,9 @@ async function resolveTarget(
|
|
|
151
154
|
.query('SELECT DISTINCT project, task FROM runs ORDER BY project, task')
|
|
152
155
|
.all() as Array<{ project: string; task: string }>
|
|
153
156
|
const ids = pairs.map((p) => `${p.project}#${p.task}`)
|
|
157
|
+
const invoked = ids.length === 0 && db.query('SELECT 1 FROM invocations LIMIT 1').get() !== null
|
|
154
158
|
if (target.includes('#')) {
|
|
155
|
-
throw new UserError(`vx why: no recorded runs for "${target}"${suggest(target, ids)}`)
|
|
159
|
+
throw new UserError(`vx why: no recorded runs for "${target}"${suggest(target, ids, invoked)}`)
|
|
156
160
|
}
|
|
157
161
|
const matches = ids.filter((id) => id.endsWith(`#${target}`))
|
|
158
162
|
if (matches.length === 1) return matches[0]!
|
|
@@ -164,7 +168,9 @@ async function resolveTarget(
|
|
|
164
168
|
matches.map((m) => ` ${m}`).join('\n'),
|
|
165
169
|
)
|
|
166
170
|
}
|
|
167
|
-
throw new UserError(
|
|
171
|
+
throw new UserError(
|
|
172
|
+
`vx why: no recorded runs for task "${target}"${suggest(target, ids, invoked)}`,
|
|
173
|
+
)
|
|
168
174
|
}
|
|
169
175
|
|
|
170
176
|
const fmtWhen = (ms: number): string => new Date(ms).toISOString()
|