cclaw-cli 0.12.0 → 0.14.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/dist/cli.d.ts +2 -0
- package/dist/cli.js +25 -1
- package/dist/config.js +19 -8
- package/dist/constants.d.ts +2 -2
- package/dist/constants.js +16 -1
- package/dist/content/archive-command.d.ts +2 -0
- package/dist/content/archive-command.js +98 -0
- package/dist/content/contracts.js +1 -1
- package/dist/content/diff-command.d.ts +2 -0
- package/dist/content/diff-command.js +83 -0
- package/dist/content/feature-command.d.ts +2 -0
- package/dist/content/feature-command.js +120 -0
- package/dist/content/harnesses-doc.js +11 -0
- package/dist/content/hooks.js +48 -2
- package/dist/content/learnings.d.ts +0 -2
- package/dist/content/learnings.js +4 -33
- package/dist/content/meta-skill.js +4 -2
- package/dist/content/next-command.js +18 -9
- package/dist/content/observe.d.ts +5 -1
- package/dist/content/observe.js +134 -2
- package/dist/content/ops-command.d.ts +2 -0
- package/dist/content/ops-command.js +60 -0
- package/dist/content/protocols.js +14 -2
- package/dist/content/retro-command.d.ts +2 -0
- package/dist/content/retro-command.js +77 -0
- package/dist/content/rewind-command.d.ts +3 -0
- package/dist/content/rewind-command.js +120 -0
- package/dist/content/skills.js +2 -0
- package/dist/content/stage-common-guidance.js +2 -1
- package/dist/content/status-command.js +43 -35
- package/dist/content/tdd-log-command.d.ts +2 -0
- package/dist/content/tdd-log-command.js +75 -0
- package/dist/content/templates.d.ts +1 -1
- package/dist/content/templates.js +36 -6
- package/dist/content/tree-command.d.ts +2 -0
- package/dist/content/tree-command.js +91 -0
- package/dist/content/utility-skills.js +1 -1
- package/dist/content/view-command.d.ts +2 -0
- package/dist/content/view-command.js +57 -0
- package/dist/doctor-registry.js +3 -3
- package/dist/doctor.js +149 -3
- package/dist/feature-system.d.ts +18 -0
- package/dist/feature-system.js +247 -0
- package/dist/flow-state.d.ts +25 -0
- package/dist/flow-state.js +8 -1
- package/dist/harness-adapters.js +95 -4
- package/dist/install.js +44 -2
- package/dist/policy.js +22 -0
- package/dist/runs.d.ts +33 -1
- package/dist/runs.js +365 -6
- package/dist/tdd-cycle.d.ts +22 -0
- package/dist/tdd-cycle.js +82 -0
- package/dist/types.d.ts +4 -2
- package/package.json +1 -1
|
@@ -19,6 +19,9 @@ function checkpointPath() {
|
|
|
19
19
|
function stageActivityPath() {
|
|
20
20
|
return `${RUNTIME_ROOT}/state/stage-activity.jsonl`;
|
|
21
21
|
}
|
|
22
|
+
function snapshotPath() {
|
|
23
|
+
return `${RUNTIME_ROOT}/state/flow-state.snapshot.json`;
|
|
24
|
+
}
|
|
22
25
|
/**
|
|
23
26
|
* Command contract for /cc-status — a read-only snapshot command.
|
|
24
27
|
* Does not mutate state. Always safe to run.
|
|
@@ -30,8 +33,8 @@ export function statusCommandContract() {
|
|
|
30
33
|
|
|
31
34
|
## Purpose
|
|
32
35
|
|
|
33
|
-
**Read-only snapshot of the cclaw run.** Shows
|
|
34
|
-
gate coverage,
|
|
36
|
+
**Read-only visual snapshot of the cclaw run.** Shows progress bar, current stage,
|
|
37
|
+
gate coverage, delegation status, stale markers, and top knowledge highlights.
|
|
35
38
|
|
|
36
39
|
This command **never mutates state**. Use it at session start to orient, or at any
|
|
37
40
|
time to answer "where are we?" without advancing the flow.
|
|
@@ -41,6 +44,7 @@ time to answer "where are we?" without advancing the flow.
|
|
|
41
44
|
- **Do not** use \`/cc-status\` output to infer gate completion for decisions — cite
|
|
42
45
|
artifact evidence via \`/cc-next\` when advancing.
|
|
43
46
|
- **Do not** mutate \`${flowPath}\` or delegation log from this command.
|
|
47
|
+
- **Do not** rewrite \`${snapshotPath()}\` from this command (use \`/cc-diff\`).
|
|
44
48
|
|
|
45
49
|
## Algorithm
|
|
46
50
|
|
|
@@ -54,38 +58,32 @@ time to answer "where are we?" without advancing the flow.
|
|
|
54
58
|
- Otherwise scan \`${stageActivityPath()}\` from the end for the first entry whose \`stage\` matches \`currentStage\` and use its \`ts\`.
|
|
55
59
|
- Compute the duration as \`now - signalTimestamp\` and render compactly: \`<X>m\`, \`<X>h<Y>m\`, or \`<X>d<Y>h\`.
|
|
56
60
|
- If no signal exists, render \`(unknown)\`.
|
|
57
|
-
5.
|
|
61
|
+
5. Optionally read **\`${snapshotPath()}\`** to compute gate delta versus prior baseline:
|
|
62
|
+
- If missing or invalid, render \`delta: (baseline unavailable; run /cc-diff)\`.
|
|
63
|
+
6. Read the top of **\`${knowledgePath}\`** — surface up to 3 most recent entries
|
|
58
64
|
(by trailing timestamp or source marker).
|
|
59
|
-
|
|
65
|
+
7. Emit the visual status block described below. Do **not** load any stage skill.
|
|
66
|
+
|
|
67
|
+
## Visual markers
|
|
68
|
+
|
|
69
|
+
Default UTF markers: \`✓\` passed, \`▶\` current, \`○\` pending, \`⊘\` skipped, \`⏸\` stale, \`✗\` blocked.
|
|
70
|
+
ASCII fallback (no UTF locale): \`[x]\`, \`[>]\`, \`[ ]\`, \`[-]\`, \`[=]\`, \`[!]\`.
|
|
60
71
|
|
|
61
72
|
## Status Block Format
|
|
62
73
|
|
|
63
74
|
\`\`\`
|
|
64
75
|
cclaw status
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
delegations (current stage):
|
|
78
|
-
required: <list>
|
|
79
|
-
completed: <list>
|
|
80
|
-
pending: <list>
|
|
81
|
-
|
|
82
|
-
knowledge highlights:
|
|
83
|
-
- <latest entry summary line>
|
|
84
|
-
- <second entry summary line>
|
|
85
|
-
- <third entry summary line>
|
|
86
|
-
|
|
87
|
-
next action:
|
|
88
|
-
/cc-next (advance or resume current stage)
|
|
76
|
+
flow: <track> · run=<runId> · feature=<feature-id>
|
|
77
|
+
stage: <stage> (<N>/<total>) · time <Xd|XhYm|Xm|unknown> · mode <activeMode>
|
|
78
|
+
bar: [✓ brainstorm] [✓ scope] [▶ design] [○ spec] [○ plan] [○ tdd] [○ review] [○ ship]
|
|
79
|
+
gates: now <passed>/<required> · blocked <count> · delta <summary or baseline-unavailable>
|
|
80
|
+
delegations: [✓ <role>] [○ <role>] ...
|
|
81
|
+
stale: <list or none>
|
|
82
|
+
knowledge:
|
|
83
|
+
- <latest entry summary>
|
|
84
|
+
- <second entry summary>
|
|
85
|
+
- <third entry summary>
|
|
86
|
+
next: /cc-next · /cc-tree · /cc-diff
|
|
89
87
|
\`\`\`
|
|
90
88
|
|
|
91
89
|
## Anti-patterns
|
|
@@ -93,6 +91,7 @@ cclaw status
|
|
|
93
91
|
- Inventing gate status without reading \`${flowPath}\`.
|
|
94
92
|
- Reporting delegations as satisfied when the log says \`pending\`.
|
|
95
93
|
- Advancing the stage from \`/cc-status\` — progression belongs to \`/cc-next\`.
|
|
94
|
+
- Hiding stale stages; stale markers must be surfaced directly in the status line.
|
|
96
95
|
|
|
97
96
|
## Primary skill
|
|
98
97
|
|
|
@@ -107,7 +106,7 @@ export function statusCommandSkillMarkdown() {
|
|
|
107
106
|
const delegationPath = delegationLogPath();
|
|
108
107
|
return `---
|
|
109
108
|
name: ${STATUS_SKILL_NAME}
|
|
110
|
-
description: "Read-only snapshot of the cclaw flow
|
|
109
|
+
description: "Read-only visual snapshot of the cclaw flow with progress bar, gate delta, delegations, and stale markers."
|
|
111
110
|
---
|
|
112
111
|
|
|
113
112
|
# /cc-status — Flow Status Snapshot
|
|
@@ -120,7 +119,7 @@ advancing or mutating anything. Safe to run at any point.
|
|
|
120
119
|
## HARD-GATE
|
|
121
120
|
|
|
122
121
|
Do **not** mutate \`${flowPath}\` or \`${delegationPath}\` from this skill. This is
|
|
123
|
-
a read-only command.
|
|
122
|
+
a read-only command. Do **not** update \`${snapshotPath()}\` here.
|
|
124
123
|
|
|
125
124
|
## Algorithm
|
|
126
125
|
|
|
@@ -131,19 +130,28 @@ a read-only command.
|
|
|
131
130
|
- Prefer \`${checkpointPath()}\` when \`stage === currentStage\` and \`timestamp\` parses as ISO 8601.
|
|
132
131
|
- Else scan \`${stageActivityPath()}\` from tail for the most recent entry whose \`stage === currentStage\`; use its \`ts\`.
|
|
133
132
|
- Render \`<X>d<Y>h\`, \`<X>h<Y>m\`, \`<X>m\`, or \`(unknown)\`.
|
|
134
|
-
5.
|
|
135
|
-
|
|
133
|
+
5. Try reading \`${snapshotPath()}\` for gate delta:
|
|
134
|
+
- If available, compare current stage \`passed\` / \`blocked\` sets against baseline.
|
|
135
|
+
- If unavailable, render \`delta: (baseline unavailable; run /cc-diff)\`.
|
|
136
|
+
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\`.
|
|
137
|
+
7. For each gate in \`stageGateCatalog[currentStage].required\`:
|
|
136
138
|
- Satisfied if present in \`passed\` and absent from \`blocked\`.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
8. Build and print the visual status block:
|
|
140
|
+
- stage header
|
|
141
|
+
- one-line progress bar with per-stage markers
|
|
142
|
+
- gate summary + delta
|
|
143
|
+
- delegation row
|
|
144
|
+
- stale stage row
|
|
145
|
+
9. Suggest the next action:
|
|
139
146
|
- If current stage has unmet gates → \`/cc-next\` to resume.
|
|
140
147
|
- If current stage is complete → \`/cc-next\` to advance (or report "Flow complete" if terminal).
|
|
141
148
|
|
|
142
149
|
## Output Guidelines
|
|
143
150
|
|
|
144
|
-
- Keep output compact (≤
|
|
151
|
+
- Keep output compact (≤ 30 lines) — status, not narrative.
|
|
145
152
|
- Report counts, not full artifact contents.
|
|
146
153
|
- If any data source is missing or corrupt, say so explicitly rather than guessing.
|
|
154
|
+
- Include \`/cc-tree\` for deep structure and \`/cc-diff\` for before/after map in the final line.
|
|
147
155
|
|
|
148
156
|
## Anti-patterns
|
|
149
157
|
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { RUNTIME_ROOT } from "../constants.js";
|
|
2
|
+
const TDD_LOG_SKILL_FOLDER = "tdd-cycle-log";
|
|
3
|
+
const TDD_LOG_SKILL_NAME = "tdd-cycle-log";
|
|
4
|
+
function logPath() {
|
|
5
|
+
return `${RUNTIME_ROOT}/state/tdd-cycle-log.jsonl`;
|
|
6
|
+
}
|
|
7
|
+
function flowStatePath() {
|
|
8
|
+
return `${RUNTIME_ROOT}/state/flow-state.json`;
|
|
9
|
+
}
|
|
10
|
+
export function tddLogCommandContract() {
|
|
11
|
+
return `# /cc-tdd-log
|
|
12
|
+
|
|
13
|
+
## Purpose
|
|
14
|
+
|
|
15
|
+
Record explicit RED/GREEN/REFACTOR evidence used by workflow guard and doctor checks.
|
|
16
|
+
|
|
17
|
+
## HARD-GATE
|
|
18
|
+
|
|
19
|
+
- Every implementation write in tdd must be preceded by a logged RED event.
|
|
20
|
+
- Use append-only JSONL at \`${logPath()}\`; never rewrite prior lines.
|
|
21
|
+
|
|
22
|
+
## Subcommands
|
|
23
|
+
|
|
24
|
+
- \`/cc-tdd-log red <slice> <command> [note]\`
|
|
25
|
+
- \`/cc-tdd-log green <slice> <command> [note]\`
|
|
26
|
+
- \`/cc-tdd-log refactor <slice> <command> [note]\`
|
|
27
|
+
- \`/cc-tdd-log show\`
|
|
28
|
+
|
|
29
|
+
## Log Schema
|
|
30
|
+
|
|
31
|
+
Each JSON line must include:
|
|
32
|
+
- \`ts\` (ISO timestamp)
|
|
33
|
+
- \`runId\` (from flow-state)
|
|
34
|
+
- \`stage\` (usually \`tdd\`)
|
|
35
|
+
- \`slice\` (e.g. \`S-1\`)
|
|
36
|
+
- \`phase\` (\`red\` | \`green\` | \`refactor\`)
|
|
37
|
+
- \`command\`
|
|
38
|
+
- optional: \`files\`, \`exitCode\`, \`note\`
|
|
39
|
+
|
|
40
|
+
## Primary skill
|
|
41
|
+
|
|
42
|
+
**${RUNTIME_ROOT}/skills/${TDD_LOG_SKILL_FOLDER}/SKILL.md**
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
export function tddLogCommandSkillMarkdown() {
|
|
46
|
+
return `---
|
|
47
|
+
name: ${TDD_LOG_SKILL_NAME}
|
|
48
|
+
description: "Append RED/GREEN/REFACTOR entries into tdd-cycle-log.jsonl for guard/doctor enforcement."
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
# /cc-tdd-log
|
|
52
|
+
|
|
53
|
+
## HARD-GATE
|
|
54
|
+
|
|
55
|
+
Do not fake RED evidence. A \`red\` entry must correspond to a failing test command.
|
|
56
|
+
|
|
57
|
+
## Protocol
|
|
58
|
+
|
|
59
|
+
1. Read \`${flowStatePath()}\` and capture \`activeRunId\` + \`currentStage\`.
|
|
60
|
+
2. Build JSON entry:
|
|
61
|
+
- \`ts\`: now ISO
|
|
62
|
+
- \`runId\`: activeRunId
|
|
63
|
+
- \`stage\`: currentStage
|
|
64
|
+
- \`slice\`: user-provided slice id
|
|
65
|
+
- \`phase\`: red|green|refactor
|
|
66
|
+
- \`command\`: test command or refactor verification command
|
|
67
|
+
3. Append one line to \`${logPath()}\`.
|
|
68
|
+
4. \`show\`: print the last 20 lines grouped by slice.
|
|
69
|
+
|
|
70
|
+
## Validation
|
|
71
|
+
|
|
72
|
+
- File remains valid JSONL (one JSON object per line).
|
|
73
|
+
- For each slice, first phase must be \`red\`.
|
|
74
|
+
`;
|
|
75
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const ARTIFACT_TEMPLATES: Record<string, string>;
|
|
2
2
|
export declare const RULEBOOK_MARKDOWN = "# Cclaw Rulebook\n\n## MUST_ALWAYS\n- Follow flow order: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship\n- Require explicit user confirmation after plan before TDD\n- Keep evidence artifacts in `.cclaw/artifacts/`\n- Enforce RED before GREEN in TDD\n- Run two-layer review (spec_compliance and code_quality) before ship\n- Validate all inputs before processing \u2014 never trust external data without sanitization\n- Prefer immutable data patterns and pure functions where the language supports them\n- Follow existing repo conventions, patterns, and directory structure \u2014 match the codebase\n- Verify claims with fresh evidence: \"tests pass\" requires running tests in this message\n- Use conventional commits: `type(scope): description` (feat, fix, refactor, test, docs, chore)\n\n## MUST_NEVER\n- Skip RED phase and jump directly to GREEN in TDD\n- Ship with critical review findings\n- Start implementation during /brainstorm\n- Modify generated cclaw files manually when CLI can regenerate them\n- Commit `.cclaw/` or generated shim files\n- Expose secrets, tokens, API keys, or absolute system paths in agent output\n- Duplicate existing functionality without explicit justification \u2014 search before building\n- Bypass security checks, linting hooks, or type checking to \"move faster\"\n- Claim success (\"Done,\" \"All good,\" \"Tests pass\") without running verification in this message\n- Make changes outside the blast radius of the current task without user consent\n\n## DELEGATION\nWhen a task requires specialist knowledge (security audit, performance profiling, database review),\ndelegate to a specialized agent or skill if the harness supports it. The primary agent should:\n1. Identify the specialist domain\n2. Provide focused context (relevant files, the specific concern)\n3. Evaluate the specialist output before acting on it \u2014 do not blindly apply recommendations\n";
|
|
3
|
-
export declare const CURSOR_WORKFLOW_RULE_MDC = "---\ndescription: cclaw workflow guardrails for Cursor agent sessions\nglobs:\n - \"**/*\"\nalwaysApply: true\n---\n\n<!-- cclaw-managed-cursor-workflow-rule -->\n\n# Cclaw Workflow Guardrails\n\n## Activation Rule\n\nBefore responding to coding work:\n1. Read `.cclaw/state/flow-state.json`.\n2. Start with `/cc` or continue with `/cc-next`.\n3. If no software-stage flow applies, respond normally.\n\n## Stage Order\n\n`brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship`\n\nTrack-specific skips are allowed only when `flow-state.track` + `skippedStages` explicitly say so.\n\n## Task Classification\n\n| Class | Route |\n|---|---|\n| non-trivial software work | `/cc <idea>` |\n| trivial software fix | `/cc <idea>` (quick or medium track) |\n| bugfix with repro | `/cc <idea>` and enforce RED-first in tdd |\n| pure question / non-software | direct answer (no stage flow) |\n\n## Command Surface\n\n- `/cc` = entry and resume.\n- `/cc-next` = only progression path.\n- `/cc-learn` = knowledge capture and recall.\n\n## Verification Discipline\n\n- No completion claim without fresh command evidence in this turn.\n- Do not mark gates passed from memory.\n- Keep evidence in `.cclaw/artifacts/`; archive
|
|
3
|
+
export declare const CURSOR_WORKFLOW_RULE_MDC = "---\ndescription: cclaw workflow guardrails for Cursor agent sessions\nglobs:\n - \"**/*\"\nalwaysApply: true\n---\n\n<!-- cclaw-managed-cursor-workflow-rule -->\n\n# Cclaw Workflow Guardrails\n\n## Activation Rule\n\nBefore responding to coding work:\n1. Read `.cclaw/state/flow-state.json`.\n2. Start with `/cc` or continue with `/cc-next`.\n3. If no software-stage flow applies, respond normally.\n\n## Stage Order\n\n`brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship`\n\nTrack-specific skips are allowed only when `flow-state.track` + `skippedStages` explicitly say so.\n\n## Task Classification\n\n| Class | Route |\n|---|---|\n| non-trivial software work | `/cc <idea>` |\n| trivial software fix | `/cc <idea>` (quick or medium track) |\n| bugfix with repro | `/cc <idea>` and enforce RED-first in tdd |\n| pure question / non-software | direct answer (no stage flow) |\n\n## Command Surface\n\n- `/cc` = entry and resume.\n- `/cc-next` = only progression path.\n- `/cc-learn` = knowledge capture and recall.\n\n## Verification Discipline\n\n- No completion claim without fresh command evidence in this turn.\n- Do not mark gates passed from memory.\n- Keep evidence in `.cclaw/artifacts/`; archive via `/cc-archive` (agent flow) or archive runtime.\n\n## Delegation And Approvals\n\n- Machine-only checks in design/plan/tdd/review/ship should auto-dispatch when tooling supports it.\n- Ask for user input only at explicit approval gates (scope mode, plan approval, challenge resolution, ship finalization).\n- If harness capabilities are partial, record waiver reasons in delegation logs.\n\n## Routing Source Of Truth\n\n- Primary router: `.cclaw/skills/using-cclaw/SKILL.md`.\n- Protocols: `.cclaw/references/protocols/*.md`.\n- Preamble budget: `.cclaw/references/protocols/ethos.md`.\n";
|
|
4
4
|
export declare function buildRulesJson(): Record<string, unknown>;
|
|
@@ -480,11 +480,41 @@ Execution rule: complete and verify each wave before starting the next wave.
|
|
|
480
480
|
- SHIPPED | SHIPPED_WITH_EXCEPTIONS | BLOCKED
|
|
481
481
|
- Exceptions (if any):
|
|
482
482
|
|
|
483
|
-
##
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
-
|
|
487
|
-
|
|
483
|
+
## Retro Gate Handoff
|
|
484
|
+
- Run \`/cc-retro\` before archive.
|
|
485
|
+
- Retro artifact path: \`.cclaw/artifacts/09-retro.md\`
|
|
486
|
+
- Archive remains blocked until retro gate is complete.
|
|
487
|
+
`,
|
|
488
|
+
"09-retro.md": `# Retro Artifact
|
|
489
|
+
|
|
490
|
+
## Run Summary
|
|
491
|
+
- Flow track:
|
|
492
|
+
- Scope delivered:
|
|
493
|
+
- Main outcome:
|
|
494
|
+
|
|
495
|
+
## Friction Log
|
|
496
|
+
| Category | What slowed us down | Evidence | Prevention rule |
|
|
497
|
+
|---|---|---|---|
|
|
498
|
+
| | | | |
|
|
499
|
+
|
|
500
|
+
## Acceleration Log
|
|
501
|
+
| Category | What helped | Evidence | Reuse trigger |
|
|
502
|
+
|---|---|---|---|
|
|
503
|
+
| | | | |
|
|
504
|
+
|
|
505
|
+
## Compound Decisions
|
|
506
|
+
| Insight | Trigger pattern | Action rule for next run |
|
|
507
|
+
|---|---|---|
|
|
508
|
+
| | | |
|
|
509
|
+
|
|
510
|
+
## Knowledge Writes
|
|
511
|
+
- Compound entries appended to \`.cclaw/knowledge.jsonl\`: <N>
|
|
512
|
+
- Entry ids / timestamps:
|
|
513
|
+
|
|
514
|
+
## Retro Completion
|
|
515
|
+
- RETRO_COMPLETE: yes
|
|
516
|
+
- Completed at (UTC):
|
|
517
|
+
- Notes:
|
|
488
518
|
`
|
|
489
519
|
};
|
|
490
520
|
export const RULEBOOK_MARKDOWN = `# Cclaw Rulebook
|
|
@@ -563,7 +593,7 @@ Track-specific skips are allowed only when \`flow-state.track\` + \`skippedStage
|
|
|
563
593
|
|
|
564
594
|
- No completion claim without fresh command evidence in this turn.
|
|
565
595
|
- Do not mark gates passed from memory.
|
|
566
|
-
- Keep evidence in \`.cclaw/artifacts/\`; archive
|
|
596
|
+
- Keep evidence in \`.cclaw/artifacts/\`; archive via \`/cc-archive\` (agent flow) or archive runtime.
|
|
567
597
|
|
|
568
598
|
## Delegation And Approvals
|
|
569
599
|
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { RUNTIME_ROOT } from "../constants.js";
|
|
2
|
+
const TREE_SKILL_FOLDER = "flow-tree";
|
|
3
|
+
const TREE_SKILL_NAME = "flow-tree";
|
|
4
|
+
function flowStatePath() {
|
|
5
|
+
return `${RUNTIME_ROOT}/state/flow-state.json`;
|
|
6
|
+
}
|
|
7
|
+
function delegationLogPath() {
|
|
8
|
+
return `${RUNTIME_ROOT}/state/delegation-log.json`;
|
|
9
|
+
}
|
|
10
|
+
function artifactsPath() {
|
|
11
|
+
return `${RUNTIME_ROOT}/artifacts`;
|
|
12
|
+
}
|
|
13
|
+
function rewindLogPath() {
|
|
14
|
+
return `${RUNTIME_ROOT}/state/rewind-log.jsonl`;
|
|
15
|
+
}
|
|
16
|
+
export function treeCommandContract() {
|
|
17
|
+
return `# /cc-tree
|
|
18
|
+
|
|
19
|
+
## Purpose
|
|
20
|
+
|
|
21
|
+
Render a visual flow tree for quick orientation across stages, gates, delegations,
|
|
22
|
+
stale markers, and artifact presence.
|
|
23
|
+
|
|
24
|
+
## HARD-GATE
|
|
25
|
+
|
|
26
|
+
- \`/cc-tree\` is read-only. Do not mutate flow-state or artifacts.
|
|
27
|
+
- Use values from \`${flowStatePath()}\` and \`${delegationLogPath()}\`; never infer missing evidence.
|
|
28
|
+
|
|
29
|
+
## Algorithm
|
|
30
|
+
|
|
31
|
+
1. Read \`${flowStatePath()}\`.
|
|
32
|
+
2. Read \`${delegationLogPath()}\` (if missing, treat current-stage delegations as pending).
|
|
33
|
+
3. Detect artifact files in \`${artifactsPath()}\`.
|
|
34
|
+
4. Read rewind records from \`${rewindLogPath()}\` when present for stale-stage context.
|
|
35
|
+
5. Render the tree using stage order from active track:
|
|
36
|
+
- stage node marker: passed/current/pending/skipped/stale
|
|
37
|
+
- gate summary: \`passed/required\`
|
|
38
|
+
- delegation summary for current stage
|
|
39
|
+
- artifact marker per stage (exists / stale copy / missing)
|
|
40
|
+
|
|
41
|
+
## Tree Format
|
|
42
|
+
|
|
43
|
+
\`\`\`
|
|
44
|
+
cclaw flow tree (track=<track>, run=<runId>)
|
|
45
|
+
├─ [✓] brainstorm gates 6/6 artifact 01-brainstorm.md
|
|
46
|
+
├─ [✓] scope gates 5/5 artifact 02-scope.md
|
|
47
|
+
├─ [▶] design gates 2/7 artifact 03-design.md
|
|
48
|
+
│ ├─ delegations: [✓] planner [○] reviewer
|
|
49
|
+
│ └─ stale: none
|
|
50
|
+
├─ [○] spec gates - artifact missing
|
|
51
|
+
└─ [○] plan gates - artifact missing
|
|
52
|
+
\`\`\`
|
|
53
|
+
|
|
54
|
+
Use UTF markers by default, ASCII fallback when terminal cannot render UTF.
|
|
55
|
+
|
|
56
|
+
## Primary skill
|
|
57
|
+
|
|
58
|
+
**${RUNTIME_ROOT}/skills/${TREE_SKILL_FOLDER}/SKILL.md**
|
|
59
|
+
`;
|
|
60
|
+
}
|
|
61
|
+
export function treeCommandSkillMarkdown() {
|
|
62
|
+
return `---
|
|
63
|
+
name: ${TREE_SKILL_NAME}
|
|
64
|
+
description: "Render a visual flow tree for stages, gates, delegations, and artifacts."
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
# /cc-tree
|
|
68
|
+
|
|
69
|
+
## HARD-GATE
|
|
70
|
+
|
|
71
|
+
Do not modify state in this command. It is a pure read/render operation.
|
|
72
|
+
|
|
73
|
+
## Protocol
|
|
74
|
+
|
|
75
|
+
1. Read \`${flowStatePath()}\` as source of truth.
|
|
76
|
+
2. Read \`${delegationLogPath()}\` for current-stage delegation status.
|
|
77
|
+
3. Inspect \`${artifactsPath()}\` for per-stage artifact presence and stale copies.
|
|
78
|
+
4. Render one compact tree:
|
|
79
|
+
- stage marker: passed/current/pending/skipped/stale
|
|
80
|
+
- gates summary
|
|
81
|
+
- artifact summary
|
|
82
|
+
- delegation branch for current stage
|
|
83
|
+
5. If rewind records exist in \`${rewindLogPath()}\`, include latest rewind note in footer.
|
|
84
|
+
|
|
85
|
+
## Validation
|
|
86
|
+
|
|
87
|
+
- Output must mention the active \`track\` and \`currentStage\`.
|
|
88
|
+
- Exactly one stage is marked current.
|
|
89
|
+
- Missing files are reported explicitly; never guessed as complete.
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
@@ -771,7 +771,7 @@ description: "Read-only curation pass over the canonical strict-JSONL knowledge
|
|
|
771
771
|
## When to run
|
|
772
772
|
|
|
773
773
|
- Triggered automatically by **\`/cc-learn curate\`**.
|
|
774
|
-
- Recommended after \`
|
|
774
|
+
- Recommended after \`/cc-archive\` (or archive runtime) of a feature run, when knowledge has grown.
|
|
775
775
|
- Recommended when active entry count exceeds **50**.
|
|
776
776
|
|
|
777
777
|
## Audit dimensions
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { RUNTIME_ROOT } from "../constants.js";
|
|
2
|
+
const VIEW_SKILL_FOLDER = "flow-view";
|
|
3
|
+
const VIEW_SKILL_NAME = "flow-view";
|
|
4
|
+
export function viewCommandContract() {
|
|
5
|
+
return `# /cc-view
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Unified read-only command surface for flow visibility.
|
|
10
|
+
|
|
11
|
+
Subcommands:
|
|
12
|
+
- \`/cc-view\` or \`/cc-view status\` -> status snapshot
|
|
13
|
+
- \`/cc-view tree\` -> structural flow tree
|
|
14
|
+
- \`/cc-view diff\` -> baseline delta map
|
|
15
|
+
|
|
16
|
+
## HARD-GATE
|
|
17
|
+
|
|
18
|
+
- \`/cc-view\` is strictly read-only at wrapper level.
|
|
19
|
+
- Do not mutate flow-state unless routing to \`diff\` (which updates snapshot baseline by design).
|
|
20
|
+
|
|
21
|
+
## Routing
|
|
22
|
+
|
|
23
|
+
1. Parse subcommand (default \`status\`).
|
|
24
|
+
2. Route:
|
|
25
|
+
- \`status\` -> load \`${RUNTIME_ROOT}/commands/status.md\` + \`${RUNTIME_ROOT}/skills/flow-status/SKILL.md\`
|
|
26
|
+
- \`tree\` -> load \`${RUNTIME_ROOT}/commands/tree.md\` + \`${RUNTIME_ROOT}/skills/flow-tree/SKILL.md\`
|
|
27
|
+
- \`diff\` -> load \`${RUNTIME_ROOT}/commands/diff.md\` + \`${RUNTIME_ROOT}/skills/flow-diff/SKILL.md\`
|
|
28
|
+
3. Unknown subcommand -> print supported values and stop.
|
|
29
|
+
|
|
30
|
+
## Primary skill
|
|
31
|
+
|
|
32
|
+
**${RUNTIME_ROOT}/skills/${VIEW_SKILL_FOLDER}/SKILL.md**
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
35
|
+
export function viewCommandSkillMarkdown() {
|
|
36
|
+
return `---
|
|
37
|
+
name: ${VIEW_SKILL_NAME}
|
|
38
|
+
description: "Unified read-only view router for status/tree/diff flow visibility commands."
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
# /cc-view
|
|
42
|
+
|
|
43
|
+
## HARD-GATE
|
|
44
|
+
|
|
45
|
+
Wrapper is read-only and dispatch-only. It must not mutate flow state directly.
|
|
46
|
+
|
|
47
|
+
## Protocol
|
|
48
|
+
|
|
49
|
+
1. Parse optional subcommand token:
|
|
50
|
+
- missing -> \`status\`
|
|
51
|
+
- \`status\` -> dispatch to \`/cc-status\`
|
|
52
|
+
- \`tree\` -> dispatch to \`/cc-tree\`
|
|
53
|
+
- \`diff\` -> dispatch to \`/cc-diff\`
|
|
54
|
+
2. Execute the target command contract and skill.
|
|
55
|
+
3. Return concise output and suggest \`/cc-view <subcommand>\` variants for navigation.
|
|
56
|
+
`;
|
|
57
|
+
}
|
package/dist/doctor-registry.js
CHANGED
|
@@ -119,9 +119,9 @@ export function doctorCheckMetadata(checkName) {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
return {
|
|
122
|
-
severity: "
|
|
123
|
-
summary: "
|
|
124
|
-
fix: "
|
|
122
|
+
severity: "warning",
|
|
123
|
+
summary: "Unclassified doctor check.",
|
|
124
|
+
fix: "Review the check details and add a matching rule in doctor-registry when this check should be severity-scoped.",
|
|
125
125
|
docRef: ref("README.md")
|
|
126
126
|
};
|
|
127
127
|
}
|