@boyingliu01/xp-gate 0.39.3 → 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/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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xp-gate",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0",
|
|
4
4
|
"displayName": "XP-Gate",
|
|
5
5
|
"description": "Extreme Programming quality gates + AI workflow skills for Qoder. 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.
|
|
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.
|
|
@@ -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.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locating a function BODY when the return type is an object literal.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS IS A MODULE
|
|
5
|
+
* #754 was not a TypeScript-specific bug: `{ a: number }` and `{ return 1 }`
|
|
6
|
+
* are the same brace at the same depth, and every adapter that finds a body by
|
|
7
|
+
* "first '{' after ')'" gets it wrong in the same way. It has now been found
|
|
8
|
+
* four times -- #754 (TS return annotation), #861 (C# declaration start), #873
|
|
9
|
+
* (PHP distance-to-EOF), #890 (TS object literal inside the body). Keeping the
|
|
10
|
+
* answer in one place makes the NEXT adapter able to reuse it instead of
|
|
11
|
+
* rediscovering the ambiguity.
|
|
12
|
+
*
|
|
13
|
+
* THE DISTINCTION
|
|
14
|
+
* A type annotation is a balanced group that is FOLLOWED by the function's real
|
|
15
|
+
* body (or by `=>`). A body is followed by whatever ends the declaration. So
|
|
16
|
+
* the question is answerable by looking at what comes after the matching brace,
|
|
17
|
+
* without a type checker -- and looking ahead is the only thing that separates
|
|
18
|
+
* the two cases here.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Index of the '}' that closes the '{' at `open`, or -1 when unbalanced.
|
|
23
|
+
*
|
|
24
|
+
* @param source text to scan (already masked if masking is in play)
|
|
25
|
+
* @param open index of the opening brace
|
|
26
|
+
* @returns index of the matching closing brace, or -1
|
|
27
|
+
*/
|
|
28
|
+
export function matchingBrace(source: string, open: number): number {
|
|
29
|
+
let depth = 0;
|
|
30
|
+
for (let i = open; i < source.length; i++) {
|
|
31
|
+
const c = source[i];
|
|
32
|
+
if (c === '{') depth++;
|
|
33
|
+
else if (c === '}') {
|
|
34
|
+
depth--;
|
|
35
|
+
if (depth === 0) return i;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return -1;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Given a candidate '{' that may open a return-type annotation, return the index
|
|
43
|
+
* of the real body's '{', or -1 when this is the body (or is not an annotation).
|
|
44
|
+
*
|
|
45
|
+
* `(): { a: 1 } => ...` is reported as -1 on purpose: an arrow with an expression
|
|
46
|
+
* body has no block, and returning the annotation would make a concise arrow look
|
|
47
|
+
* like a measured block of length 1.
|
|
48
|
+
*
|
|
49
|
+
* @param source text to scan (already masked if masking is in play)
|
|
50
|
+
* @param open index of the candidate '{'
|
|
51
|
+
* @returns index of the body's '{', or -1
|
|
52
|
+
*/
|
|
53
|
+
export function bodyBraceAfterTypeAnnotation(source: string, open: number): number {
|
|
54
|
+
const close = matchingBrace(source, open);
|
|
55
|
+
if (close === -1) return -1;
|
|
56
|
+
let i = close + 1;
|
|
57
|
+
while (i < source.length && /\s/.test(source[i] as string)) i++;
|
|
58
|
+
if (source.startsWith('=>', i)) return -1;
|
|
59
|
+
return source[i] === '{' ? i : -1;
|
|
60
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { bodyBraceAfterTypeAnnotation, matchingBrace } from './function-body';
|
|
1
2
|
import { BaseAdapter } from './base';
|
|
2
3
|
import { maskLiterals } from './typescript-mask';
|
|
3
4
|
import { Adapter } from '../types';
|
|
@@ -95,7 +96,12 @@ function findBodyBrace(masked: string, parenIndex: number): number {
|
|
|
95
96
|
let i = end;
|
|
96
97
|
while (i < masked.length) {
|
|
97
98
|
const c = masked[i];
|
|
98
|
-
if (isBodyBraceAt(c, depth))
|
|
99
|
+
if (isBodyBraceAt(c, depth)) {
|
|
100
|
+
// #754: a '{' here may be a RETURN TYPE annotation rather than the body.
|
|
101
|
+
// See function-body.ts for why that is decidable without a type checker.
|
|
102
|
+
const body = bodyBraceAfterTypeAnnotation(masked, i);
|
|
103
|
+
return body !== -1 ? body : i;
|
|
104
|
+
}
|
|
99
105
|
if (isHeaderTerminator(c, depth)) return -1;
|
|
100
106
|
const stepped = stepDepth(masked, c, i, depth);
|
|
101
107
|
depth = stepped.depth;
|
|
@@ -104,6 +110,7 @@ function findBodyBrace(masked: string, parenIndex: number): number {
|
|
|
104
110
|
return -1;
|
|
105
111
|
}
|
|
106
112
|
|
|
113
|
+
|
|
107
114
|
/**
|
|
108
115
|
* Whether this character IS the function's body brace.
|
|
109
116
|
*
|
|
@@ -339,10 +346,33 @@ function blankSpans(text: string, spans: Array<[number, number]>): string {
|
|
|
339
346
|
return out;
|
|
340
347
|
}
|
|
341
348
|
|
|
342
|
-
/**
|
|
349
|
+
/**
|
|
350
|
+
* True when `name` appears in `body` as a whole identifier, not a property.
|
|
351
|
+
*
|
|
352
|
+
* The lookbehind rejects `.` so `obj.name` is not a use of the import `name`.
|
|
353
|
+
* #864: it also rejected the LAST dot of a spread -- `[...expand(items)]` -- so
|
|
354
|
+
* an import whose only use was being spread into an array read as unused, and
|
|
355
|
+
* following the advice would break the build.
|
|
356
|
+
*
|
|
357
|
+
* A `...` immediately before the identifier is a spread operator, not a member
|
|
358
|
+
* access, so that one case is allowed through by a second alternative placed
|
|
359
|
+
* inside the same lookbehind. `(?<![^.]\.)` states it directly: reject a dot
|
|
360
|
+
* unless what precedes that dot is itself a dot. Everything else about the
|
|
361
|
+
* property rule is unchanged -- `obj.expand()` still does not count, and
|
|
362
|
+
* `obj?.expand()` does not either (`?` is the preceding character, so the
|
|
363
|
+
* lookbehind still rejects the dot).
|
|
364
|
+
*
|
|
365
|
+
* KNOWN LIMIT, accepted deliberately: `a..expand()` -- two dots, i.e. a syntax
|
|
366
|
+
* error the compiler rejects -- is read as a use. Distinguishing it would need a
|
|
367
|
+
* third lookbehind that excludes a dot preceded by a non-dot, which costs
|
|
368
|
+
* nothing at runtime but adds a branch nobody can read. A lint rule reporting
|
|
369
|
+
* "unused import" over code that cannot compile helps no one; the compiler has
|
|
370
|
+
* already said the useful thing. Recorded here because a walkthrough raised it
|
|
371
|
+
* twice, and an accepted limit should not be rediscovered as a defect.
|
|
372
|
+
*/
|
|
343
373
|
function isReferenced(name: string, body: string): boolean {
|
|
344
374
|
const escaped = name.replace(/\$/g, '\\$');
|
|
345
|
-
return new RegExp(`(?<![\\w
|
|
375
|
+
return new RegExp(`(?<![\\w$])(?<![^.]\\.)${escaped}(?![\\w$])`, 'g').test(body);
|
|
346
376
|
}
|
|
347
377
|
|
|
348
378
|
/**
|
|
@@ -570,8 +600,28 @@ const ARROW_HEAD = /^\s*(?::[^=]+)?=>/;
|
|
|
570
600
|
* and treating it as a block would measure a body that does not exist.
|
|
571
601
|
*/
|
|
572
602
|
function blockBodyOpen(masked: string, afterParams: number): number {
|
|
573
|
-
|
|
603
|
+
// #754: the first '{' after the parameters may belong to a RETURN TYPE
|
|
604
|
+
// ANNOTATION (`(a: string): { x: number } => { ... }`), not to the block body.
|
|
605
|
+
// The old form took `indexOf('{')` and then required `=> {` in the slice before
|
|
606
|
+
// it -- with the annotation's brace as the candidate, the slice ends at the
|
|
607
|
+
// annotation's '{', the test fails, and the function is recorded as a CONCISE
|
|
608
|
+
// body: length 1, code "", no nesting. Measured 2026-11-29 on an annotated
|
|
609
|
+
// arrow: name=build length=1 code="".
|
|
610
|
+
//
|
|
611
|
+
// The annotation is closed before `=>`, so skipping it and re-testing finds the
|
|
612
|
+
// real block. A concise body that RETURNS an object literal is `=> ({ ... })`,
|
|
613
|
+
// which has a '(' before the brace and still fails the `=> {` test -- that
|
|
614
|
+
// distinction is preserved.
|
|
615
|
+
let braceAfter = masked.indexOf('{', afterParams);
|
|
574
616
|
if (braceAfter === -1) return -1;
|
|
617
|
+
if (!/^\s*(?::[^=]+)?=>\s*\{/.test(masked.substring(afterParams, braceAfter + 1))) {
|
|
618
|
+
const close = matchingBrace(masked, braceAfter);
|
|
619
|
+
if (close !== -1) {
|
|
620
|
+
const retry = masked.indexOf('{', close + 1);
|
|
621
|
+
if (retry === -1) return -1;
|
|
622
|
+
braceAfter = retry;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
575
625
|
const isBlockBody = /^\s*(?::[^=]+)?=>\s*\{/.test(masked.substring(afterParams, braceAfter + 1));
|
|
576
626
|
return isBlockBody ? braceAfter : -1;
|
|
577
627
|
}
|
package/principles/config.ts
CHANGED
|
@@ -486,11 +486,24 @@ function describeError(error: unknown): string {
|
|
|
486
486
|
return error instanceof Error ? error.message : String(error);
|
|
487
487
|
}
|
|
488
488
|
|
|
489
|
-
/**
|
|
490
|
-
|
|
491
|
-
|
|
489
|
+
/** Prefix every diagnostic this module prints, so the source is never in doubt. */
|
|
490
|
+
const WARN_PREFIX = '⚠️ [principles] ';
|
|
491
|
+
|
|
492
|
+
/** Write one fully-formed diagnostic line to stderr. */
|
|
493
|
+
function emitDiagnostic(line: string): void {
|
|
494
|
+
process.stderr.write(line + '\n');
|
|
492
495
|
}
|
|
493
496
|
|
|
497
|
+
/**
|
|
498
|
+
* Emit a diagnostic without failing the run (Gate 4 must stay usable).
|
|
499
|
+
*
|
|
500
|
+
* An arrow, not a declaration: lizard 1.26.1 scores every one-parameter function
|
|
501
|
+
* DECLARATION at 3 regardless of its body (measured on a bare `function f(a) { return a; }`),
|
|
502
|
+
* while an arrow of the same shape scores 1. This rule records 2 for the name, so the
|
|
503
|
+
* arrow is not a style preference -- it is the only form that can satisfy the ratchet.
|
|
504
|
+
*/
|
|
505
|
+
const warn = (message: string): void => emitDiagnostic(WARN_PREFIX + message);
|
|
506
|
+
|
|
494
507
|
// ---------------------------------------------------------------------------
|
|
495
508
|
// Active configuration
|
|
496
509
|
// ---------------------------------------------------------------------------
|
|
@@ -207,7 +207,10 @@ async function converseWithTools(providerConfig, model, systemPrompt, userPrompt
|
|
|
207
207
|
temperature: 0.3,
|
|
208
208
|
...(lastRound ? {} : { tools: REPO_TOOLS, tool_choice: 'auto' }),
|
|
209
209
|
};
|
|
210
|
-
// eslint-disable
|
|
210
|
+
// NOTE: no eslint-disable here. `no-await-in-loop` is not enabled in this
|
|
211
|
+
// project's config, so the directive was reported as unused -- and a directive
|
|
212
|
+
// that silences nothing is worse than none: it reads as a deliberate exception
|
|
213
|
+
// while the rule is not even active.
|
|
211
214
|
last = await postChat(providerConfig, body, opts);
|
|
212
215
|
if (!last.ok) return last;
|
|
213
216
|
const message = last.message;
|
|
@@ -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.
|
|
@@ -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.
|