cclaw-cli 0.55.2 → 1.0.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/README.md +3 -3
- package/dist/artifact-linter/brainstorm.js +45 -1
- package/dist/artifact-linter/design.js +32 -1
- package/dist/artifact-linter/plan.js +22 -1
- package/dist/artifact-linter/review.js +35 -1
- package/dist/artifact-linter/scope.js +19 -9
- package/dist/artifact-linter/shared.d.ts +11 -10
- package/dist/artifact-linter/shared.js +70 -41
- package/dist/artifact-linter/ship.js +36 -0
- package/dist/artifact-linter/spec.js +23 -1
- package/dist/artifact-linter/tdd.js +74 -0
- package/dist/artifact-linter.d.ts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -0
- package/dist/content/closeout-guidance.d.ts +1 -1
- package/dist/content/closeout-guidance.js +10 -11
- package/dist/content/core-agents.d.ts +35 -36
- package/dist/content/core-agents.js +189 -99
- package/dist/content/diff-command.js +1 -1
- package/dist/content/examples.d.ts +0 -3
- package/dist/content/examples.js +197 -752
- package/dist/content/idea.d.ts +60 -0
- package/dist/content/idea.js +404 -0
- package/dist/content/learnings.d.ts +2 -4
- package/dist/content/learnings.js +10 -26
- package/dist/content/node-hooks.js +131 -97
- package/dist/content/opencode-plugin.js +12 -26
- package/dist/content/reference-patterns.js +2 -2
- package/dist/content/runtime-shared-snippets.d.ts +8 -0
- package/dist/content/runtime-shared-snippets.js +80 -0
- package/dist/content/session-hooks.js +1 -1
- package/dist/content/skills.d.ts +1 -0
- package/dist/content/skills.js +50 -0
- package/dist/content/stage-schema.js +107 -63
- package/dist/content/stages/review.js +8 -8
- package/dist/content/stages/schema-types.d.ts +2 -2
- package/dist/content/stages/scope.js +1 -1
- package/dist/content/stages/ship.js +1 -1
- package/dist/content/status-command.js +3 -3
- package/dist/content/subagent-context-skills.js +156 -1
- package/dist/content/subagents.d.ts +0 -5
- package/dist/content/subagents.js +12 -82
- package/dist/content/templates.js +87 -6
- package/dist/content/utility-skills.js +26 -97
- package/dist/flow-state.d.ts +5 -6
- package/dist/flow-state.js +4 -6
- package/dist/gate-evidence.d.ts +0 -31
- package/dist/gate-evidence.js +3 -181
- package/dist/harness-adapters.js +1 -1
- package/dist/install.js +38 -4
- package/dist/internal/advance-stage/advance.js +0 -1
- package/dist/internal/advance-stage/review-loop.js +1 -10
- package/dist/knowledge-store.d.ts +2 -20
- package/dist/knowledge-store.js +43 -57
- package/dist/policy.js +3 -3
- package/dist/retro-gate.js +8 -90
- package/dist/run-archive.js +1 -4
- package/dist/run-persistence.js +14 -109
- package/dist/runtime/run-hook.entry.d.ts +3 -0
- package/dist/runtime/run-hook.entry.js +5 -0
- package/dist/runtime/run-hook.mjs +9477 -0
- package/package.json +4 -2
- package/dist/content/hook-inline-snippets.d.ts +0 -96
- package/dist/content/hook-inline-snippets.js +0 -515
- package/dist/content/idea-command.d.ts +0 -8
- package/dist/content/idea-command.js +0 -322
- package/dist/content/idea-frames.d.ts +0 -31
- package/dist/content/idea-frames.js +0 -140
- package/dist/content/idea-ranking.d.ts +0 -25
- package/dist/content/idea-ranking.js +0 -65
- package/dist/trace-matrix.d.ts +0 -27
- package/dist/trace-matrix.js +0 -226
package/dist/trace-matrix.js
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { resolveArtifactPath } from "./artifact-paths.js";
|
|
4
|
-
import { RUNTIME_ROOT } from "./constants.js";
|
|
5
|
-
import { extractReviewLoopEnvelopeFromArtifact } from "./content/review-loop.js";
|
|
6
|
-
import { exists } from "./fs-utils.js";
|
|
7
|
-
function activeArtifactPath(projectRoot, name) {
|
|
8
|
-
return path.join(projectRoot, RUNTIME_ROOT, "artifacts", name);
|
|
9
|
-
}
|
|
10
|
-
async function readArtifact(projectRoot, name) {
|
|
11
|
-
const candidate = activeArtifactPath(projectRoot, name);
|
|
12
|
-
if (await exists(candidate)) {
|
|
13
|
-
return fs.readFile(candidate, "utf8");
|
|
14
|
-
}
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
function uniqPreserve(ids) {
|
|
18
|
-
const seen = new Set();
|
|
19
|
-
const out = [];
|
|
20
|
-
for (const id of ids) {
|
|
21
|
-
if (!seen.has(id)) {
|
|
22
|
-
seen.add(id);
|
|
23
|
-
out.push(id);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return out;
|
|
27
|
-
}
|
|
28
|
-
function criterionTokens(text) {
|
|
29
|
-
return text.match(/\bAC-\d+\b/g) ?? [];
|
|
30
|
-
}
|
|
31
|
-
/** AC-1, AC-12, etc. */
|
|
32
|
-
function parseAcceptanceCriterionIds(specMd) {
|
|
33
|
-
return uniqPreserve(criterionTokens(specMd));
|
|
34
|
-
}
|
|
35
|
-
/** Map task id -> AC ids mentioned on same table row or bullet line as the task. */
|
|
36
|
-
function parsePlanTaskAcLinks(planMd) {
|
|
37
|
-
const map = new Map();
|
|
38
|
-
const lines = planMd.split(/\r?\n/);
|
|
39
|
-
const taskRe = /\b(T-\d+)\b/;
|
|
40
|
-
const acRe = /\b(AC-\d+)\b/g;
|
|
41
|
-
for (const line of lines) {
|
|
42
|
-
const tm = taskRe.exec(line);
|
|
43
|
-
if (!tm) {
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
const taskId = tm[1];
|
|
47
|
-
const acs = [...line.matchAll(acRe)].map((m) => m[0]);
|
|
48
|
-
if (acs.length === 0) {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
const prev = map.get(taskId) ?? [];
|
|
52
|
-
map.set(taskId, uniqPreserve([...prev, ...acs]));
|
|
53
|
-
}
|
|
54
|
-
return map;
|
|
55
|
-
}
|
|
56
|
-
/** All T-N ids appearing in the plan (best-effort). */
|
|
57
|
-
function parsePlanTaskIds(planMd) {
|
|
58
|
-
const re = /\bT-\d+\b/g;
|
|
59
|
-
return uniqPreserve(planMd.match(re) ?? []);
|
|
60
|
-
}
|
|
61
|
-
/** Map slice id -> task ids on same line. */
|
|
62
|
-
function parseTddSliceTaskLinks(tddMd) {
|
|
63
|
-
const map = new Map();
|
|
64
|
-
const sliceRe = /\b(S-\d+)\b/g;
|
|
65
|
-
const taskRe = /\b(T-\d+)\b/g;
|
|
66
|
-
const lines = tddMd.split(/\r?\n/);
|
|
67
|
-
for (const line of lines) {
|
|
68
|
-
const slices = [...line.matchAll(sliceRe)].map((m) => m[1]);
|
|
69
|
-
if (slices.length === 0) {
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
const tasks = [...line.matchAll(taskRe)].map((m) => m[1]);
|
|
73
|
-
for (const s of slices) {
|
|
74
|
-
const prev = map.get(s) ?? [];
|
|
75
|
-
map.set(s, uniqPreserve([...prev, ...tasks]));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return map;
|
|
79
|
-
}
|
|
80
|
-
function parseTddSliceIds(tddMd) {
|
|
81
|
-
return uniqPreserve(tddMd.match(/\bS-\d+\b/g) ?? []);
|
|
82
|
-
}
|
|
83
|
-
/** Body of Layer 1 spec compliance section in 07-review.md */
|
|
84
|
-
function extractLayer1Section(reviewMd) {
|
|
85
|
-
const lines = reviewMd.split(/\r?\n/);
|
|
86
|
-
let start = -1;
|
|
87
|
-
for (let i = 0; i < lines.length; i++) {
|
|
88
|
-
if (/^##\s+Layer\s*1/i.test(lines[i])) {
|
|
89
|
-
start = i + 1;
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (start < 0) {
|
|
94
|
-
return "";
|
|
95
|
-
}
|
|
96
|
-
const buf = [];
|
|
97
|
-
for (let i = start; i < lines.length; i++) {
|
|
98
|
-
const line = lines[i];
|
|
99
|
-
if (/^##\s+/.test(line)) {
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
buf.push(line);
|
|
103
|
-
}
|
|
104
|
-
return buf.join("\n");
|
|
105
|
-
}
|
|
106
|
-
function layer1LinesForCriterion(layer1, criterionId) {
|
|
107
|
-
const out = [];
|
|
108
|
-
for (const line of layer1.split(/\r?\n/)) {
|
|
109
|
-
if (criterionTokens(line).includes(criterionId)) {
|
|
110
|
-
out.push(line.trim());
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return out;
|
|
114
|
-
}
|
|
115
|
-
async function readStageArtifact(projectRoot, stage) {
|
|
116
|
-
let resolved = null;
|
|
117
|
-
try {
|
|
118
|
-
resolved = await resolveArtifactPath(stage, {
|
|
119
|
-
projectRoot,
|
|
120
|
-
intent: "read"
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
catch {
|
|
124
|
-
resolved = null;
|
|
125
|
-
}
|
|
126
|
-
if (!resolved || !(await exists(resolved.absPath))) {
|
|
127
|
-
return null;
|
|
128
|
-
}
|
|
129
|
-
try {
|
|
130
|
-
const markdown = await fs.readFile(resolved.absPath, "utf8");
|
|
131
|
-
return { markdown, relPath: resolved.relPath };
|
|
132
|
-
}
|
|
133
|
-
catch {
|
|
134
|
-
return null;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
async function collectReviewLoopTraceEntries(projectRoot) {
|
|
138
|
-
const entries = [];
|
|
139
|
-
for (const stage of ["scope", "design"]) {
|
|
140
|
-
const artifact = await readStageArtifact(projectRoot, stage);
|
|
141
|
-
if (!artifact)
|
|
142
|
-
continue;
|
|
143
|
-
const envelope = extractReviewLoopEnvelopeFromArtifact(artifact.markdown, stage, artifact.relPath);
|
|
144
|
-
if (!envelope)
|
|
145
|
-
continue;
|
|
146
|
-
const finalScore = envelope.iterations.length > 0
|
|
147
|
-
? envelope.iterations[envelope.iterations.length - 1].qualityScore
|
|
148
|
-
: 0;
|
|
149
|
-
entries.push({
|
|
150
|
-
stage,
|
|
151
|
-
artifactPath: artifact.relPath,
|
|
152
|
-
targetScore: envelope.targetScore,
|
|
153
|
-
maxIterations: envelope.maxIterations,
|
|
154
|
-
stopReason: envelope.stopReason,
|
|
155
|
-
finalScore,
|
|
156
|
-
iterations: envelope.iterations.map((row) => ({
|
|
157
|
-
iteration: row.iteration,
|
|
158
|
-
qualityScore: row.qualityScore,
|
|
159
|
-
findingsCount: row.findingsCount
|
|
160
|
-
}))
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
return entries;
|
|
164
|
-
}
|
|
165
|
-
export async function buildTraceMatrix(projectRoot) {
|
|
166
|
-
const spec = await readArtifact(projectRoot, "04-spec.md");
|
|
167
|
-
const plan = await readArtifact(projectRoot, "05-plan.md");
|
|
168
|
-
const tdd = await readArtifact(projectRoot, "06-tdd.md");
|
|
169
|
-
const review = await readArtifact(projectRoot, "07-review.md");
|
|
170
|
-
const criterionIds = spec ? parseAcceptanceCriterionIds(spec) : [];
|
|
171
|
-
const taskToAcs = plan ? parsePlanTaskAcLinks(plan) : new Map();
|
|
172
|
-
const allTaskIds = plan ? parsePlanTaskIds(plan) : [];
|
|
173
|
-
const sliceToTasks = tdd ? parseTddSliceTaskLinks(tdd) : new Map();
|
|
174
|
-
const allSliceIds = tdd ? parseTddSliceIds(tdd) : [];
|
|
175
|
-
const layer1 = review ? extractLayer1Section(review) : "";
|
|
176
|
-
const acToTasks = new Map();
|
|
177
|
-
for (const [task, acs] of taskToAcs) {
|
|
178
|
-
for (const ac of acs) {
|
|
179
|
-
const prev = acToTasks.get(ac) ?? new Set();
|
|
180
|
-
prev.add(task);
|
|
181
|
-
acToTasks.set(ac, prev);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
const entries = criterionIds.map((criterionId) => {
|
|
185
|
-
const taskIds = [...(acToTasks.get(criterionId) ?? new Set())];
|
|
186
|
-
const taskIdSet = new Set(taskIds);
|
|
187
|
-
const testSlices = [];
|
|
188
|
-
for (const [slice, tasks] of sliceToTasks) {
|
|
189
|
-
if (tasks.some((t) => taskIdSet.has(t))) {
|
|
190
|
-
testSlices.push(slice);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
return {
|
|
194
|
-
criterionId,
|
|
195
|
-
taskIds: uniqPreserve(taskIds),
|
|
196
|
-
testSlices: uniqPreserve(testSlices),
|
|
197
|
-
reviewFindings: layer1LinesForCriterion(layer1, criterionId)
|
|
198
|
-
};
|
|
199
|
-
});
|
|
200
|
-
const orphanedCriteria = criterionIds.filter((ac) => (acToTasks.get(ac)?.size ?? 0) === 0);
|
|
201
|
-
const tasksWithSlice = new Set();
|
|
202
|
-
for (const tasks of sliceToTasks.values()) {
|
|
203
|
-
for (const t of tasks) {
|
|
204
|
-
tasksWithSlice.add(t);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
const orphanedTasks = allTaskIds.filter((t) => !tasksWithSlice.has(t));
|
|
208
|
-
const orphanedTests = allSliceIds.filter((s) => {
|
|
209
|
-
const tasks = sliceToTasks.get(s) ?? [];
|
|
210
|
-
if (tasks.length === 0) {
|
|
211
|
-
return true;
|
|
212
|
-
}
|
|
213
|
-
return tasks.every((t) => {
|
|
214
|
-
const acs = taskToAcs.get(t);
|
|
215
|
-
return !acs || acs.length === 0;
|
|
216
|
-
});
|
|
217
|
-
});
|
|
218
|
-
const reviewLoops = await collectReviewLoopTraceEntries(projectRoot);
|
|
219
|
-
return {
|
|
220
|
-
entries,
|
|
221
|
-
orphanedCriteria,
|
|
222
|
-
orphanedTasks,
|
|
223
|
-
orphanedTests,
|
|
224
|
-
reviewLoops
|
|
225
|
-
};
|
|
226
|
-
}
|