@boyingliu01/xp-gate 0.38.76 → 0.38.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/lib/__tests__/mirror-sync.test.js +387 -5
  2. package/lib/mattpocock-license-verdict.json +1 -1
  3. package/lib/mirror-sync.js +202 -15
  4. package/package.json +1 -1
  5. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  6. package/plugins/claude-code/skills/delphi-review/AGENTS.md +1 -1
  7. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +1 -1
  8. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +1 -1
  9. package/plugins/dsh/package.json +1 -1
  10. package/plugins/dsh/skills/delphi-review/AGENTS.md +1 -1
  11. package/plugins/dsh/skills/sprint-flow/AGENTS.md +1 -1
  12. package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +1 -1
  13. package/plugins/opencode/package.json +1 -1
  14. package/plugins/opencode/skills/delphi-review/AGENTS.md +1 -1
  15. package/plugins/opencode/skills/sprint-flow/AGENTS.md +1 -1
  16. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +1 -1
  17. package/plugins/qoder/plugin.json +1 -1
  18. package/plugins/qoder/skills/delphi-review/AGENTS.md +1 -1
  19. package/plugins/qoder/skills/sprint-flow/AGENTS.md +1 -1
  20. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +1 -1
  21. package/scripts/generate-mirrors.cjs +10 -0
  22. package/skills/delphi-review/AGENTS.md +1 -1
  23. package/skills/sprint-flow/AGENTS.md +1 -1
  24. package/skills/test-specification-alignment/AGENTS.md +1 -1
  25. package/mock-policy/__tests__/config.test.ts +0 -292
  26. package/mock-policy/__tests__/gate-m3.test.ts +0 -379
  27. package/mock-policy/__tests__/integration.test.ts +0 -600
  28. package/mock-policy/__tests__/mock-decision-engine.test.ts +0 -231
  29. package/mock-policy/__tests__/schema.test.ts +0 -239
  30. package/mock-policy/__tests__/scope-scanner.test.ts +0 -541
  31. package/mutation/__tests__/detect-ai-test.test.ts +0 -152
  32. package/mutation/__tests__/gate-m-survivors.test.ts +0 -167
  33. package/mutation/__tests__/gate-m.test.ts +0 -246
  34. package/mutation/__tests__/go-mutant-runner.test.ts +0 -288
  35. package/mutation/__tests__/gremlins-runner.test.ts +0 -167
  36. package/mutation/__tests__/init-baseline.test.ts +0 -347
  37. package/mutation/__tests__/mutation-mirror.test.ts +0 -49
  38. package/mutation/__tests__/mutmut-runner.test.ts +0 -1049
  39. package/mutation/__tests__/pitest-gradle-availability.test.ts +0 -74
  40. package/mutation/__tests__/pitest-runner.test.ts +0 -574
  41. package/mutation/__tests__/runners-index.test.ts +0 -162
  42. package/mutation/__tests__/stryker-runner.test.ts +0 -455
  43. package/mutation/__tests__/test-filter-parity.test.ts +0 -40
  44. package/mutation/__tests__/update-baseline.test.ts +0 -395
  45. package/principles/__tests__/adapter-metrics.test.ts +0 -292
  46. package/principles/__tests__/analyze-read-failure.test.ts +0 -70
  47. package/principles/__tests__/analyzer.test.ts +0 -367
  48. package/principles/__tests__/baseline-entry-total-warnings.test.ts +0 -76
  49. package/principles/__tests__/baseline-prune-timeout.test.ts +0 -71
  50. package/principles/__tests__/baseline-prune.test.ts +0 -399
  51. package/principles/__tests__/baseline-storage.test.ts +0 -188
  52. package/principles/__tests__/baseline.test.ts +0 -330
  53. package/principles/__tests__/boy-scout-init-baseline.test.ts +0 -167
  54. package/principles/__tests__/boy-scout-integration.test.ts +0 -355
  55. package/principles/__tests__/boy-scout.test.ts +0 -893
  56. package/principles/__tests__/cli-files-separators.test.ts +0 -69
  57. package/principles/__tests__/config-arch-group.test.ts +0 -106
  58. package/principles/__tests__/config-enforcement.test.ts +0 -470
  59. package/principles/__tests__/config-git-timeout.test.ts +0 -66
  60. package/principles/__tests__/config-merge-warnings.test.ts +0 -148
  61. package/principles/__tests__/config.test.ts +0 -78
  62. package/principles/__tests__/direct-execution.test.ts +0 -187
  63. package/principles/__tests__/index.test.ts +0 -94
  64. package/principles/__tests__/issue-587-java-member-count.test.ts +0 -279
  65. package/principles/__tests__/issue-588-lsp-java-false-positives.test.ts +0 -213
  66. package/principles/__tests__/lint-baseline.test.ts +0 -314
  67. package/principles/__tests__/many-exports-reexport.test.ts +0 -40
  68. package/principles/__tests__/reporter.test.ts +0 -660
  69. package/principles/__tests__/types.test.ts +0 -103
  70. package/principles/__tests__/warnings-baseline-budgets.test.ts +0 -74
  71. package/principles/adapters/__tests__/base.test.ts +0 -95
  72. package/principles/adapters/__tests__/cpp-code-block.test.ts +0 -123
  73. package/principles/adapters/__tests__/cpp-scanner-equivalence.test.ts +0 -67
  74. package/principles/adapters/__tests__/cpp.test.ts +0 -290
  75. package/principles/adapters/__tests__/dart.test.ts +0 -84
  76. package/principles/adapters/__tests__/go.test.ts +0 -68
  77. package/principles/adapters/__tests__/java.test.ts +0 -385
  78. package/principles/adapters/__tests__/kotlin.test.ts +0 -76
  79. package/principles/adapters/__tests__/objectivec.test.ts +0 -453
  80. package/principles/adapters/__tests__/python.test.ts +0 -84
  81. package/principles/adapters/__tests__/swift.test.ts +0 -68
  82. package/principles/adapters/__tests__/typescript-block-comment-lines.test.ts +0 -53
  83. package/principles/adapters/__tests__/typescript-masking.test.ts +0 -96
  84. package/principles/adapters/__tests__/typescript.test.ts +0 -116
  85. package/principles/rules/__tests__/clean-code/code-duplication.test.ts +0 -85
  86. package/principles/rules/__tests__/clean-code/deep-nesting.test.ts +0 -73
  87. package/principles/rules/__tests__/clean-code/god-class.test.ts +0 -109
  88. package/principles/rules/__tests__/clean-code/large-file.test.ts +0 -73
  89. package/principles/rules/__tests__/clean-code/long-function.test.ts +0 -81
  90. package/principles/rules/__tests__/clean-code/magic-numbers.test.ts +0 -68
  91. package/principles/rules/__tests__/clean-code/many-exports.test.ts +0 -123
  92. package/principles/rules/__tests__/clean-code/missing-error-handling.test.ts +0 -171
  93. package/principles/rules/__tests__/clean-code/too-many-params.test.ts +0 -58
  94. package/principles/rules/__tests__/clean-code/unused-imports.test.ts +0 -107
  95. package/principles/rules/__tests__/index.test.ts +0 -49
  96. package/principles/rules/__tests__/solid/dip.test.ts +0 -119
  97. package/principles/rules/__tests__/solid/isp.test.ts +0 -58
  98. package/principles/rules/__tests__/solid/issue-588-lsp-base-contract.test.ts +0 -252
  99. package/principles/rules/__tests__/solid/lsp.test.ts +0 -186
  100. package/principles/rules/__tests__/solid/ocp.test.ts +0 -67
  101. package/principles/rules/__tests__/solid/srp.test.ts +0 -87
  102. package/principles/rules/arch/__tests__/dependency.test.ts +0 -180
  103. package/principles/rules/arch/__tests__/naming.test.ts +0 -133
  104. package/principles/rules/arch/__tests__/shared.test.ts +0 -113
@@ -1,314 +0,0 @@
1
- /**
2
- * @test REQ-152 Baseline-based lint checking
3
- * @intent Lint baseline engine: parse tool output, diff baselines, manage baseline lifecycle
4
- * @covers AC-152
5
- */
6
- import { describe, it, expect } from 'vitest';
7
- import {
8
- parseLintOutput,
9
- diffBaselines,
10
- formatBaselineSummary,
11
- computeLintDelta,
12
- } from '../lint-baseline';
13
-
14
- describe('parseLintOutput', () => {
15
- it('parses ESLint JSON output into BaselineEntry format', () => {
16
- const eslintJson = JSON.stringify([
17
- {
18
- filePath: '/project/src/app.ts',
19
- errorCount: 2,
20
- warningCount: 3,
21
- messages: [
22
- { ruleId: 'no-unused-vars', severity: 2 },
23
- { ruleId: 'no-console', severity: 1 },
24
- ],
25
- },
26
- {
27
- filePath: '/project/src/utils.ts',
28
- errorCount: 0,
29
- warningCount: 1,
30
- messages: [{ ruleId: 'no-var', severity: 1 }],
31
- },
32
- ]);
33
-
34
- const result = parseLintOutput('eslint', eslintJson, ['src/app.ts', 'src/utils.ts']);
35
-
36
- expect(result['src/app.ts']).toBeDefined();
37
- expect(result['src/app.ts'].eslint).toEqual({ warnings: 3, errors: 2 });
38
- expect(result['src/app.ts'].totalWarnings).toBe(3);
39
- expect(result['src/utils.ts'].eslint).toEqual({ warnings: 1, errors: 0 });
40
- expect(result['src/utils.ts'].totalWarnings).toBe(1);
41
- });
42
-
43
- it('parses ruff JSON output into BaselineEntry format', () => {
44
- const ruffJson = JSON.stringify([
45
- {
46
- file: 'src/app.py',
47
- noqa_count: 0,
48
- cells: [],
49
- messages: [
50
- { kind: 'E501', message: 'Line too long' },
51
- { kind: 'F401', message: 'Unused import' },
52
- ],
53
- },
54
- ]);
55
-
56
- const result = parseLintOutput('ruff', ruffJson, ['src/app.py']);
57
-
58
- expect(result['src/app.py']).toBeDefined();
59
- expect(result['src/app.py'].ruff).toEqual({ warnings: 2, errors: 0 });
60
- expect(result['src/app.py'].totalWarnings).toBe(2);
61
- });
62
-
63
- it('parses golangci-lint JSON output into BaselineEntry format', () => {
64
- const golangciJson = JSON.stringify({
65
- Issues: [
66
- { file: 'src/main.go', line: 10, severity: 'warning', text: 'unused variable' },
67
- { file: 'src/main.go', line: 20, severity: 'error', text: 'missing error check' },
68
- ],
69
- });
70
-
71
- const result = parseLintOutput('golangci', golangciJson, ['src/main.go']);
72
-
73
- expect(result['src/main.go']).toBeDefined();
74
- expect(result['src/main.go'].golangci).toEqual({ warnings: 1, errors: 1 });
75
- expect(result['src/main.go'].totalWarnings).toBe(1);
76
- });
77
-
78
- it('parses shellcheck JSON output into BaselineEntry format', () => {
79
- const shellcheckJson = JSON.stringify([
80
- {
81
- file: 'deploy.sh',
82
- line: 5,
83
- level: 'warning',
84
- message: 'Double quote to prevent globbing',
85
- },
86
- {
87
- file: 'deploy.sh',
88
- line: 12,
89
- level: 'error',
90
- message: 'Missing shebang',
91
- },
92
- ]);
93
-
94
- const result = parseLintOutput('shellcheck', shellcheckJson, ['deploy.sh']);
95
-
96
- expect(result['deploy.sh']).toBeDefined();
97
- expect(result['deploy.sh'].shellcheck).toEqual({ warnings: 1, errors: 1 });
98
- expect(result['deploy.sh'].totalWarnings).toBe(1);
99
- });
100
-
101
- it('returns empty baseline for empty tool output', () => {
102
- expect(parseLintOutput('eslint', '[]', ['a.ts'])).toEqual({});
103
- });
104
-
105
- it('ignores files not in the target file list', () => {
106
- const eslintJson = JSON.stringify([
107
- {
108
- filePath: '/project/src/ignored.ts',
109
- errorCount: 5,
110
- warningCount: 0,
111
- messages: [{ ruleId: 'no-console', severity: 2 }],
112
- },
113
- ]);
114
-
115
- const result = parseLintOutput('eslint', eslintJson, ['src/target.ts']);
116
- expect(result).toEqual({});
117
- });
118
- });
119
-
120
- describe('diffBaselines', () => {
121
- it('detects increased lint debt', () => {
122
- const oldBaseline = {
123
- 'src/app.ts': {
124
- eslint: { warnings: 2, errors: 0 },
125
- totalWarnings: 2,
126
- lastAnalyzed: '2026-01-01T00:00:00Z',
127
- },
128
- };
129
- const newBaseline = {
130
- 'src/app.ts': {
131
- eslint: { warnings: 5, errors: 1 },
132
- totalWarnings: 5,
133
- lastAnalyzed: '2026-06-01T00:00:00Z',
134
- },
135
- };
136
-
137
- const diff = diffBaselines(oldBaseline, newBaseline);
138
- expect(diff.totalWarningsDelta).toBe(3);
139
- expect(diff.filesIncreased).toHaveLength(1);
140
- expect(diff.filesIncreased[0].file).toBe('src/app.ts');
141
- expect(diff.filesIncreased[0].warningsDelta).toBe(3);
142
- expect(diff.filesDecreased).toHaveLength(0);
143
- expect(diff.filesUnchanged).toHaveLength(0);
144
- });
145
-
146
- it('detects decreased lint debt', () => {
147
- const oldBaseline = {
148
- 'src/app.ts': {
149
- eslint: { warnings: 5, errors: 0 },
150
- totalWarnings: 5,
151
- lastAnalyzed: '2026-01-01T00:00:00Z',
152
- },
153
- };
154
- const newBaseline = {
155
- 'src/app.ts': {
156
- eslint: { warnings: 2, errors: 0 },
157
- totalWarnings: 2,
158
- lastAnalyzed: '2026-06-01T00:00:00Z',
159
- },
160
- };
161
-
162
- const diff = diffBaselines(oldBaseline, newBaseline);
163
- expect(diff.totalWarningsDelta).toBe(-3);
164
- expect(diff.filesDecreased).toHaveLength(1);
165
- expect(diff.filesDecreased[0].warningsDelta).toBe(-3);
166
- });
167
-
168
- it('detects new files added to baseline', () => {
169
- const oldBaseline = {};
170
- const newBaseline = {
171
- 'src/new.ts': {
172
- eslint: { warnings: 1, errors: 0 },
173
- totalWarnings: 1,
174
- lastAnalyzed: '2026-06-01T00:00:00Z',
175
- },
176
- };
177
-
178
- const diff = diffBaselines(oldBaseline, newBaseline);
179
- expect(diff.filesAdded).toHaveLength(1);
180
- expect(diff.filesAdded[0].file).toBe('src/new.ts');
181
- });
182
-
183
- it('detects files removed from baseline (warnings cleared)', () => {
184
- const oldBaseline = {
185
- 'src/gone.ts': {
186
- eslint: { warnings: 3, errors: 0 },
187
- totalWarnings: 3,
188
- lastAnalyzed: '2026-01-01T00:00:00Z',
189
- },
190
- };
191
- const newBaseline = {};
192
-
193
- const diff = diffBaselines(oldBaseline, newBaseline);
194
- expect(diff.filesRemoved).toHaveLength(1);
195
- expect(diff.filesRemoved[0].file).toBe('src/gone.ts');
196
- });
197
-
198
- it('reports unchanged files correctly', () => {
199
- const baseline = {
200
- 'src/stable.ts': {
201
- eslint: { warnings: 2, errors: 0 },
202
- totalWarnings: 2,
203
- lastAnalyzed: '2026-01-01T00:00:00Z',
204
- },
205
- };
206
-
207
- const diff = diffBaselines(baseline, { ...baseline });
208
- expect(diff.filesUnchanged).toHaveLength(1);
209
- expect(diff.totalWarningsDelta).toBe(0);
210
- });
211
-
212
- it('computes diff across multiple lint tools', () => {
213
- const oldBaseline = {
214
- 'src/app.py': {
215
- ruff: { warnings: 5, errors: 2 },
216
- totalWarnings: 5,
217
- lastAnalyzed: '2026-01-01T00:00:00Z',
218
- },
219
- 'src/main.go': {
220
- golangci: { warnings: 3, errors: 0 },
221
- totalWarnings: 3,
222
- lastAnalyzed: '2026-01-01T00:00:00Z',
223
- },
224
- };
225
- const newBaseline = {
226
- 'src/app.py': {
227
- ruff: { warnings: 2, errors: 1 },
228
- totalWarnings: 2,
229
- lastAnalyzed: '2026-06-01T00:00:00Z',
230
- },
231
- 'src/main.go': {
232
- golangci: { warnings: 3, errors: 0 },
233
- totalWarnings: 3,
234
- lastAnalyzed: '2026-06-01T00:00:00Z',
235
- },
236
- };
237
-
238
- const diff = diffBaselines(oldBaseline, newBaseline);
239
- expect(diff.filesDecreased).toHaveLength(1);
240
- expect(diff.filesDecreased[0].file).toBe('src/app.py');
241
- expect(diff.filesUnchanged).toHaveLength(1);
242
- expect(diff.totalWarningsDelta).toBe(-3);
243
- });
244
- });
245
-
246
- describe('computeLintDelta', () => {
247
- it('returns BLOCK if new warnings > baseline warnings', () => {
248
- const baseline = { eslint: { warnings: 2, errors: 0 }, totalWarnings: 2, lastAnalyzed: '' };
249
- const current = { eslint: { warnings: 5, errors: 0 }, totalWarnings: 5, lastAnalyzed: '' };
250
- const result = computeLintDelta(baseline, current);
251
- expect(result.enforcement).toBe('BLOCK');
252
- expect(result.newWarnings).toBe(3);
253
- expect(result.newErrors).toBe(0);
254
- });
255
-
256
- it('returns PASS if current warnings <= baseline warnings', () => {
257
- const baseline = { eslint: { warnings: 5, errors: 1 }, totalWarnings: 5, lastAnalyzed: '' };
258
- const current = { eslint: { warnings: 3, errors: 0 }, totalWarnings: 3, lastAnalyzed: '' };
259
- const result = computeLintDelta(baseline, current);
260
- expect(result.enforcement).toBe('PASS');
261
- expect(result.newWarnings).toBe(0);
262
- expect(result.reduction).toBe(2);
263
- });
264
-
265
- it('returns PASS with reduction message when debt decreases', () => {
266
- const baseline = { eslint: { warnings: 10, errors: 0 }, totalWarnings: 10, lastAnalyzed: '' };
267
- const current = { eslint: { warnings: 4, errors: 0 }, totalWarnings: 4, lastAnalyzed: '' };
268
- const result = computeLintDelta(baseline, current);
269
- expect(result.enforcement).toBe('PASS');
270
- expect(result.reduction).toBe(6);
271
- });
272
-
273
- it('handles no baseline (first scan) - always PASS', () => {
274
- const current = { eslint: { warnings: 10, errors: 2 }, totalWarnings: 10, lastAnalyzed: '' };
275
- const result = computeLintDelta(null, current);
276
- expect(result.enforcement).toBe('PASS');
277
- expect(result.message).toContain('baseline created');
278
- });
279
-
280
- it('handles empty tool fields gracefully', () => {
281
- const baseline = { eslint: { warnings: 0, errors: 0 }, totalWarnings: 0, lastAnalyzed: '' };
282
- const current = { eslint: { warnings: 0, errors: 0 }, totalWarnings: 0, lastAnalyzed: '' };
283
- const result = computeLintDelta(baseline, current);
284
- expect(result.enforcement).toBe('PASS');
285
- });
286
- });
287
-
288
- describe('formatBaselineSummary', () => {
289
- it('returns summary string with file count and warning totals', () => {
290
- const baseline = {
291
- 'src/a.ts': {
292
- eslint: { warnings: 3, errors: 1 },
293
- totalWarnings: 3,
294
- lastAnalyzed: '2026-06-01T00:00:00Z',
295
- },
296
- 'src/b.py': {
297
- ruff: { warnings: 5, errors: 0 },
298
- totalWarnings: 5,
299
- lastAnalyzed: '2026-06-01T00:00:00Z',
300
- },
301
- };
302
-
303
- const summary = formatBaselineSummary(baseline);
304
- expect(summary).toContain('2');
305
- expect(summary).toContain('8');
306
- expect(summary).toContain('ESLint');
307
- expect(summary).toContain('Ruff');
308
- });
309
-
310
- it('returns empty message for empty baseline', () => {
311
- const summary = formatBaselineSummary({});
312
- expect(summary).toContain('No baseline');
313
- });
314
- });
@@ -1,40 +0,0 @@
1
- /**
2
- * @test REQ-CCLINT-001
3
- * @intent a pure re-export barrel (export { … } from './x') forwards names but
4
- * adds no module surface; counting each forwarded member inflates the
5
- * many-exports metric and blocks Boy-Scout splits that are exactly what
6
- * the rule asks for (common.ts → common-process.ts)
7
- * @covers AC-CCLINT-001-01
8
- */
9
- import { describe, it, expect, vi } from 'vitest';
10
- import { readFileSync } from 'fs';
11
- import { TypeScriptAdapter } from '../adapters/typescript';
12
-
13
- vi.mock('fs', () => ({ readFileSync: vi.fn() }));
14
-
15
- function exportCount(content: string): number {
16
- (readFileSync as ReturnType<typeof vi.fn>).mockReturnValue(content);
17
- return new TypeScriptAdapter('t.ts').extractExports().length;
18
- }
19
-
20
- describe('extractExports counts module surface, not forwarded names', () => {
21
- it('does not count members of an export-from re-export block', () => {
22
- const content = [
23
- "export {",
24
- ' type ToolAvailability,',
25
- ' isToolAvailable,',
26
- ' runTool,',
27
- " getChangedFiles,",
28
- "} from './common-process';",
29
- 'export function local(): void {}',
30
- '',
31
- ].join('\n');
32
- // One local export only — the six forwarded names are not this module's surface.
33
- expect(exportCount(content)).toBe(1);
34
- });
35
-
36
- it('still counts local export { A, B } blocks without a from clause', () => {
37
- const content = ['export { alpha, beta };', 'const alpha = 1;', 'const beta = 2;', ''].join('\n');
38
- expect(exportCount(content)).toBe(2);
39
- });
40
- });