@dtlabs/ai-toolkit 0.10.0 → 0.10.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/CHANGELOG.md +8 -0
- package/bin/cli.js +16 -0
- package/package.json +7 -2
- package/.claude/.ai-toolkit-version +0 -1
- package/.claude/scripts/tests/fixtures/ac-table-format.md +0 -48
- package/.claude/scripts/tests/fixtures/test-feature/TEST-001-Work-Breakdown.json +0 -234
- package/.claude/scripts/tests/fixtures/test-feature/TEST-001-semantic-output.json +0 -4
- package/.claude/scripts/tests/fixtures/test-feature/feature.md +0 -45
- package/.claude/scripts/tests/fixtures/wb-invalid-bad-domain.json +0 -39
- package/.claude/scripts/tests/fixtures/wb-invalid-cycle.json +0 -61
- package/.claude/scripts/tests/fixtures/wb-invalid-duplicate-id.json +0 -72
- package/.claude/scripts/tests/fixtures/wb-invalid-missing-field.json +0 -38
- package/.claude/scripts/tests/fixtures/wb-valid.json +0 -189
- package/.claude/scripts/tests/helpers/buildWaves.js +0 -21
- package/.claude/scripts/tests/helpers/pm-phase2-flow.js +0 -29
- package/.claude/scripts/tests/helpers/pm-phase2-gate2.js +0 -55
- package/.claude/scripts/tests/helpers/pm-phase2-ledger.js +0 -108
- package/.claude/scripts/tests/installer.scripts-distribution.test.js +0 -131
- package/.claude/scripts/tests/pm-phase2.gate2-payload.test.js +0 -353
- package/.claude/scripts/tests/pm-phase2.ledger-transitions.test.js +0 -346
- package/.claude/scripts/tests/pm-phase2.orchestration-flow.test.js +0 -276
- package/.claude/scripts/tests/verify-us-01-t03.js +0 -288
- package/.claude/scripts/tests/verify-us-03-t04.js +0 -262
- package/.claude/scripts/tests/wb-render.checks-md-csv-deps.test.js +0 -337
- package/.claude/scripts/tests/wb-render.checks-sanitize-commit-paths.test.js +0 -352
- package/.claude/scripts/tests/wb-render.regression-pm-phase3-csv.test.js +0 -219
- package/.claude/scripts/tests/wb-validate.checks-1-7.test.js +0 -330
- package/.claude/scripts/tests/wb-validate.checks-11.test.js +0 -166
- package/.claude/scripts/tests/wb-validate.checks-12-14.test.js +0 -222
- package/.claude/scripts/tests/wb-validate.checks-15-18.test.js +0 -359
- package/.claude/scripts/tests/wb-validate.checks-19-21.test.js +0 -362
- package/.claude/scripts/tests/wb-validate.checks-22-23-report.test.js +0 -297
- package/.claude/scripts/tests/wb-validate.checks-8-10.test.js +0 -243
- package/.claude/settings.json +0 -5
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const { spawnSync } = require('child_process');
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
const os = require('os');
|
|
6
|
-
const path = require('path');
|
|
7
|
-
|
|
8
|
-
const VALIDATE = path.resolve(__dirname, '../wb-validate.js');
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Run wb-validate.js as a subprocess and return exit code, parsed JSON report,
|
|
12
|
-
* and stderr. No requirements path is needed for checks 8–10.
|
|
13
|
-
*/
|
|
14
|
-
function runValidator(wbPath) {
|
|
15
|
-
const result = spawnSync('node', [VALIDATE, wbPath], { encoding: 'utf8' });
|
|
16
|
-
let report = null;
|
|
17
|
-
try { report = JSON.parse(result.stdout); } catch (_) {}
|
|
18
|
-
return { exitCode: result.status, report, stderr: result.stderr };
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// ── Shared temp-file lifecycle ────────────────────────────────────────────────
|
|
22
|
-
|
|
23
|
-
let tmpFile;
|
|
24
|
-
|
|
25
|
-
beforeEach(() => {
|
|
26
|
-
tmpFile = path.join(os.tmpdir(), `wb-t16-${Date.now()}.json`);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
afterEach(() => {
|
|
30
|
-
try { fs.unlinkSync(tmpFile); } catch (_) {}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
function writeFixture(obj) {
|
|
34
|
-
fs.writeFileSync(tmpFile, JSON.stringify(obj, null, 2));
|
|
35
|
-
return tmpFile;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// ── Domain builders ───────────────────────────────────────────────────────────
|
|
39
|
-
|
|
40
|
-
function makeTask(id, dependsOn = []) {
|
|
41
|
-
return {
|
|
42
|
-
id,
|
|
43
|
-
title: `Task ${id}`,
|
|
44
|
-
outcome: 'Something done',
|
|
45
|
-
domain: 'BE',
|
|
46
|
-
agentType: 'developer-backend',
|
|
47
|
-
dependsOn,
|
|
48
|
-
acceptanceCriteria: [],
|
|
49
|
-
verification: { commands: ['node --version'] },
|
|
50
|
-
estimate: { agentMinutes: 10, tokens: 5000 },
|
|
51
|
-
outputCount: 1,
|
|
52
|
-
groupingRationale: 'Single responsibility',
|
|
53
|
-
commit: { subject: `feat: ${id}` },
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function makePhase(id, tasks, type = 'user-story') {
|
|
58
|
-
return { id, type, title: `Phase ${id}`, commit: `feat(${id}): done`, tasks };
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function makeWB(phases) {
|
|
62
|
-
return { schemaVersion: 2, phases };
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
66
|
-
|
|
67
|
-
describe('wb-validate.js — checks 8–10', () => {
|
|
68
|
-
|
|
69
|
-
// ── Check 8: dependency reference existence ────────────────────────────────
|
|
70
|
-
|
|
71
|
-
describe('check 8 — dependency reference existence', () => {
|
|
72
|
-
|
|
73
|
-
test('exits 1 and reports dependency_not_found for the referencing task when dependsOn contains a non-existent task ID', () => {
|
|
74
|
-
// Arrange: task depends on US-01-TASK-BE-99 which is not declared anywhere
|
|
75
|
-
const wb = makeWB([
|
|
76
|
-
makePhase('US-01', [
|
|
77
|
-
makeTask('US-01-TASK-BE-01', ['US-01-TASK-BE-99']),
|
|
78
|
-
]),
|
|
79
|
-
]);
|
|
80
|
-
writeFixture(wb);
|
|
81
|
-
|
|
82
|
-
// Act
|
|
83
|
-
const { exitCode, report } = runValidator(tmpFile);
|
|
84
|
-
|
|
85
|
-
// Assert
|
|
86
|
-
expect(exitCode).toBe(1);
|
|
87
|
-
expect(report.valid).toBe(false);
|
|
88
|
-
const err = report.errors.find(e => e.category === 'dependency_not_found');
|
|
89
|
-
expect(err).toBeDefined();
|
|
90
|
-
expect(err.taskId).toBe('US-01-TASK-BE-01');
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
test('exits 0 and reports no dependency_not_found errors when all dependsOn IDs resolve to declared tasks', () => {
|
|
94
|
-
// Arrange: two tasks in the same phase; second depends on first
|
|
95
|
-
const wb = makeWB([
|
|
96
|
-
makePhase('US-01', [
|
|
97
|
-
makeTask('US-01-TASK-BE-01'),
|
|
98
|
-
makeTask('US-01-TASK-BE-02', ['US-01-TASK-BE-01']),
|
|
99
|
-
]),
|
|
100
|
-
]);
|
|
101
|
-
writeFixture(wb);
|
|
102
|
-
|
|
103
|
-
// Act
|
|
104
|
-
const { exitCode, report } = runValidator(tmpFile);
|
|
105
|
-
|
|
106
|
-
// Assert
|
|
107
|
-
expect(exitCode).toBe(0);
|
|
108
|
-
expect(report.valid).toBe(true);
|
|
109
|
-
expect(report.errors.filter(e => e.category === 'dependency_not_found')).toHaveLength(0);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
test('exits 0 and reports no dependency_not_found errors when a US task depends on an INFRA task from a preceding phase', () => {
|
|
113
|
-
// Arrange: INFRA phase declared first; US-01 task resolves its dep cross-phase
|
|
114
|
-
const wb = makeWB([
|
|
115
|
-
makePhase('INFRA', [makeTask('INFRA-TASK-BE-01')], 'infra'),
|
|
116
|
-
makePhase('US-01', [makeTask('US-01-TASK-BE-01', ['INFRA-TASK-BE-01'])]),
|
|
117
|
-
]);
|
|
118
|
-
writeFixture(wb);
|
|
119
|
-
|
|
120
|
-
// Act
|
|
121
|
-
const { exitCode, report } = runValidator(tmpFile);
|
|
122
|
-
|
|
123
|
-
// Assert
|
|
124
|
-
expect(exitCode).toBe(0);
|
|
125
|
-
expect(report.valid).toBe(true);
|
|
126
|
-
expect(report.errors.filter(e => e.category === 'dependency_not_found')).toHaveLength(0);
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
// ── Check 9: self-dependency ───────────────────────────────────────────────
|
|
131
|
-
|
|
132
|
-
describe('check 9 — self-dependency', () => {
|
|
133
|
-
|
|
134
|
-
test('exits 1 and reports self_dependency for the task that lists its own ID in dependsOn', () => {
|
|
135
|
-
// Arrange: task references itself as a dependency
|
|
136
|
-
const wb = makeWB([
|
|
137
|
-
makePhase('US-01', [
|
|
138
|
-
makeTask('US-01-TASK-BE-01', ['US-01-TASK-BE-01']),
|
|
139
|
-
]),
|
|
140
|
-
]);
|
|
141
|
-
writeFixture(wb);
|
|
142
|
-
|
|
143
|
-
// Act
|
|
144
|
-
const { exitCode, report } = runValidator(tmpFile);
|
|
145
|
-
|
|
146
|
-
// Assert
|
|
147
|
-
expect(exitCode).toBe(1);
|
|
148
|
-
expect(report.valid).toBe(false);
|
|
149
|
-
const err = report.errors.find(e => e.category === 'self_dependency');
|
|
150
|
-
expect(err).toBeDefined();
|
|
151
|
-
expect(err.taskId).toBe('US-01-TASK-BE-01');
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
test('exits 0 and reports no self_dependency errors when no task lists its own ID in dependsOn', () => {
|
|
155
|
-
// Arrange: simple valid WB with no self-references
|
|
156
|
-
const wb = makeWB([
|
|
157
|
-
makePhase('US-01', [makeTask('US-01-TASK-BE-01')]),
|
|
158
|
-
]);
|
|
159
|
-
writeFixture(wb);
|
|
160
|
-
|
|
161
|
-
// Act
|
|
162
|
-
const { exitCode, report } = runValidator(tmpFile);
|
|
163
|
-
|
|
164
|
-
// Assert
|
|
165
|
-
expect(exitCode).toBe(0);
|
|
166
|
-
expect(report.valid).toBe(true);
|
|
167
|
-
expect(report.errors.filter(e => e.category === 'self_dependency')).toHaveLength(0);
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
// ── Check 10: phase ID / task ID prefix consistency ────────────────────────
|
|
172
|
-
|
|
173
|
-
describe('check 10 — phase ID / task ID prefix consistency', () => {
|
|
174
|
-
|
|
175
|
-
test('exits 1 and reports phase_id_mismatch when an INFRA-prefixed task ID appears in a non-INFRA phase', () => {
|
|
176
|
-
// Arrange: task ID starts with INFRA-TASK- but is placed in US-01
|
|
177
|
-
const wb = makeWB([
|
|
178
|
-
makePhase('US-01', [
|
|
179
|
-
makeTask('INFRA-TASK-BE-01'),
|
|
180
|
-
]),
|
|
181
|
-
]);
|
|
182
|
-
writeFixture(wb);
|
|
183
|
-
|
|
184
|
-
// Act
|
|
185
|
-
const { exitCode, report } = runValidator(tmpFile);
|
|
186
|
-
|
|
187
|
-
// Assert
|
|
188
|
-
expect(exitCode).toBe(1);
|
|
189
|
-
expect(report.valid).toBe(false);
|
|
190
|
-
expect(report.errors.some(e => e.category === 'phase_id_mismatch')).toBe(true);
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
test('exits 1 and reports phase_id_mismatch when a task ID carries a US-prefix that does not match its containing phase', () => {
|
|
194
|
-
// Arrange: task prefixed US-02 but placed in phase US-01
|
|
195
|
-
const wb = makeWB([
|
|
196
|
-
makePhase('US-01', [
|
|
197
|
-
makeTask('US-02-TASK-BE-01'),
|
|
198
|
-
]),
|
|
199
|
-
]);
|
|
200
|
-
writeFixture(wb);
|
|
201
|
-
|
|
202
|
-
// Act
|
|
203
|
-
const { exitCode, report } = runValidator(tmpFile);
|
|
204
|
-
|
|
205
|
-
// Assert
|
|
206
|
-
expect(exitCode).toBe(1);
|
|
207
|
-
expect(report.valid).toBe(false);
|
|
208
|
-
expect(report.errors.some(e => e.category === 'phase_id_mismatch')).toBe(true);
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
test('exits 0 and reports no phase_id_mismatch errors when a US task ID prefix exactly matches its phase ID', () => {
|
|
212
|
-
// Arrange: prefix US-01 matches phase US-01
|
|
213
|
-
const wb = makeWB([
|
|
214
|
-
makePhase('US-01', [makeTask('US-01-TASK-BE-01')]),
|
|
215
|
-
]);
|
|
216
|
-
writeFixture(wb);
|
|
217
|
-
|
|
218
|
-
// Act
|
|
219
|
-
const { exitCode, report } = runValidator(tmpFile);
|
|
220
|
-
|
|
221
|
-
// Assert
|
|
222
|
-
expect(exitCode).toBe(0);
|
|
223
|
-
expect(report.valid).toBe(true);
|
|
224
|
-
expect(report.errors.filter(e => e.category === 'phase_id_mismatch')).toHaveLength(0);
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
test('exits 0 and reports no phase_id_mismatch errors when an INFRA-prefixed task is placed in the INFRA phase', () => {
|
|
228
|
-
// Arrange: INFRA-TASK-BE-01 correctly placed in the INFRA phase
|
|
229
|
-
const wb = makeWB([
|
|
230
|
-
makePhase('INFRA', [makeTask('INFRA-TASK-BE-01')], 'infra'),
|
|
231
|
-
]);
|
|
232
|
-
writeFixture(wb);
|
|
233
|
-
|
|
234
|
-
// Act
|
|
235
|
-
const { exitCode, report } = runValidator(tmpFile);
|
|
236
|
-
|
|
237
|
-
// Assert
|
|
238
|
-
expect(exitCode).toBe(0);
|
|
239
|
-
expect(report.valid).toBe(true);
|
|
240
|
-
expect(report.errors.filter(e => e.category === 'phase_id_mismatch')).toHaveLength(0);
|
|
241
|
-
});
|
|
242
|
-
});
|
|
243
|
-
});
|