@boyingliu01/xp-gate 0.31.2 → 0.31.4
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/gate-3.sh +244 -9
- package/hooks/gate-3.sh +244 -9
- package/hooks/lib/Measure-PowerShellComplexity.ps1 +186 -0
- package/hooks/pre-commit +152 -13
- package/lib/mattpocock-license-verdict.json +1 -1
- package/mock-policy/AGENTS.md +3 -3
- package/mutation/AGENTS.md +3 -3
- package/package.json +1 -1
- package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/skills/delphi-review/AGENTS.md +3 -3
- package/plugins/claude-code/skills/sprint-flow/AGENTS.md +3 -3
- package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +3 -3
- package/plugins/dsh/package.json +1 -1
- package/plugins/dsh/skills/delphi-review/AGENTS.md +3 -3
- package/plugins/dsh/skills/sprint-flow/AGENTS.md +3 -3
- package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +3 -3
- package/plugins/opencode/package.json +1 -1
- package/plugins/opencode/skills/delphi-review/AGENTS.md +3 -3
- package/plugins/opencode/skills/sprint-flow/AGENTS.md +3 -3
- package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +3 -3
- package/plugins/qoder/plugin.json +1 -1
- package/plugins/qoder/skills/delphi-review/AGENTS.md +3 -3
- package/plugins/qoder/skills/sprint-flow/AGENTS.md +3 -3
- package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +3 -3
- package/principles/AGENTS.md +3 -3
- package/principles/__tests__/baseline-entry-total-warnings.test.ts +76 -0
- package/principles/adapters/__tests__/cpp-code-block.test.ts +123 -0
- package/principles/adapters/__tests__/cpp-scanner-equivalence.test.ts +67 -0
- package/principles/adapters/__tests__/typescript-block-comment-lines.test.ts +53 -0
- package/principles/adapters/__tests__/typescript-masking.test.ts +96 -0
- package/principles/adapters/cpp.ts +102 -50
- package/principles/adapters/typescript.ts +503 -174
- package/principles/baseline.ts +58 -70
- package/skills/delphi-review/AGENTS.md +3 -3
- package/skills/sprint-flow/AGENTS.md +3 -3
- package/skills/test-specification-alignment/AGENTS.md +3 -3
package/principles/baseline.ts
CHANGED
|
@@ -19,6 +19,41 @@ interface BaselineStorageConfig {
|
|
|
19
19
|
|
|
20
20
|
type ToolValidator = (entry: BaselineEntry, file: string) => void;
|
|
21
21
|
|
|
22
|
+
/** The per-tool counters a baseline entry can carry, in report order. */
|
|
23
|
+
const TOOL_KEYS = ['eslint', 'principles', 'ccn', 'ruff', 'golangci', 'shellcheck'] as const;
|
|
24
|
+
type ToolKey = typeof TOOL_KEYS[number];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Build one baseline entry from a file's per-tool counts.
|
|
28
|
+
*
|
|
29
|
+
* `createFromFiles` and `initializeWithAnalyzer` each carried this six-`if`
|
|
30
|
+
* accumulator plus its six-spread object literal verbatim (#620). Beyond the
|
|
31
|
+
* duplication, the copy-paste is what made both methods read as CCN 15-18: the
|
|
32
|
+
* complexity was not in what they did, it was in how many tools they listed.
|
|
33
|
+
*
|
|
34
|
+
* The two copies differed in ONE way, and this function keeps the stricter
|
|
35
|
+
* reading: an explicit `totalWarnings` wins when it is a number (including 0).
|
|
36
|
+
* `createFromFiles` tested truthiness, so a deliberate `totalWarnings: 0` was
|
|
37
|
+
* silently replaced by the sum -- the one case where the caller was trying to
|
|
38
|
+
* override a stale per-tool count.
|
|
39
|
+
*/
|
|
40
|
+
function buildEntry(counts: Partial<BaselineEntry>): BaselineEntry {
|
|
41
|
+
const entry: Partial<Record<ToolKey, unknown>> = {};
|
|
42
|
+
let summed = 0;
|
|
43
|
+
for (const key of TOOL_KEYS) {
|
|
44
|
+
const tool = counts[key];
|
|
45
|
+
if (!tool) continue;
|
|
46
|
+
entry[key] = tool;
|
|
47
|
+
summed += tool.warnings;
|
|
48
|
+
}
|
|
49
|
+
const totalWarnings = typeof counts.totalWarnings === 'number' ? counts.totalWarnings : summed;
|
|
50
|
+
return {
|
|
51
|
+
...entry,
|
|
52
|
+
totalWarnings,
|
|
53
|
+
lastAnalyzed: new Date().toISOString(),
|
|
54
|
+
} as BaselineEntry;
|
|
55
|
+
}
|
|
56
|
+
|
|
22
57
|
function computeSummaryStats(baseline: Record<string, BaselineEntry>) {
|
|
23
58
|
let totalFiles = 0;
|
|
24
59
|
let totalWarnings = 0;
|
|
@@ -48,18 +83,27 @@ function computeSummaryStats(baseline: Record<string, BaselineEntry>) {
|
|
|
48
83
|
};
|
|
49
84
|
}
|
|
50
85
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
86
|
+
/** Tools whose counts are summed, and which shape their counter has. */
|
|
87
|
+
const AGGREGATED_TOOLS = ['eslint', 'principles', 'ruff', 'golangci', 'shellcheck'] as const;
|
|
88
|
+
|
|
89
|
+
function toolCounters(entry: BaselineEntry, key: typeof AGGREGATED_TOOLS[number]): { warnings: number; errors: number } {
|
|
90
|
+
const tool = entry[key];
|
|
91
|
+
if (!tool) return { warnings: 0, errors: 0 };
|
|
92
|
+
return { warnings: tool.warnings, errors: tool.errors };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function aggregateTool(
|
|
96
|
+
stats: Record<string, { totalWarnings: number; totalErrors: number }>,
|
|
97
|
+
entry: BaselineEntry,
|
|
98
|
+
): void {
|
|
99
|
+
for (const key of AGGREGATED_TOOLS) {
|
|
100
|
+
const { warnings, errors } = toolCounters(entry, key);
|
|
101
|
+
if (warnings <= 0 && errors <= 0) continue;
|
|
102
|
+
const running = stats[key] ?? { totalWarnings: 0, totalErrors: 0 };
|
|
103
|
+
stats[key] = {
|
|
104
|
+
totalWarnings: running.totalWarnings + warnings,
|
|
105
|
+
totalErrors: running.totalErrors + errors,
|
|
106
|
+
};
|
|
63
107
|
}
|
|
64
108
|
}
|
|
65
109
|
|
|
@@ -148,44 +192,9 @@ class BaselineStorage {
|
|
|
148
192
|
|
|
149
193
|
async createFromFiles(warningData: Array<{ file: string; counts: Partial<BaselineEntry> }>): Promise<Record<string, BaselineEntry>> {
|
|
150
194
|
const baseline: Record<string, BaselineEntry> = {};
|
|
151
|
-
|
|
152
195
|
for (const item of warningData) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (item.counts.eslint?.warnings) {
|
|
156
|
-
totalWarnings += item.counts.eslint.warnings;
|
|
157
|
-
}
|
|
158
|
-
if (item.counts.principles?.warnings) {
|
|
159
|
-
totalWarnings += item.counts.principles.warnings;
|
|
160
|
-
}
|
|
161
|
-
if (item.counts.ccn?.warnings) {
|
|
162
|
-
totalWarnings += item.counts.ccn.warnings;
|
|
163
|
-
}
|
|
164
|
-
if (item.counts.ruff?.warnings) {
|
|
165
|
-
totalWarnings += item.counts.ruff.warnings;
|
|
166
|
-
}
|
|
167
|
-
if (item.counts.golangci?.warnings) {
|
|
168
|
-
totalWarnings += item.counts.golangci.warnings;
|
|
169
|
-
}
|
|
170
|
-
if (item.counts.shellcheck?.warnings) {
|
|
171
|
-
totalWarnings += item.counts.shellcheck.warnings;
|
|
172
|
-
}
|
|
173
|
-
if (item.counts.totalWarnings) {
|
|
174
|
-
totalWarnings = item.counts.totalWarnings;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
baseline[item.file] = {
|
|
178
|
-
...(item.counts.eslint && { eslint: item.counts.eslint }),
|
|
179
|
-
...(item.counts.principles && { principles: item.counts.principles }),
|
|
180
|
-
...(item.counts.ccn && { ccn: item.counts.ccn }),
|
|
181
|
-
...(item.counts.ruff && { ruff: item.counts.ruff }),
|
|
182
|
-
...(item.counts.golangci && { golangci: item.counts.golangci }),
|
|
183
|
-
...(item.counts.shellcheck && { shellcheck: item.counts.shellcheck }),
|
|
184
|
-
totalWarnings,
|
|
185
|
-
lastAnalyzed: new Date().toISOString()
|
|
186
|
-
};
|
|
196
|
+
baseline[item.file] = buildEntry(item.counts);
|
|
187
197
|
}
|
|
188
|
-
|
|
189
198
|
return baseline;
|
|
190
199
|
}
|
|
191
200
|
|
|
@@ -217,28 +226,7 @@ class BaselineStorage {
|
|
|
217
226
|
const promiseResults = await Promise.allSettled(
|
|
218
227
|
batch.map(async (file) => {
|
|
219
228
|
const counts = await warningCountFunction(file);
|
|
220
|
-
|
|
221
|
-
let totalWarnings = 0;
|
|
222
|
-
if (counts.eslint?.warnings) totalWarnings += counts.eslint.warnings;
|
|
223
|
-
if (counts.principles?.warnings) totalWarnings += counts.principles.warnings;
|
|
224
|
-
if (counts.ccn?.warnings) totalWarnings += counts.ccn.warnings;
|
|
225
|
-
if (counts.ruff?.warnings) totalWarnings += counts.ruff.warnings;
|
|
226
|
-
if (counts.golangci?.warnings) totalWarnings += counts.golangci.warnings;
|
|
227
|
-
if (counts.shellcheck?.warnings) totalWarnings += counts.shellcheck.warnings;
|
|
228
|
-
if (counts.totalWarnings !== undefined) totalWarnings = counts.totalWarnings;
|
|
229
|
-
|
|
230
|
-
const baselineEntry: BaselineEntry = {
|
|
231
|
-
...(counts.eslint && { eslint: counts.eslint }),
|
|
232
|
-
...(counts.principles && { principles: counts.principles }),
|
|
233
|
-
...(counts.ccn && { ccn: counts.ccn }),
|
|
234
|
-
...(counts.ruff && { ruff: counts.ruff }),
|
|
235
|
-
...(counts.golangci && { golangci: counts.golangci }),
|
|
236
|
-
...(counts.shellcheck && { shellcheck: counts.shellcheck }),
|
|
237
|
-
totalWarnings,
|
|
238
|
-
lastAnalyzed: new Date().toISOString()
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
baseline[file] = baselineEntry;
|
|
229
|
+
baseline[file] = buildEntry(counts);
|
|
242
230
|
completed.push(file);
|
|
243
231
|
|
|
244
232
|
if (onProgress) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# SKILLS/DELPHI-REVIEW KNOWLEDGE BASE
|
|
2
2
|
|
|
3
|
-
**Generated:** 2026-10-
|
|
4
|
-
**Commit:**
|
|
3
|
+
**Generated:** 2026-10-26
|
|
4
|
+
**Commit:** dfe3bf53
|
|
5
5
|
**Branch:** main
|
|
6
|
-
**Version:** 0.31.
|
|
6
|
+
**Version:** 0.31.4.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.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# SKILLS/SPRINT-FLOW KNOWLEDGE BASE
|
|
2
2
|
|
|
3
|
-
**Generated:** 2026-10-
|
|
4
|
-
**Commit:**
|
|
3
|
+
**Generated:** 2026-10-26
|
|
4
|
+
**Commit:** dfe3bf53
|
|
5
5
|
**Branch:** main
|
|
6
|
-
**Version:** 0.31.
|
|
6
|
+
**Version:** 0.31.4.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, 40-67% token savings vs parallel). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# SKILLS/TEST-SPECIFICATION-ALIGNMENT KNOWLEDGE BASE
|
|
2
2
|
|
|
3
|
-
**Generated:** 2026-10-
|
|
4
|
-
**Commit:**
|
|
3
|
+
**Generated:** 2026-10-26
|
|
4
|
+
**Commit:** dfe3bf53
|
|
5
5
|
**Branch:** main
|
|
6
|
-
**Version:** 0.31.
|
|
6
|
+
**Version:** 0.31.4.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|