cclaw-cli 0.5.11 → 0.5.12
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/dist/artifact-linter.js +16 -0
- package/dist/content/examples.js +43 -29
- package/dist/content/stage-schema.js +61 -5
- package/dist/content/templates.js +18 -3
- package/package.json +1 -1
package/dist/artifact-linter.js
CHANGED
|
@@ -201,6 +201,22 @@ function validateSectionBody(sectionBody, rule) {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
+
if (/Status:\s*pending\s+until/iu.test(rule)) {
|
|
205
|
+
const statusLine = bodyLines.find((l) => /^\s*-?\s*Status\s*:/iu.test(l));
|
|
206
|
+
if (!statusLine) {
|
|
207
|
+
return { ok: false, details: "WAIT_FOR_CONFIRM section must contain a 'Status:' line." };
|
|
208
|
+
}
|
|
209
|
+
const validStatuses = ["pending", "approved"];
|
|
210
|
+
const statusMatch = /Status\s*:\s*(\S+)/iu.exec(statusLine);
|
|
211
|
+
const statusValue = statusMatch?.[1]?.toLowerCase();
|
|
212
|
+
if (!statusValue || !validStatuses.includes(statusValue)) {
|
|
213
|
+
const foundLabel = statusValue || "(empty)";
|
|
214
|
+
return {
|
|
215
|
+
ok: false,
|
|
216
|
+
details: "WAIT_FOR_CONFIRM Status must be exactly one of: " + validStatuses.join(", ") + ". Found: " + foundLabel + "."
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
}
|
|
204
220
|
const keywords = extractRequiredKeywords(rule);
|
|
205
221
|
if (keywords.length > 0) {
|
|
206
222
|
const bodyLower = sectionBody.toLowerCase();
|
package/dist/content/examples.js
CHANGED
|
@@ -236,11 +236,11 @@ Data flow: Gateway → Service (validate + enrich) → Publisher (fan-out) → Q
|
|
|
236
236
|
Design output should be **reviewable by someone who did not attend brainstorming**: they can trace from constraints → components → open decisions without reading code.`,
|
|
237
237
|
spec: `### Acceptance Criteria
|
|
238
238
|
|
|
239
|
-
| ID | Criterion (observable/measurable/falsifiable) |
|
|
240
|
-
| --- | --- |
|
|
241
|
-
| AC-1 | Given a signed-in user with an active session, when the server publishes a new notification event for that user, the client feed shows the new item within 5 seconds without a full page reload. |
|
|
242
|
-
| AC-2 | Given the same logical notification is published twice with the same dedupe key, when the client processes the stream, the feed contains exactly one visible item for that key. |
|
|
243
|
-
| AC-3 | Given the live connection is unavailable, when the user opens the notifications panel, the UI shows a non-blocking "live updates paused" banner and loads the latest snapshot via REST within 2 seconds. |
|
|
239
|
+
| ID | Criterion (observable/measurable/falsifiable) | Design Decision Ref |
|
|
240
|
+
| --- | --- | --- |
|
|
241
|
+
| AC-1 | Given a signed-in user with an active session, when the server publishes a new notification event for that user, the client feed shows the new item within 5 seconds without a full page reload. | Architecture: SSE delivery path |
|
|
242
|
+
| AC-2 | Given the same logical notification is published twice with the same dedupe key, when the client processes the stream, the feed contains exactly one visible item for that key. | Architecture: dedupe-key in event schema |
|
|
243
|
+
| AC-3 | Given the live connection is unavailable, when the user opens the notifications panel, the UI shows a non-blocking "live updates paused" banner and loads the latest snapshot via REST within 2 seconds. | Architecture: REST fallback + degraded UX |
|
|
244
244
|
|
|
245
245
|
### Edge Cases
|
|
246
246
|
|
|
@@ -267,39 +267,53 @@ Design output should be **reviewable by someone who did not attend brainstorming
|
|
|
267
267
|
|
|
268
268
|
- Approved by: user
|
|
269
269
|
- Date: 2026-04-14`,
|
|
270
|
-
plan: `###
|
|
271
|
-
|
|
272
|
-
| ID | Title | depends_on | acceptance_criteria | estimated_effort |
|
|
273
|
-
| --- | --- | --- | --- | --- |
|
|
274
|
-
| T1 | Define notification event schema + dedupe key rules | — | Spec criteria 2 satisfied in a written contract + fixtures | S |
|
|
275
|
-
| T2 | Implement publisher + outbox write path | T1 | Spec criterion 1 satisfied in integration test (happy path) | M |
|
|
276
|
-
| T3 | Implement client feed + SSE subscribe + REST fallback | T1, T2 | Spec criteria 1–3 satisfied in e2e-style tests (including degraded mode) | L |
|
|
277
|
-
|
|
278
|
-
### Dependency graph (ASCII)
|
|
270
|
+
plan: `### Dependency Graph
|
|
279
271
|
|
|
280
272
|
\`\`\`
|
|
281
|
-
|
|
282
|
-
│
|
|
283
|
-
|
|
273
|
+
T-1 ──▶ T-2 ──▶ T-3
|
|
274
|
+
│ ▲
|
|
275
|
+
└───────────────┘
|
|
284
276
|
\`\`\`
|
|
285
277
|
|
|
286
|
-
|
|
278
|
+
Parallel opportunity: T-1 is a prerequisite for both T-2 and T-3 (T-3 also needs T-2).
|
|
287
279
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
280
|
+
### Dependency Waves
|
|
281
|
+
|
|
282
|
+
#### Wave 1 (foundation)
|
|
283
|
+
- Task IDs: T-1
|
|
284
|
+
- Verification gate: schema tests pass, dedupe key fixtures validated
|
|
293
285
|
|
|
294
|
-
|
|
286
|
+
#### Wave 2 (core logic)
|
|
287
|
+
- Task IDs: T-2
|
|
288
|
+
- Depends on: Wave 1 (T-1 complete)
|
|
289
|
+
- Verification gate: integration test proves publish-to-outbox path
|
|
295
290
|
|
|
296
|
-
|
|
297
|
-
-
|
|
298
|
-
-
|
|
291
|
+
#### Wave 3 (integration)
|
|
292
|
+
- Task IDs: T-3
|
|
293
|
+
- Depends on: Wave 2 (T-2 complete)
|
|
294
|
+
- Verification gate: e2e tests pass for delivery, dedupe, and degraded mode
|
|
299
295
|
|
|
300
|
-
|
|
296
|
+
Execution rule: complete and verify each wave before starting the next wave.
|
|
297
|
+
|
|
298
|
+
### Task List
|
|
299
|
+
|
|
300
|
+
| Task ID | Description | Acceptance criterion | Verification command | Effort |
|
|
301
|
+
| --- | --- | --- | --- | --- |
|
|
302
|
+
| T-1 | Define notification event schema + dedupe key rules | AC-1, AC-2: schema contract + fixtures | \`\`\`pnpm vitest run tests/unit/notification-schema.test.ts\`\`\` |
|
|
303
|
+
| T-2 | Implement publisher + outbox write path | AC-1: integration test (happy path publish) | \`\`\`pnpm vitest run tests/integration/publisher.test.ts\`\`\` |
|
|
304
|
+
| T-3 | Implement client feed + SSE subscribe + REST fallback | AC-1, AC-2, AC-3: e2e tests including degraded mode | \`\`\`pnpm playwright test tests/e2e/notification-feed.spec.ts\`\`\` |
|
|
305
|
+
|
|
306
|
+
### Acceptance Mapping
|
|
307
|
+
|
|
308
|
+
| Criterion ID | Task IDs |
|
|
309
|
+
| --- | --- |
|
|
310
|
+
| AC-1 (delivery within 5s) | T-2, T-3 |
|
|
311
|
+
| AC-2 (idempotency) | T-1, T-2 |
|
|
312
|
+
| AC-3 (failure visibility) | T-3 |
|
|
301
313
|
|
|
302
|
-
|
|
314
|
+
### WAIT_FOR_CONFIRM
|
|
315
|
+
- Status: pending
|
|
316
|
+
- Confirmed by:`,
|
|
303
317
|
tdd: `### RED test (Vitest) — written before production code
|
|
304
318
|
|
|
305
319
|
\`\`\`typescript
|
|
@@ -717,7 +717,30 @@ const SPEC = {
|
|
|
717
717
|
{ name: "Assumption Surfacing", description: "Implicit assumptions are invisible requirements. Force every assumption into an explicit statement. If you cannot name the assumption, you have not found it yet." },
|
|
718
718
|
{ name: "Ambiguity Classification", description: "Before resolving any unclear requirement, classify it: (A) Insufficient information — ask the user. (B) Multiple valid interpretations — enumerate and pick with justification. (C) Genuinely unknown — propose hypothesis and validation path. Never treat all ambiguity the same way." }
|
|
719
719
|
],
|
|
720
|
-
reviewSections: [
|
|
720
|
+
reviewSections: [
|
|
721
|
+
{
|
|
722
|
+
title: "Acceptance Criteria Audit",
|
|
723
|
+
evaluationPoints: [
|
|
724
|
+
"Is every criterion observable (can you point to evidence of pass/fail)?",
|
|
725
|
+
"Is every criterion measurable (numeric threshold or boolean outcome)?",
|
|
726
|
+
"Is every criterion falsifiable (can you describe what failure looks like)?",
|
|
727
|
+
"Does every criterion trace to a design decision (Design Decision Ref)?",
|
|
728
|
+
"Are there any vague adjectives (fast, intuitive, robust) without thresholds?"
|
|
729
|
+
],
|
|
730
|
+
stopGate: true
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
title: "Testability Audit",
|
|
734
|
+
evaluationPoints: [
|
|
735
|
+
"Does every criterion have a concrete test description in the Testability Map?",
|
|
736
|
+
"Does every test specify a verification approach (unit, integration, e2e, manual)?",
|
|
737
|
+
"Does every test include a runnable command or manual steps?",
|
|
738
|
+
"Are edge cases (boundary + error) defined for every criterion?",
|
|
739
|
+
"Can you run every verification command right now and get a meaningful result?"
|
|
740
|
+
],
|
|
741
|
+
stopGate: true
|
|
742
|
+
}
|
|
743
|
+
],
|
|
721
744
|
completionStatus: ["DONE", "DONE_WITH_CONCERNS", "BLOCKED"],
|
|
722
745
|
crossStageTrace: {
|
|
723
746
|
readsFrom: [".cclaw/artifacts/03-design.md", ".cclaw/artifacts/02-scope.md"],
|
|
@@ -729,6 +752,8 @@ const SPEC = {
|
|
|
729
752
|
{ section: "Edge Cases", required: true, validationRule: "At least one boundary and one error condition per criterion." },
|
|
730
753
|
{ section: "Constraints and Assumptions", required: true, validationRule: "All implicit assumptions surfaced. Constraints have sources." },
|
|
731
754
|
{ section: "Testability Map", required: true, validationRule: "Each criterion maps to a concrete test description with verification approach (unit, integration, e2e, manual) and command or manual steps." },
|
|
755
|
+
{ section: "Vague to Fixed", required: false, validationRule: "If present: table with original vague wording and rewritten observable/testable version for each ambiguous requirement." },
|
|
756
|
+
{ section: "Non-Functional Requirements", required: false, validationRule: "If present: performance thresholds, security constraints, scalability limits, reliability targets with measurable values." },
|
|
732
757
|
{ section: "Interface Contracts", required: false, validationRule: "If present: for each module boundary list produces (outputs) and consumes (inputs) with data types." },
|
|
733
758
|
{ section: "Approval", required: true, validationRule: "Explicit user approval marker present." }
|
|
734
759
|
],
|
|
@@ -839,9 +864,35 @@ const PLAN = {
|
|
|
839
864
|
cognitivePatterns: [
|
|
840
865
|
{ name: "Vertical Slice Thinking", description: "Each task delivers one thin end-to-end slice of value. Horizontal layers (all models, then all controllers) create integration risk. Vertical slices (one feature through all layers) reduce it." },
|
|
841
866
|
{ name: "Two-Minute Smell Test", description: "If a competent engineer cannot understand and start a task in two minutes, the task is too large or too vague. Break it down further." },
|
|
842
|
-
{ name: "Make the Change Easy, Then Make the Easy Change", description: "Refactor first, implement second. Never structural + behavioral changes simultaneously. Sequence tasks accordingly." }
|
|
867
|
+
{ name: "Make the Change Easy, Then Make the Easy Change", description: "Refactor first, implement second. Never structural + behavioral changes simultaneously. Sequence tasks accordingly." },
|
|
868
|
+
{ name: "Diagnose Before Fix", description: "Before decomposing work, understand the current state of the codebase. Read existing code, tests, and conventions. Tasks should reference what exists, not assume a blank slate." },
|
|
869
|
+
{ name: "Scrap Signals", description: "If a task description is vague, the acceptance criterion is missing, or the verification command is a placeholder — it is scrap. Either rewrite it or remove it. Half-specified tasks waste more time than no tasks." },
|
|
870
|
+
{ name: "Risk-First Exploration", description: "Sequence the highest-risk or most uncertain tasks first. If wave 1 proves the risky assumption wrong, the rest of the plan can adapt. If the risk is buried in wave 3, you discover failure late." }
|
|
871
|
+
],
|
|
872
|
+
reviewSections: [
|
|
873
|
+
{
|
|
874
|
+
title: "Task Decomposition Audit",
|
|
875
|
+
evaluationPoints: [
|
|
876
|
+
"Does every task target a single coherent area (vertical slice)?",
|
|
877
|
+
"Can each task be completed in 2-5 minutes?",
|
|
878
|
+
"Does every task have an acceptance criterion link and verification command?",
|
|
879
|
+
"Are there tasks that touch multiple unrelated areas?",
|
|
880
|
+
"Would a new engineer understand and start each task within two minutes?"
|
|
881
|
+
],
|
|
882
|
+
stopGate: true
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
title: "Wave Completeness Audit",
|
|
886
|
+
evaluationPoints: [
|
|
887
|
+
"Does every task belong to exactly one wave?",
|
|
888
|
+
"Does each wave have a verification gate?",
|
|
889
|
+
"Are wave dependencies explicit and acyclic?",
|
|
890
|
+
"Is the acceptance mapping complete — every spec criterion covered?",
|
|
891
|
+
"Are there hidden dependencies between tasks in different waves?"
|
|
892
|
+
],
|
|
893
|
+
stopGate: true
|
|
894
|
+
}
|
|
843
895
|
],
|
|
844
|
-
reviewSections: [],
|
|
845
896
|
completionStatus: ["DONE", "DONE_WITH_CONCERNS", "BLOCKED"],
|
|
846
897
|
crossStageTrace: {
|
|
847
898
|
readsFrom: [".cclaw/artifacts/04-spec.md", ".cclaw/artifacts/03-design.md", ".cclaw/artifacts/02-scope.md"],
|
|
@@ -851,10 +902,15 @@ const PLAN = {
|
|
|
851
902
|
artifactValidation: [
|
|
852
903
|
{ section: "Dependency Graph", required: true, validationRule: "Ordering and parallel opportunities explicit. No circular dependencies." },
|
|
853
904
|
{ section: "Dependency Waves", required: true, validationRule: "Every task belongs to a wave. Each wave has an exit gate and dependency statement." },
|
|
854
|
-
{ section: "Task List", required: true, validationRule: "Each task: ID, description, acceptance criterion link, verification command." },
|
|
905
|
+
{ section: "Task List", required: true, validationRule: "Each task: ID, description, acceptance criterion link, verification command, and effort estimate (S/M/L)." },
|
|
855
906
|
{ section: "Acceptance Mapping", required: true, validationRule: "Every spec criterion is covered by at least one task." },
|
|
907
|
+
{ section: "Risk Assessment", required: false, validationRule: "If present: per-task or per-wave risk identification with likelihood, impact, and mitigation strategy." },
|
|
856
908
|
{ section: "WAIT_FOR_CONFIRM", required: true, validationRule: "Explicit marker present. Status: pending until user approves." }
|
|
857
|
-
]
|
|
909
|
+
],
|
|
910
|
+
namedAntiPattern: {
|
|
911
|
+
title: "Task Details Can Be Finalized During Coding",
|
|
912
|
+
description: "Underspecified tasks do not become clear during implementation — they become context thrash, broken sequencing, and rework. Every task needs an acceptance criterion, a verification command, and a wave assignment before execution starts. If you cannot describe what 'done' looks like for a task, the task is not ready."
|
|
913
|
+
}
|
|
858
914
|
};
|
|
859
915
|
// ---------------------------------------------------------------------------
|
|
860
916
|
// TDD — RED → GREEN → REFACTOR cycle (merged test + build)
|
|
@@ -221,6 +221,16 @@ export const ARTIFACT_TEMPLATES = {
|
|
|
221
221
|
|---|---|---|
|
|
222
222
|
| AC-1 | | |
|
|
223
223
|
|
|
224
|
+
## Vague to Fixed
|
|
225
|
+
| Original (vague) | Rewritten (observable/testable) |
|
|
226
|
+
|---|---|
|
|
227
|
+
| | |
|
|
228
|
+
|
|
229
|
+
## Non-Functional Requirements
|
|
230
|
+
| Category | Requirement | Threshold | Measurement |
|
|
231
|
+
|---|---|---|---|
|
|
232
|
+
| | | | |
|
|
233
|
+
|
|
224
234
|
## Interface Contracts
|
|
225
235
|
| Module | Produces | Consumes |
|
|
226
236
|
|---|---|---|
|
|
@@ -254,15 +264,20 @@ export const ARTIFACT_TEMPLATES = {
|
|
|
254
264
|
Execution rule: complete and verify each wave before starting the next wave.
|
|
255
265
|
|
|
256
266
|
## Task List
|
|
257
|
-
| Task ID | Description | Acceptance criterion | Verification command |
|
|
258
|
-
|
|
259
|
-
| T-1 | | | |
|
|
267
|
+
| Task ID | Description | Acceptance criterion | Verification command | Effort |
|
|
268
|
+
|---|---|---|---|---|
|
|
269
|
+
| T-1 | | | | |
|
|
260
270
|
|
|
261
271
|
## Acceptance Mapping
|
|
262
272
|
| Criterion ID | Task IDs |
|
|
263
273
|
|---|---|
|
|
264
274
|
| AC-1 | T-1 |
|
|
265
275
|
|
|
276
|
+
## Risk Assessment
|
|
277
|
+
| Task/Wave | Risk | Likelihood | Impact | Mitigation |
|
|
278
|
+
|---|---|---|---|---|
|
|
279
|
+
| | | | | |
|
|
280
|
+
|
|
266
281
|
## WAIT_FOR_CONFIRM
|
|
267
282
|
- Status: pending
|
|
268
283
|
- Confirmed by:
|