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
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import { renderTrackTerminology, trackRenderContext } from "../track-render-context.js";
|
|
2
|
-
// ---------------------------------------------------------------------------
|
|
3
|
-
// TDD — RED → GREEN → REFACTOR cycle (merged test + build)
|
|
4
|
-
// ---------------------------------------------------------------------------
|
|
5
|
-
export const TDD = {
|
|
6
|
-
schemaShape: "v2",
|
|
7
|
-
stage: "tdd",
|
|
8
|
-
complexityTier: "standard",
|
|
9
|
-
skillFolder: "tdd",
|
|
10
|
-
skillName: "tdd",
|
|
11
|
-
skillDescription: "Adaptive vertical-slice TDD cycle: route each feature-atomic implementation unit through inline, single-builder, parallel-builder, or strict-micro execution while preserving RED-first traceability.",
|
|
12
|
-
philosophy: {
|
|
13
|
-
hardGate: "Do NOT merge, ship, or skip review. Follow RED → GREEN → REFACTOR strictly for each plan slice. Do NOT write implementation code before RED tests exist. Do NOT write RED tests before discovering relevant existing tests and impacted contracts. Do NOT skip the REFACTOR step.",
|
|
14
|
-
ironLaw: "NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST — THE RED FAILURE IS THE SPEC.",
|
|
15
|
-
purpose: "Implement features through the TDD cycle: write failing tests, make them pass with minimal code, then refactor.",
|
|
16
|
-
whenToUse: [
|
|
17
|
-
"After plan confirmation",
|
|
18
|
-
"For every behavior change in scope",
|
|
19
|
-
"Before review stage"
|
|
20
|
-
],
|
|
21
|
-
whenNotToUse: [
|
|
22
|
-
"Plan approval is still pending WAIT_FOR_CONFIRM",
|
|
23
|
-
"The change is docs-only and does not alter behavior",
|
|
24
|
-
"The stage intent is review/ship sign-off rather than implementation"
|
|
25
|
-
],
|
|
26
|
-
commonRationalizations: [
|
|
27
|
-
"Writing code before failing test",
|
|
28
|
-
"Partial test runs presented as GREEN",
|
|
29
|
-
"Skipping evidence capture",
|
|
30
|
-
"Undocumented refactor changes",
|
|
31
|
-
"No full-suite GREEN evidence",
|
|
32
|
-
"Multiple tasks implemented in one pass without justification",
|
|
33
|
-
"Skipping test discovery and duplicating an existing test pattern blindly",
|
|
34
|
-
"Ignoring callbacks, state transitions, interfaces, or contract surfaces affected by the slice",
|
|
35
|
-
"Collapsing RED/GREEN/REFACTOR into one unreviewable checkpoint"
|
|
36
|
-
]
|
|
37
|
-
},
|
|
38
|
-
executionModel: {
|
|
39
|
-
checklist: [
|
|
40
|
-
"**Wave discovery:** Entering TDD, first call `node .cclaw/cli.mjs internal wave-status --json`. It parses the managed `<!-- parallel-exec-managed-start -->` block and reports `nextDispatch.topology`, `nextDispatch.mode`, and (when present) `nextDispatch.controllerHint`; read `05-plan.md`/`wave-plans/` only once `wave-status` names work. Restore partial waves by resuming remaining units.",
|
|
41
|
-
"**Topology routing:** Default `auto` + `balanced` means cheapest safe route: lane-aware inline collapse for non-high-risk discovery/scaffold/docs ready sets, single-builder for one feature-atomic unit or large discovery-only batches, parallel-builders only when at least one ready unit is non-discovery and the wave is genuinely independent + substantial, strict-micro for high-risk/configured micro-slice work. The router decides; the controller acts on its output without re-asking the user which slice to take next.",
|
|
42
|
-
"**Record before dispatch:** For every `Task`, write `delegation-record` `--status=scheduled` then `--status=launched` before the tool call. Workers self-record `acknowledged` and `completed`; back-fill is `--repair` only.",
|
|
43
|
-
"**Honor `topology=inline` (controller-inline):** Do NOT use `Task` to dispatch `slice-builder` for inline slices. Write each ready slice's `claimedPaths` and any small file edits yourself, then record lifecycle rows with `--dispatch-surface=role-switch --agent-definition-path=.cclaw/skills/tdd/SKILL.md` (scheduled → completed, with `--evidence-ref` on completion). RED-before-GREEN, AC traceability, path containment, verification-before-completion, lockfile twin handling, managed commit/worktree policy, and orphan-change gates remain intact — the router only changes who does the work, not what evidence is required.",
|
|
44
|
-
"**Honor `topology=single-builder`:** Issue exactly ONE `Task` dispatch that covers ALL currently ready members of the wave. The single `slice-builder` span owns multi-slice TDD: RED → GREEN → REFACTOR (and inline DOC card) for every slice it received. Do not split that ready set into multiple separate Task calls when the router chose `single-builder`.",
|
|
45
|
-
"**Honor `topology=parallel-builders`:** Fan out only when at least one ready unit is non-discovery (router collapses pure discovery-only sets into inline/single-builder per the previous bullets) and `claimedPaths` are disjoint. Emit all parallel `Task` calls in a single controller message and wait for all spans before reconciling.",
|
|
46
|
-
"**Single span owns the delegated unit:** Dispatched `slice-builder` runs RED → GREEN → REFACTOR (separate phase rows or `--refactor-outcome` on GREEN) and authors `<artifacts-dir>/tdd-slices/S-<id>.md`. Follow the agent body and `delegation-record` snippets it embeds.",
|
|
47
|
-
"**Wave closure:** When every slice/unit in the wave has GREEN + REFACTOR coverage, call `integrationCheckRequired`. Dispatch `integration-overseer` when required; otherwise emit `cclaw_integration_overseer_skipped` via `delegation-record --audit-kind=...`.",
|
|
48
|
-
"**Plan triggers:** If the unit row demands extra scrutiny (`touchCount >= filesChangedThreshold`, matching `touchPaths`, or `highRisk`), capture that review posture in `tdd-slices/S-<id>.md` or via a reviewer dispatch before closing the slice.",
|
|
49
|
-
"**Auto-render tables:** Do not hand-edit content between `auto-start: tdd-slice-summary` markers; the linter overwrites them from `delegation-events.jsonl`.",
|
|
50
|
-
"**Active-span collisions:** If scheduling fails with `dispatch_duplicate` / `dispatch_active_span_collision`, identify the live span; use `--allow-parallel` or `--supersede` deliberately. Do not silence errors blindly.",
|
|
51
|
-
],
|
|
52
|
-
interactionProtocol: [
|
|
53
|
-
"Parallel `slice-builder` tasks are allowed only when topology is `parallel-builders` and `claimedPaths` are disjoint; remain serial for dependencies, conflicts, high-risk units, or strict-micro chains. Pure discovery/scaffold/docs ready sets collapse to inline (or single-builder for large batches) — never one worker per markdown spike.",
|
|
54
|
-
"Controller normally orchestrates delegated builders. When topology is `inline` (mode `controller-inline`) it executes the wave's ready slices itself with `--dispatch-surface=role-switch` lifecycle rows, but must satisfy the same RED/GREEN/REFACTOR evidence gates before completion.",
|
|
55
|
-
"Discover existing tests and commands before RED; run a system-wide impact check (callbacks, state, interfaces, contracts) before GREEN.",
|
|
56
|
-
"RED must fail for the right reason; capture logs. GREEN must run the full relevant suite, not a narrow subset.",
|
|
57
|
-
"Before calling a slice done, run verification-before-completion (command + PASS/FAIL + durable commit evidence: managed-per-slice git commits when `.git` is present, or explicit no-VCS attestation + hash).",
|
|
58
|
-
"Integration-overseer must complete with PASS/PASS_WITH_GAPS when fan-out closes a wave unless the controller emits `cclaw_integration_overseer_skipped` for a documented heuristic skip.",
|
|
59
|
-
"Investigation discipline + behavior anchor in this skill govern evidence: cite commands and paths, not pasted source dumps.",
|
|
60
|
-
],
|
|
61
|
-
process: [
|
|
62
|
-
"Map the slice to acceptance criteria; read `ralph-loop.json` for open RED cycles before starting new work.",
|
|
63
|
-
"Discover tests, fixtures, helpers, and commands; record impact on public surfaces.",
|
|
64
|
-
"Read the topology + mode + controllerHint reported by `wave-status --json` and act on them (inline = controller fulfils ready set; single-builder = one Task covers all ready members; parallel-builders = one Task per disjoint ready unit; strict-micro = micro-slice fan-out).",
|
|
65
|
-
"For delegated units, dispatch `slice-builder` for RED (failing tests, no production edits beyond test files).",
|
|
66
|
-
"For delegated units, dispatch the same builder for GREEN with minimal production changes and full-suite evidence.",
|
|
67
|
-
"Close REFACTOR inline, via deferred phase, or `--refactor-outcome` on GREEN — match what `delegation-record` expects.",
|
|
68
|
-
"Keep `tdd-slices/S-<id>.md` aligned with evidence as the builder finishes.",
|
|
69
|
-
"Run fresh verification and attach traceability (plan task + spec criterion).",
|
|
70
|
-
"Return to `wave-status` for the next unit of work.",
|
|
71
|
-
],
|
|
72
|
-
requiredGates: [
|
|
73
|
-
{ id: "tdd_test_discovery_complete", description: "Relevant existing tests, fixtures, helpers, and runnable commands were discovered before RED tests were written." },
|
|
74
|
-
{ id: "tdd_impact_check_complete", description: "Callbacks, state transitions, interfaces, schemas, and contracts affected by the slice were checked before implementation." },
|
|
75
|
-
{ id: "tdd_red_test_written", description: "Failing tests exist before implementation changes." },
|
|
76
|
-
{ id: "tdd_green_full_suite", description: "Full relevant suite passes in GREEN state." },
|
|
77
|
-
{ id: "tdd_refactor_completed", description: "Refactor pass completed with behavior preservation verified." },
|
|
78
|
-
{ id: "tdd_verified_before_complete", description: "Fresh verification evidence includes test command + explicit pass/fail status; when `tdd.commitMode=managed-per-slice` and `.git` exists, closed slices must be backed by real git commits, otherwise provide explicit no-VCS attestation + hash." },
|
|
79
|
-
{ id: "tdd_iron_law_acknowledged", description: "Iron Law acknowledgement is explicit (`Acknowledged: yes`) before implementation proceeds." },
|
|
80
|
-
{ id: "tdd_watched_red_observed", description: "Watched-RED Proof records at least one observed failing test with ISO timestamp evidence." },
|
|
81
|
-
{ id: "tdd_slice_cycle_complete", description: "Vertical Slice Cycle records RED, GREEN, and REFACTOR phases per active slice." },
|
|
82
|
-
{ id: "tdd_slice_closes_ac", description: "Every `tdd-slices/S-<id>.md` card includes valid `Closes: AC-N` links to spec acceptance criteria." },
|
|
83
|
-
{ id: "slice_no_orphan_changes", description: "After `phase=doc`, working tree changes remain inside the slice claimedPaths boundary (worktree root when present)." },
|
|
84
|
-
{ id: "tdd_traceable_to_plan", description: "Change traceability to plan slice is explicit." },
|
|
85
|
-
{ id: "tdd_docs_drift_check", description: "When public API/config/CLI surfaces change, docs drift is addressed via a completed doc-updater pass." }
|
|
86
|
-
],
|
|
87
|
-
requiredEvidence: [
|
|
88
|
-
"Artifact updated at `.cclaw/artifacts/06-tdd.md` with System-Wide Impact Check, Acceptance & Failure Map, REFACTOR Notes, Iron Law Acknowledgement, Verification Ladder, and Learnings.",
|
|
89
|
-
"Relevant existing test files, helpers, fixtures, and exact commands identified before RED.",
|
|
90
|
-
"Callbacks, state transitions, interfaces, schemas, and contracts checked for impact before implementation.",
|
|
91
|
-
"Execution posture for RED/GREEN/REFACTOR recorded (commits or explicit checkpoint notes).",
|
|
92
|
-
"`phase=red` events in `delegation-events.jsonl` with non-empty evidenceRefs for each closed slice; derive the active slice from `wave-status --json`, not from historical flow-state markers.",
|
|
93
|
-
"`phase=green` events with `completedTs` after the matching RED, worker `slice-builder`, evidence pointing at the formerly failing test.",
|
|
94
|
-
"REFACTOR coverage: separate `phase=refactor|refactor-deferred` rows or `refactorOutcome` folded into GREEN as the hook documents.",
|
|
95
|
-
"`tdd-slices/S-<id>.md` kept current with the builder span; phase events remain the ground truth for lint auto-render blocks.",
|
|
96
|
-
"`event: slice-completed` umbrella rows tie RED/GREEN timestamps to the builder once that writer runs on the repo.",
|
|
97
|
-
"Fresh verification (command + PASS/FAIL + managed-per-slice commit proof from git log when `.git` exists, or no-VCS reason + hash); Iron Law acknowledgement; acceptance mapping + traceability IDs.",
|
|
98
|
-
],
|
|
99
|
-
inputs: ["approved plan slice", "spec acceptance criterion", "test harness configuration", "coding standards and constraints"],
|
|
100
|
-
requiredContext: ["plan artifact", "spec artifact", "existing test patterns", "affected contracts and state boundaries"],
|
|
101
|
-
blockers: [
|
|
102
|
-
"test discovery skipped before RED",
|
|
103
|
-
"system-wide impact check missing for callbacks/state/interfaces/contracts",
|
|
104
|
-
"tests pass before behavior change (RED failure missing)",
|
|
105
|
-
"full suite not green",
|
|
106
|
-
"behavior changed during refactor",
|
|
107
|
-
"no evidence recorded",
|
|
108
|
-
"RED/GREEN blocked — classify with the managed taxonomy `NO_SOURCE_CONTEXT`, `NO_TEST_SURFACE`, `NO_IMPLEMENTABLE_SLICE`, `RED_NOT_EXPRESSIBLE`, or `NO_VCS_MODE` and capture blockedBecause, missingInputs, recommendedRoute, nextCommand, resumeCriteria, and the repair path: RED needs a failing test surface, GREEN needs full-suite pass evidence, REFACTOR needs behavior-preservation evidence.",
|
|
109
|
-
"no-VCS workspace without explicit no-vcs reason and content/artifact hash"
|
|
110
|
-
],
|
|
111
|
-
exitCriteria: [
|
|
112
|
-
"test discovery and system-wide impact check are recorded",
|
|
113
|
-
"RED evidence exists and is traceable",
|
|
114
|
-
"GREEN evidence captured with full suite pass",
|
|
115
|
-
"REFACTOR evidence captured",
|
|
116
|
-
"required gates marked satisfied",
|
|
117
|
-
"traceability annotated"
|
|
118
|
-
],
|
|
119
|
-
platformNotes: [
|
|
120
|
-
"Record the **exact** test command run (`npm test -- path/to/file`, `pytest path/to/file`, `go test ./...`) so RED/GREEN evidence is reproducible on any OS. Do not paraphrase to a shorter alias.",
|
|
121
|
-
"Line-ending drift (CRLF vs LF) can turn a passing test red on Windows if the repo mixes styles. When a GREEN flip happens only after whitespace normalization, record it as a refactor note, not a hidden fix.",
|
|
122
|
-
"When invoking a test file path from Windows PowerShell, use forward slashes (`npm test -- tests/foo.test.ts`) — backslashes trip globbing on `cross-env` and similar wrappers.",
|
|
123
|
-
"Flaky tests that only fail on one OS must be marked as such in the TDD artifact (OS + runner + one failing output snippet) — do not retry until green without evidence."
|
|
124
|
-
]
|
|
125
|
-
},
|
|
126
|
-
artifactRules: {
|
|
127
|
-
artifactFile: "06-tdd.md",
|
|
128
|
-
completionStatus: ["DONE", "DONE_WITH_CONCERNS", "BLOCKED"],
|
|
129
|
-
crossStageTrace: {
|
|
130
|
-
readsFrom: [".cclaw/artifacts/05-plan.md", ".cclaw/artifacts/04-spec.md", ".cclaw/artifacts/03-design-<slug>.md"],
|
|
131
|
-
writesTo: [".cclaw/artifacts/06-tdd.md"],
|
|
132
|
-
traceabilityRule: "Every RED test traces to a plan task. Every GREEN change traces to a RED test. Every plan task traces to a spec criterion. Design decisions inform test strategy. Evidence chain must be unbroken."
|
|
133
|
-
},
|
|
134
|
-
artifactValidation: [
|
|
135
|
-
{ section: "Upstream Handoff", required: false, validationRule: "Summarizes plan/spec/design decisions, constraints, open questions, and explicit drift before RED work." },
|
|
136
|
-
{ section: "System-Wide Impact Check", required: true, validationRule: "Before implementation: names affected callbacks, state transitions, interfaces, schemas, public APIs/config/CLI, persistence, or event contracts, with coverage or explicit out-of-scope notes." },
|
|
137
|
-
{ section: "RED Evidence", required: true, validationRule: "Failing test output per slice. Auto-satisfied when `delegation-events.jsonl` has a `phase=red` row with non-empty evidenceRefs; otherwise the markdown section must document the failure." },
|
|
138
|
-
{ section: "Acceptance & Failure Map", required: false, validationRule: "Each slice row carries Source ID, AC ID, expected behavior, and a RED-link; slice phase events can satisfy the RED-link column." },
|
|
139
|
-
{ section: "GREEN Evidence", required: true, validationRule: "Full suite pass output. Auto-satisfied when `phase=green` rows exist with evidence; otherwise keep markdown proof." },
|
|
140
|
-
{ section: "REFACTOR Notes", required: true, validationRule: "What changed, why, behavior preservation confirmed." },
|
|
141
|
-
{ section: "Traceability", required: true, validationRule: "Plan task ID and spec criterion linked." },
|
|
142
|
-
{ section: "Iron Law Acknowledgement", required: true, validationRule: "Must include `Acknowledged: yes` and list exceptions (or `None`)." },
|
|
143
|
-
{ section: "Verification Ladder", required: true, validationRule: "Per-slice verification tier (static, command, behavioral, human) with evidence captured for the highest tier reached this turn. Must include command + PASS/FAIL and durable commit evidence: managed-per-slice git commit proof when VCS is present, or explicit no-vcs reason plus content/artifact hash/config override." },
|
|
144
|
-
{ section: "TDD Blocker Taxonomy", required: false, validationRule: "When blocked, classify as NO_SOURCE_CONTEXT, NO_TEST_SURFACE, NO_IMPLEMENTABLE_SLICE, RED_NOT_EXPRESSIBLE, or NO_VCS_MODE; include blockedBecause, missingInputs, recommendedRoute, nextCommand, and resumeCriteria." }
|
|
145
|
-
]
|
|
146
|
-
},
|
|
147
|
-
reviewLens: {
|
|
148
|
-
outputs: ["failing test set", "passing implementation", "refactor evidence", "review-ready change set"],
|
|
149
|
-
reviewSections: [
|
|
150
|
-
{
|
|
151
|
-
title: "RED Evidence Audit",
|
|
152
|
-
evaluationPoints: [
|
|
153
|
-
"Did every slice discover relevant existing tests, helpers, fixtures, and commands before adding RED coverage?",
|
|
154
|
-
"Does the system-wide impact check cover callbacks, state transitions, interfaces, schemas, and public contracts touched by the slice?",
|
|
155
|
-
"Does every slice have a captured failing test output?",
|
|
156
|
-
"Does each failure reason match the expected missing behavior (not a typo or config error)?",
|
|
157
|
-
"Were tests written BEFORE any production code for that slice?",
|
|
158
|
-
"Does each RED test assert observable behavior, not implementation details?",
|
|
159
|
-
"Is there a test for each acceptance criterion mapped in the plan?"
|
|
160
|
-
],
|
|
161
|
-
stopGate: true
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
title: "GREEN/REFACTOR Audit",
|
|
165
|
-
evaluationPoints: [
|
|
166
|
-
"Does GREEN evidence show a FULL suite pass (not partial)?",
|
|
167
|
-
"Is the GREEN implementation minimal — no features beyond what RED tests require?",
|
|
168
|
-
"Do checkpoint notes or commits keep RED, GREEN, and REFACTOR reviewable according to the repository git workflow?",
|
|
169
|
-
"Does the REFACTOR step preserve all existing behavior (no new failures)?",
|
|
170
|
-
"Are REFACTOR notes documented with rationale?",
|
|
171
|
-
"Is traceability complete: every change links to plan task ID and spec criterion?"
|
|
172
|
-
],
|
|
173
|
-
stopGate: true
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
title: "State-over-Interaction + Beyoncé Coverage",
|
|
177
|
-
evaluationPoints: [
|
|
178
|
-
"Do assertions target observable state (return values, persisted data, HTTP responses, logs) rather than which internal helpers were called?",
|
|
179
|
-
"Are mocks/spies used only at true trust boundaries (network, filesystem, time, external services), not for module-internal collaborators?",
|
|
180
|
-
"For every public surface touched in this slice (exported API, CLI flag, config key, env var, exit code, schema field) — does at least one test observe it?",
|
|
181
|
-
"If a bug or review finding revealed an uncovered surface, was a test added alongside the fix, not just the code change?",
|
|
182
|
-
"Are interaction-style assertions (e.g. `toHaveBeenCalledWith` without a state assertion) justified by an explicit boundary comment, or flagged for follow-up?"
|
|
183
|
-
],
|
|
184
|
-
stopGate: false
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
title: "Per-Slice Review Audit (conditional)",
|
|
188
|
-
evaluationPoints: [
|
|
189
|
-
"When `touchCount >= filesChangedThreshold`, `touchPaths` match a trigger glob, or `highRisk=true`, capture a focused pass (spec ↔ plan ↔ evidence + diff quality) in `tdd-slices/S-<id>.md` or dispatch `reviewer` before closing the slice."
|
|
190
|
-
],
|
|
191
|
-
stopGate: false
|
|
192
|
-
}
|
|
193
|
-
]
|
|
194
|
-
},
|
|
195
|
-
next: "review",
|
|
196
|
-
batchExecutionAllowed: true
|
|
197
|
-
};
|
|
198
|
-
function tddStageVariantForTrack(track) {
|
|
199
|
-
const renderContext = trackRenderContext(track);
|
|
200
|
-
if (renderContext.usesPlanTerminology) {
|
|
201
|
-
return TDD;
|
|
202
|
-
}
|
|
203
|
-
return {
|
|
204
|
-
...TDD,
|
|
205
|
-
skillDescription: renderTrackTerminology(TDD.skillDescription, renderContext),
|
|
206
|
-
philosophy: {
|
|
207
|
-
...TDD.philosophy,
|
|
208
|
-
hardGate: renderTrackTerminology(TDD.philosophy.hardGate, renderContext),
|
|
209
|
-
purpose: renderTrackTerminology(TDD.philosophy.purpose, renderContext),
|
|
210
|
-
whenToUse: TDD.philosophy.whenToUse.map((value) => renderTrackTerminology(value, renderContext)),
|
|
211
|
-
whenNotToUse: TDD.philosophy.whenNotToUse.map((value) => renderTrackTerminology(value, renderContext)),
|
|
212
|
-
commonRationalizations: TDD.philosophy.commonRationalizations
|
|
213
|
-
.map((value) => renderTrackTerminology(value, renderContext))
|
|
214
|
-
},
|
|
215
|
-
executionModel: {
|
|
216
|
-
...TDD.executionModel,
|
|
217
|
-
checklist: TDD.executionModel.checklist.map((value) => renderTrackTerminology(value, renderContext)),
|
|
218
|
-
interactionProtocol: TDD.executionModel.interactionProtocol
|
|
219
|
-
.map((value) => renderTrackTerminology(value, renderContext)),
|
|
220
|
-
process: TDD.executionModel.process.map((value) => renderTrackTerminology(value, renderContext)),
|
|
221
|
-
requiredGates: TDD.executionModel.requiredGates
|
|
222
|
-
.filter((gate) => gate.id !== "tdd_traceable_to_plan")
|
|
223
|
-
.map((gate) => ({
|
|
224
|
-
...gate,
|
|
225
|
-
description: renderTrackTerminology(gate.description, renderContext)
|
|
226
|
-
})),
|
|
227
|
-
requiredEvidence: TDD.executionModel.requiredEvidence
|
|
228
|
-
.map((value) => renderTrackTerminology(value, renderContext)),
|
|
229
|
-
inputs: TDD.executionModel.inputs.map((value) => renderTrackTerminology(value, renderContext)),
|
|
230
|
-
requiredContext: [renderContext.upstreamArtifactLabel, "existing test patterns", "affected contracts and state boundaries"],
|
|
231
|
-
blockers: TDD.executionModel.blockers.map((value) => renderTrackTerminology(value, renderContext)),
|
|
232
|
-
exitCriteria: TDD.executionModel.exitCriteria.map((value) => renderTrackTerminology(value, renderContext))
|
|
233
|
-
},
|
|
234
|
-
reviewLens: {
|
|
235
|
-
...TDD.reviewLens,
|
|
236
|
-
reviewSections: TDD.reviewLens.reviewSections.map((section) => ({
|
|
237
|
-
...section,
|
|
238
|
-
evaluationPoints: section.evaluationPoints
|
|
239
|
-
.map((point) => renderTrackTerminology(point, renderContext))
|
|
240
|
-
}))
|
|
241
|
-
},
|
|
242
|
-
artifactRules: {
|
|
243
|
-
...TDD.artifactRules,
|
|
244
|
-
crossStageTrace: {
|
|
245
|
-
...TDD.artifactRules.crossStageTrace,
|
|
246
|
-
readsFrom: [renderContext.upstreamArtifactPath],
|
|
247
|
-
traceabilityRule: "Every RED test traces to an acceptance criterion. Every GREEN change traces to a RED test. Evidence chain must be unbroken."
|
|
248
|
-
},
|
|
249
|
-
artifactValidation: TDD.artifactRules.artifactValidation.map((row) => {
|
|
250
|
-
if (row.section === "Acceptance & Failure Map") {
|
|
251
|
-
return {
|
|
252
|
-
...row,
|
|
253
|
-
required: true,
|
|
254
|
-
validationRule: "Each slice row carries Source ID, AC ID (spec acceptance criterion ID, for example AC-1), expected behavior, and a RED-link (delegation spanId or evidence path). A `phase=red` row in `delegation-events.jsonl` with non-empty evidenceRefs can satisfy the RED-link column."
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
if (row.section === "Traceability") {
|
|
258
|
-
return {
|
|
259
|
-
...row,
|
|
260
|
-
validationRule: "Spec acceptance item IDs and, for bug fixes, reproduction slice IDs are linked to RED/GREEN evidence."
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
return {
|
|
264
|
-
...row,
|
|
265
|
-
validationRule: renderTrackTerminology(row.validationRule, renderContext)
|
|
266
|
-
};
|
|
267
|
-
})
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
export function tddStageForTrack(track) {
|
|
272
|
-
return tddStageVariantForTrack(track);
|
|
273
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const STATE_CONTRACTS: Record<string, string>;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { CCLAW_VERSION, RUNTIME_ROOT, SHIP_FINALIZATION_MODES } from "../constants.js";
|
|
2
|
-
import { FLOW_STAGES } from "../types.js";
|
|
3
|
-
const REQUIRED_TOP_LEVEL_FIELDS = {
|
|
4
|
-
brainstorm: ["stage", "selectedDirection", "approachTier", "approaches", "approval", "nextStageHandoff"],
|
|
5
|
-
scope: ["stage", "scopeMode", "requirements", "lockedDecisions", "scopeSummary", "nextStageHandoff"],
|
|
6
|
-
design: ["stage", "architecture", "dataFlow", "failureModes", "requirementRefs", "decisionRefs"],
|
|
7
|
-
spec: ["stage", "acceptanceCriteria", "requirementRefs", "designDecisionRefs"],
|
|
8
|
-
plan: ["stage", "tasks", "acceptanceCriteriaRefs", "requirementRefs", "decisionRefs", "verificationCommands"],
|
|
9
|
-
tdd: ["stage", "redEvidence", "greenEvidence", "acceptanceCriteriaRefs", "verificationCommands"],
|
|
10
|
-
review: ["stage", "finalVerdict", "findings", "acceptanceCriteriaRefs", "requirementRefs", "verificationCommands"],
|
|
11
|
-
ship: ["stage", "finalizationMode", "verificationSummary", "releaseNotesDraft"]
|
|
12
|
-
};
|
|
13
|
-
const STAGE_TAXONOMIES = {
|
|
14
|
-
brainstorm: {
|
|
15
|
-
approachTier: ["Lightweight", "Standard", "Deep", "lite", "standard", "deep"],
|
|
16
|
-
approachRole: ["baseline", "challenger", "wild-card"],
|
|
17
|
-
approachUpside: ["low", "modest", "high", "higher"]
|
|
18
|
-
},
|
|
19
|
-
scope: {
|
|
20
|
-
scopeMode: ["SCOPE EXPANSION", "SELECTIVE EXPANSION", "HOLD SCOPE", "SCOPE REDUCTION"],
|
|
21
|
-
priority: ["P0", "P1", "P2", "P3", "DROPPED"]
|
|
22
|
-
},
|
|
23
|
-
design: {
|
|
24
|
-
diagramTier: ["lightweight", "standard", "deep"],
|
|
25
|
-
edgeKind: ["sync", "async", "failure", "degraded"]
|
|
26
|
-
},
|
|
27
|
-
spec: {
|
|
28
|
-
priority: ["P0", "P1", "P2", "P3", "DROPPED"]
|
|
29
|
-
},
|
|
30
|
-
plan: {
|
|
31
|
-
taskStatus: ["pending", "in_progress", "blocked", "done", "dropped"]
|
|
32
|
-
},
|
|
33
|
-
tdd: {
|
|
34
|
-
cycleState: ["RED", "GREEN", "REFACTOR", "BLOCKED"]
|
|
35
|
-
},
|
|
36
|
-
review: {
|
|
37
|
-
finalVerdict: ["APPROVED", "APPROVED_WITH_CONCERNS", "BLOCKED"],
|
|
38
|
-
findingSeverity: ["Critical", "High", "Medium", "Low", "Info"]
|
|
39
|
-
},
|
|
40
|
-
ship: {
|
|
41
|
-
finalizationMode: [...SHIP_FINALIZATION_MODES]
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
function stateContract(stage) {
|
|
45
|
-
const stageIndex = FLOW_STAGES.indexOf(stage) + 1;
|
|
46
|
-
const stageNumber = String(stageIndex).padStart(2, "0");
|
|
47
|
-
return {
|
|
48
|
-
schemaVersion: 1,
|
|
49
|
-
contractId: `cclaw-${stage}-state`,
|
|
50
|
-
stage,
|
|
51
|
-
derivedMarkdownPath: `${RUNTIME_ROOT}/artifacts/${stageNumber}-${stage}.md`,
|
|
52
|
-
requiredTopLevelFields: REQUIRED_TOP_LEVEL_FIELDS[stage],
|
|
53
|
-
taxonomies: STAGE_TAXONOMIES[stage]
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
export const STATE_CONTRACTS = Object.fromEntries(FLOW_STAGES.map((stage) => [
|
|
57
|
-
`${stage}.json`,
|
|
58
|
-
`${JSON.stringify({
|
|
59
|
-
...stateContract(stage),
|
|
60
|
-
generatedBy: "cclaw",
|
|
61
|
-
cclawVersion: CCLAW_VERSION
|
|
62
|
-
}, null, 2)}\n`
|
|
63
|
-
]));
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { RUNTIME_ROOT } from "../constants.js";
|
|
2
|
-
function flowStatePath() {
|
|
3
|
-
return `${RUNTIME_ROOT}/state/flow-state.json`;
|
|
4
|
-
}
|
|
5
|
-
function delegationLogPath() {
|
|
6
|
-
return `${RUNTIME_ROOT}/state/delegation-log.json`;
|
|
7
|
-
}
|
|
8
|
-
function delegationEventsPath() {
|
|
9
|
-
return `${RUNTIME_ROOT}/state/delegation-events.jsonl`;
|
|
10
|
-
}
|
|
11
|
-
function subagentsPath() {
|
|
12
|
-
return `${RUNTIME_ROOT}/state/subagents.json`;
|
|
13
|
-
}
|
|
14
|
-
function knowledgePath() {
|
|
15
|
-
return `${RUNTIME_ROOT}/knowledge.jsonl`;
|
|
16
|
-
}
|
|
17
|
-
function retroArtifactPath() {
|
|
18
|
-
return `${RUNTIME_ROOT}/artifacts/09-retro.md`;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Body for /cc-view status — read-only status snapshot embedded in flow-view.
|
|
22
|
-
*/
|
|
23
|
-
export function statusSubcommandMarkdown() {
|
|
24
|
-
const flowPath = flowStatePath();
|
|
25
|
-
const delegationPath = delegationLogPath();
|
|
26
|
-
return `# /cc-view status — Flow Status Snapshot
|
|
27
|
-
|
|
28
|
-
## Overview
|
|
29
|
-
|
|
30
|
-
\`/cc-view status\` is the quickest way to answer "where are we in the flow?" without
|
|
31
|
-
advancing or mutating anything. Treat it as an operator note, not a JSON dump:
|
|
32
|
-
progress, blockers, risks, next action, and human-readable gate/delegation/closeout labels. Safe to run at any point. The snapshot reflects:
|
|
33
|
-
|
|
34
|
-
- progress across stages with per-stage markers,
|
|
35
|
-
- gate coverage,
|
|
36
|
-
- mandatory delegations with **fulfillmentMode** (isolated / generic-dispatch /
|
|
37
|
-
role-switch), dispatch proof fields, explicit waived status, and evidence gate,
|
|
38
|
-
- **closeout substate** after ship (retro → compound → archive),
|
|
39
|
-
- **harness parity row** (tier + fallback) for the active harness set.
|
|
40
|
-
|
|
41
|
-
## HARD-GATE
|
|
42
|
-
|
|
43
|
-
Do **not** mutate \`${flowPath}\` or \`${delegationPath}\` from this skill. This is
|
|
44
|
-
a read-only command.
|
|
45
|
-
|
|
46
|
-
## Algorithm
|
|
47
|
-
|
|
48
|
-
1. Read \`${flowPath}\`. If missing → report **BLOCKED: flow state absent** and suggest \`npx cclaw-cli init\`.
|
|
49
|
-
2. Read \`${delegationPath}\`. Missing → treat all mandatory delegations as pending.
|
|
50
|
-
3. Render **time in stage** as \`(unknown)\` unless visible conversation or
|
|
51
|
-
artifact handoff context gives a timestamp.
|
|
52
|
-
4. Summarize current-stage gate counts from \`passed\`, \`blocked\`, and required gate metadata.
|
|
53
|
-
5. Derive harness \`<tier>/<fallback>\` rows from cclaw capability metadata.
|
|
54
|
-
6. Read \`${RUNTIME_ROOT}/knowledge.jsonl\`. If missing or empty → knowledge highlights are \`(none recorded)\`. Parse each line as JSON and surface its \`trigger\`/\`action\`.
|
|
55
|
-
7. For each gate in \`stageGateCatalog[currentStage].required\`:
|
|
56
|
-
- Satisfied if present in \`passed\` and absent from \`blocked\`.
|
|
57
|
-
8. For each mandatory delegation of the current stage, evaluate:
|
|
58
|
-
- \`✓ completed\` when \`status === "completed"\` and (harness is not role-switch
|
|
59
|
-
**or** \`evidenceRefs.length >= 1\`).
|
|
60
|
-
- \`◎ missing-evidence\` when \`status === "completed"\`, harness declares
|
|
61
|
-
\`role-switch\`, and \`evidenceRefs\` is empty or absent.
|
|
62
|
-
- \`○ <status>\` for \`scheduled\` / pending.
|
|
63
|
-
- \`⊘ waived\` when \`status === "waived"\`.
|
|
64
|
-
- \`✗ failed\` when \`status === "failed"\`.
|
|
65
|
-
9. Compute **closeout row** when \`currentStage === "ship"\` or
|
|
66
|
-
\`closeout.shipSubstate !== "idle"\`:
|
|
67
|
-
- \`shipSubstate\` verbatim,
|
|
68
|
-
- \`retro=drafted|accepted|skipped|—\` derived from \`closeout.retroDraftedAt\`,
|
|
69
|
-
\`closeout.retroAcceptedAt\`, \`closeout.retroSkipped\`,
|
|
70
|
-
- \`compound=<N promoted>|skipped|—\` from
|
|
71
|
-
\`closeout.compoundPromoted\` / \`closeout.compoundSkipped\`.
|
|
72
|
-
10. Build and print the visual status block:
|
|
73
|
-
- stage header
|
|
74
|
-
- one-line progress bar with per-stage markers
|
|
75
|
-
- gate summary
|
|
76
|
-
- delegation rows (per mandatory agent)
|
|
77
|
-
- closeout row (when active)
|
|
78
|
-
- harness row
|
|
79
|
-
- stale stage row
|
|
80
|
-
11. Suggest the next action:
|
|
81
|
-
- If current stage has unmet gates -> \`/cc\` to resume.
|
|
82
|
-
- If a mandatory delegation is missing evidence -> dispatch the worker/reviewer or waive with rationale; do not advance silently.
|
|
83
|
-
- If a TDD blocker taxonomy code is present (\`NO_SOURCE_CONTEXT\`, \`NO_TEST_SURFACE\`, \`NO_IMPLEMENTABLE_SLICE\`, \`RED_NOT_EXPRESSIBLE\`, \`NO_VCS_MODE\`) -> name the blocker and the rewind/config route.
|
|
84
|
-
- If review is blocked by critical findings -> show \`npx cclaw-cli internal rewind tdd "review_blocked_by_critical <finding-ids>"\` plus the later \`npx cclaw-cli internal rewind --ack tdd\`.
|
|
85
|
-
- If closeout substate is non-idle -> \`/cc\` to continue the chain.
|
|
86
|
-
- If current stage is complete -> \`/cc\` to advance (or report "Flow complete" if terminal).
|
|
87
|
-
|
|
88
|
-
## Output Guidelines
|
|
89
|
-
|
|
90
|
-
- Keep output compact (≤ 40 lines) — status, not narrative.
|
|
91
|
-
- Start with the same operator rows as \`/cc\` when possible:
|
|
92
|
-
\`Current\`, \`Stage\`, \`Progress\`, \`Gates\`, \`Delegations\`, \`Risks\`, \`Blocked by\`, \`Next\`, \`Evidence needed\`. Use labels like \`gate: tdd_green_full_suite\`, \`delegation proof: reviewer evidenceRefs\`, and \`closeout: post_ship_review\` instead of raw JSON tone.
|
|
93
|
-
- When blocked, include a plain-English action block:
|
|
94
|
-
\`Current: <stage or closeout substate>\`; \`Blocked by: <gate/delegation/blocker code>\`; \`Next: <exact command or managed remediation>\`; \`Evidence needed: <artifact/test/review/delegation evidence>\`.
|
|
95
|
-
- Report counts, not full artifact contents. Include active subagent count from \`${subagentsPath()}\` and proof gaps from \`${delegationEventsPath()}\` when present. Convert gate/delegation state into human labels: \`passed\`, \`blocked\`, \`missing proof\`, \`waived with reason\`, \`stale\`, \`ready to advance\`, or the closeout substate label.
|
|
96
|
-
- If any data source is missing or corrupt, say so explicitly rather than guessing.
|
|
97
|
-
- Include \`/cc-view tree\` for deep structure and \`/cc-view diff\` for before/after map in the final line.
|
|
98
|
-
|
|
99
|
-
## Anti-patterns
|
|
100
|
-
|
|
101
|
-
- Re-running heavy artifact workflows from \`/cc-view status\` — status is read-only and should not trigger sync or mutation paths.
|
|
102
|
-
- Treating absence of delegation log as "all delegations complete".
|
|
103
|
-
- Collapsing \`◎ missing-evidence\` into \`✓ completed\` — role-switch gaps must stay
|
|
104
|
-
visible so the stage cannot advance silently.
|
|
105
|
-
- Omitting the closeout row when \`shipSubstate !== "idle"\`; it is the only signal
|
|
106
|
-
that tells the user why \`/cc\` is about to run post-ship closeout/archive.
|
|
107
|
-
- Mutating state to "clean up" during a status check.
|
|
108
|
-
`;
|
|
109
|
-
}
|