@boyingliu01/xp-gate 0.38.20 → 0.38.22
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/hooks/gate-entries/gate-5-entry.sh +52 -16
- package/hooks/lib/gate-5c-alignment.sh +9 -0
- package/lib/__tests__/arch.test.js +17 -5
- package/lib/arch.js +38 -0
- package/lib/mattpocock-license-verdict.json +1 -1
- 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/lib/hooks.d.ts +4 -2
- package/plugins/dsh/lib/hooks.d.ts.map +1 -1
- package/plugins/dsh/lib/hooks.js +30 -7
- package/plugins/dsh/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/dsh/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/dsh/src/hooks.test.ts +42 -0
- package/plugins/dsh/src/hooks.ts +30 -7
- 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/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/skills/delphi-review/AGENTS.md +1 -1
- package/skills/sprint-flow/AGENTS.md +1 -1
- package/skills/test-specification-alignment/AGENTS.md +1 -1
|
@@ -258,25 +258,40 @@ else
|
|
|
258
258
|
fi
|
|
259
259
|
done <<< "$STAGED_TEST_FILES"
|
|
260
260
|
|
|
261
|
-
# --- deleted test files: WARN ---
|
|
262
|
-
DELETED_LIST=$(mktemp 2>/dev/null || echo "${TMPDIR:-/tmp}/xp-deleted-$$")
|
|
263
|
-
ADDED_LIST=$(mktemp 2>/dev/null || echo "${TMPDIR:-/tmp}/xp-added-$$")
|
|
264
|
-
# Routed through the same filter as every other staged-file scan (#649):
|
|
265
|
-
# a deleted/added file under node_modules/ or vendor/ is not project code,
|
|
266
|
-
# and treating it as one reports deletions that mean nothing.
|
|
267
|
-
git diff --cached --name-only --diff-filter=D 2>/dev/null | filter_project_paths > "$DELETED_LIST" || true
|
|
268
|
-
git diff --cached --name-only --diff-filter=A 2>/dev/null | filter_project_paths > "$ADDED_LIST" || true
|
|
269
|
-
GATE_5_DELETED_TESTS=$(classify_deleted_tests "$DELETED_LIST" "$ADDED_LIST" || true)
|
|
270
|
-
rm -f "$DELETED_LIST" "$ADDED_LIST"
|
|
271
|
-
if [ -n "$GATE_5_DELETED_TESTS" ]; then
|
|
272
|
-
echo "⚠️ WARN - test file(s) deleted with no same-named replacement:"
|
|
273
|
-
printf '%s\n' "$GATE_5_DELETED_TESTS" | sed 's/^/ /'
|
|
274
|
-
echo " Deleting a test removes the safety net (指南 §9.5). If the code is"
|
|
275
|
-
echo " genuinely gone, say so in the commit body; otherwise restore it."
|
|
276
|
-
fi
|
|
277
261
|
fi
|
|
278
262
|
fi
|
|
279
263
|
|
|
264
|
+
# --- deleted test files: WARN ---
|
|
265
|
+
#
|
|
266
|
+
# OUTSIDE the STAGED_TEST_FILES guard, deliberately. That list is built with
|
|
267
|
+
# `--diff-filter=ACM`, so it can never contain a deleted file, and a commit
|
|
268
|
+
# that ONLY deletes tests -- the one case this warning exists for -- skipped
|
|
269
|
+
# the scan entirely. Measured before this fix: staging nothing but the removal
|
|
270
|
+
# of a committed test printed "Gate 5: 2124ms (skipped - no code changes)" and
|
|
271
|
+
# SKIP(no_code_files_changed), with no mention of the deletion. That reason was
|
|
272
|
+
# not false, which is what made it dangerous: the journal showed a gate
|
|
273
|
+
# standing down for a benign cause while the safety net had disappeared.
|
|
274
|
+
#
|
|
275
|
+
# Guarded on the FUNCTION rather than on the change set: an empty deletion list
|
|
276
|
+
# is the normal case, a missing classifier is not.
|
|
277
|
+
if declare -f classify_deleted_tests >/dev/null 2>&1; then
|
|
278
|
+
DELETED_LIST=$(mktemp 2>/dev/null || echo "${TMPDIR:-/tmp}/xp-deleted-$$")
|
|
279
|
+
ADDED_LIST=$(mktemp 2>/dev/null || echo "${TMPDIR:-/tmp}/xp-added-$$")
|
|
280
|
+
# Routed through the same filter as every other staged-file scan (#649):
|
|
281
|
+
# a deleted/added file under node_modules/ or vendor/ is not project code,
|
|
282
|
+
# and treating it as one reports deletions that mean nothing.
|
|
283
|
+
git diff --cached --name-only --diff-filter=D 2>/dev/null | filter_project_paths > "$DELETED_LIST" || true
|
|
284
|
+
git diff --cached --name-only --diff-filter=A 2>/dev/null | filter_project_paths > "$ADDED_LIST" || true
|
|
285
|
+
GATE_5_DELETED_TESTS=$(classify_deleted_tests "$DELETED_LIST" "$ADDED_LIST" || true)
|
|
286
|
+
rm -f "$DELETED_LIST" "$ADDED_LIST"
|
|
287
|
+
if [ -n "$GATE_5_DELETED_TESTS" ]; then
|
|
288
|
+
echo "⚠️ WARN - test file(s) deleted with no same-named replacement:"
|
|
289
|
+
printf '%s\n' "$GATE_5_DELETED_TESTS" | sed 's/^/ /'
|
|
290
|
+
echo " Deleting a test removes the safety net (指南 §9.5). If the code is"
|
|
291
|
+
echo " genuinely gone, say so in the commit body; otherwise restore it."
|
|
292
|
+
fi
|
|
293
|
+
fi
|
|
294
|
+
|
|
280
295
|
if [ "$GATE_5_FOCUS_BLOCKED" -gt 0 ]; then
|
|
281
296
|
echo ""
|
|
282
297
|
echo "❌ BLOCKED - Gate 5: $GATE_5_FOCUS_BLOCKED test-hygiene violation(s) (see above)."
|
|
@@ -1946,6 +1961,27 @@ else
|
|
|
1946
1961
|
GATE_5_COVERAGE_APPLIES_TO="project"
|
|
1947
1962
|
fi
|
|
1948
1963
|
|
|
1964
|
+
# Gate 5c computes a verdict on every path and, until now, NOTHING read it.
|
|
1965
|
+
# Measured: grep -rn GATE_5C_STATUS across pre-commit, gate-driver and lib/*.sh
|
|
1966
|
+
# returned no matches outside the checker itself. The BLOCK arm was still
|
|
1967
|
+
# effective (gate_5c_alignment returns 1 and this body does `|| return 1`), but
|
|
1968
|
+
# the two SKIP arms printed a reason to the console and the audit row -- which
|
|
1969
|
+
# records GATE_5_DETAIL, a variable 5c never set -- could not distinguish
|
|
1970
|
+
# "alignment ran and was clean" from "alignment never ran".
|
|
1971
|
+
#
|
|
1972
|
+
# The verdict is folded into the detail rather than into GATE_5_STATUS because
|
|
1973
|
+
# 5c is a SUB-check: a sub-check that could not run does not make the tests and
|
|
1974
|
+
# coverage it sits beside unmeasured, and promoting SKIP over a PASS earned by
|
|
1975
|
+
# a real test run would trade one wrong record for another. What must survive
|
|
1976
|
+
# is the REASON, and it is prefixed so a reader can tell which sub-check it
|
|
1977
|
+
# came from.
|
|
1978
|
+
if [ -n "${GATE_5C_STATUS:-}" ] && [ -z "${GATE_5_DETAIL:-}" ]; then
|
|
1979
|
+
case "$GATE_5C_STATUS" in
|
|
1980
|
+
SKIP) GATE_5_DETAIL="alignment_skipped:${GATE_5C_REASON:-unspecified}" ;;
|
|
1981
|
+
PASS) GATE_5_DETAIL="alignment_clean" ;;
|
|
1982
|
+
esac
|
|
1983
|
+
fi
|
|
1984
|
+
|
|
1949
1985
|
record_gate_audit "gate-5" "tests-coverage" "$GATE_5_STATUS" "0" "$GATE_5_START" "${GATE_5_DETAIL:-}"
|
|
1950
1986
|
return 0
|
|
1951
1987
|
}
|
|
@@ -72,6 +72,7 @@ gate_5c_alignment() {
|
|
|
72
72
|
echo " ⏭️ Gate 5c: spec/test alignment NOT CHECKED — $req_ids_file missing"
|
|
73
73
|
echo " Run 'xp-gate check-alignment' to generate it and enable this gate."
|
|
74
74
|
GATE_5C_STATUS="SKIP"
|
|
75
|
+
GATE_5C_REASON="no_req_ids"
|
|
75
76
|
return 0
|
|
76
77
|
fi
|
|
77
78
|
|
|
@@ -81,6 +82,7 @@ gate_5c_alignment() {
|
|
|
81
82
|
echo " ⏭️ Gate 5c: spec/test alignment NOT CHECKED — req-ids.json is stale"
|
|
82
83
|
echo " specification.yaml is newer. Run 'xp-gate check-alignment' to regenerate."
|
|
83
84
|
GATE_5C_STATUS="SKIP"
|
|
85
|
+
GATE_5C_REASON="stale_req_ids"
|
|
84
86
|
return 0
|
|
85
87
|
fi
|
|
86
88
|
|
|
@@ -91,6 +93,13 @@ gate_5c_alignment() {
|
|
|
91
93
|
# "nothing to check" from "the gate is broken" (#585).
|
|
92
94
|
echo " ℹ️ Gate 5c: no test files among the staged changes — nothing to align."
|
|
93
95
|
GATE_5C_STATUS="SKIP"
|
|
96
|
+
# Consumed by the sourcing gate body: gate-5-entry.sh folds it into
|
|
97
|
+
# GATE_5_DETAIL for the audit row. shellcheck analyses this file alone, and
|
|
98
|
+
# this is the last assignment in the function, so it reads it as dead -- the
|
|
99
|
+
# two earlier ones are followed by reads on the same path. Same contract as
|
|
100
|
+
# GATE_5C_STATUS directly above.
|
|
101
|
+
# shellcheck disable=SC2034
|
|
102
|
+
GATE_5C_REASON="no_staged_test_files"
|
|
94
103
|
return 0
|
|
95
104
|
fi
|
|
96
105
|
|
|
@@ -73,7 +73,19 @@ afterEach(() => {
|
|
|
73
73
|
fs.rmSync(sandbox, { recursive: true, force: true });
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
function writeCleanSandbox() {
|
|
76
|
+
function writeCleanSandbox({ withConfig = false } = {}) {
|
|
77
|
+
// Architecture config is REQUIRED before lib/arch.js will scan
|
|
78
|
+
// (REQ-GATE6-CONFIG-PARITY, mirroring the hook), so every case that expects a
|
|
79
|
+
// scan must declare one. Opt-in rather than unconditional: the --use-config
|
|
80
|
+
// group runs `archlint init` and asserts the file appears, and pre-creating it
|
|
81
|
+
// made init refuse to overwrite and exit non-zero (measured: that group went
|
|
82
|
+
// from green to 1 failed | 34 passed when the config was written here always).
|
|
83
|
+
if (withConfig) {
|
|
84
|
+
fs.writeFileSync(
|
|
85
|
+
path.join(sandbox, '.archlint.yaml'),
|
|
86
|
+
['rules:', ' code-clone:', ' severity: high', ' cyclic-dependency:', ' severity: high', ''].join(String.fromCharCode(10)),
|
|
87
|
+
);
|
|
88
|
+
}
|
|
77
89
|
fs.mkdirSync(path.join(sandbox, 'src'), { recursive: true });
|
|
78
90
|
fs.writeFileSync(path.join(sandbox, 'src', 'a.js'), 'module.exports = { a: 1 };\n');
|
|
79
91
|
fs.writeFileSync(
|
|
@@ -323,7 +335,7 @@ describe('stripExtendedPrefix', () => {
|
|
|
323
335
|
|
|
324
336
|
describe('arch — real archlint integration (anti-noop)', () => {
|
|
325
337
|
it('exits 0 on a clean sandbox (zero-tolerance mode, no baseline)', () => {
|
|
326
|
-
writeCleanSandbox();
|
|
338
|
+
writeCleanSandbox({ withConfig: true });
|
|
327
339
|
const run = runArchInChild(sandbox, []);
|
|
328
340
|
expect(run.status).toBe(0);
|
|
329
341
|
expect(run.stdout).toContain('Zero-tolerance mode');
|
|
@@ -331,7 +343,7 @@ describe('arch — real archlint integration (anti-noop)', () => {
|
|
|
331
343
|
}, 60000);
|
|
332
344
|
|
|
333
345
|
it('BLOCKS a planted high-severity violation — exit 0 is a real scan, not a no-op', () => {
|
|
334
|
-
writeCleanSandbox();
|
|
346
|
+
writeCleanSandbox({ withConfig: true });
|
|
335
347
|
plantHighClone();
|
|
336
348
|
const run = runArchInChild(sandbox, []);
|
|
337
349
|
expect(run.status).toBe(1);
|
|
@@ -340,7 +352,7 @@ describe('arch — real archlint integration (anti-noop)', () => {
|
|
|
340
352
|
}, 60000);
|
|
341
353
|
|
|
342
354
|
it('baseline ratchet: snapshot of a clean tree then re-scan exits 0', () => {
|
|
343
|
-
writeCleanSandbox();
|
|
355
|
+
writeCleanSandbox({ withConfig: true });
|
|
344
356
|
const snapshot = runRealArchlint(['snapshot', '-o', path.join(sandbox, '.architecture-baseline.json'), '-p', sandbox], sandbox);
|
|
345
357
|
expect(snapshot.status).toBe(0);
|
|
346
358
|
const run = runArchInChild(sandbox, []);
|
|
@@ -349,7 +361,7 @@ describe('arch — real archlint integration (anti-noop)', () => {
|
|
|
349
361
|
}, 120000);
|
|
350
362
|
|
|
351
363
|
it('baseline ratchet: a NEW high finding against the baseline blocks', () => {
|
|
352
|
-
writeCleanSandbox();
|
|
364
|
+
writeCleanSandbox({ withConfig: true });
|
|
353
365
|
const snapshot = runRealArchlint(['snapshot', '-o', path.join(sandbox, '.architecture-baseline.json'), '-p', sandbox], sandbox);
|
|
354
366
|
expect(snapshot.status).toBe(0);
|
|
355
367
|
plantHighClone();
|
package/lib/arch.js
CHANGED
|
@@ -550,6 +550,44 @@ function arch(args) {
|
|
|
550
550
|
}
|
|
551
551
|
|
|
552
552
|
const projectRoot = findProjectRoot(process.cwd());
|
|
553
|
+
|
|
554
|
+
// Architecture config is REQUIRED, exactly as gate-6-entry.sh says: without an
|
|
555
|
+
// explicit constraint file there is nothing to validate against, and a scan
|
|
556
|
+
// that scores 1.3/10 "Critical" while reporting "no high/critical findings" is
|
|
557
|
+
// the worst kind of green -- a number nobody can act on, printed next to a
|
|
558
|
+
// checkmark.
|
|
559
|
+
//
|
|
560
|
+
// Measured before this check existed, on a repo holding only package.json and
|
|
561
|
+
// two .ts files:
|
|
562
|
+
//
|
|
563
|
+
// git commit -> ❌ ARCHITECTURE CONFIG MISSING - COMMIT BLOCKED
|
|
564
|
+
// xp-gate check 6 -> ✅ arch: no high/critical architecture findings, exit 0
|
|
565
|
+
//
|
|
566
|
+
// `check 6` is the command a user runs to PRE-FLIGHT the gate, so being more
|
|
567
|
+
// forgiving than the gate it previews is precisely backwards.
|
|
568
|
+
//
|
|
569
|
+
// Only when no explicit --use-config/--config was given: an explicit path is
|
|
570
|
+
// already validated below, and second-guessing it here would block a
|
|
571
|
+
// deliberate one-off scan.
|
|
572
|
+
if (!config) {
|
|
573
|
+
const CONFIG_NAMES = ['.archlint.yaml', 'architecture.yaml', '.architecturerc'];
|
|
574
|
+
const hasConfig = CONFIG_NAMES.some((name) => fs.existsSync(path.join(projectRoot, name)));
|
|
575
|
+
if (!hasConfig) {
|
|
576
|
+
// The hook's escape valve, honoured here too so the two agree.
|
|
577
|
+
if (fs.existsSync(path.join(projectRoot, '.architecture-skip'))) {
|
|
578
|
+
console.warn('[xp-gate arch] ⚠️ Architecture config missing but .architecture-skip present — skipping.');
|
|
579
|
+
return Promise.resolve(0);
|
|
580
|
+
}
|
|
581
|
+
console.error('');
|
|
582
|
+
console.error('[xp-gate arch] ❌ ARCHITECTURE CONFIG MISSING');
|
|
583
|
+
console.error(`[xp-gate arch] Required: one of ${CONFIG_NAMES.join(' / ')} in ${projectRoot}`);
|
|
584
|
+
console.error('[xp-gate arch] Without it there are no declared constraints to validate against.');
|
|
585
|
+
console.error('[xp-gate arch] Create one with: npx archlint init --no-interactive');
|
|
586
|
+
console.error('[xp-gate arch] Or accept that it is not checked: create .architecture-skip');
|
|
587
|
+
return Promise.resolve(1);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
|
|
553
591
|
const resolved = resolveArchlint(projectRoot);
|
|
554
592
|
|
|
555
593
|
if (config) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xp-gate",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.22",
|
|
4
4
|
"displayName": "XP-Gate",
|
|
5
5
|
"description": "Extreme Programming quality gates + AI workflow skills for Claude Code. Includes 12 pre-commit gates (Gate 0-11), 8 pre-push gates, Sprint Flow (6 phases), and Delphi multi-expert review (>=90% consensus).",
|
|
6
6
|
"author": {
|
|
@@ -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.38.
|
|
6
|
+
**Version:** 0.38.22.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.
|
|
@@ -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.38.
|
|
6
|
+
**Version:** 0.38.22.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.38.
|
|
6
|
+
**Version:** 0.38.22.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|
|
@@ -34,8 +34,10 @@ export declare function isEditTool(name: string): boolean;
|
|
|
34
34
|
/**
|
|
35
35
|
* Must this tool be gated by the sprint review guard?
|
|
36
36
|
*
|
|
37
|
-
* The inverse of {@link
|
|
38
|
-
* capable of writing, which is what closes the `bash` hole.
|
|
37
|
+
* The inverse of {@link UNGATED_TOOLS}: an unrecognised tool is treated as
|
|
38
|
+
* capable of writing, which is what closes the `bash` hole. The name is kept
|
|
39
|
+
* for its call sites even though an exempt tool such as `delphi-review` can
|
|
40
|
+
* write — see {@link UNGATED_TOOLS} for why membership is not "cannot write".
|
|
39
41
|
*/
|
|
40
42
|
export declare function mayModifyFiles(name: string): boolean;
|
|
41
43
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAyDH,kFAAkF;AAClF,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAsBD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKrD;AAgBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CA8B3F"}
|
package/plugins/dsh/lib/hooks.js
CHANGED
|
@@ -21,16 +21,33 @@
|
|
|
21
21
|
import { existsSync, readFileSync } from "node:fs";
|
|
22
22
|
import { join } from "node:path";
|
|
23
23
|
/**
|
|
24
|
-
* Tools
|
|
24
|
+
* Tools the sprint guard must never block. Everything else is gated.
|
|
25
25
|
*
|
|
26
26
|
* This is an ALLOWLIST on purpose. The guard used to name the write tools
|
|
27
27
|
* instead (`write`, `edit`, `str_replace_editor`), which let `bash` through —
|
|
28
28
|
* one shell command writes a file, so the guard was bypassable by the very tool
|
|
29
29
|
* a model reaches for first. A write-blacklist loses again on every new
|
|
30
|
-
* file-touching tool;
|
|
31
|
-
*
|
|
30
|
+
* file-touching tool; an allowlist loses only by being too strict, which
|
|
31
|
+
* surfaces as an over-eager denial rather than a silent hole.
|
|
32
|
+
*
|
|
33
|
+
* Membership is NOT "cannot write" — it is "cannot be used to sidestep this
|
|
34
|
+
* guard". Two groups qualify:
|
|
35
|
+
*
|
|
36
|
+
* 1. Tools that cannot modify a file at all (read, grep, todo_write, ...).
|
|
37
|
+
* 2. Tools that ARE the guard's exit. `delphi-review` runs the review this
|
|
38
|
+
* guard waits for, and `sprint`/`phase-transition` update the sprint state
|
|
39
|
+
* that carries the verdict. Gating them is a deadlock: the only way to
|
|
40
|
+
* satisfy the guard is to call a tool the guard rejects. Observed in
|
|
41
|
+
* practice — a repository with `.sprint-state/` but no verdict could not
|
|
42
|
+
* run `delphi-review` (or anything else) again, and had to be unblocked by
|
|
43
|
+
* hand-editing the state directory outside the session.
|
|
44
|
+
*
|
|
45
|
+
* Exempting `delphi-review` does not open a hole. It does not accept a caller-
|
|
46
|
+
* supplied verdict; it runs the three seats and derives one. The gate still
|
|
47
|
+
* stands between a model and the code until that review actually returns
|
|
48
|
+
* APPROVED, which is the behaviour it was built to enforce.
|
|
32
49
|
*/
|
|
33
|
-
const
|
|
50
|
+
const UNGATED_TOOLS = new Set([
|
|
34
51
|
"read",
|
|
35
52
|
"read_image",
|
|
36
53
|
"grep",
|
|
@@ -45,6 +62,10 @@ const READ_ONLY_TOOLS = new Set([
|
|
|
45
62
|
"gate-check",
|
|
46
63
|
"gate-principles",
|
|
47
64
|
"gate-arch",
|
|
65
|
+
// The guard's own exit. See the block comment above: without these the guard
|
|
66
|
+
// cannot be satisfied in a sprint that has state but no recorded verdict.
|
|
67
|
+
"delphi-review",
|
|
68
|
+
"sprint",
|
|
48
69
|
]);
|
|
49
70
|
/** Where Sprint Flow records the review verdict. */
|
|
50
71
|
const SPRINT_STATE_DIR = ".sprint-state";
|
|
@@ -81,11 +102,13 @@ export function isEditTool(name) {
|
|
|
81
102
|
/**
|
|
82
103
|
* Must this tool be gated by the sprint review guard?
|
|
83
104
|
*
|
|
84
|
-
* The inverse of {@link
|
|
85
|
-
* capable of writing, which is what closes the `bash` hole.
|
|
105
|
+
* The inverse of {@link UNGATED_TOOLS}: an unrecognised tool is treated as
|
|
106
|
+
* capable of writing, which is what closes the `bash` hole. The name is kept
|
|
107
|
+
* for its call sites even though an exempt tool such as `delphi-review` can
|
|
108
|
+
* write — see {@link UNGATED_TOOLS} for why membership is not "cannot write".
|
|
86
109
|
*/
|
|
87
110
|
export function mayModifyFiles(name) {
|
|
88
|
-
return !
|
|
111
|
+
return !UNGATED_TOOLS.has(name);
|
|
89
112
|
}
|
|
90
113
|
/**
|
|
91
114
|
* Should a save-time check run for this path?
|
|
@@ -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.38.
|
|
6
|
+
**Version:** 0.38.22.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.
|
|
@@ -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.38.
|
|
6
|
+
**Version:** 0.38.22.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.38.
|
|
6
|
+
**Version:** 0.38.22.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|
|
@@ -133,3 +133,45 @@ describe("delphiGuardDecision tool classification", () => {
|
|
|
133
133
|
}
|
|
134
134
|
})
|
|
135
135
|
})
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @test REQ-DSH-015 sprint-phase writes are gated the way the IDE plugin gates them
|
|
139
|
+
* @intent 复现并锁定「门禁自锁」:有 .sprint-state 但没有 verdict 时,
|
|
140
|
+
* 唯一能产生 verdict 的工具 delphi-review 自己也被门禁拦住,
|
|
141
|
+
* 导致仓库永久无法解封。sprint 工具同理。
|
|
142
|
+
* @covers AC-DSH-015-01 AC-DSH-015-03
|
|
143
|
+
*
|
|
144
|
+
* This is the regression that matters most in this file. The allowlist was
|
|
145
|
+
* originally "tools that provably cannot modify a file", which excluded the two
|
|
146
|
+
* tools that END the block — so a sprint with state but no recorded verdict
|
|
147
|
+
* deadlocked, and the only escape was editing `.sprint-state` outside the
|
|
148
|
+
* session. Reproduced against a real install before the fix.
|
|
149
|
+
*/
|
|
150
|
+
describe("delphiGuardDecision deadlock", () => {
|
|
151
|
+
/** The tools that can clear the block, and therefore must never be blocked. */
|
|
152
|
+
const UNBLOCKERS = ["delphi-review", "sprint"]
|
|
153
|
+
|
|
154
|
+
it("never gates the tools that clear the block", () => {
|
|
155
|
+
// "no-verdict" is the deadlocked state: state exists, verdict does not.
|
|
156
|
+
const root = project("no-verdict")
|
|
157
|
+
for (const tool of UNBLOCKERS) {
|
|
158
|
+
expect(delphiGuardDecision(root, tool), `${tool} must not be gated`).toBeUndefined()
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
it("still gates code writes in the same state", () => {
|
|
163
|
+
// Exempting the exit must not open the gate itself.
|
|
164
|
+
const root = project("no-verdict")
|
|
165
|
+
for (const tool of ["write", "edit", "bash"]) {
|
|
166
|
+
expect(delphiGuardDecision(root, tool), `${tool} must stay gated`).toBeDefined()
|
|
167
|
+
}
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
it("remains usable after a rejected review", () => {
|
|
171
|
+
// A rejection must leave the path to a re-review open.
|
|
172
|
+
const root = project("rejected")
|
|
173
|
+
for (const tool of UNBLOCKERS) {
|
|
174
|
+
expect(delphiGuardDecision(root, tool), `${tool} must not be gated`).toBeUndefined()
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
})
|
package/plugins/dsh/src/hooks.ts
CHANGED
|
@@ -23,16 +23,33 @@ import { existsSync, readFileSync } from "node:fs"
|
|
|
23
23
|
import { join } from "node:path"
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* Tools
|
|
26
|
+
* Tools the sprint guard must never block. Everything else is gated.
|
|
27
27
|
*
|
|
28
28
|
* This is an ALLOWLIST on purpose. The guard used to name the write tools
|
|
29
29
|
* instead (`write`, `edit`, `str_replace_editor`), which let `bash` through —
|
|
30
30
|
* one shell command writes a file, so the guard was bypassable by the very tool
|
|
31
31
|
* a model reaches for first. A write-blacklist loses again on every new
|
|
32
|
-
* file-touching tool;
|
|
33
|
-
*
|
|
32
|
+
* file-touching tool; an allowlist loses only by being too strict, which
|
|
33
|
+
* surfaces as an over-eager denial rather than a silent hole.
|
|
34
|
+
*
|
|
35
|
+
* Membership is NOT "cannot write" — it is "cannot be used to sidestep this
|
|
36
|
+
* guard". Two groups qualify:
|
|
37
|
+
*
|
|
38
|
+
* 1. Tools that cannot modify a file at all (read, grep, todo_write, ...).
|
|
39
|
+
* 2. Tools that ARE the guard's exit. `delphi-review` runs the review this
|
|
40
|
+
* guard waits for, and `sprint`/`phase-transition` update the sprint state
|
|
41
|
+
* that carries the verdict. Gating them is a deadlock: the only way to
|
|
42
|
+
* satisfy the guard is to call a tool the guard rejects. Observed in
|
|
43
|
+
* practice — a repository with `.sprint-state/` but no verdict could not
|
|
44
|
+
* run `delphi-review` (or anything else) again, and had to be unblocked by
|
|
45
|
+
* hand-editing the state directory outside the session.
|
|
46
|
+
*
|
|
47
|
+
* Exempting `delphi-review` does not open a hole. It does not accept a caller-
|
|
48
|
+
* supplied verdict; it runs the three seats and derives one. The gate still
|
|
49
|
+
* stands between a model and the code until that review actually returns
|
|
50
|
+
* APPROVED, which is the behaviour it was built to enforce.
|
|
34
51
|
*/
|
|
35
|
-
const
|
|
52
|
+
const UNGATED_TOOLS: ReadonlySet<string> = new Set([
|
|
36
53
|
"read",
|
|
37
54
|
"read_image",
|
|
38
55
|
"grep",
|
|
@@ -47,6 +64,10 @@ const READ_ONLY_TOOLS: ReadonlySet<string> = new Set([
|
|
|
47
64
|
"gate-check",
|
|
48
65
|
"gate-principles",
|
|
49
66
|
"gate-arch",
|
|
67
|
+
// The guard's own exit. See the block comment above: without these the guard
|
|
68
|
+
// cannot be satisfied in a sprint that has state but no recorded verdict.
|
|
69
|
+
"delphi-review",
|
|
70
|
+
"sprint",
|
|
50
71
|
])
|
|
51
72
|
|
|
52
73
|
/** Where Sprint Flow records the review verdict. */
|
|
@@ -93,11 +114,13 @@ export function isEditTool(name: string): boolean {
|
|
|
93
114
|
/**
|
|
94
115
|
* Must this tool be gated by the sprint review guard?
|
|
95
116
|
*
|
|
96
|
-
* The inverse of {@link
|
|
97
|
-
* capable of writing, which is what closes the `bash` hole.
|
|
117
|
+
* The inverse of {@link UNGATED_TOOLS}: an unrecognised tool is treated as
|
|
118
|
+
* capable of writing, which is what closes the `bash` hole. The name is kept
|
|
119
|
+
* for its call sites even though an exempt tool such as `delphi-review` can
|
|
120
|
+
* write — see {@link UNGATED_TOOLS} for why membership is not "cannot write".
|
|
98
121
|
*/
|
|
99
122
|
export function mayModifyFiles(name: string): boolean {
|
|
100
|
-
return !
|
|
123
|
+
return !UNGATED_TOOLS.has(name)
|
|
101
124
|
}
|
|
102
125
|
|
|
103
126
|
/**
|
|
@@ -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.38.
|
|
6
|
+
**Version:** 0.38.22.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.
|
|
@@ -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.38.
|
|
6
|
+
**Version:** 0.38.22.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.38.
|
|
6
|
+
**Version:** 0.38.22.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.38.
|
|
6
|
+
**Version:** 0.38.22.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.
|
|
@@ -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.38.
|
|
6
|
+
**Version:** 0.38.22.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.38.
|
|
6
|
+
**Version:** 0.38.22.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.38.
|
|
6
|
+
**Version:** 0.38.22.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.
|
|
@@ -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.38.
|
|
6
|
+
**Version:** 0.38.22.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.38.
|
|
6
|
+
**Version:** 0.38.22.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|