@boyingliu01/xp-gate 0.15.5 → 0.18.1
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/adapter-common.sh +0 -0
- package/adapters/cpp.sh +0 -0
- package/adapters/dart.sh +0 -0
- package/adapters/flutter.sh +0 -0
- package/adapters/go.sh +0 -0
- package/adapters/iac.sh +0 -0
- package/adapters/java.sh +0 -0
- package/adapters/kotlin.sh +0 -0
- package/adapters/objectivec.sh +0 -0
- package/adapters/plugins/book299-20132-python/scripts/install-gradle.sh +0 -0
- package/adapters/plugins/book299-20132-python/scripts/install-maven.sh +0 -0
- package/adapters/plugins/book299-4081-c/scripts/install-gradle.sh +0 -0
- package/adapters/plugins/book299-4081-c/scripts/install-maven.sh +0 -0
- package/adapters/plugins/book299-4083-javascriptes5/scripts/install-gradle.sh +0 -0
- package/adapters/plugins/book299-4083-javascriptes5/scripts/install-maven.sh +0 -0
- package/adapters/powershell.sh +0 -0
- package/adapters/python.sh +0 -0
- package/adapters/shell.sh +0 -0
- package/adapters/swift.sh +0 -0
- package/adapters/typescript.sh +0 -0
- package/bin/xp-gate.js +29 -1
- package/gate-3.sh +0 -0
- package/gate-4.sh +0 -0
- package/gate-7.sh +0 -0
- package/gate-8.sh +0 -0
- package/gate-9.sh +0 -0
- package/hooks/adapter-common.sh +0 -0
- package/hooks/gate-3.sh +0 -0
- package/hooks/gate-4.sh +0 -0
- package/hooks/gate-7.sh +0 -0
- package/hooks/gate-8.sh +0 -0
- package/hooks/gate-9.sh +0 -0
- package/hooks/lib/now-ms.sh +33 -0
- package/hooks/pre-commit +63 -47
- package/hooks/pre-push +0 -0
- package/hooks/sprint-gate.sh +291 -0
- package/lib/__tests__/check-version.test.js +122 -0
- package/lib/__tests__/doctor.test.js +13 -15
- package/lib/__tests__/gate-audit.test.ts +38 -0
- package/lib/__tests__/phase-transition.test.js +512 -272
- package/lib/__tests__/retro.test.js +131 -0
- package/lib/__tests__/sprint-audit.test.js +207 -207
- package/lib/__tests__/sprint-status-rework.test.js +184 -0
- package/lib/check-version.js +9 -0
- package/lib/doctor-tui.js +268 -198
- package/lib/doctor.js +15 -3
- package/lib/gate-audit.ts +18 -7
- package/lib/gate-runner.js +77 -30
- package/lib/init.js +10 -0
- package/lib/language-tools.js +833 -833
- package/lib/mattpocock-license-verdict.json +7 -0
- package/lib/phase-transition.js +499 -249
- package/lib/retro.js +222 -0
- package/lib/shared-utils.js +7 -0
- package/lib/sprint-audit.js +235 -235
- package/lib/sprint-init.js +207 -0
- package/lib/sprint-state-migrator.js +1 -0
- package/lib/sprint-status.js +111 -0
- package/mock-policy/AGENTS.md +3 -3
- package/mutation/AGENTS.md +3 -3
- package/package.json +3 -2
- package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/bin/delphi-review-guard.sh +0 -0
- package/plugins/claude-code/bin/xp-gate-check +0 -0
- package/plugins/claude-code/skills/batch-grill-me/SKILL.md +15 -0
- package/plugins/claude-code/skills/delphi-review/AGENTS.md +3 -3
- package/plugins/claude-code/skills/delphi-review/SKILL.md +59 -4
- package/plugins/claude-code/skills/delphi-review/references/requirements.md +390 -0
- package/plugins/claude-code/skills/delphi-review/references/round-templates.md +67 -0
- package/plugins/claude-code/skills/domain-modeling/ADR-FORMAT.md +64 -0
- package/plugins/claude-code/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/plugins/claude-code/skills/domain-modeling/SKILL.md +74 -0
- package/plugins/claude-code/skills/grill-with-docs/SKILL.md +7 -0
- package/plugins/claude-code/skills/grilling/SKILL.md +12 -0
- package/plugins/claude-code/skills/sprint-flow/AGENTS.md +3 -3
- package/plugins/claude-code/skills/sprint-flow/SKILL.md +168 -43
- package/plugins/claude-code/skills/sprint-flow/references/components/memory.md +1 -1
- package/plugins/claude-code/skills/sprint-flow/references/components/middleware.md +1 -1
- package/plugins/claude-code/skills/sprint-flow/references/components/skill-invocations.md +21 -20
- package/plugins/claude-code/skills/sprint-flow/references/components/tool-descriptions.md +22 -23
- package/plugins/claude-code/skills/sprint-flow/references/orchestration-rules.md +14 -12
- package/plugins/claude-code/skills/sprint-flow/references/phase-2-design.md +145 -133
- package/plugins/claude-code/skills/sprint-flow/references/phase-3-build.md +69 -2
- package/plugins/claude-code/skills/sprint-flow/references/phase-4-verify.md +93 -31
- package/plugins/claude-code/skills/sprint-flow/references/phase-5-ship.md +99 -14
- package/plugins/claude-code/skills/sprint-flow/references/phase-6-close.md +37 -5
- package/plugins/claude-code/skills/sprint-flow/references/phase-overview.md +58 -53
- package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +3 -3
- package/plugins/claude-code/skills/test-specification-alignment/SKILL.md +8 -3
- package/plugins/claude-code/skills/to-issues/SKILL.md +1 -1
- package/plugins/opencode/index.ts +1 -0
- package/plugins/opencode/package.json +1 -1
- package/plugins/opencode/skills/batch-grill-me/SKILL.md +15 -0
- package/plugins/opencode/skills/delphi-review/AGENTS.md +3 -3
- package/plugins/opencode/skills/delphi-review/SKILL.md +59 -4
- package/plugins/opencode/skills/delphi-review/references/requirements.md +390 -0
- package/plugins/opencode/skills/delphi-review/references/round-templates.md +67 -0
- package/plugins/opencode/skills/domain-modeling/ADR-FORMAT.md +64 -0
- package/plugins/opencode/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/plugins/opencode/skills/domain-modeling/SKILL.md +74 -0
- package/plugins/opencode/skills/grill-with-docs/SKILL.md +7 -0
- package/plugins/opencode/skills/grilling/SKILL.md +12 -0
- package/plugins/opencode/skills/sprint-flow/AGENTS.md +3 -3
- package/plugins/opencode/skills/sprint-flow/SKILL.md +168 -43
- package/plugins/opencode/skills/sprint-flow/references/components/memory.md +1 -1
- package/plugins/opencode/skills/sprint-flow/references/components/middleware.md +1 -1
- package/plugins/opencode/skills/sprint-flow/references/components/skill-invocations.md +21 -20
- package/plugins/opencode/skills/sprint-flow/references/components/tool-descriptions.md +22 -23
- package/plugins/opencode/skills/sprint-flow/references/orchestration-rules.md +14 -12
- package/plugins/opencode/skills/sprint-flow/references/phase-2-design.md +145 -133
- package/plugins/opencode/skills/sprint-flow/references/phase-3-build.md +69 -2
- package/plugins/opencode/skills/sprint-flow/references/phase-4-verify.md +93 -31
- package/plugins/opencode/skills/sprint-flow/references/phase-5-ship.md +99 -14
- package/plugins/opencode/skills/sprint-flow/references/phase-6-close.md +37 -5
- package/plugins/opencode/skills/sprint-flow/references/phase-overview.md +58 -53
- package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +3 -3
- package/plugins/opencode/skills/test-specification-alignment/SKILL.md +8 -3
- package/plugins/opencode/skills/to-issues/SKILL.md +1 -1
- package/plugins/qoder/agents/delphi-architecture.md +48 -48
- package/plugins/qoder/agents/delphi-feasibility.md +48 -48
- package/plugins/qoder/agents/delphi-technical.md +48 -48
- package/plugins/qoder/bin/sprint-flow-guard.sh +0 -0
- package/plugins/qoder/bin/xp-gate-check +0 -0
- 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/scripts/__tests__/check-mattpocock-license.test.js +229 -0
- package/scripts/__tests__/sync-package-content.test.js +50 -0
- package/scripts/check-mattpocock-license.cjs +302 -0
- package/scripts/delphi-external-review.cjs +432 -432
- package/scripts/migrate-audit-anomalies.mjs +78 -0
- package/scripts/sync-package-content.js +52 -5
- package/skills/batch-grill-me/SKILL.md +15 -0
- package/skills/delphi-review/AGENTS.md +3 -3
- package/skills/delphi-review/SKILL.md +59 -4
- package/skills/delphi-review/references/requirements.md +390 -0
- package/skills/delphi-review/references/round-templates.md +67 -0
- package/skills/domain-modeling/ADR-FORMAT.md +64 -0
- package/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/skills/domain-modeling/SKILL.md +74 -0
- package/skills/grill-with-docs/SKILL.md +7 -0
- package/skills/grilling/SKILL.md +12 -0
- package/skills/sprint-flow/AGENTS.md +3 -3
- package/skills/sprint-flow/SKILL.md +168 -43
- package/skills/sprint-flow/references/components/memory.md +1 -1
- package/skills/sprint-flow/references/components/middleware.md +1 -1
- package/skills/sprint-flow/references/components/skill-invocations.md +21 -20
- package/skills/sprint-flow/references/components/tool-descriptions.md +22 -23
- package/skills/sprint-flow/references/orchestration-rules.md +14 -12
- package/skills/sprint-flow/references/phase-2-design.md +145 -133
- package/skills/sprint-flow/references/phase-3-build.md +69 -2
- package/skills/sprint-flow/references/phase-4-verify.md +93 -31
- package/skills/sprint-flow/references/phase-5-ship.md +99 -14
- package/skills/sprint-flow/references/phase-6-close.md +37 -5
- package/skills/sprint-flow/references/phase-overview.md +58 -53
- package/skills/test-specification-alignment/AGENTS.md +3 -3
- package/skills/test-specification-alignment/SKILL.md +8 -3
- package/skills/to-issues/SKILL.md +1 -1
- package/adapters/gate-3.sh +0 -68
- package/adapters/gate-4.sh +0 -80
- package/adapters/gate-7.sh +0 -45
- package/adapters/gate-8.sh +0 -56
- package/adapters/gate-9.sh +0 -104
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TDD: written RED first (Phase G per design §12)
|
|
3
|
+
* @test REQ-REWORK-001 Sprint rework rate tracking (#369)
|
|
4
|
+
* @intent Validate xp-gate sprint-status --rework-check computes rework rate for closed sprints
|
|
5
|
+
*/
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const os = require('os');
|
|
9
|
+
const { execSync } = require('child_process');
|
|
10
|
+
|
|
11
|
+
const { handleSprintStatus } = require('../sprint-status');
|
|
12
|
+
|
|
13
|
+
let TMP_DIR;
|
|
14
|
+
let cwdSpy;
|
|
15
|
+
|
|
16
|
+
function git(cmd, dir) {
|
|
17
|
+
return execSync(`git ${cmd}`, { cwd: dir || TMP_DIR, encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function writeSprintState(state, dir) {
|
|
21
|
+
const sd = path.join(dir || TMP_DIR, '.sprint-state');
|
|
22
|
+
fs.mkdirSync(sd, { recursive: true });
|
|
23
|
+
fs.writeFileSync(path.join(sd, 'sprint-state.json'), JSON.stringify(state, null, 2));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function writeHistoryFile(name, state, dir) {
|
|
27
|
+
const hd = path.join(dir || TMP_DIR, '.sprint-state', 'sprint-history');
|
|
28
|
+
fs.mkdirSync(hd, { recursive: true });
|
|
29
|
+
fs.writeFileSync(path.join(hd, name), JSON.stringify(state, null, 2));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function makeCommit(msg, dir) {
|
|
33
|
+
const d = dir || TMP_DIR;
|
|
34
|
+
fs.appendFileSync(path.join(d, 'file.txt'), `${msg}-${Date.now()}\n`);
|
|
35
|
+
git('add -A', d);
|
|
36
|
+
git(`commit --no-verify -m "${msg}"`, d);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function daysAgo(n) {
|
|
40
|
+
return new Date(Date.now() - n * 86400000).toISOString();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
beforeAll(() => {
|
|
44
|
+
TMP_DIR = fs.mkdtempSync(path.join(os.tmpdir(), 'rework-test-'));
|
|
45
|
+
cwdSpy = vi.spyOn(process, 'cwd');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
beforeEach(() => {
|
|
49
|
+
cwdSpy.mockReturnValue(TMP_DIR);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
afterAll(() => {
|
|
53
|
+
cwdSpy.mockRestore();
|
|
54
|
+
fs.rmSync(TMP_DIR, { recursive: true, force: true });
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
describe('sprint-status --rework-check (#369)', () => {
|
|
58
|
+
// TDD: written RED first (G phase per design §12)
|
|
59
|
+
test('(a) no closed sprints → exit 0 + graceful message', async () => {
|
|
60
|
+
writeSprintState({
|
|
61
|
+
_schema_version: 1,
|
|
62
|
+
id: 'sprint-open',
|
|
63
|
+
task_description: 'Open sprint',
|
|
64
|
+
phase: 3,
|
|
65
|
+
status: 'in_progress',
|
|
66
|
+
started_at: daysAgo(1),
|
|
67
|
+
isolation: { worktree_path: null, branch: 'main' },
|
|
68
|
+
phase_history: [],
|
|
69
|
+
metrics: {},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
73
|
+
const code = await handleSprintStatus(['--rework-check', '--window-days', '7', '--dir', TMP_DIR]);
|
|
74
|
+
const output = logSpy.mock.calls.map(c => c.join(' ')).join('\n');
|
|
75
|
+
logSpy.mockRestore();
|
|
76
|
+
|
|
77
|
+
expect(code).toBe(0);
|
|
78
|
+
expect(output).toContain('No closed sprints within');
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// TDD: written RED first (G phase per design §12)
|
|
82
|
+
test('(b) 2 fix / 10 total → rework_rate 0.2, no alert, state file updated', async () => {
|
|
83
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'rework-b-'));
|
|
84
|
+
cwdSpy.mockReturnValue(dir);
|
|
85
|
+
|
|
86
|
+
git('init', dir);
|
|
87
|
+
git('config user.email "test@test.com"', dir);
|
|
88
|
+
git('config user.name "Test"', dir);
|
|
89
|
+
makeCommit('feat: initial', dir);
|
|
90
|
+
makeCommit('fix: resolve login bug', dir);
|
|
91
|
+
makeCommit('fix(auth): handle timeout', dir);
|
|
92
|
+
|
|
93
|
+
writeSprintState({
|
|
94
|
+
_schema_version: 1,
|
|
95
|
+
id: 'sprint-b',
|
|
96
|
+
task_description: 'Sprint B',
|
|
97
|
+
phase: 6,
|
|
98
|
+
status: 'completed',
|
|
99
|
+
started_at: daysAgo(9),
|
|
100
|
+
isolation: { worktree_path: null, branch: 'main' },
|
|
101
|
+
phase_history: [],
|
|
102
|
+
metrics: { completed_at: daysAgo(2), total_sprint_commits: 10 },
|
|
103
|
+
}, dir);
|
|
104
|
+
|
|
105
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
106
|
+
const code = await handleSprintStatus(['--rework-check', '--window-days', '7', '--dir', dir]);
|
|
107
|
+
const output = logSpy.mock.calls.map(c => c.join(' ')).join('\n');
|
|
108
|
+
logSpy.mockRestore();
|
|
109
|
+
|
|
110
|
+
expect(code).toBe(0);
|
|
111
|
+
expect(output).toContain('20.0%');
|
|
112
|
+
expect(output).not.toContain('⚠️');
|
|
113
|
+
|
|
114
|
+
const updated = JSON.parse(
|
|
115
|
+
fs.readFileSync(path.join(dir, '.sprint-state', 'sprint-state.json'), 'utf8')
|
|
116
|
+
);
|
|
117
|
+
expect(updated.metrics.rework_rate).toBeCloseTo(0.2, 1);
|
|
118
|
+
|
|
119
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// TDD: written RED first (G phase per design §12)
|
|
123
|
+
test('(c) 5 fix / 10 total → rework_rate 0.5, alert printed', async () => {
|
|
124
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'rework-c-'));
|
|
125
|
+
cwdSpy.mockReturnValue(dir);
|
|
126
|
+
|
|
127
|
+
git('init', dir);
|
|
128
|
+
git('config user.email "test@test.com"', dir);
|
|
129
|
+
git('config user.name "Test"', dir);
|
|
130
|
+
makeCommit('fix: one', dir);
|
|
131
|
+
makeCommit('fix: two', dir);
|
|
132
|
+
makeCommit('bugfix: three', dir);
|
|
133
|
+
makeCommit('hotfix: four', dir);
|
|
134
|
+
makeCommit('patch: five', dir);
|
|
135
|
+
makeCommit('feat: six', dir);
|
|
136
|
+
|
|
137
|
+
writeSprintState({
|
|
138
|
+
_schema_version: 1,
|
|
139
|
+
id: 'sprint-c',
|
|
140
|
+
task_description: 'Sprint C',
|
|
141
|
+
phase: 6,
|
|
142
|
+
status: 'completed',
|
|
143
|
+
started_at: daysAgo(9),
|
|
144
|
+
isolation: { worktree_path: null, branch: 'main' },
|
|
145
|
+
phase_history: [],
|
|
146
|
+
metrics: { completed_at: daysAgo(2), total_sprint_commits: 10 },
|
|
147
|
+
}, dir);
|
|
148
|
+
|
|
149
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
150
|
+
const code = await handleSprintStatus(['--rework-check', '--window-days', '7', '--dir', dir]);
|
|
151
|
+
const output = logSpy.mock.calls.map(c => c.join(' ')).join('\n');
|
|
152
|
+
logSpy.mockRestore();
|
|
153
|
+
|
|
154
|
+
expect(code).toBe(0);
|
|
155
|
+
expect(output).toContain('50.0%');
|
|
156
|
+
expect(output).toContain('⚠️');
|
|
157
|
+
expect(output).toContain('sprint-c');
|
|
158
|
+
|
|
159
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// TDD: written RED first (G phase per design §12)
|
|
163
|
+
test('(d) --window-days 1 filters out sprints closed >1 day ago', async () => {
|
|
164
|
+
writeHistoryFile('sprint-old.json', {
|
|
165
|
+
_schema_version: 1,
|
|
166
|
+
id: 'sprint-old',
|
|
167
|
+
task_description: 'Old sprint',
|
|
168
|
+
phase: 6,
|
|
169
|
+
status: 'completed',
|
|
170
|
+
started_at: daysAgo(20),
|
|
171
|
+
isolation: { worktree_path: null, branch: 'main' },
|
|
172
|
+
phase_history: [],
|
|
173
|
+
metrics: { completed_at: daysAgo(10), total_sprint_commits: 10 },
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
177
|
+
const code = await handleSprintStatus(['--rework-check', '--window-days', '1', '--dir', TMP_DIR]);
|
|
178
|
+
const output = logSpy.mock.calls.map(c => c.join(' ')).join('\n');
|
|
179
|
+
logSpy.mockRestore();
|
|
180
|
+
|
|
181
|
+
expect(code).toBe(0);
|
|
182
|
+
expect(output).toContain('No closed sprints within 1 day');
|
|
183
|
+
});
|
|
184
|
+
});
|
package/lib/check-version.js
CHANGED
|
@@ -89,6 +89,15 @@ function readCache() {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
function writeCache(latest, publishedAt) {
|
|
92
|
+
// Validate version before writing — prevent corrupted/non-semver values
|
|
93
|
+
// from persisting in version-cache.json (e.g. undefined, empty string, placeholders).
|
|
94
|
+
// Uses 3-digit semver: MAJOR.MINOR.PATCH with optional pre-release tag.
|
|
95
|
+
const semverRegex = /^\d+\.\d+\.\d+(-[\w.]+)?$/;
|
|
96
|
+
if (typeof latest !== 'string' || !semverRegex.test(latest)) {
|
|
97
|
+
console.warn(`[version-cache] Invalid version "${latest}" — not writing to cache`);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
92
101
|
const cp = cachePath();
|
|
93
102
|
if (!cp) return;
|
|
94
103
|
ensureDir(path.dirname(cp));
|