@vzn/vx 0.0.576 → 0.0.578
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/cache/git-inputs.ts +2 -5
- package/src/util/errors.ts +12 -0
- package/src/util/index.ts +1 -0
- package/src/workspace/affected.ts +23 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vzn/vx",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.578",
|
|
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.578",
|
|
25
|
+
"@vzn/vx-linux-arm64": "0.0.578",
|
|
26
|
+
"@vzn/vx-darwin-x64": "0.0.578",
|
|
27
|
+
"@vzn/vx-darwin-arm64": "0.0.578"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@anthropic-ai/sandbox-runtime": "^0.0.76"
|
package/src/cache/git-inputs.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
executablePath,
|
|
13
13
|
gitSpawnRefusal,
|
|
14
14
|
isInstalledPath,
|
|
15
|
+
notAWorkTree,
|
|
15
16
|
xxh3hex,
|
|
16
17
|
} from '../util/index.js'
|
|
17
18
|
import { FILE_HASH_RACY_MS, racyWindowMs } from './layer.js'
|
|
@@ -457,11 +458,7 @@ export function runGitLsFiles(cwd: string): GitLsResult {
|
|
|
457
458
|
if (proc.exitCode !== 0) {
|
|
458
459
|
// Exit 128 = not a git work tree; other non-zero = git failure.
|
|
459
460
|
// Either way we can't enumerate inputs reliably.
|
|
460
|
-
|
|
461
|
-
throw new UserError(
|
|
462
|
-
`vx requires git: ${cwd} is not inside a git work tree. ` +
|
|
463
|
-
`Run 'git init' in your workspace root.${stderr ? ` (git: ${stderr})` : ''}`,
|
|
464
|
-
)
|
|
461
|
+
throw notAWorkTree(cwd, new TextDecoder().decode(proc.stderr).trim())
|
|
465
462
|
}
|
|
466
463
|
const { text, undecodable } = decodeGitZ(proc.stdout)
|
|
467
464
|
const parsed = parseLsFilesOutput(text.length === 0 ? [] : text.split('\0'), undecodable)
|
package/src/util/errors.ts
CHANGED
|
@@ -98,6 +98,18 @@ export function gitSpawnRefusal(cwd: string): UserError {
|
|
|
98
98
|
)
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
/**
|
|
102
|
+
* The one refusal for a directory git does not track, wherever vx needed
|
|
103
|
+
* it: `--affected` named a missing base there, as a shallow clone, while
|
|
104
|
+
* a plain run already said this (X-52).
|
|
105
|
+
*/
|
|
106
|
+
export function notAWorkTree(cwd: string, stderr = ''): UserError {
|
|
107
|
+
return new UserError(
|
|
108
|
+
`vx requires git: ${cwd} is not inside a git work tree. ` +
|
|
109
|
+
`Run 'git init' in your workspace root.${stderr ? ` (git: ${stderr})` : ''}`,
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
101
113
|
export const TMPDIR_HINT = 'point TMPDIR at a writable directory'
|
|
102
114
|
|
|
103
115
|
/**
|
package/src/util/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
gitSpawnRefusal,
|
|
16
16
|
isExecutableMissing,
|
|
17
17
|
isInstalledPath,
|
|
18
|
+
notAWorkTree,
|
|
18
19
|
relPosix,
|
|
19
20
|
} from '../util/index.js'
|
|
20
21
|
import { LOCKFILE_NAME } from './lockfile.js'
|
|
@@ -649,6 +650,8 @@ export async function defaultAffectedBase(workspaceRoot: string): Promise<string
|
|
|
649
650
|
const trunk = trunkBase(workspaceRoot)
|
|
650
651
|
if (trunk !== undefined) return trunk
|
|
651
652
|
if (revParse(workspaceRoot, 'HEAD~1') === undefined) {
|
|
653
|
+
const noHistory = noHistoryRefusal(workspaceRoot)
|
|
654
|
+
if (noHistory !== undefined) throw noHistory
|
|
652
655
|
throw new UserError(
|
|
653
656
|
'--affected has no base here: origin/HEAD is not set (or names a branch that is gone) and HEAD has no parent to compare ' +
|
|
654
657
|
'with — a shallow clone? Fetch history (actions/checkout: fetch-depth: 0) or name the ' +
|
|
@@ -658,6 +661,24 @@ export async function defaultAffectedBase(workspaceRoot: string): Promise<string
|
|
|
658
661
|
return 'HEAD~1'
|
|
659
662
|
}
|
|
660
663
|
|
|
664
|
+
/**
|
|
665
|
+
* Why a base cannot resolve before any ref is to blame: no work tree, or
|
|
666
|
+
* no commit yet. Asked only once a base has failed, so a run that finds
|
|
667
|
+
* one spawns nothing more (X-52).
|
|
668
|
+
*/
|
|
669
|
+
function noHistoryRefusal(workspaceRoot: string): UserError | undefined {
|
|
670
|
+
const tree = spawnGitSync(['rev-parse', '--is-inside-work-tree'], workspaceRoot, 'pipe')
|
|
671
|
+
if (tree.exitCode !== 0) {
|
|
672
|
+
return notAWorkTree(workspaceRoot, new TextDecoder().decode(tree.stderr).trim())
|
|
673
|
+
}
|
|
674
|
+
if (revParse(workspaceRoot, 'HEAD') === undefined) {
|
|
675
|
+
return new UserError(
|
|
676
|
+
'--affected has no base here: this repository has no commit yet. Commit first, or run without --affected.',
|
|
677
|
+
)
|
|
678
|
+
}
|
|
679
|
+
return undefined
|
|
680
|
+
}
|
|
681
|
+
|
|
661
682
|
const TRUNKS = ['origin/main', 'origin/master', 'main', 'master']
|
|
662
683
|
|
|
663
684
|
/** The first of `TRUNKS` that exists and is not HEAD's commit, in one spawn. */
|
|
@@ -752,6 +773,8 @@ async function verifyRef(workspaceRoot: string, ref: string): Promise<void> {
|
|
|
752
773
|
// 1 gets the ref message; anything else surfaces what git actually said.
|
|
753
774
|
const stderr = new TextDecoder().decode(proc.stderr).trim()
|
|
754
775
|
if (proc.exitCode !== 1) {
|
|
776
|
+
const noHistory = noHistoryRefusal(workspaceRoot)
|
|
777
|
+
if (noHistory !== undefined) throw noHistory
|
|
755
778
|
throw new UserError(
|
|
756
779
|
`git rev-parse failed (exit ${proc.exitCode}) in ${workspaceRoot}` +
|
|
757
780
|
(stderr.length > 0 ? `: ${stderr}` : ''),
|