@tokenfactory/acc-runner 0.42.0 → 0.44.0

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.
Files changed (111) hide show
  1. package/README.md +52 -3
  2. package/dist/companion-run.d.ts.map +1 -1
  3. package/dist/companion-run.js +20 -0
  4. package/dist/companion-run.js.map +1 -1
  5. package/dist/config.d.ts +72 -0
  6. package/dist/config.d.ts.map +1 -1
  7. package/dist/config.js +117 -3
  8. package/dist/config.js.map +1 -1
  9. package/dist/doctor.d.ts.map +1 -1
  10. package/dist/doctor.js +13 -3
  11. package/dist/doctor.js.map +1 -1
  12. package/dist/engines/account-probe.d.ts +24 -0
  13. package/dist/engines/account-probe.d.ts.map +1 -1
  14. package/dist/engines/account-probe.js +18 -1
  15. package/dist/engines/account-probe.js.map +1 -1
  16. package/dist/engines/registry.d.ts +17 -6
  17. package/dist/engines/registry.d.ts.map +1 -1
  18. package/dist/engines/registry.js +38 -13
  19. package/dist/engines/registry.js.map +1 -1
  20. package/dist/git-auth/github-token-source.d.ts +54 -0
  21. package/dist/git-auth/github-token-source.d.ts.map +1 -0
  22. package/dist/git-auth/github-token-source.js +44 -0
  23. package/dist/git-auth/github-token-source.js.map +1 -0
  24. package/dist/git-auth/index.d.ts +4 -0
  25. package/dist/git-auth/index.d.ts.map +1 -1
  26. package/dist/git-auth/index.js +4 -0
  27. package/dist/git-auth/index.js.map +1 -1
  28. package/dist/git-auth/installation-token.d.ts +95 -0
  29. package/dist/git-auth/installation-token.d.ts.map +1 -0
  30. package/dist/git-auth/installation-token.js +192 -0
  31. package/dist/git-auth/installation-token.js.map +1 -0
  32. package/dist/local-repo/command.d.ts +28 -0
  33. package/dist/local-repo/command.d.ts.map +1 -0
  34. package/dist/local-repo/command.js +178 -0
  35. package/dist/local-repo/command.js.map +1 -0
  36. package/dist/local-repo/index.d.ts +119 -0
  37. package/dist/local-repo/index.d.ts.map +1 -0
  38. package/dist/local-repo/index.js +141 -0
  39. package/dist/local-repo/index.js.map +1 -0
  40. package/dist/machine-capabilities/index.d.ts +21 -0
  41. package/dist/machine-capabilities/index.d.ts.map +1 -0
  42. package/dist/machine-capabilities/index.js +21 -0
  43. package/dist/machine-capabilities/index.js.map +1 -0
  44. package/dist/machine-capabilities/probe.d.ts +61 -0
  45. package/dist/machine-capabilities/probe.d.ts.map +1 -0
  46. package/dist/machine-capabilities/probe.js +243 -0
  47. package/dist/machine-capabilities/probe.js.map +1 -0
  48. package/dist/machine-capabilities/redact.d.ts +42 -0
  49. package/dist/machine-capabilities/redact.d.ts.map +1 -0
  50. package/dist/machine-capabilities/redact.js +160 -0
  51. package/dist/machine-capabilities/redact.js.map +1 -0
  52. package/dist/machine-capabilities/report.d.ts +107 -0
  53. package/dist/machine-capabilities/report.d.ts.map +1 -0
  54. package/dist/machine-capabilities/report.js +211 -0
  55. package/dist/machine-capabilities/report.js.map +1 -0
  56. package/dist/machine-capabilities/types.d.ts +115 -0
  57. package/dist/machine-capabilities/types.d.ts.map +1 -0
  58. package/dist/machine-capabilities/types.js +11 -0
  59. package/dist/machine-capabilities/types.js.map +1 -0
  60. package/dist/mcp-spawn.d.ts +19 -0
  61. package/dist/mcp-spawn.d.ts.map +1 -1
  62. package/dist/mcp-spawn.js +52 -26
  63. package/dist/mcp-spawn.js.map +1 -1
  64. package/dist/migration-seq-guard.d.ts +78 -0
  65. package/dist/migration-seq-guard.d.ts.map +1 -0
  66. package/dist/migration-seq-guard.js +304 -0
  67. package/dist/migration-seq-guard.js.map +1 -0
  68. package/dist/node-version.d.ts +132 -0
  69. package/dist/node-version.d.ts.map +1 -0
  70. package/dist/node-version.js +318 -0
  71. package/dist/node-version.js.map +1 -0
  72. package/dist/prepr-gate.d.ts +120 -0
  73. package/dist/prepr-gate.d.ts.map +1 -1
  74. package/dist/prepr-gate.js +202 -3
  75. package/dist/prepr-gate.js.map +1 -1
  76. package/dist/program.d.ts.map +1 -1
  77. package/dist/program.js +34 -0
  78. package/dist/program.js.map +1 -1
  79. package/dist/provider-auth.d.ts +51 -1
  80. package/dist/provider-auth.d.ts.map +1 -1
  81. package/dist/provider-auth.js +83 -2
  82. package/dist/provider-auth.js.map +1 -1
  83. package/dist/runtime/review-chunking.d.ts +101 -0
  84. package/dist/runtime/review-chunking.d.ts.map +1 -0
  85. package/dist/runtime/review-chunking.js +192 -0
  86. package/dist/runtime/review-chunking.js.map +1 -0
  87. package/dist/runtime/review-diff.d.ts +30 -0
  88. package/dist/runtime/review-diff.d.ts.map +1 -0
  89. package/dist/runtime/review-diff.js +59 -0
  90. package/dist/runtime/review-diff.js.map +1 -0
  91. package/dist/runtime/reviewer.d.ts +40 -19
  92. package/dist/runtime/reviewer.d.ts.map +1 -1
  93. package/dist/runtime/reviewer.js +283 -68
  94. package/dist/runtime/reviewer.js.map +1 -1
  95. package/dist/serve-scope/command.d.ts +12 -0
  96. package/dist/serve-scope/command.d.ts.map +1 -0
  97. package/dist/serve-scope/command.js +89 -0
  98. package/dist/serve-scope/command.js.map +1 -0
  99. package/dist/serve-scope/index.d.ts +130 -0
  100. package/dist/serve-scope/index.d.ts.map +1 -0
  101. package/dist/serve-scope/index.js +148 -0
  102. package/dist/serve-scope/index.js.map +1 -0
  103. package/dist/task-runner.d.ts +22 -2
  104. package/dist/task-runner.d.ts.map +1 -1
  105. package/dist/task-runner.js +142 -25
  106. package/dist/task-runner.js.map +1 -1
  107. package/dist/watch.d.ts +21 -0
  108. package/dist/watch.d.ts.map +1 -1
  109. package/dist/watch.js +109 -1
  110. package/dist/watch.js.map +1 -1
  111. package/package.json +1 -1
@@ -0,0 +1,132 @@
1
+ /** Worktree-relative path of the file `nvm use` reads. */
2
+ export declare const NVMRC_REL = ".nvmrc";
3
+ /**
4
+ * Explicit escape hatch: a bin dir containing the node the gates must run under.
5
+ * Set it on a host whose node lives outside every layout below. Trusted as
6
+ * declared — the version behind it is not re-verified (that would cost a spawn).
7
+ */
8
+ export declare const NODE_BIN_DIR_ENV = "ACC_RUNNER_NODE_BIN_DIR";
9
+ /** Where a pin was declared. */
10
+ export type NodePinSource = ".nvmrc" | "package.json engines.node";
11
+ export interface NodePin {
12
+ /** The pin normalised without a leading `v` (`22`, `22.20.0`). */
13
+ spec: string;
14
+ /** Major version — the part that actually has to match. */
15
+ major: number;
16
+ /** Full `x.y.z` when the pin names one; null for a major-only pin. */
17
+ exact: string | null;
18
+ source: NodePinSource;
19
+ }
20
+ /** Version-manager on-disk layouts this module knows how to walk. */
21
+ export type NodeInstallLayout = "nvm" | "fnm" | "volta" | "asdf" | "n";
22
+ /** How `binDir` was arrived at. */
23
+ export type NodeResolutionSource = "current" | "explicit" | NodeInstallLayout | "unresolved" | "unpinned";
24
+ export interface PinnedNodeResolution {
25
+ /** The repo's pin, or null when it declares none. */
26
+ pin: NodePin | null;
27
+ /**
28
+ * The node version the gates will run under, when knowable: the picked
29
+ * install's version, or the current process's. Null only for `explicit`
30
+ * (declared by the operator, deliberately not re-verified).
31
+ */
32
+ effective: string | null;
33
+ /**
34
+ * True when the node the gates will run under satisfies the pin — and also
35
+ * true when there is no pin to violate. False means "we ran under the wrong
36
+ * node and could not fix it", which is exactly the signal that turns a jsdom
37
+ * failure into an ENVIRONMENT fault rather than a code defect.
38
+ */
39
+ satisfied: boolean;
40
+ /**
41
+ * Dir to prepend to PATH so `node` (and therefore `pnpm`, whose shim shebangs
42
+ * `#!/usr/bin/env node`) resolves to the pinned install. Null when the current
43
+ * node is already right, or when nothing matching was found.
44
+ */
45
+ binDir: string | null;
46
+ source: NodeResolutionSource;
47
+ /** One-line, log-safe explanation for the runner log. Never contains secrets. */
48
+ note: string;
49
+ }
50
+ export interface NodeVersionDeps {
51
+ /** Env source. Default `process.env`. */
52
+ env?: NodeJS.ProcessEnv;
53
+ /** Home dir the version-manager layouts hang off. Default `os.homedir()`. */
54
+ homedir?: string;
55
+ /** The running node's version (`v22.20.0` or `22.20.0`). Default `process.version`. */
56
+ currentVersion?: string;
57
+ /** Read a text file. Default `fs.readFile(abs, "utf8")`; rejects when absent. */
58
+ readTextFile?: (abs: string) => Promise<string>;
59
+ /** List a directory's entry names. Default `fs.readdir`; rejects when absent. */
60
+ listDir?: (abs: string) => Promise<string[]>;
61
+ /** True when `abs` exists and is executable. Default `fs.access(X_OK)`. */
62
+ isExecutable?: (abs: string) => Promise<boolean>;
63
+ }
64
+ /**
65
+ * The version a `.nvmrc` names, normalised without the leading `v`. Comments and
66
+ * blank lines are skipped (nvm allows both). Returns null for an ALIAS
67
+ * (`lts/*`, `node`, `stable`, `iron`) — resolving one needs nvm's alias table,
68
+ * and guessing is worse than reporting "unpinned" and falling back to `engines`.
69
+ */
70
+ export declare function parseNvmrc(text: string): string | null;
71
+ /**
72
+ * The major version an `engines.node` RANGE requires, as a major-only pin
73
+ * (`">=22 <23"` → `22`, `"22.x"` → `22`, `"^22.20.0"` → `22`). A range is a
74
+ * range: even when it names a patch we only ever pin the major, so `>=22.20.0
75
+ * <23` is satisfied by 22.21.0. Returns null when no number can be read.
76
+ */
77
+ export declare function parseEnginesRange(range: string): string | null;
78
+ /** Build a `NodePin` from a normalised spec, or null when it is unusable. */
79
+ export declare function nodePinFrom(spec: string, source: NodePinSource): NodePin | null;
80
+ /** `[major, minor, patch]` of a version string, or null when unparseable. */
81
+ export declare function parseNodeVersion(v: string): [number, number, number] | null;
82
+ /** Ascending comparison; unparseable versions sort first. */
83
+ export declare function compareNodeVersions(a: string, b: string): number;
84
+ /**
85
+ * True when `version` satisfies `pin`: the major must match, and when the pin
86
+ * names an exact `x.y.z` that must match too. An unparseable version satisfies
87
+ * nothing (fail closed — an unknown node is not assumed correct).
88
+ */
89
+ export declare function satisfiesPin(version: string, pin: NodePin): boolean;
90
+ /**
91
+ * The HIGHEST version in `versions` that satisfies `pin`, or null when none
92
+ * does. Highest, not first: on a host with 22.11.0 and 22.20.0 installed the
93
+ * newer patch is the one CI's `node-version: 22` would resolve to.
94
+ */
95
+ export declare function pickPinnedInstall(versions: string[], pin: NodePin): string | null;
96
+ export interface NodeInstallRoot {
97
+ layout: NodeInstallLayout;
98
+ /** Directory whose entries are version names (`v22.20.0` or `22.20.0`). */
99
+ dir: string;
100
+ /** The `bin` dir for one entry of `dir`. */
101
+ binDirFor: (entry: string) => string;
102
+ }
103
+ /**
104
+ * Version-manager roots to search, in preference order. Honours each manager's
105
+ * own env override so a non-default install location still resolves. Directories
106
+ * that do not exist are simply skipped by the caller — listing them is the probe.
107
+ */
108
+ export declare function nodeInstallRoots(env: NodeJS.ProcessEnv, homedir: string): NodeInstallRoot[];
109
+ /**
110
+ * Prepend `binDir` to a launchd-safe PATH (see bin-resolve.ts) so the pinned
111
+ * node wins every lookup — including `pnpm`'s own shebang, which is what makes
112
+ * the whole `pnpm run test` subtree inherit it. Idempotent: an already-leading
113
+ * `binDir` is not duplicated.
114
+ */
115
+ export declare function withPinnedNodePath(env: NodeJS.ProcessEnv, binDir: string | null): NodeJS.ProcessEnv;
116
+ /**
117
+ * The repo's declared node pin: `.nvmrc` first (it is what a human's `nvm use`
118
+ * obeys, so runner and human never disagree), then `package.json`
119
+ * `engines.node`. Null when neither declares a readable version.
120
+ */
121
+ export declare function readRepoNodePin(workdir: string, deps?: NodeVersionDeps): Promise<NodePin | null>;
122
+ /**
123
+ * Resolve which node the repo's gates must run under, and where it is.
124
+ *
125
+ * Order: no pin → nothing to enforce; current node satisfies → run as-is (the
126
+ * common case, and it costs one file read); `ACC_RUNNER_NODE_BIN_DIR` →
127
+ * trusted as declared; then each version-manager layout, highest matching patch
128
+ * wins; finally `unresolved`, which the caller surfaces rather than papering
129
+ * over.
130
+ */
131
+ export declare function resolvePinnedNode(workdir: string, deps?: NodeVersionDeps): Promise<PinnedNodeResolution>;
132
+ //# sourceMappingURL=node-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-version.d.ts","sourceRoot":"","sources":["../src/node-version.ts"],"names":[],"mappings":"AA4CA,0DAA0D;AAC1D,eAAO,MAAM,SAAS,WAAW,CAAC;AAElC;;;;GAIG;AACH,e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,EAAE,MAAM,CAAC,UAAU,EACtB,MAAM,EAAE,MAAM,GAAG,IAAI,GACpB,MAAM,CAAC,UAAU,CAKnB;AA2BD;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,eAAoB,GACzB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CA2BzB;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,eAAoB,GACzB,OAAO,CAAC,oBAAoB,CAAC,CAmF/B"}
@@ -0,0 +1,318 @@
1
+ /**
2
+ * TESTENV-NODE-PIN: resolve the node version the REPO pins, not the one the
3
+ * runner happens to be launched with.
4
+ *
5
+ * WHY THIS EXISTS
6
+ * ----------------------------------------------------------------------------
7
+ * The pre-PR gate (prepr-gate.ts) runs the repo's own `pnpm test` inside the task
8
+ * worktree. It inherited the runner process's node — on the fleet's macOS host a
9
+ * Homebrew node 26 — while CI, which is authoritative and green, runs node 22
10
+ * (`actions/setup-node` `node-version: 22` in every workflow). jsdom 25's DOM is
11
+ * incomplete under node 23+: `window.localStorage` is absent, so zustand's
12
+ * persist middleware gets an undefined storage and EVERY store-backed UI suite
13
+ * dies with `Cannot read properties of undefined (reading 'setItem')`. The gate
14
+ * read that as "this task broke the UI suites", refused to open the PR, and the
15
+ * task dead-lettered — a pure false-fail (it near-rejected #1836 as INFRA).
16
+ *
17
+ * So the gate must stop trusting whatever `node` is first on PATH. This module
18
+ * answers one question — "which node does THIS repo want, and where is it on
19
+ * this host?" — and hands back a bin dir to prepend to PATH. The runner's global
20
+ * node then no longer matters.
21
+ *
22
+ * Read order for the pin: `.nvmrc` (what `nvm use` reads, so humans and the
23
+ * runner agree), then `package.json` `engines.node`. A `.nvmrc` alias this module
24
+ * cannot resolve without nvm's alias table (`lts/*`, `node`, `stable`) is treated
25
+ * as NO pin rather than guessed at.
26
+ *
27
+ * Discovery covers the version managers actually found on runner hosts (nvm, fnm,
28
+ * volta, asdf, n) plus an explicit `ACC_RUNNER_NODE_BIN_DIR` escape hatch for a
29
+ * host that installs node anywhere else. Nothing is ever installed or downloaded:
30
+ * when no matching node exists the resolution says so (`satisfied: false`) and
31
+ * the caller degrades — it is diagnosis, never a silent second failure mode.
32
+ *
33
+ * Every I/O boundary is an injectable dep, so the unit suite drives the whole
34
+ * resolver over a fake host filesystem and never reads the real one.
35
+ */
36
+ import path from "node:path";
37
+ import os from "node:os";
38
+ import fs from "node:fs/promises";
39
+ import { augmentedPathFrom } from "./bin-resolve.js";
40
+ // ─────────────────────────────────────────────────────────────────────────────
41
+ // Types
42
+ // ─────────────────────────────────────────────────────────────────────────────
43
+ /** Worktree-relative path of the file `nvm use` reads. */
44
+ export const NVMRC_REL = ".nvmrc";
45
+ /**
46
+ * Explicit escape hatch: a bin dir containing the node the gates must run under.
47
+ * Set it on a host whose node lives outside every layout below. Trusted as
48
+ * declared — the version behind it is not re-verified (that would cost a spawn).
49
+ */
50
+ export const NODE_BIN_DIR_ENV = "ACC_RUNNER_NODE_BIN_DIR";
51
+ // ─────────────────────────────────────────────────────────────────────────────
52
+ // Pure parsing / comparison helpers
53
+ // ─────────────────────────────────────────────────────────────────────────────
54
+ /**
55
+ * The version a `.nvmrc` names, normalised without the leading `v`. Comments and
56
+ * blank lines are skipped (nvm allows both). Returns null for an ALIAS
57
+ * (`lts/*`, `node`, `stable`, `iron`) — resolving one needs nvm's alias table,
58
+ * and guessing is worse than reporting "unpinned" and falling back to `engines`.
59
+ */
60
+ export function parseNvmrc(text) {
61
+ for (const raw of text.split("\n")) {
62
+ const line = raw.trim();
63
+ if (!line || line.startsWith("#"))
64
+ continue;
65
+ const m = /^v?(\d+(?:\.\d+){0,2})$/.exec(line);
66
+ return m ? m[1] : null;
67
+ }
68
+ return null;
69
+ }
70
+ /**
71
+ * The major version an `engines.node` RANGE requires, as a major-only pin
72
+ * (`">=22 <23"` → `22`, `"22.x"` → `22`, `"^22.20.0"` → `22`). A range is a
73
+ * range: even when it names a patch we only ever pin the major, so `>=22.20.0
74
+ * <23` is satisfied by 22.21.0. Returns null when no number can be read.
75
+ */
76
+ export function parseEnginesRange(range) {
77
+ const m = /(\d+)/.exec(range);
78
+ return m ? m[1] : null;
79
+ }
80
+ /** Build a `NodePin` from a normalised spec, or null when it is unusable. */
81
+ export function nodePinFrom(spec, source) {
82
+ const parts = /^(\d+)(?:\.(\d+))?(?:\.(\d+))?$/.exec(spec.trim());
83
+ if (!parts)
84
+ return null;
85
+ const major = Number(parts[1]);
86
+ const exact = parts[2] !== undefined && parts[3] !== undefined
87
+ ? `${parts[1]}.${parts[2]}.${parts[3]}`
88
+ : null;
89
+ return { spec: spec.trim(), major, exact, source };
90
+ }
91
+ /** `[major, minor, patch]` of a version string, or null when unparseable. */
92
+ export function parseNodeVersion(v) {
93
+ const m = /^v?(\d+)\.(\d+)\.(\d+)/.exec(v.trim());
94
+ return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : null;
95
+ }
96
+ /** Ascending comparison; unparseable versions sort first. */
97
+ export function compareNodeVersions(a, b) {
98
+ const pa = parseNodeVersion(a);
99
+ const pb = parseNodeVersion(b);
100
+ if (!pa)
101
+ return pb ? -1 : 0;
102
+ if (!pb)
103
+ return 1;
104
+ for (let i = 0; i < 3; i++) {
105
+ if (pa[i] !== pb[i])
106
+ return pa[i] - pb[i];
107
+ }
108
+ return 0;
109
+ }
110
+ /**
111
+ * True when `version` satisfies `pin`: the major must match, and when the pin
112
+ * names an exact `x.y.z` that must match too. An unparseable version satisfies
113
+ * nothing (fail closed — an unknown node is not assumed correct).
114
+ */
115
+ export function satisfiesPin(version, pin) {
116
+ const parsed = parseNodeVersion(version);
117
+ if (!parsed)
118
+ return false;
119
+ if (parsed[0] !== pin.major)
120
+ return false;
121
+ if (pin.exact)
122
+ return `${parsed[0]}.${parsed[1]}.${parsed[2]}` === pin.exact;
123
+ return true;
124
+ }
125
+ /**
126
+ * The HIGHEST version in `versions` that satisfies `pin`, or null when none
127
+ * does. Highest, not first: on a host with 22.11.0 and 22.20.0 installed the
128
+ * newer patch is the one CI's `node-version: 22` would resolve to.
129
+ */
130
+ export function pickPinnedInstall(versions, pin) {
131
+ const matching = versions.filter((v) => satisfiesPin(v, pin));
132
+ if (matching.length === 0)
133
+ return null;
134
+ return matching.sort(compareNodeVersions)[matching.length - 1];
135
+ }
136
+ /**
137
+ * Version-manager roots to search, in preference order. Honours each manager's
138
+ * own env override so a non-default install location still resolves. Directories
139
+ * that do not exist are simply skipped by the caller — listing them is the probe.
140
+ */
141
+ export function nodeInstallRoots(env, homedir) {
142
+ const nvm = env.NVM_DIR?.trim() || path.join(homedir, ".nvm");
143
+ const fnm = env.FNM_DIR?.trim() || path.join(homedir, ".fnm");
144
+ const asdf = env.ASDF_DATA_DIR?.trim() || path.join(homedir, ".asdf");
145
+ const nPrefix = env.N_PREFIX?.trim() || "/usr/local";
146
+ const volta = path.join(homedir, ".volta", "tools", "image", "node");
147
+ const nvmVersions = path.join(nvm, "versions", "node");
148
+ const fnmVersions = path.join(fnm, "node-versions");
149
+ const asdfVersions = path.join(asdf, "installs", "nodejs");
150
+ const nVersions = path.join(nPrefix, "n", "versions", "node");
151
+ return [
152
+ { layout: "nvm", dir: nvmVersions, binDirFor: (e) => path.join(nvmVersions, e, "bin") },
153
+ {
154
+ layout: "fnm",
155
+ dir: fnmVersions,
156
+ // fnm nests the install under `installation/`.
157
+ binDirFor: (e) => path.join(fnmVersions, e, "installation", "bin"),
158
+ },
159
+ { layout: "volta", dir: volta, binDirFor: (e) => path.join(volta, e, "bin") },
160
+ { layout: "asdf", dir: asdfVersions, binDirFor: (e) => path.join(asdfVersions, e, "bin") },
161
+ { layout: "n", dir: nVersions, binDirFor: (e) => path.join(nVersions, e, "bin") },
162
+ ];
163
+ }
164
+ /**
165
+ * Prepend `binDir` to a launchd-safe PATH (see bin-resolve.ts) so the pinned
166
+ * node wins every lookup — including `pnpm`'s own shebang, which is what makes
167
+ * the whole `pnpm run test` subtree inherit it. Idempotent: an already-leading
168
+ * `binDir` is not duplicated.
169
+ */
170
+ export function withPinnedNodePath(env, binDir) {
171
+ const augmented = augmentedPathFrom(env.PATH);
172
+ if (!binDir)
173
+ return { ...env, PATH: augmented };
174
+ const parts = augmented.split(":").filter((p) => p !== binDir);
175
+ return { ...env, PATH: [binDir, ...parts].join(":") };
176
+ }
177
+ // ─────────────────────────────────────────────────────────────────────────────
178
+ // Default I/O
179
+ // ─────────────────────────────────────────────────────────────────────────────
180
+ async function defaultReadTextFile(abs) {
181
+ return fs.readFile(abs, "utf8");
182
+ }
183
+ async function defaultListDir(abs) {
184
+ return fs.readdir(abs);
185
+ }
186
+ async function defaultIsExecutable(abs) {
187
+ try {
188
+ await fs.access(abs, fs.constants.X_OK);
189
+ return true;
190
+ }
191
+ catch {
192
+ return false;
193
+ }
194
+ }
195
+ // ─────────────────────────────────────────────────────────────────────────────
196
+ // The resolver
197
+ // ─────────────────────────────────────────────────────────────────────────────
198
+ /**
199
+ * The repo's declared node pin: `.nvmrc` first (it is what a human's `nvm use`
200
+ * obeys, so runner and human never disagree), then `package.json`
201
+ * `engines.node`. Null when neither declares a readable version.
202
+ */
203
+ export async function readRepoNodePin(workdir, deps = {}) {
204
+ const readTextFile = deps.readTextFile ?? defaultReadTextFile;
205
+ try {
206
+ const spec = parseNvmrc(await readTextFile(path.join(workdir, NVMRC_REL)));
207
+ if (spec) {
208
+ const pin = nodePinFrom(spec, ".nvmrc");
209
+ if (pin)
210
+ return pin;
211
+ }
212
+ }
213
+ catch {
214
+ // No .nvmrc (or unreadable) — fall through to engines.
215
+ }
216
+ try {
217
+ const raw = JSON.parse(await readTextFile(path.join(workdir, "package.json")));
218
+ const range = raw?.engines?.node;
219
+ if (typeof range === "string") {
220
+ const spec = parseEnginesRange(range);
221
+ if (spec)
222
+ return nodePinFrom(spec, "package.json engines.node");
223
+ }
224
+ }
225
+ catch {
226
+ // Missing/unparseable package.json — no pin.
227
+ }
228
+ return null;
229
+ }
230
+ /**
231
+ * Resolve which node the repo's gates must run under, and where it is.
232
+ *
233
+ * Order: no pin → nothing to enforce; current node satisfies → run as-is (the
234
+ * common case, and it costs one file read); `ACC_RUNNER_NODE_BIN_DIR` →
235
+ * trusted as declared; then each version-manager layout, highest matching patch
236
+ * wins; finally `unresolved`, which the caller surfaces rather than papering
237
+ * over.
238
+ */
239
+ export async function resolvePinnedNode(workdir, deps = {}) {
240
+ const env = deps.env ?? process.env;
241
+ const homedir = deps.homedir ?? os.homedir();
242
+ const current = (deps.currentVersion ?? process.version).replace(/^v/, "");
243
+ const isExecutable = deps.isExecutable ?? defaultIsExecutable;
244
+ const listDir = deps.listDir ?? defaultListDir;
245
+ const pin = await readRepoNodePin(workdir, deps);
246
+ if (!pin) {
247
+ return {
248
+ pin: null,
249
+ effective: current,
250
+ satisfied: true,
251
+ binDir: null,
252
+ source: "unpinned",
253
+ note: `repo declares no node version (no ${NVMRC_REL}, no engines.node) — running gates under node ${current}`,
254
+ };
255
+ }
256
+ if (satisfiesPin(current, pin)) {
257
+ return {
258
+ pin,
259
+ effective: current,
260
+ satisfied: true,
261
+ binDir: null,
262
+ source: "current",
263
+ note: `node ${current} satisfies the repo pin ${pin.spec} (${pin.source})`,
264
+ };
265
+ }
266
+ const explicit = env[NODE_BIN_DIR_ENV]?.trim();
267
+ if (explicit) {
268
+ if (await isExecutable(path.join(explicit, "node"))) {
269
+ return {
270
+ pin,
271
+ effective: null,
272
+ satisfied: true,
273
+ binDir: explicit,
274
+ source: "explicit",
275
+ note: `node ${current} does not satisfy the repo pin ${pin.spec} (${pin.source}); ` +
276
+ `using ${NODE_BIN_DIR_ENV}=${explicit} as declared (version not re-verified)`,
277
+ };
278
+ }
279
+ // A set-but-broken override is a configuration bug worth naming; keep
280
+ // searching the layouts rather than failing outright.
281
+ }
282
+ for (const root of nodeInstallRoots(env, homedir)) {
283
+ let entries;
284
+ try {
285
+ entries = await listDir(root.dir);
286
+ }
287
+ catch {
288
+ continue; // manager not installed here
289
+ }
290
+ const picked = pickPinnedInstall(entries, pin);
291
+ if (!picked)
292
+ continue;
293
+ const binDir = root.binDirFor(picked);
294
+ if (!(await isExecutable(path.join(binDir, "node"))))
295
+ continue;
296
+ return {
297
+ pin,
298
+ effective: picked.replace(/^v/, ""),
299
+ satisfied: true,
300
+ binDir,
301
+ source: root.layout,
302
+ note: `node ${current} does not satisfy the repo pin ${pin.spec} (${pin.source}) — ` +
303
+ `running gates under ${root.layout} node ${picked.replace(/^v/, "")} (${binDir})`,
304
+ };
305
+ }
306
+ return {
307
+ pin,
308
+ effective: current,
309
+ satisfied: false,
310
+ binDir: null,
311
+ source: "unresolved",
312
+ note: `node ${current} does not satisfy the repo pin ${pin.spec} (${pin.source}) and no ` +
313
+ `matching install was found (searched nvm/fnm/volta/asdf/n) — gates will run under ` +
314
+ `node ${current}; install it (e.g. \`nvm install ${pin.major}\`) or set ` +
315
+ `${NODE_BIN_DIR_ENV} to its bin dir`,
316
+ };
317
+ }
318
+ //# sourceMappingURL=node-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-version.js","sourceRoot":"","sources":["../src/node-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,gFAAgF;AAChF,QAAQ;AACR,gFAAgF;AAEhF,0DAA0D;AAC1D,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC;AAElC;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,yBAAyB,CAAC;AAoE1D,gFAAgF;AAChF,oCAAoC;AACpC,gFAAgF;AAEhF;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,KAAK,MAAM,GAAG,I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 @@
1
+ import { type PinnedNodeResolution } from "./node-version.js";
1
2
  export type PreprGateName = "nul-check" | "scope" | "typecheck" | "lint" | "build" | "test" | "migration-lint";
2
3
  /**
3
4
  * Run order. typecheck → lint → build → test mirrors the CLAUDE.md quality-gate
@@ -62,6 +63,21 @@ export interface PreprGateResult {
62
63
  /** Tail of the failing suite's output — kept for the operator. */
63
64
  outputTail: string;
64
65
  };
66
+ /**
67
+ * TESTENV-NODE-PIN: set when the `test` gate FAILED for ENVIRONMENT reasons
68
+ * (`needs-env`) rather than because of anything this task changed. `ok` stays
69
+ * `true` and no `failure` is set — a broken test environment is an INFRA fault,
70
+ * never a code-defect gate failure. The caller logs `reviewerNotice` verbatim so
71
+ * the reviewer classifies it as INFRA instead of rejecting the PR.
72
+ */
73
+ testEnvironmentFailure?: TestEnvironmentFailure;
74
+ /**
75
+ * TESTENV-NODE-PIN: which node the gates actually ran under, and how it was
76
+ * resolved against the repo's `.nvmrc` / `engines.node`. Present whenever the
77
+ * gate resolved a pin (i.e. for the default gate runner); `satisfied: false`
78
+ * means the host had no matching node and the gates ran off-pin. Log-safe.
79
+ */
80
+ node?: PinnedNodeResolution;
65
81
  /**
66
82
  * MIGFIX-01: set when the pre-PR auto-renumber (opt-in) renamed a NEW migration
67
83
  * to the next contiguous seq before the seq-lint ran. `output` is the
@@ -212,6 +228,21 @@ export interface PreprGateDeps {
212
228
  * task-runner.ts, outside this track's scope.
213
229
  */
214
230
  loadKnownTestFailures?: (workdir: string) => Promise<PreprKnownFailures | null>;
231
+ /**
232
+ * TESTENV-NODE-PIN: resolve the node the gates must run under (the repo's
233
+ * `.nvmrc` / `engines.node`) and where it lives on this host. Default:
234
+ * `resolvePinnedNode` — but only when `runGate` is NOT injected, because an
235
+ * injected gate runner owns its own environment and the unit suite must not
236
+ * touch the host's node installs. Inject explicitly to drive the pin logic
237
+ * (including the off-pin case) in tests.
238
+ */
239
+ resolveNode?: (workdir: string) => Promise<PinnedNodeResolution>;
240
+ /**
241
+ * TESTENV-NODE-PIN: classify a failed `test` gate's output as an environment
242
+ * fault or not. Default: `classifyTestEnvironmentFailure`. Injectable so a repo
243
+ * with a different test stack can supply its own signatures.
244
+ */
245
+ classifyTestEnvironment?: (output: string, ctx: TestEnvironmentContext) => TestEnvironmentVerdict;
215
246
  /**
216
247
  * RF-14: recover the failing test ids from the failed `test` gate's own output.
217
248
  * Default: `extractVitestFailures` (parses vitest's `FAIL <file> > <name>`
@@ -247,6 +278,88 @@ export interface PreprTestFailureScan {
247
278
  */
248
279
  complete: boolean;
249
280
  }
281
+ /** The single classification this module assigns to an environment fault. */
282
+ export declare const NEEDS_ENV_CLASSIFICATION: "needs-env";
283
+ /**
284
+ * Prefix the reviewer already recognises for a harness fault it must not blame the
285
+ * PR for (`api/_lib/reviewer-agent.ts` emits the same shape for a truncated diff).
286
+ * Reusing the exact wording is deliberate: it is how "not a defect" travels.
287
+ */
288
+ export declare const INFRA_NOTICE_PREFIX = "INFRA NOTICE \u2014";
289
+ export interface TestEnvironmentSignature {
290
+ /** Stable id, used in logs and asserted by the unit suite. */
291
+ id: string;
292
+ re: RegExp;
293
+ /**
294
+ * HARD signatures are environment faults on any host: the test environment
295
+ * itself could not be loaded, so no assertion in the suite ever ran and the
296
+ * result says nothing about the task's code.
297
+ *
298
+ * SOFT signatures are DOM-shaped symptoms that a code defect could also
299
+ * produce (`document is not defined` in a suite that forgot its environment).
300
+ * They only count as environment when the suite provably ran under a node the
301
+ * repo does not pin — otherwise they block exactly as before.
302
+ */
303
+ hard: boolean;
304
+ /** Operator-facing explanation of what the signature means. */
305
+ hint: string;
306
+ }
307
+ /**
308
+ * Signatures of "the test ENVIRONMENT is broken", not "the code is broken".
309
+ * Ordered most-specific first; the first match wins.
310
+ */
311
+ export declare const TEST_ENVIRONMENT_SIGNATURES: TestEnvironmentSignature[];
312
+ /** What the classifier knows about the node the suite ran under. */
313
+ export interface TestEnvironmentContext {
314
+ /**
315
+ * True when the suite provably ran under a node that does NOT satisfy the
316
+ * repo's pin. This is what promotes a SOFT signature to an environment fault.
317
+ */
318
+ nodeMismatch?: boolean;
319
+ /** The repo's pin (`22`), for the notice. */
320
+ pin?: string | null;
321
+ /** The node the suite actually ran under, when known. */
322
+ effective?: string | null;
323
+ }
324
+ export interface TestEnvironmentVerdict {
325
+ /** True → `needs-env`: report as INFRA, never block the PR. */
326
+ environment: boolean;
327
+ /** Id of the matched signature, or null when nothing matched. */
328
+ signature: string | null;
329
+ /** Log-safe reason, whichever way it went. */
330
+ reason: string;
331
+ }
332
+ /** The reported shape of an environment-classified `test` gate failure. */
333
+ export interface TestEnvironmentFailure {
334
+ classification: typeof NEEDS_ENV_CLASSIFICATION;
335
+ /** Which signature matched (see `TEST_ENVIRONMENT_SIGNATURES`). */
336
+ signature: string;
337
+ reason: string;
338
+ /** The gate command's exit code (null on signal). */
339
+ exitCode: number | null;
340
+ /** The reviewer-facing INFRA notice — log/PR-safe, quote verbatim. */
341
+ reviewerNotice: string;
342
+ /** Tail of the failing suite's own output, kept for the operator. */
343
+ outputTail: string;
344
+ }
345
+ /**
346
+ * Decide whether a red `test` gate is an ENVIRONMENT fault (`needs-env`) rather
347
+ * than a defect in the task's code.
348
+ *
349
+ * Fails CLOSED in both directions that matter: an output matching nothing is not
350
+ * an environment fault, and a DOM-shaped (SOFT) match on a host whose node DOES
351
+ * satisfy the repo pin is not one either — there the symptom really is the suite's
352
+ * own problem, and blocking is correct. Only a HARD signature (the environment
353
+ * never loaded, so nothing was actually tested) is trusted unconditionally.
354
+ */
355
+ export declare function classifyTestEnvironmentFailure(output: string, ctx?: TestEnvironmentContext): TestEnvironmentVerdict;
356
+ /**
357
+ * The reviewer-facing body of an environment-classified `test` failure. Opens with
358
+ * the prefix the reviewer already treats as "harness fault, not a defect", names
359
+ * the signature and the node facts, and states the required handling explicitly so
360
+ * neither the reviewer nor the rework loop charges it to the PR.
361
+ */
362
+ export declare function formatTestEnvironmentNotice(verdict: TestEnvironmentVerdict, ctx: TestEnvironmentContext, outputTail: string): string;
250
363
  /**
251
364
  * Text-source extensions the NUL/binary check scans. An allowlist (never a
252
365
  * binary denylist) so genuine binary assets — images, fonts, the design export —
@@ -445,6 +558,13 @@ export declare function formatNewTestFailures(newFailures: string[], preExisting
445
558
  * Returns `{ ok: true, skipped: true }` when the escape hatch is set, and
446
559
  * `{ ok: true, ran: [] }` (a clean pass) when the worktree declares none of
447
560
  * the four gate scripts.
561
+ *
562
+ * TESTENV-NODE-PIN: the gates run under the node the WORKTREE pins (`.nvmrc`, else
563
+ * `engines.node`) whenever this call owns the gate environment — `result.node`
564
+ * records which node that was and how it was found. A `test` gate that fails with a
565
+ * test-ENVIRONMENT signature does not set `failure` at all: it comes back
566
+ * `ok: true` with `testEnvironmentFailure` (`needs-env`), whose `reviewerNotice`
567
+ * the caller should log verbatim so the reviewer reads it as INFRA.
448
568
  */
449
569
  export declare function runPreprGate(workdir: string, deps?: PreprGateDeps): Promise<PreprGateResult>;
450
570
  //# sourceMappingURL=prepr-gate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prepr-gate.d.ts","sourceRoot":"","sources":["../src/prepr-gate.ts"],"names":[],"mappings":"AA6CA,MAAM,MAAM,aAAa,GACrB,WAAW,GACX,OAAO,GACP,WAAW,GACX,MAAM,GACN,OAAO,GACP,MAAM,GACN,gBAAgB,CAAC;AAErB;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,aAAa,EAA2C,CAAC;AAEnF,MAAM,WAAW,gBAAgB;IAC/B,yBAAyB;IACzB,IAAI,EAAE,aAAa,CAAC;IACpB,qDAAqD;IACrD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,EAAE,EAAE,OAAO,CAAC;IACZ,uEAAuE;IACvE,OAAO,EAAE,OAAO,CAAC;IACjB,6CAA6C;IAC7C,GAAG,EAAE,aAAa,EAAE,CA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