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
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
const AC_TRACEABILITY_BREAK = `# Recovery — AC traceability broken
|
|
2
|
+
|
|
3
|
+
The orchestrator detects a broken AC ↔ commit chain when:
|
|
4
|
+
|
|
5
|
+
- \`flow-state.json\` has an AC with \`status: pending\` but \`builds/<slug>.md\` already has a row for that AC;
|
|
6
|
+
- the commit-helper hook was bypassed (a plain \`git commit\` produced a SHA that flow-state does not know about);
|
|
7
|
+
- a force-push rewrote SHAs that flow-state had recorded.
|
|
8
|
+
|
|
9
|
+
## Symptoms
|
|
10
|
+
|
|
11
|
+
- \`runCompoundAndShip()\` refuses to run with: \`Cannot ship <slug>: AC traceability gate failed. Pending AC: ...\`
|
|
12
|
+
- a review iteration finds an AC labelled \`pending\` with a commit cited in \`builds/<slug>.md\`.
|
|
13
|
+
|
|
14
|
+
## Recovery steps
|
|
15
|
+
|
|
16
|
+
1. Identify the affected AC ids and the actual commit SHAs from \`git log\`.
|
|
17
|
+
2. Open \`.cclaw/state/flow-state.json\` and locate the matching AC entry.
|
|
18
|
+
3. Set \`commit\` to the verified SHA and \`status\` to \`committed\`.
|
|
19
|
+
4. Re-render the traceability block in \`plans/<slug>.md\`: every AC gets a single line \`AC-N → commit <short-sha>\`.
|
|
20
|
+
5. Re-run review-stage for the affected AC. The reviewer must see the correct chain before ship proceeds.
|
|
21
|
+
|
|
22
|
+
## What not to do
|
|
23
|
+
|
|
24
|
+
- Do not delete \`.cclaw/state/flow-state.json\` to "start fresh". The active artifacts still reference the slug; deleting state desynchronizes everything.
|
|
25
|
+
- Do not edit historical commits to "fix" the message. The ship gate trusts SHAs, not messages.
|
|
26
|
+
- Do not amend the commit produced by commit-helper. Amending changes the SHA and breaks the chain again.
|
|
27
|
+
`;
|
|
28
|
+
const REVIEW_CAP_REACHED = `# Recovery — review hard cap reached
|
|
29
|
+
|
|
30
|
+
The reviewer reached iteration 5 with outstanding block-level findings.
|
|
31
|
+
|
|
32
|
+
## Symptoms
|
|
33
|
+
|
|
34
|
+
- \`reviews/<slug>.md\` has 5 iteration blocks; the last one carries \`status: cap-reached\`.
|
|
35
|
+
- The orchestrator surfaces remaining findings and recommends \`/cc-cancel\` or splitting.
|
|
36
|
+
|
|
37
|
+
## Recovery steps
|
|
38
|
+
|
|
39
|
+
Pick one of:
|
|
40
|
+
|
|
41
|
+
### Option A — \`/cc-cancel\` and re-plan
|
|
42
|
+
|
|
43
|
+
1. \`/cc-cancel reason="cap reached on <slug>"\`.
|
|
44
|
+
2. Read the cap-reached block to identify the still-broken AC.
|
|
45
|
+
3. \`/cc <task>\` with a tighter scope. Often the cap was reached because the slug bundled two changes; split them.
|
|
46
|
+
4. The cancelled artifacts under \`.cclaw/flows/cancelled/<slug>/\` can be referenced from the new plan via the Refs section.
|
|
47
|
+
|
|
48
|
+
### Option B — fold remaining findings into a fresh slug
|
|
49
|
+
|
|
50
|
+
1. Manually move \`.cclaw/flows/<slug>/plan.md\` and friends out of the active directory (e.g. into \`.cclaw/flows/cancelled/\` for archive).
|
|
51
|
+
2. Reset flow-state.
|
|
52
|
+
3. \`/cc <new task>\` for the leftovers.
|
|
53
|
+
|
|
54
|
+
### Option C — escalate to a human review
|
|
55
|
+
|
|
56
|
+
If the cap is genuinely a tooling failure (e.g. the reviewer kept hallucinating the same finding), capture the iteration logs as a decision record and ask a human to break the loop.
|
|
57
|
+
|
|
58
|
+
## What not to do
|
|
59
|
+
|
|
60
|
+
- Do not raise the iteration cap. The cap exists because past iteration 5 the marginal value of another iteration is near zero.
|
|
61
|
+
- Do not silently force \`clear\` to ship. The block findings are real; ignoring them puts garbage into shipped/.
|
|
62
|
+
- Do not fork the slug into ten micro-slugs. Two or three is healthy; ten is fragmentation.
|
|
63
|
+
`;
|
|
64
|
+
const PARALLEL_BUILD_CONFLICT = `# Recovery — parallel-build slice conflict
|
|
65
|
+
|
|
66
|
+
Two slice-builders touch the same file or write conflicting changes during a \`parallel-build\` wave.
|
|
67
|
+
|
|
68
|
+
## Symptoms
|
|
69
|
+
|
|
70
|
+
- Slice-builder #2 reports a path conflict with slice-builder #1 mid-wave.
|
|
71
|
+
- The integration reviewer finds two commits both editing the same file.
|
|
72
|
+
- Build log shows two AC committing to the same file.
|
|
73
|
+
|
|
74
|
+
## Recovery steps
|
|
75
|
+
|
|
76
|
+
1. Pause the wave. Stop dispatching new slice-builders.
|
|
77
|
+
2. Read \`builds/<slug>.md\` to understand which AC each commit closes.
|
|
78
|
+
3. Decide ownership:
|
|
79
|
+
- if the file legitimately needs both changes, integration reviewer reconciles them and creates a single fix-only commit referencing both AC;
|
|
80
|
+
- if one slice should not have touched the file, slice-builder mode=\`fix-only\` reverts the offending hunk and re-implements the AC inside its declared file set.
|
|
81
|
+
4. Re-run the integration reviewer.
|
|
82
|
+
|
|
83
|
+
## Pre-flight prevention
|
|
84
|
+
|
|
85
|
+
- Planner topology=\`parallel-build\` must verify disjoint file sets before recommending the topology.
|
|
86
|
+
- The orchestrator must surface the file-set partition to the user before dispatching slices.
|
|
87
|
+
- Slice-builders never read each other's working trees mid-wave.
|
|
88
|
+
|
|
89
|
+
## What not to do
|
|
90
|
+
|
|
91
|
+
- Do not "merge" the conflicting commits with \`git rebase\` or \`git merge\` inside \`/cc\`. The AC chain breaks.
|
|
92
|
+
- Do not have one slice-builder re-do another slice-builder's AC. Hand it back to the original slice-builder via fix-only.
|
|
93
|
+
- Do not silently rewrite the topology to inline mid-wave. Cancel the wave, re-plan, restart.
|
|
94
|
+
`;
|
|
95
|
+
const FRONTMATTER_CORRUPTION = `# Recovery — frontmatter corruption
|
|
96
|
+
|
|
97
|
+
A YAML parser error appears when the orchestrator tries to read \`plans/<slug>.md\` or another active artifact.
|
|
98
|
+
|
|
99
|
+
## Symptoms
|
|
100
|
+
|
|
101
|
+
- Existing-plan detection silently skips a plan it should have matched.
|
|
102
|
+
- The frontmatter parser throws \`FrontmatterError: Invalid YAML frontmatter: ...\`.
|
|
103
|
+
- The orchestrator surfaces "Artifact is missing the required YAML frontmatter block (---)".
|
|
104
|
+
|
|
105
|
+
## Recovery steps
|
|
106
|
+
|
|
107
|
+
1. Open the artifact in your editor.
|
|
108
|
+
2. Compare against the canonical template in \`.cclaw/lib/templates/<stage>.md\`.
|
|
109
|
+
3. Fix the YAML — the most common errors are:
|
|
110
|
+
- missing closing \`---\`;
|
|
111
|
+
- tabs inside the YAML block (use spaces);
|
|
112
|
+
- unquoted strings containing \`:\` (quote them);
|
|
113
|
+
- invalid date / timestamp values.
|
|
114
|
+
4. Re-run the operation that surfaced the error.
|
|
115
|
+
|
|
116
|
+
## Defensive workflow
|
|
117
|
+
|
|
118
|
+
- Every edit to an artifact frontmatter should go through \`syncFrontmatter()\` rather than hand-editing whenever possible. The function reads, patches, re-renders, and re-writes atomically.
|
|
119
|
+
- AC entries in frontmatter are arrays of objects; do not collapse them to one-line strings.
|
|
120
|
+
- Treat the AC body table and the frontmatter \`ac\` array as the same data; \`mergeAcceptanceCriteria()\` keeps them aligned.
|
|
121
|
+
|
|
122
|
+
## What not to do
|
|
123
|
+
|
|
124
|
+
- Do not delete the frontmatter and rewrite from scratch when only one field is wrong; you lose history (review_iterations, last_specialist).
|
|
125
|
+
- Do not ignore the parser error and assume the orchestrator will "figure it out". Existing-plan detection silently drops corrupt artifacts.
|
|
126
|
+
`;
|
|
127
|
+
const SCHEMA_MISMATCH = `# Recovery — flow-state schemaVersion mismatch
|
|
128
|
+
|
|
129
|
+
\`/cc\` refuses to run because \`.cclaw/state/flow-state.json\` carries \`schemaVersion: 1\` (cclaw 7.x) instead of \`schemaVersion: 2\`.
|
|
130
|
+
|
|
131
|
+
## Symptoms
|
|
132
|
+
|
|
133
|
+
- \`/cc\` prints: "This project's flow-state.json is from cclaw 7.x. cclaw v8 cannot resume it."
|
|
134
|
+
- \`commit-helper.mjs\` refuses to record commits with \`schemaVersion mismatch\`.
|
|
135
|
+
|
|
136
|
+
## Recovery options
|
|
137
|
+
|
|
138
|
+
The orchestrator surfaces three options. Pick one explicitly:
|
|
139
|
+
|
|
140
|
+
### (a) Finish or abandon the run with cclaw 7.x
|
|
141
|
+
|
|
142
|
+
If you have an in-flight 7.x run and want to ship it, do that first. After ship, the active state is reset and the project can install cclaw v8 cleanly.
|
|
143
|
+
|
|
144
|
+
### (b) Delete \`.cclaw/state/flow-state.json\` and start fresh
|
|
145
|
+
|
|
146
|
+
For projects that are not mid-run, this is the right answer. The artifacts under \`.cclaw/flows/<slug>/\` are not deleted; only the state file is.
|
|
147
|
+
|
|
148
|
+
\`\`\`bash
|
|
149
|
+
rm .cclaw/state/flow-state.json
|
|
150
|
+
npx cclaw-cli sync
|
|
151
|
+
\`\`\`
|
|
152
|
+
|
|
153
|
+
\`cclaw sync\` writes a fresh \`flow-state.json\` with \`schemaVersion: 2\`.
|
|
154
|
+
|
|
155
|
+
### (c) Leave it alone
|
|
156
|
+
|
|
157
|
+
If you want to continue using cclaw 7.x for now, do not run any v8 \`/cc\` commands. Pin the toolkit version in your project to \`7.7.1\`.
|
|
158
|
+
|
|
159
|
+
## What not to do
|
|
160
|
+
|
|
161
|
+
- Do not edit the \`schemaVersion\` field by hand. Version 2 has different fields than version 1; mismatched fields fail validation downstream.
|
|
162
|
+
- Do not delete the artifacts under \`.cclaw/flows/<slug>/\` — they survive the version transition; only the state file does not.
|
|
163
|
+
- Do not run \`cclaw-cli upgrade\` while a 7.x run is mid-flight. Finish the run first.
|
|
164
|
+
`;
|
|
165
|
+
export const RECOVERY_PLAYBOOKS = [
|
|
166
|
+
{ id: "ac-traceability-break", fileName: "ac-traceability-break.md", title: "Recovery — AC traceability broken", body: AC_TRACEABILITY_BREAK },
|
|
167
|
+
{ id: "review-cap-reached", fileName: "review-cap-reached.md", title: "Recovery — review hard cap reached", body: REVIEW_CAP_REACHED },
|
|
168
|
+
{ id: "parallel-build-conflict", fileName: "parallel-build-conflict.md", title: "Recovery — parallel-build slice conflict", body: PARALLEL_BUILD_CONFLICT },
|
|
169
|
+
{ id: "frontmatter-corruption", fileName: "frontmatter-corruption.md", title: "Recovery — frontmatter corruption", body: FRONTMATTER_CORRUPTION },
|
|
170
|
+
{ id: "schema-mismatch", fileName: "schema-mismatch.md", title: "Recovery — flow-state schemaVersion mismatch", body: SCHEMA_MISMATCH }
|
|
171
|
+
];
|
|
172
|
+
export const RECOVERY_INDEX = `# .cclaw/lib/recovery/
|
|
173
|
+
|
|
174
|
+
Recovery playbooks for the most common failure modes. The orchestrator opens these when an automated check fails or when a specialist asks for guidance.
|
|
175
|
+
|
|
176
|
+
| playbook | symptom |
|
|
177
|
+
| --- | --- |
|
|
178
|
+
${RECOVERY_PLAYBOOKS.map((p) => `| [\`${p.fileName}\`](./${p.fileName}) | ${p.title.replace(/^Recovery — /u, "")} |`).join("\n")}
|
|
179
|
+
`;
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import type { FlowStage } from "../types.js";
|
|
2
|
-
export interface ReferencePatternContract {
|
|
3
|
-
stage: FlowStage;
|
|
4
|
-
guidance: string[];
|
|
5
|
-
artifactSections: string[];
|
|
6
|
-
}
|
|
7
1
|
export interface ReferencePattern {
|
|
8
2
|
id: string;
|
|
3
|
+
fileName: string;
|
|
9
4
|
title: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
policyNeedles: string[];
|
|
13
|
-
contracts: ReferencePatternContract[];
|
|
5
|
+
triggers: string[];
|
|
6
|
+
body: string;
|
|
14
7
|
}
|
|
15
8
|
export declare const REFERENCE_PATTERNS: ReferencePattern[];
|
|
16
|
-
export declare
|
|
17
|
-
export declare function referencePatternContractsForStage(stage: FlowStage): ReferencePatternContract[];
|
|
18
|
-
export declare function referencePatternPolicyNeedles(stage: FlowStage): string[];
|
|
9
|
+
export declare const REFERENCE_PATTERNS_INDEX: string;
|