cclaw-cli 7.7.1 → 8.1.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 +210 -134
- package/dist/artifact-frontmatter.d.ts +51 -0
- package/dist/artifact-frontmatter.js +131 -0
- package/dist/artifact-paths.d.ts +7 -27
- package/dist/artifact-paths.js +20 -249
- package/dist/cancel.d.ts +16 -0
- package/dist/cancel.js +66 -0
- package/dist/cli.d.ts +2 -27
- package/dist/cli.js +90 -508
- package/dist/compound.d.ts +26 -0
- package/dist/compound.js +96 -0
- package/dist/config.d.ts +14 -51
- package/dist/config.js +23 -359
- package/dist/constants.d.ts +11 -18
- package/dist/constants.js +19 -106
- package/dist/content/antipatterns.d.ts +1 -0
- package/dist/content/antipatterns.js +109 -0
- package/dist/content/artifact-templates.d.ts +10 -0
- package/dist/content/artifact-templates.js +550 -0
- package/dist/content/cancel-command.d.ts +2 -2
- package/dist/content/cancel-command.js +25 -17
- package/dist/content/core-agents.d.ts +9 -233
- package/dist/content/core-agents.js +39 -768
- package/dist/content/decision-protocol.d.ts +1 -12
- package/dist/content/decision-protocol.js +27 -20
- package/dist/content/examples.d.ts +8 -42
- package/dist/content/examples.js +293 -425
- package/dist/content/idea-command.d.ts +2 -0
- package/dist/content/idea-command.js +38 -0
- package/dist/content/iron-laws.d.ts +4 -138
- package/dist/content/iron-laws.js +18 -197
- package/dist/content/meta-skill.d.ts +1 -3
- package/dist/content/meta-skill.js +57 -134
- package/dist/content/node-hooks.d.ts +12 -8
- package/dist/content/node-hooks.js +188 -838
- package/dist/content/recovery.d.ts +8 -0
- package/dist/content/recovery.js +179 -0
- package/dist/content/reference-patterns.d.ts +4 -13
- package/dist/content/reference-patterns.js +260 -389
- package/dist/content/research-playbooks.d.ts +8 -8
- package/dist/content/research-playbooks.js +108 -121
- package/dist/content/review-loop.d.ts +6 -192
- package/dist/content/review-loop.js +29 -731
- package/dist/content/skills.d.ts +8 -38
- package/dist/content/skills.js +681 -732
- package/dist/content/specialist-prompts/architect.d.ts +1 -0
- package/dist/content/specialist-prompts/architect.js +225 -0
- package/dist/content/specialist-prompts/brainstormer.d.ts +1 -0
- package/dist/content/specialist-prompts/brainstormer.js +168 -0
- package/dist/content/specialist-prompts/index.d.ts +2 -0
- package/dist/content/specialist-prompts/index.js +14 -0
- package/dist/content/specialist-prompts/planner.d.ts +1 -0
- package/dist/content/specialist-prompts/planner.js +182 -0
- package/dist/content/specialist-prompts/reviewer.d.ts +1 -0
- package/dist/content/specialist-prompts/reviewer.js +193 -0
- package/dist/content/specialist-prompts/security-reviewer.d.ts +1 -0
- package/dist/content/specialist-prompts/security-reviewer.js +133 -0
- package/dist/content/specialist-prompts/slice-builder.d.ts +1 -0
- package/dist/content/specialist-prompts/slice-builder.js +232 -0
- package/dist/content/stage-playbooks.d.ts +8 -0
- package/dist/content/stage-playbooks.js +404 -0
- package/dist/content/start-command.d.ts +2 -12
- package/dist/content/start-command.js +221 -207
- package/dist/flow-state.d.ts +21 -178
- package/dist/flow-state.js +67 -170
- package/dist/fs-utils.d.ts +6 -26
- package/dist/fs-utils.js +29 -162
- package/dist/gitignore.d.ts +2 -1
- package/dist/gitignore.js +51 -34
- package/dist/harness-detect.d.ts +10 -0
- package/dist/harness-detect.js +29 -0
- package/dist/install.d.ts +27 -15
- package/dist/install.js +230 -1342
- package/dist/knowledge-store.d.ts +19 -163
- package/dist/knowledge-store.js +56 -590
- package/dist/logger.d.ts +8 -3
- package/dist/logger.js +13 -4
- package/dist/orchestrator-routing.d.ts +29 -0
- package/dist/orchestrator-routing.js +156 -0
- package/dist/run-persistence.d.ts +7 -118
- package/dist/run-persistence.js +29 -845
- package/dist/runtime/run-hook.entry.d.ts +1 -3
- package/dist/runtime/run-hook.entry.js +19 -4
- package/dist/runtime/run-hook.mjs +13 -1024
- package/dist/types.d.ts +25 -261
- package/dist/types.js +8 -36
- package/package.json +6 -3
- package/dist/artifact-linter/brainstorm.d.ts +0 -2
- package/dist/artifact-linter/brainstorm.js +0 -353
- package/dist/artifact-linter/design.d.ts +0 -18
- package/dist/artifact-linter/design.js +0 -444
- package/dist/artifact-linter/findings-dedup.d.ts +0 -56
- package/dist/artifact-linter/findings-dedup.js +0 -232
- package/dist/artifact-linter/plan.d.ts +0 -2
- package/dist/artifact-linter/plan.js +0 -826
- package/dist/artifact-linter/review-army.d.ts +0 -49
- package/dist/artifact-linter/review-army.js +0 -520
- package/dist/artifact-linter/review.d.ts +0 -2
- package/dist/artifact-linter/review.js +0 -113
- package/dist/artifact-linter/scope.d.ts +0 -2
- package/dist/artifact-linter/scope.js +0 -158
- package/dist/artifact-linter/shared.d.ts +0 -637
- package/dist/artifact-linter/shared.js +0 -2163
- package/dist/artifact-linter/ship.d.ts +0 -2
- package/dist/artifact-linter/ship.js +0 -250
- package/dist/artifact-linter/spec.d.ts +0 -2
- package/dist/artifact-linter/spec.js +0 -176
- package/dist/artifact-linter/tdd.d.ts +0 -118
- package/dist/artifact-linter/tdd.js +0 -1404
- package/dist/artifact-linter.d.ts +0 -15
- package/dist/artifact-linter.js +0 -517
- package/dist/codex-feature-flag.d.ts +0 -58
- package/dist/codex-feature-flag.js +0 -193
- package/dist/content/closeout-guidance.d.ts +0 -14
- package/dist/content/closeout-guidance.js +0 -44
- package/dist/content/diff-command.d.ts +0 -1
- package/dist/content/diff-command.js +0 -43
- package/dist/content/harness-doc.d.ts +0 -1
- package/dist/content/harness-doc.js +0 -65
- package/dist/content/hook-events.d.ts +0 -9
- package/dist/content/hook-events.js +0 -23
- package/dist/content/hook-manifest.d.ts +0 -81
- package/dist/content/hook-manifest.js +0 -156
- package/dist/content/hooks.d.ts +0 -11
- package/dist/content/hooks.js +0 -1972
- package/dist/content/idea.d.ts +0 -60
- package/dist/content/idea.js +0 -416
- package/dist/content/language-policy.d.ts +0 -2
- package/dist/content/language-policy.js +0 -13
- package/dist/content/learnings.d.ts +0 -6
- package/dist/content/learnings.js +0 -141
- package/dist/content/observe.d.ts +0 -19
- package/dist/content/observe.js +0 -86
- package/dist/content/opencode-plugin.d.ts +0 -1
- package/dist/content/opencode-plugin.js +0 -635
- package/dist/content/review-prompts.d.ts +0 -1
- package/dist/content/review-prompts.js +0 -104
- package/dist/content/runtime-shared-snippets.d.ts +0 -8
- package/dist/content/runtime-shared-snippets.js +0 -80
- package/dist/content/session-hooks.d.ts +0 -7
- package/dist/content/session-hooks.js +0 -107
- package/dist/content/skills-elicitation.d.ts +0 -1
- package/dist/content/skills-elicitation.js +0 -167
- package/dist/content/stage-command.d.ts +0 -2
- package/dist/content/stage-command.js +0 -17
- package/dist/content/stage-schema.d.ts +0 -117
- package/dist/content/stage-schema.js +0 -955
- package/dist/content/stages/_lint-metadata/index.d.ts +0 -2
- package/dist/content/stages/_lint-metadata/index.js +0 -97
- package/dist/content/stages/brainstorm.d.ts +0 -2
- package/dist/content/stages/brainstorm.js +0 -184
- package/dist/content/stages/design.d.ts +0 -2
- package/dist/content/stages/design.js +0 -288
- package/dist/content/stages/index.d.ts +0 -8
- package/dist/content/stages/index.js +0 -11
- package/dist/content/stages/plan.d.ts +0 -2
- package/dist/content/stages/plan.js +0 -191
- package/dist/content/stages/review.d.ts +0 -2
- package/dist/content/stages/review.js +0 -240
- package/dist/content/stages/schema-types.d.ts +0 -203
- package/dist/content/stages/schema-types.js +0 -1
- package/dist/content/stages/scope.d.ts +0 -2
- package/dist/content/stages/scope.js +0 -254
- package/dist/content/stages/ship.d.ts +0 -2
- package/dist/content/stages/ship.js +0 -159
- package/dist/content/stages/spec.d.ts +0 -2
- package/dist/content/stages/spec.js +0 -170
- package/dist/content/stages/tdd.d.ts +0 -4
- package/dist/content/stages/tdd.js +0 -273
- package/dist/content/state-contracts.d.ts +0 -1
- package/dist/content/state-contracts.js +0 -63
- package/dist/content/status-command.d.ts +0 -4
- package/dist/content/status-command.js +0 -109
- package/dist/content/subagent-context-skills.d.ts +0 -4
- package/dist/content/subagent-context-skills.js +0 -279
- package/dist/content/subagents.d.ts +0 -3
- package/dist/content/subagents.js +0 -997
- package/dist/content/templates.d.ts +0 -26
- package/dist/content/templates.js +0 -1692
- package/dist/content/track-render-context.d.ts +0 -18
- package/dist/content/track-render-context.js +0 -53
- package/dist/content/tree-command.d.ts +0 -1
- package/dist/content/tree-command.js +0 -64
- package/dist/content/utility-skills.d.ts +0 -30
- package/dist/content/utility-skills.js +0 -160
- package/dist/content/view-command.d.ts +0 -2
- package/dist/content/view-command.js +0 -92
- package/dist/delegation.d.ts +0 -649
- package/dist/delegation.js +0 -1539
- package/dist/early-loop.d.ts +0 -70
- package/dist/early-loop.js +0 -302
- package/dist/execution-topology.d.ts +0 -44
- package/dist/execution-topology.js +0 -95
- package/dist/gate-evidence.d.ts +0 -85
- package/dist/gate-evidence.js +0 -631
- package/dist/harness-adapters.d.ts +0 -151
- package/dist/harness-adapters.js +0 -756
- package/dist/harness-selection.d.ts +0 -31
- package/dist/harness-selection.js +0 -214
- package/dist/hook-schema.d.ts +0 -6
- package/dist/hook-schema.js +0 -114
- package/dist/hook-schemas/claude-hooks.v1.json +0 -10
- package/dist/hook-schemas/codex-hooks.v1.json +0 -10
- package/dist/hook-schemas/cursor-hooks.v1.json +0 -13
- package/dist/init-detect.d.ts +0 -2
- package/dist/init-detect.js +0 -50
- package/dist/internal/advance-stage/advance.d.ts +0 -89
- package/dist/internal/advance-stage/advance.js +0 -655
- package/dist/internal/advance-stage/cancel-run.d.ts +0 -8
- package/dist/internal/advance-stage/cancel-run.js +0 -19
- package/dist/internal/advance-stage/flow-state-coercion.d.ts +0 -3
- package/dist/internal/advance-stage/flow-state-coercion.js +0 -81
- package/dist/internal/advance-stage/helpers.d.ts +0 -14
- package/dist/internal/advance-stage/helpers.js +0 -145
- package/dist/internal/advance-stage/hook.d.ts +0 -8
- package/dist/internal/advance-stage/hook.js +0 -40
- package/dist/internal/advance-stage/parsers.d.ts +0 -72
- package/dist/internal/advance-stage/parsers.js +0 -357
- package/dist/internal/advance-stage/proactive-delegation-trace.d.ts +0 -24
- package/dist/internal/advance-stage/proactive-delegation-trace.js +0 -56
- package/dist/internal/advance-stage/review-loop.d.ts +0 -16
- package/dist/internal/advance-stage/review-loop.js +0 -199
- package/dist/internal/advance-stage/rewind.d.ts +0 -14
- package/dist/internal/advance-stage/rewind.js +0 -108
- package/dist/internal/advance-stage/start-flow.d.ts +0 -13
- package/dist/internal/advance-stage/start-flow.js +0 -241
- package/dist/internal/advance-stage/verify.d.ts +0 -21
- package/dist/internal/advance-stage/verify.js +0 -185
- package/dist/internal/advance-stage.d.ts +0 -7
- package/dist/internal/advance-stage.js +0 -138
- package/dist/internal/cohesion-contract-stub.d.ts +0 -24
- package/dist/internal/cohesion-contract-stub.js +0 -148
- package/dist/internal/compound-readiness.d.ts +0 -23
- package/dist/internal/compound-readiness.js +0 -102
- package/dist/internal/detect-public-api-changes.d.ts +0 -5
- package/dist/internal/detect-public-api-changes.js +0 -45
- package/dist/internal/detect-supply-chain-changes.d.ts +0 -6
- package/dist/internal/detect-supply-chain-changes.js +0 -138
- package/dist/internal/early-loop-status.d.ts +0 -7
- package/dist/internal/early-loop-status.js +0 -93
- package/dist/internal/envelope-validate.d.ts +0 -7
- package/dist/internal/envelope-validate.js +0 -66
- package/dist/internal/flow-state-repair.d.ts +0 -20
- package/dist/internal/flow-state-repair.js +0 -104
- package/dist/internal/plan-split-waves.d.ts +0 -190
- package/dist/internal/plan-split-waves.js +0 -764
- package/dist/internal/runtime-integrity.d.ts +0 -7
- package/dist/internal/runtime-integrity.js +0 -268
- package/dist/internal/slice-commit.d.ts +0 -7
- package/dist/internal/slice-commit.js +0 -619
- package/dist/internal/tdd-loop-status.d.ts +0 -14
- package/dist/internal/tdd-loop-status.js +0 -68
- package/dist/internal/tdd-red-evidence.d.ts +0 -7
- package/dist/internal/tdd-red-evidence.js +0 -153
- package/dist/internal/waiver-grant.d.ts +0 -62
- package/dist/internal/waiver-grant.js +0 -294
- package/dist/internal/wave-status.d.ts +0 -74
- package/dist/internal/wave-status.js +0 -506
- package/dist/managed-resources.d.ts +0 -53
- package/dist/managed-resources.js +0 -313
- package/dist/policy.d.ts +0 -10
- package/dist/policy.js +0 -167
- package/dist/retro-gate.d.ts +0 -9
- package/dist/retro-gate.js +0 -47
- package/dist/run-archive.d.ts +0 -61
- package/dist/run-archive.js +0 -391
- package/dist/runs.d.ts +0 -2
- package/dist/runs.js +0 -2
- package/dist/stack-detection.d.ts +0 -116
- package/dist/stack-detection.js +0 -489
- package/dist/streaming/event-stream.d.ts +0 -31
- package/dist/streaming/event-stream.js +0 -114
- package/dist/tdd-cycle.d.ts +0 -107
- package/dist/tdd-cycle.js +0 -289
- package/dist/tdd-verification-evidence.d.ts +0 -17
- package/dist/tdd-verification-evidence.js +0 -122
- package/dist/track-heuristics.d.ts +0 -27
- package/dist/track-heuristics.js +0 -154
- package/dist/util/slice-id.d.ts +0 -58
- package/dist/util/slice-id.js +0 -89
- package/dist/worktree-manager.d.ts +0 -20
- package/dist/worktree-manager.js +0 -108
package/dist/content/examples.js
CHANGED
|
@@ -1,471 +1,339 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
stage: "ship",
|
|
53
|
-
section: "Preflight Results",
|
|
54
|
-
bad: "Preflight: \"Looks good, tests passed last night\"; no fresh command output, no commit SHA, no exit code.",
|
|
55
|
-
good: "Preflight: paste the command, the exit code, and the commit SHA from this turn; if the suite was not re-run after the last edit, mark BLOCKED.",
|
|
56
|
-
ruleHint: "Victory-by-confidence is not a preflight. Re-run, capture, cite SHA — or stay BLOCKED."
|
|
57
|
-
}
|
|
58
|
-
];
|
|
59
|
-
const BEHAVIOR_ANCHOR_BY_STAGE = new Map(BEHAVIOR_ANCHORS.map((entry) => [entry.stage, entry]));
|
|
60
|
-
export function behaviorAnchorFor(stage) {
|
|
61
|
-
return BEHAVIOR_ANCHOR_BY_STAGE.get(stage) ?? null;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Render the one-line "Behavior anchor (bad → good)" pointer used at the top
|
|
65
|
-
* of each artifact template (01..08). Templates carry the anchor inline so
|
|
66
|
-
* agents see it before they start filling sections; the prose itself lives
|
|
67
|
-
* only in `BEHAVIOR_ANCHORS` to avoid duplication.
|
|
68
|
-
*/
|
|
69
|
-
export function renderBehaviorAnchorTemplateLine(stage) {
|
|
70
|
-
const anchor = behaviorAnchorFor(stage);
|
|
71
|
-
if (!anchor)
|
|
72
|
-
return "";
|
|
73
|
-
return `> Behavior anchor (bad -> good) — ${anchor.section}: bad: ${anchor.bad} good: ${anchor.good}`;
|
|
74
|
-
}
|
|
75
|
-
const STAGE_EXAMPLES = {
|
|
76
|
-
brainstorm: `## Context
|
|
77
|
-
|
|
78
|
-
- Project state: release checks exist but CI/local behavior drifts.
|
|
79
|
-
- Existing anchors: \`scripts/pre-publish.sh\`, \`src/release/\`, incident notes.
|
|
80
|
-
|
|
81
|
-
## Q&A Log
|
|
82
|
-
|
|
83
|
-
| Turn | Question | User answer (1-line) | Decision impact |
|
|
1
|
+
const PLAN_SMALL = `---
|
|
2
|
+
slug: approval-pill
|
|
3
|
+
stage: plan
|
|
4
|
+
status: active
|
|
5
|
+
ac:
|
|
6
|
+
- id: AC-1
|
|
7
|
+
text: "Approval status pill renders pending/approved/rejected on the dashboard tile."
|
|
8
|
+
status: pending
|
|
9
|
+
- id: AC-2
|
|
10
|
+
text: "Pill shows a tooltip with approver name and request age when status != pending."
|
|
11
|
+
status: pending
|
|
12
|
+
last_specialist: planner
|
|
13
|
+
refines: null
|
|
14
|
+
shipped_at: null
|
|
15
|
+
ship_commit: null
|
|
16
|
+
review_iterations: 0
|
|
17
|
+
security_flag: false
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# approval-pill
|
|
21
|
+
|
|
22
|
+
Add a status pill on the dashboard's request card so users can spot the approval lifecycle at a glance instead of opening the request modal.
|
|
23
|
+
|
|
24
|
+
## Context
|
|
25
|
+
|
|
26
|
+
The dashboard currently lists pending and approved requests in two flat tables. Customer support has been pasting the request id into the modal to read the approver — that workflow is slow. We can keep the existing tables but add a single 56×24 pill that encodes the same information visually.
|
|
27
|
+
|
|
28
|
+
## Frame
|
|
29
|
+
|
|
30
|
+
- Already true: \`Request\` model has \`status\`, \`approverId\`, \`requestedAt\`. \`User\` model has \`displayName\`.
|
|
31
|
+
- Not sure: whether designers want the pill to animate on status change. We default to no animation.
|
|
32
|
+
- Out of scope: the modal itself; approver workflows; mobile layout.
|
|
33
|
+
|
|
34
|
+
## Scope
|
|
35
|
+
|
|
36
|
+
- **In scope:** \`src/components/dashboard/RequestCard.tsx\`, \`src/components/dashboard/StatusPill.tsx\` (new), \`src/components/dashboard/StatusPill.test.tsx\` (new), \`src/styles/tokens.css\` (3 colour tokens).
|
|
37
|
+
- **Out of scope:** \`src/components/dashboard/RequestModal.tsx\`, mobile breakpoints, dark mode.
|
|
38
|
+
|
|
39
|
+
## Plan
|
|
40
|
+
|
|
41
|
+
- Phase 1 — Foundation
|
|
42
|
+
- Add \`StatusPill\` component with three variants (\`pending\`, \`approved\`, \`rejected\`) — \`src/components/dashboard/StatusPill.tsx\`.
|
|
43
|
+
- Add the three colour tokens — \`src/styles/tokens.css:42\`.
|
|
44
|
+
- Phase 2 — Wiring
|
|
45
|
+
- Render \`StatusPill\` inside \`RequestCard\` — \`src/components/dashboard/RequestCard.tsx:88\`.
|
|
46
|
+
- Surface the tooltip with approver name + relative time — \`src/components/dashboard/RequestCard.tsx:90\`.
|
|
47
|
+
|
|
48
|
+
## Acceptance Criteria
|
|
49
|
+
|
|
50
|
+
| id | text | status | commit |
|
|
84
51
|
| --- | --- | --- | --- |
|
|
85
|
-
| 1 |
|
|
86
|
-
| 2 |
|
|
87
|
-
|
|
52
|
+
| AC-1 | Approval status pill renders pending/approved/rejected on the dashboard tile. | pending | — |
|
|
53
|
+
| AC-2 | Pill shows a tooltip with approver name and request age when status != pending. | pending | — |
|
|
54
|
+
|
|
55
|
+
## Topology
|
|
56
|
+
|
|
57
|
+
- topology: inline
|
|
58
|
+
- parallel slices: none
|
|
59
|
+
|
|
60
|
+
## Traceability block
|
|
61
|
+
|
|
62
|
+
- AC-1 → commit pending
|
|
63
|
+
- AC-2 → commit pending
|
|
64
|
+
`;
|
|
65
|
+
const PLAN_PARALLEL_BUILD = `---
|
|
66
|
+
slug: search-overhaul
|
|
67
|
+
stage: plan
|
|
68
|
+
status: active
|
|
69
|
+
ac:
|
|
70
|
+
- id: AC-1
|
|
71
|
+
text: "Search index includes ticket comments alongside titles."
|
|
72
|
+
status: pending
|
|
73
|
+
- id: AC-2
|
|
74
|
+
text: "Search ranking uses BM25 instead of plain TF."
|
|
75
|
+
status: pending
|
|
76
|
+
- id: AC-3
|
|
77
|
+
text: "Search UI surfaces a \\"comments matched\\" badge."
|
|
78
|
+
status: pending
|
|
79
|
+
- id: AC-4
|
|
80
|
+
text: "Search API returns matched-comments fixture in integration tests."
|
|
81
|
+
status: pending
|
|
82
|
+
last_specialist: planner
|
|
83
|
+
refines: null
|
|
84
|
+
shipped_at: null
|
|
85
|
+
ship_commit: null
|
|
86
|
+
review_iterations: 0
|
|
87
|
+
security_flag: false
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
# search-overhaul
|
|
91
|
+
|
|
92
|
+
## Topology
|
|
93
|
+
|
|
94
|
+
- topology: parallel-build
|
|
95
|
+
- parallel slices:
|
|
96
|
+
- AC-1, AC-2 → slice-builder #1 (backend) — owners: \`src/server/search/*\`, \`src/server/db/migrations/2026-05-07-bm25.sql\`
|
|
97
|
+
- AC-3 → slice-builder #2 (frontend) — owner: \`src/client/search/Hits.tsx\`
|
|
98
|
+
- AC-4 → slice-builder #3 (integration tests) — owner: \`tests/integration/search.spec.ts\`
|
|
99
|
+
- integration reviewer: \`reviewer #integration\` after the wave finishes.
|
|
100
|
+
|
|
101
|
+
(File set per slice is disjoint; AC-3 does not depend on AC-1/AC-2 because the badge is purely presentational and can use a feature flag for the first review pass.)
|
|
102
|
+
|
|
103
|
+
## Plan
|
|
104
|
+
|
|
105
|
+
(See per-slice owner files; do not merge them into one log. The integration reviewer reconstructs the picture from \`builds/search-overhaul.md\` after the wave.)
|
|
106
|
+
|
|
107
|
+
## Acceptance Criteria
|
|
108
|
+
|
|
109
|
+
| id | text | status | commit |
|
|
110
|
+
| --- | --- | --- | --- |
|
|
111
|
+
| AC-1 | Search index includes ticket comments alongside titles. | pending | — |
|
|
112
|
+
| AC-2 | Search ranking uses BM25 instead of plain TF. | pending | — |
|
|
113
|
+
| AC-3 | Search UI surfaces a "comments matched" badge. | pending | — |
|
|
114
|
+
| AC-4 | Search API returns matched-comments fixture in integration tests. | pending | — |
|
|
115
|
+
|
|
116
|
+
## Traceability block
|
|
88
117
|
|
|
89
|
-
|
|
118
|
+
- AC-1 → commit pending
|
|
119
|
+
- AC-2 → commit pending
|
|
120
|
+
- AC-3 → commit pending
|
|
121
|
+
- AC-4 → commit pending
|
|
122
|
+
`;
|
|
123
|
+
const BUILD_LOG = `---
|
|
124
|
+
slug: approval-pill
|
|
125
|
+
stage: build
|
|
126
|
+
status: active
|
|
127
|
+
build_iterations: 2
|
|
128
|
+
last_commit: 9e2c3a4
|
|
129
|
+
---
|
|
90
130
|
|
|
91
|
-
|
|
92
|
-
- Frame type: \`technical-maintenance\`
|
|
93
|
-
- Affected user / role / operator: release operator
|
|
94
|
-
- Current state / failure mode / opportunity: inconsistent validation paths
|
|
95
|
-
- Desired outcome (observable): one deterministic preflight in CI and local flows
|
|
96
|
-
- Evidence / signal: repeated metadata drift incidents
|
|
97
|
-
- Why now: recurring operational cost on every release
|
|
98
|
-
- Do-nothing consequence: continued publish risk
|
|
99
|
-
- Non-goals: no release framework rewrite
|
|
131
|
+
# Build log — approval-pill
|
|
100
132
|
|
|
101
|
-
##
|
|
133
|
+
## Plan summary
|
|
102
134
|
|
|
103
|
-
|
|
135
|
+
Two AC: pill component + tooltip with approver name. Inline topology, single slice-builder.
|
|
136
|
+
|
|
137
|
+
## Commits
|
|
138
|
+
|
|
139
|
+
| AC | commit | files | note |
|
|
104
140
|
| --- | --- | --- | --- |
|
|
105
|
-
| 1 |
|
|
106
|
-
| 2 |
|
|
141
|
+
| AC-1 | a1b2c3d | \`src/components/dashboard/StatusPill.tsx:1-58\`, \`src/components/dashboard/StatusPill.test.tsx:1-44\`, \`src/styles/tokens.css:42-44\` | Three variants, snapshot test for each. |
|
|
142
|
+
| AC-2 | 9e2c3a4 | \`src/components/dashboard/RequestCard.tsx:88-104\`, \`src/components/dashboard/RequestCard.test.tsx:51-72\` | Wires \`StatusPill\` + tooltip. Uses existing \`<Tooltip>\` from \`src/components/Tooltip.tsx\`. |
|
|
143
|
+
|
|
144
|
+
## Open work
|
|
107
145
|
|
|
108
|
-
|
|
146
|
+
_(none — both AC are committed.)_
|
|
109
147
|
|
|
110
|
-
|
|
111
|
-
- Why this tier: cross-cutting release path change, bounded subsystem
|
|
148
|
+
## Hooks invoked
|
|
112
149
|
|
|
113
|
-
|
|
150
|
+
- \`commit-helper.mjs --ac=AC-1 --message="Add StatusPill component with three variants"\` → \`a1b2c3d\`
|
|
151
|
+
- \`commit-helper.mjs --ac=AC-2 --message="Wire StatusPill + tooltip into RequestCard"\` → \`9e2c3a4\`
|
|
152
|
+
|
|
153
|
+
## Notes
|
|
114
154
|
|
|
115
|
-
|
|
155
|
+
- \`<Tooltip>\` component already supports a \`delay\` prop; reused the 250 ms token from \`src/styles/tokens.css\` instead of hardcoding.
|
|
156
|
+
- Snapshot tests use \`@testing-library/react\` v15 \`render\` API; same as adjacent tests, no test-config changes needed.
|
|
157
|
+
`;
|
|
158
|
+
const REVIEW_LOG = `---
|
|
159
|
+
slug: approval-pill
|
|
160
|
+
stage: review
|
|
161
|
+
status: active
|
|
162
|
+
review_iterations: 2
|
|
163
|
+
modes_run:
|
|
164
|
+
- code
|
|
165
|
+
- text-review
|
|
166
|
+
findings_block:
|
|
167
|
+
- F-1
|
|
168
|
+
- F-2
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
# Review — approval-pill
|
|
172
|
+
|
|
173
|
+
## Run summary
|
|
174
|
+
|
|
175
|
+
| iteration | mode | reviewer | result |
|
|
176
|
+
| --- | --- | --- | --- |
|
|
177
|
+
| 1 | code | reviewer | block |
|
|
178
|
+
| 2 | code | reviewer | clear |
|
|
179
|
+
|
|
180
|
+
## Findings
|
|
181
|
+
|
|
182
|
+
| id | severity | AC | location | finding | fix |
|
|
116
183
|
| --- | --- | --- | --- | --- | --- |
|
|
117
|
-
|
|
|
118
|
-
|
|
|
184
|
+
| F-1 | block | AC-1 | \`src/components/dashboard/StatusPill.tsx:23\` | The \`rejected\` variant uses the same red token as warning banners; designers want a separate "muted red" token. | Add \`--color-status-rejected\` to \`src/styles/tokens.css\` and reference it. |
|
|
185
|
+
| F-2 | warn | AC-2 | \`src/components/dashboard/RequestCard.tsx:97\` | Tooltip text uses absolute timestamps; product asked for relative ("2 hours ago"). | Replace with \`formatRelativeTime\` from \`src/lib/time.ts\`. |
|
|
119
186
|
|
|
120
|
-
##
|
|
187
|
+
## Five Failure Modes pass
|
|
121
188
|
|
|
122
|
-
|
|
123
|
-
- Concerns: keep v1 delivery tight; avoid framework creep
|
|
124
|
-
- What changed after reaction: kept module path and added incremental rollout guardrails
|
|
189
|
+
Iteration 1:
|
|
125
190
|
|
|
126
|
-
|
|
191
|
+
- Hallucinated actions: no.
|
|
192
|
+
- Scope creep: no.
|
|
193
|
+
- Cascading errors: no.
|
|
194
|
+
- Context loss: no — all decisions on display name still hold.
|
|
195
|
+
- Tool misuse: no.
|
|
127
196
|
|
|
128
|
-
|
|
129
|
-
- Disposition: rejected for this cycle.
|
|
130
|
-
- Enforcement note: preserve the challenger as a bounded fallback, but do not mix both paths in v1 implementation.
|
|
197
|
+
Iteration 2: same answers, all "no".
|
|
131
198
|
|
|
132
|
-
##
|
|
199
|
+
## Decision
|
|
133
200
|
|
|
134
|
-
-
|
|
135
|
-
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
201
|
+
- Iteration 1: **block** — slice-builder mode=fix-only on F-1 and F-2.
|
|
202
|
+
- Iteration 2: **clear** — both findings resolved; ready for ship.
|
|
203
|
+
`;
|
|
204
|
+
const SHIP_NOTES = `---
|
|
205
|
+
slug: approval-pill
|
|
206
|
+
stage: ship
|
|
207
|
+
status: active
|
|
208
|
+
ship_commit: 9e2c3a4
|
|
209
|
+
push_approved: true
|
|
210
|
+
pr_url: https://github.com/example/web/pull/2317
|
|
211
|
+
---
|
|
140
212
|
|
|
141
|
-
|
|
213
|
+
# Ship notes — approval-pill
|
|
142
214
|
|
|
143
|
-
##
|
|
215
|
+
## Summary
|
|
144
216
|
|
|
145
|
-
|
|
146
|
-
| --- | --- |
|
|
147
|
-
| In scope | durable in-app feed, SSE path, degraded-state UX |
|
|
148
|
-
| Out of scope | email/SMS/push channels, marketing flows |
|
|
149
|
-
| Deferred | WebSocket migration, rich-media payloads |
|
|
217
|
+
Adds a colour-coded approval status pill to dashboard request cards plus a tooltip exposing the approver's display name and the request age. No backend or schema changes.
|
|
150
218
|
|
|
151
|
-
##
|
|
219
|
+
## AC ↔ commit map
|
|
152
220
|
|
|
153
|
-
|
|
|
221
|
+
| AC | commit | description |
|
|
154
222
|
| --- | --- | --- |
|
|
155
|
-
|
|
|
156
|
-
|
|
|
223
|
+
| AC-1 | \`a1b2c3d\` | StatusPill component with three variants (pending / approved / rejected). |
|
|
224
|
+
| AC-2 | \`9e2c3a4\` | RequestCard wires StatusPill and tooltip. |
|
|
157
225
|
|
|
158
|
-
##
|
|
226
|
+
## Push / PR
|
|
159
227
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
| R-1 | Feed is queryable for recent window | Baseline usability |
|
|
163
|
-
| R-2 | Live updates are timely and recoverable | Reliability |
|
|
164
|
-
| R-3 | Degraded state is explicit to users | No silent failure |
|
|
228
|
+
- push: approved by user on 2026-04-18T14:21Z.
|
|
229
|
+
- PR: https://github.com/example/web/pull/2317.
|
|
165
230
|
|
|
166
|
-
##
|
|
231
|
+
## Breaking changes / migration
|
|
167
232
|
|
|
168
|
-
|
|
169
|
-
- Snapshot/stream cursor mismatch -> deterministic recovery required.
|
|
170
|
-
`,
|
|
171
|
-
design: `## Blast Radius
|
|
233
|
+
None. Public component API unchanged.
|
|
172
234
|
|
|
173
|
-
|
|
174
|
-
| --- | --- | --- |
|
|
175
|
-
| \`src/services/notifications.ts\` | modify | persistence-aware publish path |
|
|
176
|
-
| \`src/api/routes/notifications.ts\` | modify | snapshot + stream endpoints |
|
|
177
|
-
| \`src/ui/feed.tsx\` | modify | degraded banner + reconnect states |
|
|
178
|
-
| \`tests/integration/notifications.test.ts\` | add/update | consistency + auth coverage |
|
|
235
|
+
## Release notes
|
|
179
236
|
|
|
180
|
-
|
|
237
|
+
> Dashboard request cards now display a colour-coded approval status pill with a tooltip showing the approver and the request age. No configuration changes required.
|
|
238
|
+
`;
|
|
239
|
+
const DECISION_RECORD = `---
|
|
240
|
+
slug: approval-pill-tooltips
|
|
241
|
+
stage: plan
|
|
242
|
+
status: active
|
|
243
|
+
decision_count: 1
|
|
244
|
+
---
|
|
181
245
|
|
|
182
|
-
|
|
183
|
-
flowchart LR
|
|
184
|
-
API --> Service --> Outbox --> Projector --> Feed
|
|
185
|
-
Service --> Stream
|
|
186
|
-
\`\`\`
|
|
246
|
+
# Decisions — approval-pill-tooltips
|
|
187
247
|
|
|
188
|
-
##
|
|
248
|
+
## D-1 — Permission check is read-from-cached-claim, not re-checked on render
|
|
189
249
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
250
|
+
- **Context:** the tooltip needs to gate email visibility on the \`view-email\` permission. We can either (A) re-check the permission on every render via a synchronous IAM call, (B) read from the already-cached user claim with a 60 s TTL, or (C) push permission into a render-time React context.
|
|
251
|
+
- **Considered options:**
|
|
252
|
+
- Option A — re-check on render. Pros: always fresh. Cons: adds 8 ms p99 to dashboard render budget; couples the dashboard to IAM uptime.
|
|
253
|
+
- Option B — cached claim, 60 s TTL. Pros: zero extra latency on render; same path used by \`view-billing\`. Cons: stale for up to 60 s after permission revoke.
|
|
254
|
+
- Option C — render-time React context. Pros: makes permission explicit at the call site. Cons: another context provider; redundant with the cached claim path.
|
|
255
|
+
- **Selected:** Option B.
|
|
256
|
+
- **Rationale:** consistent with \`view-billing\` (\`src/lib/permissions.ts:14\`); 60 s TTL is acceptable per the threat model since permission changes already pin a fresh login on next nav; render budget is non-negotiable for the dashboard.
|
|
257
|
+
- **Rejected because:** A — render budget impact unacceptable; C — redundant.
|
|
258
|
+
- **Consequences:** any future permission gate on the dashboard is expected to follow the same pattern. \`view-billing\` and \`view-email\` should be tested together to keep the path single-purpose.
|
|
259
|
+
- **Refs:** \`src/lib/permissions.ts:14\`, AC-1, AC-3, threat model entry from security-reviewer iteration 1.
|
|
260
|
+
`;
|
|
261
|
+
const LEARNING_RECORD = `---
|
|
262
|
+
slug: approval-pill-tooltips
|
|
263
|
+
stage: ship
|
|
264
|
+
status: active
|
|
265
|
+
captured_by: orchestrator
|
|
266
|
+
quality_gate: passed
|
|
267
|
+
signals:
|
|
268
|
+
hasArchitectDecision: true
|
|
269
|
+
reviewIterations: 2
|
|
270
|
+
securityFlag: true
|
|
271
|
+
userRequestedCapture: false
|
|
272
|
+
---
|
|
195
273
|
|
|
196
|
-
|
|
274
|
+
# Learnings — approval-pill-tooltips
|
|
197
275
|
|
|
198
|
-
|
|
199
|
-
- Integration: snapshot+stream consistency and auth boundaries.
|
|
200
|
-
- E2E: degraded banner and recovery UX.
|
|
201
|
-
`,
|
|
202
|
-
spec: `## Acceptance Criteria
|
|
276
|
+
## What we believed at the start
|
|
203
277
|
|
|
204
|
-
|
|
205
|
-
| --- | --- | --- | --- |
|
|
206
|
-
| AC-1 | Feed returns recent window reliably | R-1 | integration test |
|
|
207
|
-
| AC-2 | Live updates visible within agreed latency | R-2 | perf + integration |
|
|
208
|
-
| AC-3 | Disconnect shows degraded state promptly | R-3 | e2e scenario |
|
|
278
|
+
The simple thing is to call IAM on render whenever the dashboard wants to know whether to show email. That assumption was the original brainstormer frame.
|
|
209
279
|
|
|
210
|
-
##
|
|
280
|
+
## What turned out to be true
|
|
211
281
|
|
|
212
|
-
-
|
|
213
|
-
-
|
|
214
|
-
`,
|
|
215
|
-
plan: `## Dependency Graph
|
|
282
|
+
- \`useCurrentUser\` already caches permission claims. We did not need a new mechanism.
|
|
283
|
+
- Designers' "muted red" complaint from the original \`approval-pill\` slug was still relevant for new pill variants; we should add it to the design tokens skill.
|
|
216
284
|
|
|
217
|
-
|
|
218
|
-
- D2 API snapshot/stream
|
|
219
|
-
- D3 UI degraded-state handling
|
|
220
|
-
- D4 tests + observability
|
|
285
|
+
## What turned out to be wrong
|
|
221
286
|
|
|
222
|
-
|
|
287
|
+
- The render budget is much tighter than expected — 8 ms is not free in this code path. The architect's feasibility check caught this.
|
|
223
288
|
|
|
224
|
-
|
|
225
|
-
| --- | --- | --- | --- |
|
|
226
|
-
| T-1 | schema + migration | M | 90 |
|
|
227
|
-
| T-2 | snapshot/stream API updates | M | 90 |
|
|
228
|
-
| T-3 | UI degraded-state path | M | 70 |
|
|
229
|
-
| T-4 | consistency + auth tests | M | 85 |
|
|
289
|
+
## Decisions worth remembering
|
|
230
290
|
|
|
231
|
-
|
|
291
|
+
- D-1 (cached claim with 60 s TTL).
|
|
232
292
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
293
|
+
## Patterns we should keep
|
|
294
|
+
|
|
295
|
+
- Permission gates at render should reuse \`useCurrentUser\` claim caching unless the threat model says otherwise.
|
|
296
|
+
- Refinement slugs that touch sensitive data should set \`security_flag: true\` even when the diff feels small.
|
|
297
|
+
|
|
298
|
+
## Anti-patterns we should avoid
|
|
299
|
+
|
|
300
|
+
- Re-checking permissions on render in a tight UI path without measuring the budget first.
|
|
301
|
+
|
|
302
|
+
## Follow-ups
|
|
238
303
|
|
|
239
|
-
|
|
304
|
+
- Document the 60 s TTL contract on \`useCurrentUser\` in \`src/lib/auth.ts\` (one-line JSDoc).
|
|
305
|
+
- Consider an \`assertPermission\` helper for non-render paths so the rules are obvious.
|
|
306
|
+
`;
|
|
307
|
+
const COMMIT_HELPER_SESSION = `\`\`\`bash
|
|
308
|
+
$ git status --short
|
|
309
|
+
M src/components/dashboard/StatusPill.tsx
|
|
310
|
+
M src/components/dashboard/StatusPill.test.tsx
|
|
311
|
+
M src/styles/tokens.css
|
|
312
|
+
|
|
313
|
+
$ git add src/components/dashboard/StatusPill.tsx \\
|
|
314
|
+
src/components/dashboard/StatusPill.test.tsx \\
|
|
315
|
+
src/styles/tokens.css
|
|
316
|
+
|
|
317
|
+
$ node .cclaw/hooks/commit-helper.mjs --ac=AC-1 \\
|
|
318
|
+
--message="Add StatusPill component with three variants"
|
|
319
|
+
|
|
320
|
+
[commit-helper] AC-1 committed as a1b2c3d
|
|
321
|
+
\`\`\``;
|
|
322
|
+
export const EXAMPLES = [
|
|
323
|
+
{ id: "plan-small", fileName: "plan-small.md", title: "Plan — small slug", description: "Two AC, inline topology, no specialists invoked.", body: PLAN_SMALL },
|
|
324
|
+
{ id: "plan-parallel-build", fileName: "plan-parallel-build.md", title: "Plan — parallel-build topology", description: "Four AC across three slice owners + integration reviewer.", body: PLAN_PARALLEL_BUILD },
|
|
325
|
+
{ id: "build-log", fileName: "build-log.md", title: "Build log — two AC committed", description: "Commit table with file:line refs and hook invocations.", body: BUILD_LOG },
|
|
326
|
+
{ id: "review-log", fileName: "review-log.md", title: "Review — two iterations to clear", description: "Iteration table, findings, Five Failure Modes pass.", body: REVIEW_LOG },
|
|
327
|
+
{ id: "ship-notes", fileName: "ship-notes.md", title: "Ship notes — approved push + PR", description: "Summary, AC↔commit map, push/PR, release notes.", body: SHIP_NOTES },
|
|
328
|
+
{ id: "decision-permission-cache", fileName: "decision-permission-cache.md", title: "Decision — cached permission claim (D-1)", description: "Considered options, selection, rationale, consequences, refs.", body: DECISION_RECORD },
|
|
329
|
+
{ id: "learning-record", fileName: "learning-record.md", title: "Learnings — gated capture", description: "Belief / outcomes / patterns / antipatterns / follow-ups.", body: LEARNING_RECORD },
|
|
330
|
+
{ id: "commit-helper-session", fileName: "commit-helper-session.md", title: "Commit-helper session", description: "Shell transcript for one AC commit via the hook.", body: `# commit-helper.mjs session\n\n${COMMIT_HELPER_SESSION}\n` }
|
|
331
|
+
];
|
|
332
|
+
export const EXAMPLES_INDEX = `# .cclaw/lib/examples/
|
|
240
333
|
|
|
241
|
-
|
|
242
|
-
`,
|
|
243
|
-
tdd: `## RED
|
|
334
|
+
Worked artifacts the orchestrator and specialists can study before producing their own. Each file is a real-looking plan / build / review / ship / decision / learning artifact, plus a few orchestrator-prompt transcripts.
|
|
244
335
|
|
|
245
|
-
|
|
|
336
|
+
| file | what it shows |
|
|
246
337
|
| --- | --- |
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
## Acceptance & Failure Map
|
|
251
|
-
|
|
252
|
-
| Slice | Source ID | AC ID | Expected behavior | RED-link |
|
|
253
|
-
| --- | --- | --- | --- | --- |
|
|
254
|
-
| S-1 | SRC-1 | AC-1 | feed window honors 30d cap | spanId:tdd-feed-window-red |
|
|
255
|
-
| S-2 | SRC-2 | AC-3 | degraded banner appears on disconnect | spanId:tdd-banner-red (auto-derived from delegation-events.jsonl) |
|
|
256
|
-
|
|
257
|
-
## GREEN
|
|
258
|
-
|
|
259
|
-
- Targeted tests pass.
|
|
260
|
-
- Full suite re-run after fixes.
|
|
261
|
-
|
|
262
|
-
## REFACTOR
|
|
263
|
-
|
|
264
|
-
- Reduced reconnect state duplication.
|
|
265
|
-
- Revalidated behavior with regression tests.
|
|
266
|
-
`,
|
|
267
|
-
review: `## Layer 1 — Spec Compliance
|
|
268
|
-
|
|
269
|
-
| ID | Severity | Finding | Evidence | Status |
|
|
270
|
-
| --- | --- | --- | --- | --- |
|
|
271
|
-
| R-1 | low | AC mapping remains intact | trace table + tests | closed |
|
|
272
|
-
|
|
273
|
-
## Layer 2 — Code Quality
|
|
274
|
-
|
|
275
|
-
| ID | Severity | Finding | Evidence | Status |
|
|
276
|
-
| --- | --- | --- | --- | --- |
|
|
277
|
-
| R-2 | high | auth guard gap in stream query path | curl repro + failing test | open |
|
|
278
|
-
|
|
279
|
-
## Victory Detector
|
|
280
|
-
|
|
281
|
-
Victory Detector: pass | fail
|
|
282
|
-
|
|
283
|
-
- Current verdict: fail (R-2 open)
|
|
284
|
-
`,
|
|
285
|
-
ship: `## Release Checklist
|
|
286
|
-
|
|
287
|
-
- version/changelog prepared
|
|
288
|
-
- test/build/preflight passed
|
|
289
|
-
- review blockers resolved or explicitly accepted
|
|
290
|
-
|
|
291
|
-
## Victory Detector
|
|
292
|
-
|
|
293
|
-
Victory Detector: pass | fail
|
|
294
|
-
|
|
295
|
-
- Current verdict: pass
|
|
296
|
-
|
|
297
|
-
## Rollback Plan
|
|
298
|
-
|
|
299
|
-
- Trigger: error-rate or latency threshold breach
|
|
300
|
-
- Steps: revert + redeploy prior artifact
|
|
301
|
-
- Verification: key metrics return to baseline
|
|
302
|
-
`
|
|
303
|
-
};
|
|
304
|
-
const GOOD_BAD_EXAMPLES = {
|
|
305
|
-
brainstorm: [{
|
|
306
|
-
label: "Problem framing",
|
|
307
|
-
good: "Names affected role, current failure mode, measurable target, and non-goals.",
|
|
308
|
-
bad: "Need to improve this area somehow.",
|
|
309
|
-
lesson: "Concrete framing prevents scope drift in downstream stages."
|
|
310
|
-
}],
|
|
311
|
-
scope: [{
|
|
312
|
-
label: "Boundary clarity",
|
|
313
|
-
good: "Clear in-scope/out-of-scope/deferred lists with concrete capabilities.",
|
|
314
|
-
bad: "Add improvements where useful.",
|
|
315
|
-
lesson: "Scope without hard boundaries becomes hidden commitment."
|
|
316
|
-
}],
|
|
317
|
-
design: [{
|
|
318
|
-
label: "Failure handling",
|
|
319
|
-
good: "Each failure row includes trigger, detection, and mitigation.",
|
|
320
|
-
bad: "Could fail, handle later.",
|
|
321
|
-
lesson: "Actionable design risk must be testable and operationally visible."
|
|
322
|
-
}],
|
|
323
|
-
spec: [{
|
|
324
|
-
label: "AC quality",
|
|
325
|
-
good: "AC includes measurable signal and explicit verification approach.",
|
|
326
|
-
bad: "System should work reliably.",
|
|
327
|
-
lesson: "Observable/falsifiable language is required for meaningful verification."
|
|
328
|
-
}],
|
|
329
|
-
plan: [{
|
|
330
|
-
label: "Task granularity",
|
|
331
|
-
good: "Tasks have bounded outputs, effort, and AC links.",
|
|
332
|
-
bad: "Implement feature end-to-end.",
|
|
333
|
-
lesson: "Execution speed depends on concrete, reviewable task slices."
|
|
334
|
-
}],
|
|
335
|
-
tdd: [{
|
|
336
|
-
label: "RED evidence",
|
|
337
|
-
good: "Includes failing output tied to one behavior slice.",
|
|
338
|
-
bad: "Tests failed at first.",
|
|
339
|
-
lesson: "Without concrete RED evidence, behavior intent is not auditable."
|
|
340
|
-
}],
|
|
341
|
-
review: [{
|
|
342
|
-
label: "Finding quality",
|
|
343
|
-
good: "Severity + falsifiable claim + evidence + status.",
|
|
344
|
-
bad: "LGTM with a few comments.",
|
|
345
|
-
lesson: "Review findings are decisions, not vibes."
|
|
346
|
-
}],
|
|
347
|
-
ship: [{
|
|
348
|
-
label: "Rollback contract",
|
|
349
|
-
good: "Named trigger, exact rollback steps, and verification condition.",
|
|
350
|
-
bad: "Revert if something goes wrong.",
|
|
351
|
-
lesson: "Rollback must be executable under incident pressure."
|
|
352
|
-
}]
|
|
353
|
-
};
|
|
354
|
-
export function stageGoodBadExamples(stage) {
|
|
355
|
-
const samples = GOOD_BAD_EXAMPLES[stage];
|
|
356
|
-
if (!samples || samples.length === 0)
|
|
357
|
-
return "";
|
|
358
|
-
const blocks = [
|
|
359
|
-
"## Good vs Bad (at-a-glance)",
|
|
360
|
-
"",
|
|
361
|
-
"Contrasting samples to calibrate quality for this stage.",
|
|
362
|
-
""
|
|
363
|
-
];
|
|
364
|
-
samples.forEach((sample, index) => {
|
|
365
|
-
blocks.push(`### ${index + 1}. ${sample.label}`);
|
|
366
|
-
blocks.push("");
|
|
367
|
-
blocks.push("**Good**");
|
|
368
|
-
blocks.push("");
|
|
369
|
-
blocks.push("> " + sample.good);
|
|
370
|
-
blocks.push("");
|
|
371
|
-
blocks.push("**Bad**");
|
|
372
|
-
blocks.push("");
|
|
373
|
-
blocks.push("> " + sample.bad);
|
|
374
|
-
blocks.push("");
|
|
375
|
-
blocks.push("**Why it matters:** " + sample.lesson);
|
|
376
|
-
blocks.push("");
|
|
377
|
-
});
|
|
378
|
-
return blocks.join("\n");
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Returns the full example artifact body for tests and internal quality checks.
|
|
382
|
-
* Generated user projects keep only short inline shape cues.
|
|
383
|
-
*/
|
|
384
|
-
export function stageFullArtifactExampleMarkdown(stage) {
|
|
385
|
-
const examples = STAGE_EXAMPLES[stage];
|
|
386
|
-
if (!examples)
|
|
387
|
-
return null;
|
|
388
|
-
return [
|
|
389
|
-
`---`,
|
|
390
|
-
`stage: ${stage}`,
|
|
391
|
-
`name: ${stage}-stage-examples`,
|
|
392
|
-
`description: "Full sample artifact for the ${stage} stage."`,
|
|
393
|
-
`---`,
|
|
394
|
-
"",
|
|
395
|
-
`# ${stage} stage — full artifact sample`,
|
|
396
|
-
"",
|
|
397
|
-
`The sample uses H2 headings that mirror the artifact a cclaw session must produce, so the markdown is wrapped in a fence to avoid collapsing into the outline.`,
|
|
398
|
-
"",
|
|
399
|
-
"```markdown",
|
|
400
|
-
examples,
|
|
401
|
-
"```",
|
|
402
|
-
""
|
|
403
|
-
].join("\n");
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* Returns short inline shape cues rendered directly inside the stage skill.
|
|
407
|
-
*/
|
|
408
|
-
export function stageExamples(stage) {
|
|
409
|
-
const examples = STAGE_EXAMPLES[stage];
|
|
410
|
-
if (!examples)
|
|
411
|
-
return "";
|
|
412
|
-
return [
|
|
413
|
-
"## Examples",
|
|
414
|
-
"",
|
|
415
|
-
"Shape cues to follow; do not paste these headings verbatim unless they match the work:",
|
|
416
|
-
...exampleSummaryBullets(stage),
|
|
417
|
-
""
|
|
418
|
-
].join("\n");
|
|
419
|
-
}
|
|
420
|
-
function exampleSummaryBullets(stage) {
|
|
421
|
-
const headings = STAGE_EXAMPLE_SECTION_HEADINGS[stage] ?? [];
|
|
422
|
-
if (headings.length === 0)
|
|
423
|
-
return ["- Full artifact structure."];
|
|
424
|
-
return headings.map((heading) => `- ${heading}`);
|
|
425
|
-
}
|
|
426
|
-
const STAGE_EXAMPLE_SECTION_HEADINGS = {
|
|
427
|
-
brainstorm: [
|
|
428
|
-
"Problem Decision Record (free-form Frame type label + universal framing fields)",
|
|
429
|
-
"Approaches with explicit trade-offs",
|
|
430
|
-
"Approach Reaction and Selected Direction"
|
|
431
|
-
],
|
|
432
|
-
scope: [
|
|
433
|
-
"In-scope / out-of-scope / deferred lists with concrete capabilities",
|
|
434
|
-
"Reference Pattern Registry with clear dispositions",
|
|
435
|
-
"Requirements table with stable R# IDs"
|
|
436
|
-
],
|
|
437
|
-
design: [
|
|
438
|
-
"Blast-radius file list",
|
|
439
|
-
"Mandatory architecture diagram (Mermaid)",
|
|
440
|
-
"Failure-mode table with detection + mitigation"
|
|
441
|
-
],
|
|
442
|
-
spec: [
|
|
443
|
-
"Acceptance-criteria table (observable, measurable, falsifiable)",
|
|
444
|
-
"Requirement-ref column tying each AC back to an R# from scope",
|
|
445
|
-
"Verification-approach column"
|
|
446
|
-
],
|
|
447
|
-
plan: [
|
|
448
|
-
"Dependency graph",
|
|
449
|
-
"Task list with effort + minutes estimate per task",
|
|
450
|
-
"Acceptance mapping (every AC -> task IDs)",
|
|
451
|
-
"WAIT_FOR_CONFIRM marker"
|
|
452
|
-
],
|
|
453
|
-
tdd: [
|
|
454
|
-
"RED evidence per vertical slice",
|
|
455
|
-
"Acceptance mapping per slice",
|
|
456
|
-
"GREEN evidence",
|
|
457
|
-
"REFACTOR notes with behavior-preservation confirmation"
|
|
458
|
-
],
|
|
459
|
-
review: [
|
|
460
|
-
"Spec-compliance findings (Layer 1)",
|
|
461
|
-
"Code-quality findings (Layer 2)",
|
|
462
|
-
"Severity, evidence, and status per finding",
|
|
463
|
-
"Victory Detector-backed go / no-go verdict"
|
|
464
|
-
],
|
|
465
|
-
ship: [
|
|
466
|
-
"Release checklist",
|
|
467
|
-
"Victory Detector: pass | fail",
|
|
468
|
-
"Rollback plan with trigger, steps, verification",
|
|
469
|
-
"Runbook and sign-off"
|
|
470
|
-
]
|
|
471
|
-
};
|
|
338
|
+
${EXAMPLES.map((e) => `| \`${e.fileName}\` | ${e.description} |`).join("\n")}
|
|
339
|
+
`;
|