@boyingliu01/xp-gate 0.39.2 → 0.40.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.
- package/adapters/gate-12-file-hygiene.sh +103 -15
- package/adapters/gate-6-layers.sh +158 -16
- package/gate-12-file-hygiene.sh +103 -15
- package/gate-6-layers.sh +158 -16
- package/hooks/gate-12-file-hygiene.sh +103 -15
- package/hooks/gate-6-layers.sh +158 -16
- package/hooks/gate-entries/gate-5-entry.sh +52 -2
- package/hooks/gate-entries/gate-6-entry.sh +86 -3
- package/hooks/lib/gate-12-blob-scan.awk +42 -2
- package/hooks/pre-commit +46 -2
- package/lib/gate-runner.js +52 -13
- package/mutation/init-baseline.ts +82 -26
- package/mutation/runners/mutmut-runner.ts +110 -26
- package/package.json +1 -1
- package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/claude-code/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/dsh/package.json +1 -1
- package/plugins/dsh/scripts/prepack.cjs +39 -14
- package/plugins/dsh/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/dsh/skills/reinstall-xp-gate/.architecture-skip +8 -0
- package/plugins/dsh/skills/reinstall-xp-gate/.github/workflows/test.yml +106 -0
- package/plugins/dsh/skills/reinstall-xp-gate/CHANGELOG.md +379 -0
- package/plugins/dsh/skills/reinstall-xp-gate/LICENSE +21 -0
- package/plugins/dsh/skills/reinstall-xp-gate/QUALITY-OVERVIEW.md +173 -0
- package/plugins/dsh/skills/reinstall-xp-gate/README.md +167 -0
- package/plugins/dsh/skills/reinstall-xp-gate/SKILL.md +271 -0
- package/plugins/dsh/skills/reinstall-xp-gate/TODO.md +253 -0
- package/plugins/dsh/skills/reinstall-xp-gate/VERSION +1 -0
- package/plugins/dsh/skills/reinstall-xp-gate/package.json +28 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/audit.mjs +193 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/coverage.mjs +140 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/hp-gate.mjs +175 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/install.mjs +64 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/agent-paths.mjs +67 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/agents.mjs +247 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/backups.mjs +96 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/baseline.mjs +101 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/ccn.mjs +124 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/delphi.mjs +61 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/fs-tree.mjs +108 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/gatecheck.mjs +290 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/json-file.mjs +37 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/mutations.mjs +154 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/platform.mjs +92 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/probes.mjs +128 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/proc.mjs +33 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/report.mjs +29 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/residue.mjs +188 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/selfsync.mjs +75 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/skills.mjs +121 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/spawn.mjs +181 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/testreport.mjs +26 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/tools.mjs +238 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/util.mjs +33 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/verdict.mjs +45 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/version.mjs +29 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/xp-cli.mjs +66 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/mutation.mjs +132 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/preflight.mjs +75 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/reinstall.mjs +305 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/setup-wsl.sh +633 -0
- package/plugins/dsh/skills/reinstall-xp-gate/scripts/verify.mjs +239 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/agents.test.mjs +168 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/baseline.test.mjs +104 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/ccn.test.mjs +87 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/cleanup.test.mjs +128 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/coverage.test.mjs +69 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/delphi.test.mjs +78 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/fixtures.mjs +61 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/gatecheck-audit.test.mjs +157 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/gatecheck.test.mjs +57 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/mutation-anchors.test.mjs +49 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/proc-contract.test.mjs +58 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/proc.test.mjs +255 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/report.test.mjs +66 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/residue.test.mjs +278 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/selfsync.test.mjs +70 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/skills.test.mjs +171 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/testreport.test.mjs +40 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/timeout-budgets.test.mjs +38 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/tools-leaf.test.mjs +323 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/tools-probe.test.mjs +350 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/tools.test.mjs +131 -0
- package/plugins/dsh/skills/reinstall-xp-gate/tests/util.test.mjs +154 -0
- package/plugins/dsh/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/opencode/package.json +1 -1
- package/plugins/opencode/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/opencode/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/qoder/plugin.json +1 -1
- package/plugins/qoder/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/qoder/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +1 -1
- package/principles/adapters/function-body.ts +60 -0
- package/principles/adapters/typescript.ts +54 -4
- package/principles/config.ts +16 -3
- package/scripts/delphi-repo-tools.cjs +4 -1
- package/skills/delphi-review/AGENTS.md +1 -1
- package/skills/sprint-flow/AGENTS.md +1 -1
- package/skills/test-specification-alignment/AGENTS.md +1 -1
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
|
|
4
|
+
import { toolReport, upgradeTool, classify } from '../scripts/lib/tools.mjs';
|
|
5
|
+
|
|
6
|
+
// The probing half of tools.mjs: everything that decides whether a gate tool is
|
|
7
|
+
// present, which version it is, and whether an upgrade is reachable.
|
|
8
|
+
//
|
|
9
|
+
// Why these are injected rather than run for real: every one of them shells out
|
|
10
|
+
// (npm, pip, where/which) or hits the network (PyPI, GitHub). A test that ran the
|
|
11
|
+
// real thing would assert against whatever happens to be installed on the machine
|
|
12
|
+
// running it -- green on a dev box with the full toolchain, red in CI -- and
|
|
13
|
+
// `pip install -U` can genuinely change the host.
|
|
14
|
+
//
|
|
15
|
+
// This half was 25% function coverage before these tests, despite carrying the
|
|
16
|
+
// decision that turns a row into 'outdated'. The risk is not academic: a wrong
|
|
17
|
+
// answer here either skips a needed gate-tool upgrade or warns on every run until
|
|
18
|
+
// the whole report is ignored.
|
|
19
|
+
|
|
20
|
+
/** A spawnSync-shaped result, matching the real one (stdout is a string). */
|
|
21
|
+
function ok(stdout = '') {
|
|
22
|
+
return { status: 0, stdout, stderr: '', signal: null, pid: 1 };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function fail(status = 1) {
|
|
26
|
+
return { status, stdout: '', stderr: 'boom', signal: null, pid: 1 };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** A probe that resolves every tool to `path`, with `version` for all of them. */
|
|
30
|
+
function probeAll(path = (n) => `/usr/bin/${n}`, version = '1.0.0') {
|
|
31
|
+
return (name) => ({ path: path(name), version });
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Report every pip row as present without asking pip.
|
|
36
|
+
*
|
|
37
|
+
* Several cases need the pip rows past `classify`'s 'missing' short-circuit to
|
|
38
|
+
* reach the lookup under test; this is that setup, written once.
|
|
39
|
+
*/
|
|
40
|
+
function pipPresent(version = '1.0.0') {
|
|
41
|
+
return (spec, row) => {
|
|
42
|
+
row.present = true;
|
|
43
|
+
row.version = version;
|
|
44
|
+
row.path = '/usr/bin/pip-tool';
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* A fully isolated dependency set for toolReport.
|
|
50
|
+
*
|
|
51
|
+
* Every field is injected because omitting one makes toolReport fall back to the
|
|
52
|
+
* real probe, which shells out (`which python`, `npm view`) or hits the network.
|
|
53
|
+
* An earlier version of these tests omitted `pipProbe` and paid a live lookup per
|
|
54
|
+
* case -- slow enough to look like a hang and non-deterministic enough to pass on
|
|
55
|
+
* a dev box and fail in CI.
|
|
56
|
+
*/
|
|
57
|
+
function isolated(overrides = {}) {
|
|
58
|
+
return {
|
|
59
|
+
toolVersion: () => ({ path: '', version: '' }),
|
|
60
|
+
pipProbe: () => { },
|
|
61
|
+
pythonBin: () => '',
|
|
62
|
+
lookup: async () => '',
|
|
63
|
+
...overrides,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ── probing ─────────────────────────────────────────────────────────────────
|
|
68
|
+
|
|
69
|
+
test('toolReport probes every declared tool exactly once', async () => {
|
|
70
|
+
const seen = [];
|
|
71
|
+
const rows = await toolReport(isolated({
|
|
72
|
+
toolVersion: (name) => {
|
|
73
|
+
seen.push(name);
|
|
74
|
+
return { path: `/usr/bin/${name}`, version: '1.0.0' };
|
|
75
|
+
},
|
|
76
|
+
}));
|
|
77
|
+
assert.equal(rows.length > 0, true);
|
|
78
|
+
// A tool probed twice doubles the spawn cost of every reinstall run; one probed
|
|
79
|
+
// zero times silently keeps its row defaults.
|
|
80
|
+
assert.equal(new Set(seen).size, seen.length);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test('a present tool is marked present and keeps the path the probe found', async () => {
|
|
84
|
+
const rows = await toolReport(isolated({
|
|
85
|
+
toolVersion: probeAll((n) => `/opt/bin/${n}`, '2.1.0'),
|
|
86
|
+
lookup: async () => '2.1.0',
|
|
87
|
+
}));
|
|
88
|
+
const npmRow = rows.find((r) => r.kind === 'npm');
|
|
89
|
+
assert.equal(npmRow.present, true);
|
|
90
|
+
assert.equal(npmRow.path, `/opt/bin/${npmRow.name}`);
|
|
91
|
+
assert.equal(npmRow.status, 'ok');
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('an absent tool is reported missing, not simply dropped from the list', async () => {
|
|
95
|
+
// A row dropped instead of marked 'missing' makes the report look complete
|
|
96
|
+
// while a gate tool is absent -- exactly the silent-pass shape.
|
|
97
|
+
const rows = await toolReport(isolated({ lookup: async () => '9.9.9' }));
|
|
98
|
+
const missing = rows.filter((r) => !r.present);
|
|
99
|
+
assert.ok(missing.length > 0);
|
|
100
|
+
for (const row of missing) assert.equal(row.status, 'missing');
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('the latest-version lookup reaches every tool kind', async () => {
|
|
104
|
+
const asked = {};
|
|
105
|
+
await toolReport(isolated({
|
|
106
|
+
toolVersion: probeAll(),
|
|
107
|
+
pipProbe: pipPresent(),
|
|
108
|
+
lookup: async (row) => {
|
|
109
|
+
(asked[row.kind] ||= []).push(row.name);
|
|
110
|
+
return '';
|
|
111
|
+
},
|
|
112
|
+
}));
|
|
113
|
+
for (const kind of ['npm', 'pip', 'binary']) {
|
|
114
|
+
assert.ok(asked[kind]?.length > 0, `no ${kind} lookups`);
|
|
115
|
+
}
|
|
116
|
+
// `node` (npx) is present and so does reach classify's lookup, but
|
|
117
|
+
// `latestFor` answers '' for it by design -- there is no peer version to
|
|
118
|
+
// compare. The row is 'ok' regardless, which the next test pins.
|
|
119
|
+
assert.deepEqual(asked.node, ['npx']);
|
|
120
|
+
const names = Object.values(asked).flat();
|
|
121
|
+
assert.equal(new Set(names).size, names.length, 'a row was looked up twice');
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test('binary tools keep their raw version string instead of a parsed one', async () => {
|
|
125
|
+
// gitleaks prints "gitleaks version 8.18.2". A binary's version is displayed
|
|
126
|
+
// as-is, so the parse must not rewrite it before it is shown.
|
|
127
|
+
const rows = await toolReport(isolated({ toolVersion: probeAll(undefined, 'gitleaks version 8.18.2') }));
|
|
128
|
+
const binaryRow = rows.find((r) => r.kind === 'binary');
|
|
129
|
+
assert.equal(binaryRow.version, 'gitleaks version 8.18.2');
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test('npm rows store a parsed version so the comparison stays numeric', async () => {
|
|
133
|
+
const rows = await toolReport(isolated({ toolVersion: probeAll(undefined, 'npm 9.8.1') }));
|
|
134
|
+
const npmRow = rows.find((r) => r.kind === 'npm');
|
|
135
|
+
assert.equal(npmRow.version, '9.8.1');
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test('a pip tool falls back to the PATH hit when pip metadata is unavailable', async () => {
|
|
139
|
+
// pip show answers nothing but the tool is on PATH: the row must still read as
|
|
140
|
+
// present, otherwise a working tool is reported as missing.
|
|
141
|
+
const rows = await toolReport(isolated({
|
|
142
|
+
toolVersion: () => ({ path: '/usr/bin/lizard', version: '1.17.10' }),
|
|
143
|
+
pipProbe: (spec, row, deps) => {
|
|
144
|
+
assert.equal(deps.pythonBin(), '', 'no interpreter was injected');
|
|
145
|
+
row.present = true;
|
|
146
|
+
row.version = '1.17.10';
|
|
147
|
+
row.path = '/usr/bin/lizard';
|
|
148
|
+
},
|
|
149
|
+
}));
|
|
150
|
+
const pipRow = rows.find((r) => r.kind === 'pip');
|
|
151
|
+
assert.equal(pipRow.present, true);
|
|
152
|
+
assert.equal(pipRow.version, '1.17.10');
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
test('a pip tool with neither metadata nor a PATH hit stays missing', async () => {
|
|
156
|
+
const rows = await toolReport(isolated());
|
|
157
|
+
for (const row of rows.filter((r) => r.kind === 'pip')) {
|
|
158
|
+
assert.equal(row.present, false);
|
|
159
|
+
assert.equal(row.status, 'missing');
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test('toolReport passes one lookup through to every probed row', async () => {
|
|
164
|
+
const calls = [];
|
|
165
|
+
await toolReport(isolated({
|
|
166
|
+
toolVersion: probeAll(),
|
|
167
|
+
lookup: async (row) => {
|
|
168
|
+
calls.push(row);
|
|
169
|
+
return '';
|
|
170
|
+
},
|
|
171
|
+
}));
|
|
172
|
+
assert.ok(calls.length > 0);
|
|
173
|
+
for (const row of calls) assert.equal(typeof row.name, 'string');
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
test('the default lookup is never reached when every tool is absent', async () => {
|
|
177
|
+
// Guards the fix documented on toolReport: `rows.map(classify)` would pass the
|
|
178
|
+
// array index as `lookup` and throw "lookup is not a function". classify
|
|
179
|
+
// short-circuits on absent rows, so the run must not throw -- and with no
|
|
180
|
+
// injected lookup it must not reach the network either.
|
|
181
|
+
const rows = await toolReport(isolated());
|
|
182
|
+
assert.ok(rows.every((r) => r.status === 'missing'));
|
|
183
|
+
assert.ok(rows.every((r) => r.latest === ''));
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
// ── interaction with classify ────────────────────────────────────────────────
|
|
187
|
+
|
|
188
|
+
test('toolReport marks a tool whose latest lookup failed as unverified, not ok', async () => {
|
|
189
|
+
// An empty lookup result means nothing was compared. Reporting 'ok' there is
|
|
190
|
+
// the silent pass this project exists to avoid.
|
|
191
|
+
const rows = await toolReport(isolated({
|
|
192
|
+
toolVersion: probeAll(),
|
|
193
|
+
// pip rows must be present too, otherwise they short-circuit to 'missing'
|
|
194
|
+
// and never reach the lookup this test is about.
|
|
195
|
+
pipProbe: pipPresent(),
|
|
196
|
+
lookup: async () => '',
|
|
197
|
+
}));
|
|
198
|
+
const present = rows.filter((r) => r.present && r.kind !== 'node');
|
|
199
|
+
assert.ok(present.length > 0, 'no present non-node rows to classify');
|
|
200
|
+
for (const row of present) {
|
|
201
|
+
assert.equal(row.status, 'unverified', `${row.name} claimed ok without comparing`);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
test('toolReport keeps npx ok when the lookup fails, since it has no peer version', async () => {
|
|
206
|
+
const rows = await toolReport(isolated({
|
|
207
|
+
toolVersion: probeAll(undefined, '24.0.0'),
|
|
208
|
+
pipProbe: pipPresent(),
|
|
209
|
+
}));
|
|
210
|
+
const nodeRow = rows.find((r) => r.kind === 'node');
|
|
211
|
+
assert.equal(nodeRow.status, 'ok');
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
test('toolReport flags a tool that is behind as outdated', async () => {
|
|
215
|
+
const rows = await toolReport(isolated({
|
|
216
|
+
toolVersion: probeAll(),
|
|
217
|
+
pipProbe: pipPresent(),
|
|
218
|
+
lookup: async () => '2.5.0',
|
|
219
|
+
}));
|
|
220
|
+
const outdated = rows.filter((r) => r.status === 'outdated');
|
|
221
|
+
assert.ok(outdated.length > 0);
|
|
222
|
+
assert.equal(outdated[0].latest, '2.5.0');
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
test('classify still honours an explicitly injected lookup (regression guard)', async () => {
|
|
226
|
+
const row = await classify({ present: true, kind: 'npm', version: '1.0.0', latest: '' }, async () => '3.0.0');
|
|
227
|
+
assert.equal(row.status, 'outdated');
|
|
228
|
+
assert.equal(row.latest, '3.0.0');
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
// ── upgradeTool ──────────────────────────────────────────────────────────────
|
|
232
|
+
// These invoke real global installs in production. Each case asserts the exact
|
|
233
|
+
// command AND that nothing ran for the kinds that must not.
|
|
234
|
+
|
|
235
|
+
test('npm upgrade runs a global install of the pinned package', () => {
|
|
236
|
+
const calls = [];
|
|
237
|
+
const code = upgradeTool(
|
|
238
|
+
{ name: 'jscpd', kind: 'npm', pkg: 'jscpd' },
|
|
239
|
+
{ runNpm: (args, opts) => { calls.push({ args, opts }); return ok(); } },
|
|
240
|
+
);
|
|
241
|
+
assert.equal(code, 0);
|
|
242
|
+
assert.equal(calls.length, 1);
|
|
243
|
+
assert.deepEqual(calls[0].args, ['install', '-g', 'jscpd@latest']);
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
test('npm upgrade propagates a non-zero status instead of claiming success', () => {
|
|
247
|
+
const code = upgradeTool({ name: 'jscpd', kind: 'npm', pkg: 'jscpd' }, { runNpm: () => fail(7) });
|
|
248
|
+
assert.equal(code, 7);
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
test('npm upgrade reports failure when spawn produced no status at all', () => {
|
|
252
|
+
// A signal-killed or ENOENT spawn has no status; treating that as 0 would
|
|
253
|
+
// report a successful upgrade for a command that never ran.
|
|
254
|
+
const code = upgradeTool({ name: 'jscpd', kind: 'npm', pkg: 'jscpd' }, { runNpm: () => ({ status: undefined }) });
|
|
255
|
+
assert.equal(code, 1);
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
test('pip upgrade runs pip install -U through the discovered interpreter', () => {
|
|
259
|
+
const calls = [];
|
|
260
|
+
const code = upgradeTool(
|
|
261
|
+
{ name: 'lizard', kind: 'pip', pkg: 'lizard' },
|
|
262
|
+
{
|
|
263
|
+
pythonBin: () => '/usr/bin/python3',
|
|
264
|
+
run: (cmd, args) => { calls.push({ cmd, args }); return ok(); },
|
|
265
|
+
},
|
|
266
|
+
);
|
|
267
|
+
assert.equal(code, 0);
|
|
268
|
+
assert.equal(calls.length, 1);
|
|
269
|
+
assert.equal(calls[0].cmd, '/usr/bin/python3');
|
|
270
|
+
assert.deepEqual(calls[0].args, ['-m', 'pip', 'install', '-U', 'lizard']);
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
test('pip upgrade fails without touching the system when no interpreter exists', () => {
|
|
274
|
+
let spawned = false;
|
|
275
|
+
const code = upgradeTool(
|
|
276
|
+
{ name: 'lizard', kind: 'pip', pkg: 'lizard' },
|
|
277
|
+
{ pythonBin: () => '', run: () => { spawned = true; return ok(); } },
|
|
278
|
+
);
|
|
279
|
+
assert.equal(code, 1);
|
|
280
|
+
assert.equal(spawned, false);
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
test('pip upgrade propagates a failing install status', () => {
|
|
284
|
+
const code = upgradeTool(
|
|
285
|
+
{ name: 'lizard', kind: 'pip', pkg: 'lizard' },
|
|
286
|
+
{ pythonBin: () => '/usr/bin/python3', run: () => fail(2) },
|
|
287
|
+
);
|
|
288
|
+
assert.equal(code, 2);
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
test('binary upgrade only advises and never downloads over the user PATH', () => {
|
|
292
|
+
const logs = [];
|
|
293
|
+
let spawned = false;
|
|
294
|
+
const code = upgradeTool(
|
|
295
|
+
{ name: 'gitleaks', kind: 'binary', repo: 'gitleaks/gitleaks', latest: '8.18.2' },
|
|
296
|
+
{
|
|
297
|
+
log: (m) => logs.push(m),
|
|
298
|
+
run: () => { spawned = true; return ok(); },
|
|
299
|
+
runNpm: () => { spawned = true; return ok(); },
|
|
300
|
+
},
|
|
301
|
+
);
|
|
302
|
+
assert.equal(code, 0);
|
|
303
|
+
assert.equal(spawned, false, 'binary upgrade must not install anything');
|
|
304
|
+
assert.equal(logs.length, 1);
|
|
305
|
+
assert.match(logs[0], /gitleaks/);
|
|
306
|
+
assert.match(logs[0], /gitleaks\/gitleaks/);
|
|
307
|
+
assert.match(logs[0], /8\.18\.2/);
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
test('binary upgrade names the repo and latest version for the operator', () => {
|
|
311
|
+
const logs = [];
|
|
312
|
+
upgradeTool({ name: 'jq', kind: 'binary', repo: 'jqlang/jq', latest: '1.7.1' }, { log: (m) => logs.push(m) });
|
|
313
|
+
assert.match(logs[0], /jqlang\/jq/);
|
|
314
|
+
assert.match(logs[0], /1\.7\.1/);
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
test('binary upgrade degrades gracefully when repo and version are unknown', () => {
|
|
318
|
+
const logs = [];
|
|
319
|
+
const code = upgradeTool({ name: 'mystery', kind: 'binary' }, { log: (m) => logs.push(m) });
|
|
320
|
+
assert.equal(code, 0);
|
|
321
|
+
assert.match(logs[0], /官方 release/);
|
|
322
|
+
assert.match(logs[0], /最新版/);
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
test('an unknown kind is a no-op success rather than a crash', () => {
|
|
326
|
+
// A spec that declares a new kind before its upgrader exists must not take the
|
|
327
|
+
// whole reinstall run down.
|
|
328
|
+
for (const kind of ['node', 'something-new', '']) {
|
|
329
|
+
assert.doesNotThrow(() => upgradeTool({ name: 'x', kind }, {}));
|
|
330
|
+
assert.equal(upgradeTool({ name: 'x', kind }, {}), 0);
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
test('upgradeTool never spawns for a kind it has no command for', () => {
|
|
335
|
+
let spawned = false;
|
|
336
|
+
const deps = {
|
|
337
|
+
runNpm: () => { spawned = true; return ok(); },
|
|
338
|
+
run: () => { spawned = true; return ok(); },
|
|
339
|
+
pythonBin: () => '/usr/bin/python3',
|
|
340
|
+
log: () => { },
|
|
341
|
+
};
|
|
342
|
+
upgradeTool({ name: 'npx', kind: 'node' }, deps);
|
|
343
|
+
assert.equal(spawned, false);
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
test('upgradeTool defaults to the real commands when no deps are injected', () => {
|
|
347
|
+
// Only the `node` kind is safe to call here: it has no upgrader, so this
|
|
348
|
+
// asserts the default lookup path without installing anything.
|
|
349
|
+
assert.equal(upgradeTool({ name: 'npx', kind: 'node' }), 0);
|
|
350
|
+
});
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
|
|
4
|
+
import fs from 'node:fs';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
semverOf, cmpVersion, TOOLS, classify, statusOf, PACKAGE_INSTALL_TIMEOUT_MS,
|
|
8
|
+
} from '../scripts/lib/tools.mjs';
|
|
9
|
+
|
|
10
|
+
// semverOf + cmpVersion decide "is this tool outdated". A wrong answer either
|
|
11
|
+
// silently skips an upgrade (gate tool stays old) or claims a bogus upgrade is
|
|
12
|
+
// available on every run and trains the operator to ignore the report.
|
|
13
|
+
|
|
14
|
+
test('semverOf extracts a version from the shapes real tools print', () => {
|
|
15
|
+
assert.equal(semverOf('1.2.3'), '1.2.3');
|
|
16
|
+
assert.equal(semverOf('v2.0.0'), '2.0.0');
|
|
17
|
+
assert.equal(semverOf('jscpd 3.5.10'), '3.5.10');
|
|
18
|
+
assert.equal(semverOf('lizard (1.17.10)'), '1.17.10');
|
|
19
|
+
assert.equal(semverOf('gitleaks version 8.18.2'), '8.18.2');
|
|
20
|
+
// Fourth component is kept: several gate tools ship 4-part versions.
|
|
21
|
+
assert.equal(semverOf('1.2.3.4'), '1.2.3.4');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('semverOf returns empty string when no version is present', () => {
|
|
25
|
+
assert.equal(semverOf(''), '');
|
|
26
|
+
assert.equal(semverOf(null), '');
|
|
27
|
+
assert.equal(semverOf('not found'), '');
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test('cmpVersion compares numerically, not lexically', () => {
|
|
31
|
+
// "10" must beat "9". A string compare would rank 9 higher and the upgrade
|
|
32
|
+
// would never fire for double-digit minors.
|
|
33
|
+
assert.equal(cmpVersion('1.10.0', '1.9.0'), 1);
|
|
34
|
+
assert.equal(cmpVersion('1.9.0', '1.10.0'), -1);
|
|
35
|
+
assert.equal(cmpVersion('10.0.0', '9.9.9'), 1);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('cmpVersion treats missing components as zero', () => {
|
|
39
|
+
assert.equal(cmpVersion('1.2', '1.2.0'), 0);
|
|
40
|
+
assert.equal(cmpVersion('1.2.0', '1.2'), 0);
|
|
41
|
+
assert.equal(cmpVersion('1.2.1', '1.2'), 1);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('cmpVersion ranks a bare major as OLDER, not equal', () => {
|
|
45
|
+
// semverOf requires at least two components, by design: it must not mistake a
|
|
46
|
+
// stray integer in tool output for a version. So "1" parses to '' and compares
|
|
47
|
+
// as [0], ranking below 1.0.0. Pinning this because it looks like a bug but is
|
|
48
|
+
// the intended trade-off -- a looser regex would pick up build numbers and
|
|
49
|
+
// produce false "outdated" reports.
|
|
50
|
+
assert.equal(semverOf('1'), '');
|
|
51
|
+
assert.equal(cmpVersion('1', '1.0.0'), -1);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('cmpVersion returns 0 only for equal versions', () => {
|
|
55
|
+
assert.equal(cmpVersion('3.5.10', '3.5.10'), 0);
|
|
56
|
+
assert.equal(cmpVersion('v3.5.10', '3.5.10'), 0);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('cmpVersion handles unparseable input without throwing', () => {
|
|
60
|
+
assert.doesNotThrow(() => cmpVersion('garbage', '1.0.0'));
|
|
61
|
+
assert.equal(cmpVersion('garbage', '1.0.0'), -1);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('TOOLS declares every tool the verify step expects, with a usable spec', () => {
|
|
65
|
+
const names = TOOLS.map((t) => t.name);
|
|
66
|
+
for (const required of ['jscpd', 'lizard', 'checkov', 'hadolint', 'gitleaks', 'semgrep', 'npx', 'jq']) {
|
|
67
|
+
assert.ok(names.includes(required), `missing tool spec: ${required}`);
|
|
68
|
+
}
|
|
69
|
+
// Every entry needs a dispatcher, otherwise upgradeTool returns 0 and the
|
|
70
|
+
// report claims success while the tool is never upgraded. The table says what
|
|
71
|
+
// each kind owes; a new kind that nobody wires up fails the first assertion.
|
|
72
|
+
const REQUIRED_FIELD = { npm: 'pkg', pip: 'pkg', binary: 'repo' };
|
|
73
|
+
const KINDS = ['npm', 'pip', 'binary', 'node'];
|
|
74
|
+
for (const tool of TOOLS) {
|
|
75
|
+
assert.ok(KINDS.includes(tool.kind), `bad kind for ${tool.name}`);
|
|
76
|
+
const field = REQUIRED_FIELD[tool.kind];
|
|
77
|
+
if (field) assert.ok(tool[field], `${tool.name} (${tool.kind}) needs ${field}`);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test('classify reports a missing tool as missing, never as ok', () => {
|
|
82
|
+
return classify({ present: false, kind: 'npm', version: '', latest: '' }).then((row) => {
|
|
83
|
+
assert.equal(row.status, 'missing');
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('classify marks a tool outdated only when it is genuinely behind', async () => {
|
|
88
|
+
const behind = await classify({ present: true, kind: 'npm', version: '1.0.0', latest: '' }, async () => '2.0.0');
|
|
89
|
+
assert.equal(behind.status, 'outdated');
|
|
90
|
+
assert.equal(behind.latest, '2.0.0');
|
|
91
|
+
|
|
92
|
+
const current = await classify({ present: true, kind: 'npm', version: '2.0.0', latest: '' }, async () => '2.0.0');
|
|
93
|
+
assert.equal(current.status, 'ok');
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('classify separates "could not look up" from "up to date"', async () => {
|
|
97
|
+
// The distinction that matters: an empty `latest` means nothing was compared.
|
|
98
|
+
// Reporting that as 'ok' claims a tool is current on the strength of a failed
|
|
99
|
+
// network call, which is the silent-pass shape this project exists to avoid.
|
|
100
|
+
const unknown = await classify({ present: true, kind: 'npm', version: '1.0.0', latest: '' }, async () => '');
|
|
101
|
+
assert.equal(unknown.status, 'unverified');
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test('classify treats node/npx as ok when present, since it has no peer version', async () => {
|
|
105
|
+
const row = await classify({ present: true, kind: 'node', version: '24.0.0', latest: '' }, async () => '');
|
|
106
|
+
assert.equal(row.status, 'ok');
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test('statusOf blocks an upgrade claim on an unparseable version', () => {
|
|
110
|
+
// cmpVersion ranks '' below anything numeric, so a tool whose version could
|
|
111
|
+
// not be read counts as behind -- never as current.
|
|
112
|
+
assert.equal(statusOf({ kind: 'npm', version: '', latest: '2.0.0' }), 'outdated');
|
|
113
|
+
assert.equal(statusOf({ kind: 'npm', version: '2.0.0', latest: '' }), 'unverified');
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// ---------------------------------------------------------------------------
|
|
117
|
+
// Install budget (magic-number refactor).
|
|
118
|
+
//
|
|
119
|
+
// Two sites installed a global package -- `npm install -g` and `pip install -U`
|
|
120
|
+
// -- and both carried a bare 600000. Same intent, copied twice: change one and
|
|
121
|
+
// the other silently keeps the old budget.
|
|
122
|
+
// ---------------------------------------------------------------------------
|
|
123
|
+
|
|
124
|
+
test('PACKAGE_INSTALL_TIMEOUT_MS covers both npm and pip global installs', () => {
|
|
125
|
+
assert.equal(PACKAGE_INSTALL_TIMEOUT_MS, 600000);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test('both global-install call sites use PACKAGE_INSTALL_TIMEOUT_MS', () => {
|
|
129
|
+
const src = fs.readFileSync(new URL('../scripts/lib/tools.mjs', import.meta.url), 'utf8');
|
|
130
|
+
assert.deepEqual(src.match(/timeout: 600000\b/g) || [], [], 'install sites must use the constant');
|
|
131
|
+
});
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
isFile, isDir, listFiles, hashTree, sameTree, rmrf, copyTree,
|
|
8
|
+
readJson, writeJson, stamp, stripNul,
|
|
9
|
+
} from '../scripts/lib/util.mjs';
|
|
10
|
+
import { tmpDir } from './fixtures.mjs';
|
|
11
|
+
|
|
12
|
+
const BACKSLASH = String.fromCharCode(92);
|
|
13
|
+
|
|
14
|
+
test('isFile / isDir return false for a nonexistent path instead of throwing', () => {
|
|
15
|
+
// Both are guards used everywhere; throwing would turn a missing agent
|
|
16
|
+
// directory into a crashed reinstall.
|
|
17
|
+
assert.equal(isFile('/no/such/file/anywhere'), false);
|
|
18
|
+
assert.equal(isDir('/no/such/dir/anywhere'), false);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('isFile and isDir distinguish the two kinds', (t) => {
|
|
22
|
+
const dir = tmpDir(t);
|
|
23
|
+
const file = path.join(dir, 'a.txt');
|
|
24
|
+
fs.writeFileSync(file, 'x');
|
|
25
|
+
|
|
26
|
+
assert.equal(isFile(file), true);
|
|
27
|
+
assert.equal(isDir(file), false);
|
|
28
|
+
assert.equal(isFile(dir), false);
|
|
29
|
+
assert.equal(isDir(dir), true);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('listFiles returns forward-slash relative paths sorted, walking nested dirs', (t) => {
|
|
33
|
+
const dir = tmpDir(t);
|
|
34
|
+
fs.mkdirSync(path.join(dir, 'sub', 'deep'), { recursive: true });
|
|
35
|
+
fs.writeFileSync(path.join(dir, 'z.txt'), 'z');
|
|
36
|
+
fs.writeFileSync(path.join(dir, 'a.txt'), 'a');
|
|
37
|
+
fs.writeFileSync(path.join(dir, 'sub', 'deep', 'n.txt'), 'n');
|
|
38
|
+
|
|
39
|
+
const files = listFiles(dir);
|
|
40
|
+
|
|
41
|
+
assert.deepEqual(files, ['a.txt', 'sub/deep/n.txt', 'z.txt']);
|
|
42
|
+
// A Windows backslash here would make two identical trees compare unequal.
|
|
43
|
+
assert.ok(files.every((f) => !f.includes(BACKSLASH)));
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('listFiles skips node_modules, .git and other noise directories', (t) => {
|
|
47
|
+
const dir = tmpDir(t);
|
|
48
|
+
for (const skip of ['node_modules', '.git', '__pycache__', '.svn']) {
|
|
49
|
+
fs.mkdirSync(path.join(dir, skip), { recursive: true });
|
|
50
|
+
fs.writeFileSync(path.join(dir, skip, 'junk.txt'), 'junk');
|
|
51
|
+
}
|
|
52
|
+
fs.writeFileSync(path.join(dir, 'keep.txt'), 'keep');
|
|
53
|
+
|
|
54
|
+
assert.deepEqual(listFiles(dir), ['keep.txt']);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test('listFiles returns an empty listing rather than throwing on an unreadable root', () => {
|
|
58
|
+
assert.deepEqual(listFiles('/definitely/not/here'), []);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('hashTree is order-independent and content-sensitive', (t) => {
|
|
62
|
+
const a = tmpDir(t);
|
|
63
|
+
const b = tmpDir(t);
|
|
64
|
+
// Creation order must not leak into the hash, or sameTree reports permanent
|
|
65
|
+
// drift and every reinstall rewrites a tree that was already correct.
|
|
66
|
+
for (const name of ['one.txt', 'two.txt', 'three.txt']) fs.writeFileSync(path.join(b, name), name);
|
|
67
|
+
for (const name of ['three.txt', 'two.txt', 'one.txt']) fs.writeFileSync(path.join(a, name), name);
|
|
68
|
+
|
|
69
|
+
assert.equal(hashTree(a), hashTree(b));
|
|
70
|
+
|
|
71
|
+
fs.writeFileSync(path.join(b, 'two.txt'), 'changed');
|
|
72
|
+
assert.notEqual(hashTree(a), hashTree(b));
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('hashTree distinguishes a renamed file from an identical one', (t) => {
|
|
76
|
+
const a = tmpDir(t);
|
|
77
|
+
const b = tmpDir(t);
|
|
78
|
+
fs.writeFileSync(path.join(a, 'x.txt'), 'same');
|
|
79
|
+
fs.writeFileSync(path.join(b, 'y.txt'), 'same');
|
|
80
|
+
|
|
81
|
+
// If names were ignored, a copy could report "ok" while missing a file.
|
|
82
|
+
assert.notEqual(hashTree(a), hashTree(b));
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test('sameTree compares contents, not just existence', (t) => {
|
|
86
|
+
const a = tmpDir(t);
|
|
87
|
+
const b = tmpDir(t);
|
|
88
|
+
fs.writeFileSync(path.join(a, 'f.txt'), 'v1');
|
|
89
|
+
fs.writeFileSync(path.join(b, 'f.txt'), 'v1');
|
|
90
|
+
assert.equal(sameTree(a, b), true);
|
|
91
|
+
|
|
92
|
+
fs.writeFileSync(path.join(b, 'f.txt'), 'v2');
|
|
93
|
+
assert.equal(sameTree(a, b), false);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('sameTree returns false when either side is missing or is a file', (t) => {
|
|
97
|
+
const a = tmpDir(t);
|
|
98
|
+
fs.writeFileSync(path.join(a, 'f.txt'), 'x');
|
|
99
|
+
|
|
100
|
+
assert.equal(sameTree(a, '/no/such/dir'), false);
|
|
101
|
+
assert.equal(sameTree('/no/such/dir', a), false);
|
|
102
|
+
assert.equal(sameTree(path.join(a, 'f.txt'), a), false);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
test('copyTree replaces the destination so stale files cannot survive', (t) => {
|
|
106
|
+
const src = tmpDir(t);
|
|
107
|
+
const dest = path.join(tmpDir(t), 'copy');
|
|
108
|
+
fs.writeFileSync(path.join(src, 'new.txt'), 'new');
|
|
109
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
110
|
+
fs.writeFileSync(path.join(dest, 'stale.txt'), 'stale');
|
|
111
|
+
|
|
112
|
+
copyTree(src, dest);
|
|
113
|
+
|
|
114
|
+
assert.equal(isFile(path.join(dest, 'new.txt')), true);
|
|
115
|
+
// A leftover file would make the copy drift from its source forever.
|
|
116
|
+
assert.equal(isFile(path.join(dest, 'stale.txt')), false);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test('rmrf on a missing path is a no-op', () => {
|
|
120
|
+
assert.doesNotThrow(() => rmrf('/no/such/path/to/remove'));
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
test('readJson returns null for missing and malformed files', (t) => {
|
|
124
|
+
const dir = tmpDir(t);
|
|
125
|
+
const broken = path.join(dir, 'broken.json');
|
|
126
|
+
fs.writeFileSync(broken, '{ not json');
|
|
127
|
+
|
|
128
|
+
assert.equal(readJson('/no/such/file.json'), null);
|
|
129
|
+
assert.equal(readJson(broken), null);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test('readJson round-trips through writeJson', (t) => {
|
|
133
|
+
const dir = tmpDir(t);
|
|
134
|
+
const p = path.join(dir, 'nested', 'deep', 'v.json');
|
|
135
|
+
writeJson(p, { a: 1, b: ['x'] });
|
|
136
|
+
|
|
137
|
+
assert.deepEqual(readJson(p), { a: 1, b: ['x'] });
|
|
138
|
+
assert.ok(fs.readFileSync(p, 'utf8').endsWith('\n'));
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test('stamp produces a fixed-width, sortable timestamp', () => {
|
|
142
|
+
assert.equal(stamp(new Date(2026, 0, 5, 7, 8, 9)), '20260105-070809');
|
|
143
|
+
// Sorting run directories depends on zero padding.
|
|
144
|
+
assert.match(stamp(new Date(2026, 0, 5, 7, 8, 9)), /^\d{8}-\d{6}$/);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
test('stripNul removes NUL bytes that Windows console output introduces', () => {
|
|
148
|
+
// reg.exe output is UTF-16 and arrives NUL-interleaved; leaving them in
|
|
149
|
+
// breaks every downstream regex.
|
|
150
|
+
assert.equal(stripNul('a\0b\0c'), 'abc');
|
|
151
|
+
assert.equal(stripNul(null), '');
|
|
152
|
+
assert.equal(stripNul(undefined), '');
|
|
153
|
+
assert.equal(stripNul(0), '0');
|
|
154
|
+
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.
|
|
6
|
+
**Version:** 0.40.0.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
**6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; each REQ starts from a clean context instead of accumulating one across REQs). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.
|
|
6
|
+
**Version:** 0.40.0.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.
|
|
6
|
+
**Version:** 0.40.0.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
|