cclaw-cli 0.11.0 → 0.13.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 +4 -3
- package/dist/cli.d.ts +8 -0
- package/dist/cli.js +311 -10
- package/dist/config.js +19 -0
- package/dist/constants.d.ts +2 -2
- package/dist/constants.js +13 -1
- package/dist/content/core-agents.d.ts +44 -0
- package/dist/content/core-agents.js +225 -0
- package/dist/content/diff-command.d.ts +2 -0
- package/dist/content/diff-command.js +83 -0
- package/dist/content/doctor-references.d.ts +2 -0
- package/dist/content/doctor-references.js +144 -0
- package/dist/content/examples.js +1 -1
- package/dist/content/feature-command.d.ts +2 -0
- package/dist/content/feature-command.js +120 -0
- package/dist/content/harnesses-doc.d.ts +1 -0
- package/dist/content/harnesses-doc.js +103 -0
- package/dist/content/hook-events.d.ts +4 -0
- package/dist/content/hook-events.js +42 -0
- package/dist/content/hooks.js +47 -1
- package/dist/content/meta-skill.js +3 -2
- package/dist/content/next-command.js +8 -6
- package/dist/content/observe.d.ts +5 -1
- package/dist/content/observe.js +134 -2
- package/dist/content/protocols.js +34 -6
- package/dist/content/research-playbooks.d.ts +8 -0
- package/dist/content/research-playbooks.js +135 -0
- 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 +20 -0
- package/dist/content/stage-schema.d.ts +3 -1
- package/dist/content/stage-schema.js +20 -51
- package/dist/content/status-command.js +43 -35
- package/dist/content/subagents.d.ts +1 -1
- package/dist/content/subagents.js +23 -38
- 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 +84 -16
- package/dist/content/tree-command.d.ts +2 -0
- package/dist/content/tree-command.js +91 -0
- package/dist/delegation.d.ts +1 -0
- package/dist/delegation.js +27 -1
- package/dist/doctor-registry.d.ts +8 -0
- package/dist/doctor-registry.js +127 -0
- package/dist/doctor.d.ts +5 -0
- package/dist/doctor.js +261 -7
- 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.d.ts +7 -0
- package/dist/harness-adapters.js +127 -13
- package/dist/init-detect.d.ts +2 -0
- package/dist/init-detect.js +45 -0
- package/dist/install.js +98 -3
- package/dist/policy.js +27 -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 -0
- package/package.json +2 -1
- package/dist/content/agents.d.ts +0 -48
- package/dist/content/agents.js +0 -411
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent persona content for cclaw.
|
|
3
|
+
*
|
|
4
|
+
* cclaw materializes markdown agent definitions (`.md` with YAML frontmatter)
|
|
5
|
+
* under `.cclaw/agents/` for harness delegation. Research work that does not
|
|
6
|
+
* need isolated subagent context lives in `.cclaw/skills/research/*.md`
|
|
7
|
+
* playbooks and is executed in-thread by the primary agent.
|
|
8
|
+
*/
|
|
9
|
+
function yamlScalarString(value) {
|
|
10
|
+
// JSON double-quoted strings are valid YAML scalars and escape reliably.
|
|
11
|
+
return JSON.stringify(value);
|
|
12
|
+
}
|
|
13
|
+
function yamlFlowSequence(values) {
|
|
14
|
+
return JSON.stringify(values);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Canonical specialist roster (core-5) materialized under `.cclaw/agents/`.
|
|
18
|
+
*/
|
|
19
|
+
export const CCLAW_AGENTS = [
|
|
20
|
+
{
|
|
21
|
+
name: "planner",
|
|
22
|
+
description: "MANDATORY for scope/design/plan and PROACTIVE for high-ambiguity work. MUST BE USED when sequencing, dependency mapping, or risk trade-offs are required before coding.",
|
|
23
|
+
tools: ["Read", "Grep", "Glob", "WebSearch"],
|
|
24
|
+
model: "deep",
|
|
25
|
+
activation: "mandatory",
|
|
26
|
+
relatedStages: ["brainstorm", "scope", "design", "spec", "plan"],
|
|
27
|
+
body: [
|
|
28
|
+
"You are an **implementation planning specialist** (staff engineer mindset).",
|
|
29
|
+
"",
|
|
30
|
+
"When invoked:",
|
|
31
|
+
"1. Analyze scope and break it into concrete sub-problems.",
|
|
32
|
+
"2. Map each sub-problem to existing modules and reusable code.",
|
|
33
|
+
"3. Produce an ordered execution plan with dependencies and checks.",
|
|
34
|
+
"4. Highlight risks and unknowns that need user decisions.",
|
|
35
|
+
"",
|
|
36
|
+
"**Role boundary:** planning only. Do NOT write production code."
|
|
37
|
+
].join("\n")
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "reviewer",
|
|
41
|
+
description: "MANDATORY during review. MUST BE USED to run a two-pass audit: spec compliance first, then correctness/maintainability/performance/architecture.",
|
|
42
|
+
tools: ["Read", "Grep", "Glob"],
|
|
43
|
+
model: "balanced",
|
|
44
|
+
activation: "mandatory",
|
|
45
|
+
relatedStages: ["spec", "review", "ship"],
|
|
46
|
+
body: [
|
|
47
|
+
"You are a **combined spec + code reviewer**.",
|
|
48
|
+
"",
|
|
49
|
+
"Run two explicit passes:",
|
|
50
|
+
"",
|
|
51
|
+
"1. **Spec pass**",
|
|
52
|
+
" - For each acceptance criterion: PASS / PARTIAL / FAIL.",
|
|
53
|
+
" - Cite evidence as `file:line`.",
|
|
54
|
+
"",
|
|
55
|
+
"2. **Code-quality pass**",
|
|
56
|
+
" - Correctness: logic, boundaries, state transitions.",
|
|
57
|
+
" - Maintainability: naming, structure, complexity, debt risks.",
|
|
58
|
+
" - Performance: avoid obvious hot-path regressions.",
|
|
59
|
+
" - Architecture fit: layering and contract stability.",
|
|
60
|
+
"",
|
|
61
|
+
"For each finding include:",
|
|
62
|
+
"- Severity: `Critical` | `Important` | `Suggestion`",
|
|
63
|
+
"- Location: `file:line`",
|
|
64
|
+
"- Problem and concrete recommendation",
|
|
65
|
+
"",
|
|
66
|
+
"**Trust model:** never rely on implementer claims; verify by reading code."
|
|
67
|
+
].join("\n")
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "security-reviewer",
|
|
71
|
+
description: "MANDATORY during review; PROACTIVE during design/ship for trust-boundary changes. Always produce an explicit no-change attestation when no security-relevant surface moved.",
|
|
72
|
+
tools: ["Read", "Grep", "Glob"],
|
|
73
|
+
model: "balanced",
|
|
74
|
+
activation: "mandatory",
|
|
75
|
+
relatedStages: ["design", "review", "ship"],
|
|
76
|
+
body: [
|
|
77
|
+
"You are a **security vulnerability specialist** focused on exploitability.",
|
|
78
|
+
"",
|
|
79
|
+
"Check for (non-exhaustive):",
|
|
80
|
+
"- validation gaps and injection vectors",
|
|
81
|
+
"- authz/authn boundary violations",
|
|
82
|
+
"- secret leakage in code/logging",
|
|
83
|
+
"- unsafe file/system/network operations",
|
|
84
|
+
"- privilege escalation and trust-boundary misuse",
|
|
85
|
+
"",
|
|
86
|
+
"For each finding include:",
|
|
87
|
+
"- severity aligned to ship risk",
|
|
88
|
+
"- CWE ID when possible (or UNKNOWN)",
|
|
89
|
+
"- short proof-of-concept vector",
|
|
90
|
+
"- concrete control-oriented fix"
|
|
91
|
+
].join("\n")
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: "test-author",
|
|
95
|
+
description: "MANDATORY in TDD stage. MUST BE USED for RED -> GREEN -> REFACTOR with evidence-first discipline.",
|
|
96
|
+
tools: ["Read", "Write", "Edit", "Grep", "Glob", "Bash"],
|
|
97
|
+
model: "balanced",
|
|
98
|
+
activation: "mandatory",
|
|
99
|
+
relatedStages: ["tdd"],
|
|
100
|
+
body: [
|
|
101
|
+
"You are a **test-driven development** specialist.",
|
|
102
|
+
"",
|
|
103
|
+
"**Iron law:** no production code without a failing test first.",
|
|
104
|
+
"",
|
|
105
|
+
"Process:",
|
|
106
|
+
"1. RED: write a failing test for the desired behavior.",
|
|
107
|
+
"2. Verify RED fails for the right reason.",
|
|
108
|
+
"3. GREEN: implement minimal code to pass.",
|
|
109
|
+
"4. Verify GREEN on relevant suite/full suite.",
|
|
110
|
+
"5. REFACTOR with behavior preserved."
|
|
111
|
+
].join("\n")
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: "doc-updater",
|
|
115
|
+
description: "MANDATORY at ship and PROACTIVE when behavior/config/public API changes. Keep docs and runbooks in lockstep with shipped behavior.",
|
|
116
|
+
tools: ["Read", "Write", "Edit", "Grep", "Glob"],
|
|
117
|
+
model: "fast",
|
|
118
|
+
activation: "mandatory",
|
|
119
|
+
relatedStages: ["tdd", "ship"],
|
|
120
|
+
body: [
|
|
121
|
+
"You are a **documentation maintenance specialist**.",
|
|
122
|
+
"",
|
|
123
|
+
"After code changes, verify and update only stale sections in:",
|
|
124
|
+
"- README / setup / usage",
|
|
125
|
+
"- API docs and examples",
|
|
126
|
+
"- migration and operational notes",
|
|
127
|
+
"",
|
|
128
|
+
"Preserve existing tone and structure; avoid rewrites for style alone."
|
|
129
|
+
].join("\n")
|
|
130
|
+
}
|
|
131
|
+
];
|
|
132
|
+
import { enhancedAgentBody } from "./subagents.js";
|
|
133
|
+
/**
|
|
134
|
+
* Render a complete cclaw agent markdown file (YAML frontmatter + body).
|
|
135
|
+
*/
|
|
136
|
+
export function agentMarkdown(agent) {
|
|
137
|
+
const frontmatter = [
|
|
138
|
+
"---",
|
|
139
|
+
`name: ${agent.name}`,
|
|
140
|
+
`description: ${yamlScalarString(agent.description)}`,
|
|
141
|
+
`tools: ${yamlFlowSequence(agent.tools)}`,
|
|
142
|
+
`model: ${agent.model}`,
|
|
143
|
+
"---"
|
|
144
|
+
].join("\n");
|
|
145
|
+
const relatedStages = agent.relatedStages.length > 0 ? agent.relatedStages.join(", ") : "(none)";
|
|
146
|
+
const taskDelegation = enhancedAgentBody(agent.name);
|
|
147
|
+
return `${frontmatter}
|
|
148
|
+
|
|
149
|
+
# ${agent.name}
|
|
150
|
+
|
|
151
|
+
${agent.body}
|
|
152
|
+
|
|
153
|
+
## Activation
|
|
154
|
+
|
|
155
|
+
- Mode: ${agent.activation}
|
|
156
|
+
- Related stages: ${relatedStages}
|
|
157
|
+
|
|
158
|
+
## Rules
|
|
159
|
+
|
|
160
|
+
- Cite file:line for every finding
|
|
161
|
+
- Do not make changes outside your specialist domain
|
|
162
|
+
- Report findings with severity classification
|
|
163
|
+
- If uncertain, say "UNKNOWN" - never guess
|
|
164
|
+
|
|
165
|
+
${taskDelegation}
|
|
166
|
+
`;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Markdown table mapping cclaw stage entry points to specialist agents.
|
|
170
|
+
*/
|
|
171
|
+
export function agentRoutingTable() {
|
|
172
|
+
return `| Stage Entry | Primary Agent(s) | Supporting guidance |
|
|
173
|
+
|---|---|---|
|
|
174
|
+
| Brainstorm (start with \`/cc <idea>\`) | planner | Run in-thread research playbooks: \`research/repo-scan.md\`, \`research/learnings-lookup.md\` |
|
|
175
|
+
| Scope / Design / Plan (via \`/cc-next\`) | planner | Use \`research/git-history.md\` (scope) and \`research/framework-docs-lookup.md\` + \`research/best-practices-lookup.md\` (design) as needed |
|
|
176
|
+
| Spec (via \`/cc-next\`) | reviewer | planner (if ambiguity or conflicts remain) |
|
|
177
|
+
| TDD (via \`/cc-next\`) | test-author | doc-updater on public behavior/config changes |
|
|
178
|
+
| Review (via \`/cc-next\`) | reviewer, security-reviewer | conditional second reviewer for high blast-radius diffs |
|
|
179
|
+
| Ship (via \`/cc-next\`) | doc-updater | security-reviewer when release risk is elevated |
|
|
180
|
+
`;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Cost tier routing for the core-5 agent roster.
|
|
184
|
+
*/
|
|
185
|
+
export function agentCostTierTable() {
|
|
186
|
+
return `| Tier | Use for | Example agents |
|
|
187
|
+
|---|---|---|
|
|
188
|
+
| \`deep\` | one heavy planning pass per stage | planner |
|
|
189
|
+
| \`balanced\` | review and TDD specialists with stronger reasoning depth | reviewer, security-reviewer, test-author |
|
|
190
|
+
| \`fast\` | bounded maintenance updates with limited blast radius | doc-updater |
|
|
191
|
+
`;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* AGENTS.md-ready section describing cclaw’s specialist delegation model.
|
|
195
|
+
*/
|
|
196
|
+
export function agentsAgentsMdBlock() {
|
|
197
|
+
return `### Agent Specialists
|
|
198
|
+
|
|
199
|
+
cclaw materializes **5 core specialist agents** under \`.cclaw/agents/\`.
|
|
200
|
+
|
|
201
|
+
${agentRoutingTable()}
|
|
202
|
+
|
|
203
|
+
### Research Playbooks (in-thread)
|
|
204
|
+
|
|
205
|
+
Research work is no longer modeled as standalone personas. Use in-thread playbooks under \`.cclaw/skills/research/\`:
|
|
206
|
+
|
|
207
|
+
- \`repo-scan.md\`
|
|
208
|
+
- \`learnings-lookup.md\`
|
|
209
|
+
- \`framework-docs-lookup.md\`
|
|
210
|
+
- \`best-practices-lookup.md\`
|
|
211
|
+
- \`git-history.md\`
|
|
212
|
+
|
|
213
|
+
### Activation modes
|
|
214
|
+
|
|
215
|
+
- **Mandatory:** planner (scope/design/plan), reviewer + security-reviewer (review), test-author (tdd), doc-updater (ship).
|
|
216
|
+
- **Proactive:** planner on ambiguity, security-reviewer on trust-boundary movement outside review, doc-updater on behavior/config drift.
|
|
217
|
+
- **On-demand:** none in the core-5 roster; research playbooks are in-thread procedures.
|
|
218
|
+
|
|
219
|
+
### Cost-aware routing
|
|
220
|
+
|
|
221
|
+
${agentCostTierTable()}
|
|
222
|
+
|
|
223
|
+
**Agent files:** \`.cclaw/agents/{name}.md\` — each contains YAML frontmatter with tools and model tier.
|
|
224
|
+
`;
|
|
225
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { RUNTIME_ROOT } from "../constants.js";
|
|
2
|
+
const DIFF_SKILL_FOLDER = "flow-diff";
|
|
3
|
+
const DIFF_SKILL_NAME = "flow-diff";
|
|
4
|
+
function flowStatePath() {
|
|
5
|
+
return `${RUNTIME_ROOT}/state/flow-state.json`;
|
|
6
|
+
}
|
|
7
|
+
function snapshotPath() {
|
|
8
|
+
return `${RUNTIME_ROOT}/state/flow-state.snapshot.json`;
|
|
9
|
+
}
|
|
10
|
+
export function diffCommandContract() {
|
|
11
|
+
return `# /cc-diff
|
|
12
|
+
|
|
13
|
+
## Purpose
|
|
14
|
+
|
|
15
|
+
Show a visual before/after diff map for flow-state progression.
|
|
16
|
+
|
|
17
|
+
## HARD-GATE
|
|
18
|
+
|
|
19
|
+
- Compare against \`${snapshotPath()}\` first; do not overwrite baseline before rendering.
|
|
20
|
+
- If no snapshot exists, initialize baseline and report "baseline created" explicitly.
|
|
21
|
+
|
|
22
|
+
## Algorithm
|
|
23
|
+
|
|
24
|
+
1. Read current state from \`${flowStatePath()}\`.
|
|
25
|
+
2. Read baseline from \`${snapshotPath()}\` (if missing -> create baseline from current state and stop).
|
|
26
|
+
3. Compute deltas:
|
|
27
|
+
- stage transition (\`from -> to\`)
|
|
28
|
+
- completed stage additions/removals
|
|
29
|
+
- skipped stage additions/removals
|
|
30
|
+
- stale stage additions/removals
|
|
31
|
+
- current-stage gate \`passed\` and \`blocked\` changes
|
|
32
|
+
4. Render a compact diff map (added \`+\`, removed \`-\`, changed \`->\`).
|
|
33
|
+
5. Persist current state back to \`${snapshotPath()}\` as new baseline with \`capturedAt\`.
|
|
34
|
+
|
|
35
|
+
## Diff Map Format
|
|
36
|
+
|
|
37
|
+
\`\`\`
|
|
38
|
+
cclaw flow diff
|
|
39
|
+
stage: design -> spec
|
|
40
|
+
completed: +design
|
|
41
|
+
stale: -design
|
|
42
|
+
gates(spec): +spec_contract_complete -spec_open_questions_closed
|
|
43
|
+
blocked(spec): +spec_trace_matrix_missing
|
|
44
|
+
\`\`\`
|
|
45
|
+
|
|
46
|
+
## Primary skill
|
|
47
|
+
|
|
48
|
+
**${RUNTIME_ROOT}/skills/${DIFF_SKILL_FOLDER}/SKILL.md**
|
|
49
|
+
`;
|
|
50
|
+
}
|
|
51
|
+
export function diffCommandSkillMarkdown() {
|
|
52
|
+
return `---
|
|
53
|
+
name: ${DIFF_SKILL_NAME}
|
|
54
|
+
description: "Compare current flow-state against saved snapshot and render gate/stage deltas."
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
# /cc-diff
|
|
58
|
+
|
|
59
|
+
## HARD-GATE
|
|
60
|
+
|
|
61
|
+
Never lose baseline visibility: render deltas before writing a new snapshot.
|
|
62
|
+
|
|
63
|
+
## Protocol
|
|
64
|
+
|
|
65
|
+
1. Read \`${flowStatePath()}\`.
|
|
66
|
+
2. Read \`${snapshotPath()}\`.
|
|
67
|
+
3. If snapshot missing:
|
|
68
|
+
- write baseline snapshot from current state,
|
|
69
|
+
- print \`flow diff baseline created\`,
|
|
70
|
+
- stop.
|
|
71
|
+
4. Build deltas for stage, completed/skipped/stale sets, and current-stage gate arrays.
|
|
72
|
+
5. Print a compact diff map with explicit \`+\`, \`-\`, and \`->\` markers.
|
|
73
|
+
6. Write updated snapshot with:
|
|
74
|
+
- \`capturedAt\` (ISO)
|
|
75
|
+
- \`state\` (full current flow-state object)
|
|
76
|
+
|
|
77
|
+
## Validation
|
|
78
|
+
|
|
79
|
+
- Diff output must be deterministic for identical states ("no changes").
|
|
80
|
+
- Snapshot file stays valid JSON after every run.
|
|
81
|
+
- Do not suppress removed values; removals are first-class evidence.
|
|
82
|
+
`;
|
|
83
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { RUNTIME_ROOT } from "../constants.js";
|
|
2
|
+
export const DOCTOR_REFERENCE_DIR = `${RUNTIME_ROOT}/references/doctor`;
|
|
3
|
+
export const DOCTOR_REFERENCE_MARKDOWN = {
|
|
4
|
+
"README.md": `# Doctor Reference Index
|
|
5
|
+
|
|
6
|
+
Reference docs for \`cclaw doctor\` checks.
|
|
7
|
+
|
|
8
|
+
## Categories
|
|
9
|
+
|
|
10
|
+
- \`runtime-layout.md\` - runtime directories, generated commands, and skill files
|
|
11
|
+
- \`hooks-and-lifecycle.md\` - hook wiring and harness lifecycle integration
|
|
12
|
+
- \`harness-and-routing.md\` - harness shims, AGENTS/CLAUDE routing blocks, cursor rule
|
|
13
|
+
- \`state-and-gates.md\` - flow-state integrity and gate evidence contracts
|
|
14
|
+
- \`delegation-and-preamble.md\` - mandatory delegations and preamble budget controls
|
|
15
|
+
- \`traceability.md\` - spec/plan/tdd trace matrix expectations
|
|
16
|
+
- \`tooling-capabilities.md\` - local runtime prerequisites (bash/node/python/jq)
|
|
17
|
+
- \`config-and-policy.md\` - config schema, rules policy, and validation references
|
|
18
|
+
`,
|
|
19
|
+
"runtime-layout.md": `# Runtime Layout
|
|
20
|
+
|
|
21
|
+
## Expected surfaces
|
|
22
|
+
|
|
23
|
+
- \`.cclaw/\` root and generated subdirectories
|
|
24
|
+
- stage command contracts under \`.cclaw/commands/\`
|
|
25
|
+
- stage skills under \`.cclaw/skills/\`
|
|
26
|
+
- utility command contracts (\`start\`, \`next\`, \`learn\`, \`status\`)
|
|
27
|
+
- state files under \`.cclaw/state/\`
|
|
28
|
+
|
|
29
|
+
## Typical fixes
|
|
30
|
+
|
|
31
|
+
1. Run \`cclaw sync\` to re-materialize generated assets.
|
|
32
|
+
2. If runtime is severely drifted, run \`cclaw upgrade\`.
|
|
33
|
+
3. Avoid manual edits under generated runtime paths unless explicitly supported.
|
|
34
|
+
`,
|
|
35
|
+
"hooks-and-lifecycle.md": `# Hooks And Lifecycle
|
|
36
|
+
|
|
37
|
+
## Expected behavior
|
|
38
|
+
|
|
39
|
+
- session start rehydrates flow + knowledge digest
|
|
40
|
+
- pre-tool hooks run prompt/workflow guards
|
|
41
|
+
- post-tool hooks run context monitor
|
|
42
|
+
- stop hooks checkpoint progress
|
|
43
|
+
- OpenCode uses plugin-based lifecycle integration
|
|
44
|
+
|
|
45
|
+
## Typical fixes
|
|
46
|
+
|
|
47
|
+
1. Re-run \`cclaw sync\` after harness config changes.
|
|
48
|
+
2. Ensure harness is enabled in \`.cclaw/config.yaml\`.
|
|
49
|
+
3. Validate hook JSON shape and remove malformed manual edits.
|
|
50
|
+
`,
|
|
51
|
+
"harness-and-routing.md": `# Harness And Routing
|
|
52
|
+
|
|
53
|
+
## Expected behavior
|
|
54
|
+
|
|
55
|
+
- command shims exist for every enabled harness
|
|
56
|
+
- managed routing block is present in \`AGENTS.md\` (and \`CLAUDE.md\` when applicable)
|
|
57
|
+
- cursor rule mirrors workflow activation guidance
|
|
58
|
+
- opencode plugin path is registered in opencode config
|
|
59
|
+
|
|
60
|
+
## Typical fixes
|
|
61
|
+
|
|
62
|
+
1. Confirm \`harnesses\` list in \`.cclaw/config.yaml\`.
|
|
63
|
+
2. Run \`cclaw sync\` to re-generate shims/routing files.
|
|
64
|
+
3. Remove stale harness artifacts for disabled harnesses via \`cclaw sync\`.
|
|
65
|
+
`,
|
|
66
|
+
"state-and-gates.md": `# State And Gates
|
|
67
|
+
|
|
68
|
+
## Expected behavior
|
|
69
|
+
|
|
70
|
+
- \`flow-state.json\` has activeRunId, current stage, and consistent track/skippedStages
|
|
71
|
+
- current-stage gate evidence is internally consistent
|
|
72
|
+
- completed stages only include passed required gates
|
|
73
|
+
|
|
74
|
+
## Typical fixes
|
|
75
|
+
|
|
76
|
+
1. Run \`cclaw doctor --reconcile-gates\` to refresh current-stage gate catalog.
|
|
77
|
+
2. Repair inconsistent stage artifacts, then re-run doctor.
|
|
78
|
+
3. Do not manually mutate gate arrays without matching artifact evidence.
|
|
79
|
+
`,
|
|
80
|
+
"delegation-and-preamble.md": `# Delegation And Preamble
|
|
81
|
+
|
|
82
|
+
## Delegation contract
|
|
83
|
+
|
|
84
|
+
- mandatory delegations for the current stage must be completed or waived
|
|
85
|
+
- waivers should include an explicit reason
|
|
86
|
+
- stale entries from previous runs are ignored by current-run checks
|
|
87
|
+
|
|
88
|
+
## Preamble budget contract
|
|
89
|
+
|
|
90
|
+
- preamble events are logged to \`.cclaw/state/preamble-log.jsonl\`
|
|
91
|
+
- repeated entries inside cooldown windows indicate noisy preamble behavior
|
|
92
|
+
- in TDD wave mode, emit once per wave unless plan materially changes
|
|
93
|
+
|
|
94
|
+
## Typical fixes
|
|
95
|
+
|
|
96
|
+
1. Append missing delegation records with \`completed\` or \`waived\` status.
|
|
97
|
+
2. Record harness-limitation waivers when native delegation is unavailable.
|
|
98
|
+
3. Reduce repeated preamble emissions and keep logs structured (\`ts/stage/trigger/hash\`).
|
|
99
|
+
`,
|
|
100
|
+
"traceability.md": `# Traceability
|
|
101
|
+
|
|
102
|
+
## Expected behavior
|
|
103
|
+
|
|
104
|
+
- spec criteria map to plan tasks
|
|
105
|
+
- plan tasks map to tdd slices/tests
|
|
106
|
+
- no orphaned criteria/tasks/tests when downstream artifacts exist
|
|
107
|
+
|
|
108
|
+
## Typical fixes
|
|
109
|
+
|
|
110
|
+
1. Add stable IDs to spec/plan/tdd sections.
|
|
111
|
+
2. Ensure mapping tables include every active criterion/task/slice.
|
|
112
|
+
3. Re-run \`cclaw doctor\` after artifact updates.
|
|
113
|
+
`,
|
|
114
|
+
"tooling-capabilities.md": `# Tooling Capabilities
|
|
115
|
+
|
|
116
|
+
## Required
|
|
117
|
+
|
|
118
|
+
- \`bash\` for runtime hook scripts
|
|
119
|
+
- \`node\` for generated runtime scripts/plugins
|
|
120
|
+
|
|
121
|
+
## Optional fallback
|
|
122
|
+
|
|
123
|
+
- at least one of \`python3\` or \`jq\` for JSON parsing fallback paths
|
|
124
|
+
|
|
125
|
+
## Typical fixes
|
|
126
|
+
|
|
127
|
+
1. Install missing runtime tools.
|
|
128
|
+
2. Keep at least one JSON fallback parser available (\`python3\` or \`jq\`).
|
|
129
|
+
`,
|
|
130
|
+
"config-and-policy.md": `# Config And Policy
|
|
131
|
+
|
|
132
|
+
## Expected behavior
|
|
133
|
+
|
|
134
|
+
- \`.cclaw/config.yaml\` parses and uses supported keys/values
|
|
135
|
+
- \`.cclaw/rules/rules.json\` matches generated policy schema
|
|
136
|
+
- policy needles and required sections remain present in generated contracts
|
|
137
|
+
|
|
138
|
+
## Typical fixes
|
|
139
|
+
|
|
140
|
+
1. Repair invalid config values and run \`cclaw sync\`.
|
|
141
|
+
2. Re-generate policy files via \`cclaw sync\` if drift is detected.
|
|
142
|
+
3. Keep generated contracts aligned with stage schemas and policy needles.
|
|
143
|
+
`
|
|
144
|
+
};
|
package/dist/content/examples.js
CHANGED
|
@@ -379,7 +379,7 @@ Execution rule: complete and verify each wave before starting the next wave.
|
|
|
379
379
|
## Review Army Contract
|
|
380
380
|
|
|
381
381
|
- See \`07-review-army.json\`
|
|
382
|
-
- Reconciliation summary: 1 duplicate collapsed (R-1 reported by
|
|
382
|
+
- Reconciliation summary: 1 duplicate collapsed (R-1 reported by reviewer and security-reviewer), 0 conflicts
|
|
383
383
|
|
|
384
384
|
## Review Readiness Dashboard
|
|
385
385
|
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { RUNTIME_ROOT } from "../constants.js";
|
|
2
|
+
const FEATURE_SKILL_FOLDER = "feature-workspaces";
|
|
3
|
+
const FEATURE_SKILL_NAME = "feature-workspaces";
|
|
4
|
+
function activeFeaturePath() {
|
|
5
|
+
return `${RUNTIME_ROOT}/state/active-feature.json`;
|
|
6
|
+
}
|
|
7
|
+
function featuresRoot() {
|
|
8
|
+
return `${RUNTIME_ROOT}/features`;
|
|
9
|
+
}
|
|
10
|
+
function runtimeArtifactsPath() {
|
|
11
|
+
return `${RUNTIME_ROOT}/artifacts`;
|
|
12
|
+
}
|
|
13
|
+
function runtimeStatePath() {
|
|
14
|
+
return `${RUNTIME_ROOT}/state`;
|
|
15
|
+
}
|
|
16
|
+
export function featureCommandContract() {
|
|
17
|
+
return `# /cc-feature
|
|
18
|
+
|
|
19
|
+
## Purpose
|
|
20
|
+
|
|
21
|
+
Manage multi-feature workspaces without flow-state/artifact collisions.
|
|
22
|
+
|
|
23
|
+
The active runtime remains:
|
|
24
|
+
- \`${runtimeArtifactsPath()}\` (active artifacts)
|
|
25
|
+
- \`${runtimeStatePath()}\` (active state)
|
|
26
|
+
|
|
27
|
+
Feature snapshots live under \`${featuresRoot()}/<feature-id>/\`.
|
|
28
|
+
|
|
29
|
+
## HARD-GATE
|
|
30
|
+
|
|
31
|
+
- Never overwrite another feature snapshot silently.
|
|
32
|
+
- Before switching feature, snapshot the current active runtime first.
|
|
33
|
+
- Keep \`${activeFeaturePath()}\` as the single source of "current feature".
|
|
34
|
+
|
|
35
|
+
## Subcommands
|
|
36
|
+
|
|
37
|
+
### \`/cc-feature status\`
|
|
38
|
+
Show active feature id and snapshot location.
|
|
39
|
+
|
|
40
|
+
### \`/cc-feature list\`
|
|
41
|
+
List all feature ids in \`${featuresRoot()}/\` (directory names).
|
|
42
|
+
|
|
43
|
+
### \`/cc-feature new <feature-id>\`
|
|
44
|
+
Create \`${featuresRoot()}/<feature-id>/artifacts\` and \`${featuresRoot()}/<feature-id>/state\`.
|
|
45
|
+
|
|
46
|
+
Optional flag:
|
|
47
|
+
- \`--clone-active\`: clone current active runtime into the new feature snapshot.
|
|
48
|
+
|
|
49
|
+
### \`/cc-feature switch <feature-id>\`
|
|
50
|
+
1. Snapshot current active runtime into \`${featuresRoot()}/<active>/\`.
|
|
51
|
+
2. Restore target snapshot from \`${featuresRoot()}/<feature-id>/\` into active runtime:
|
|
52
|
+
- \`${runtimeArtifactsPath()}\`
|
|
53
|
+
- \`${runtimeStatePath()}\` (preserve \`active-feature.json\`)
|
|
54
|
+
3. Update \`${activeFeaturePath()}\` with \`activeFeature=<feature-id>\`.
|
|
55
|
+
|
|
56
|
+
If the target snapshot is empty, initialize runtime as a fresh flow.
|
|
57
|
+
|
|
58
|
+
## Output
|
|
59
|
+
|
|
60
|
+
Always print:
|
|
61
|
+
- active feature before
|
|
62
|
+
- active feature after
|
|
63
|
+
- whether snapshot/restore changed files
|
|
64
|
+
|
|
65
|
+
## Primary skill
|
|
66
|
+
|
|
67
|
+
**${RUNTIME_ROOT}/skills/${FEATURE_SKILL_FOLDER}/SKILL.md**
|
|
68
|
+
`;
|
|
69
|
+
}
|
|
70
|
+
export function featureCommandSkillMarkdown() {
|
|
71
|
+
return `---
|
|
72
|
+
name: ${FEATURE_SKILL_NAME}
|
|
73
|
+
description: "Manage cclaw multi-feature workspaces (status/list/new/switch) while preserving active flow runtime."
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
# /cc-feature — Feature Workspace Manager
|
|
77
|
+
|
|
78
|
+
## HARD-GATE
|
|
79
|
+
|
|
80
|
+
Do not switch feature by editing only \`active-feature.json\`. A valid switch must snapshot current runtime and restore target runtime.
|
|
81
|
+
|
|
82
|
+
## Paths
|
|
83
|
+
|
|
84
|
+
- Active pointer: \`${activeFeaturePath()}\`
|
|
85
|
+
- Feature snapshots: \`${featuresRoot()}/<feature-id>/\`
|
|
86
|
+
- Active runtime artifacts: \`${runtimeArtifactsPath()}\`
|
|
87
|
+
- Active runtime state: \`${runtimeStatePath()}\`
|
|
88
|
+
|
|
89
|
+
## Protocol
|
|
90
|
+
|
|
91
|
+
### status
|
|
92
|
+
1. Read \`${activeFeaturePath()}\`.
|
|
93
|
+
2. Print active feature id and its snapshot folder.
|
|
94
|
+
|
|
95
|
+
### list
|
|
96
|
+
1. Enumerate directories in \`${featuresRoot()}/\`.
|
|
97
|
+
2. Mark the active one.
|
|
98
|
+
|
|
99
|
+
### new <feature-id> [--clone-active]
|
|
100
|
+
1. Validate \`feature-id\` (lowercase slug, letters/numbers/dashes).
|
|
101
|
+
2. Create snapshot dirs:
|
|
102
|
+
- \`${featuresRoot()}/<feature-id>/artifacts\`
|
|
103
|
+
- \`${featuresRoot()}/<feature-id>/state\`
|
|
104
|
+
3. If \`--clone-active\`: copy active runtime artifacts/state into the new snapshot.
|
|
105
|
+
4. Do not change active feature unless the user explicitly requests switch.
|
|
106
|
+
|
|
107
|
+
### switch <feature-id>
|
|
108
|
+
1. Read current active feature id.
|
|
109
|
+
2. Snapshot current runtime into current feature snapshot.
|
|
110
|
+
3. Restore target snapshot into active runtime.
|
|
111
|
+
4. Update \`${activeFeaturePath()}\`.
|
|
112
|
+
5. Report stage/run after restore (\`flow-state.json\`).
|
|
113
|
+
|
|
114
|
+
## Safety checks
|
|
115
|
+
|
|
116
|
+
- If target feature does not exist: block and suggest \`/cc-feature new <id>\`.
|
|
117
|
+
- If snapshot copy fails: abort switch, keep current active feature unchanged.
|
|
118
|
+
- Preserve global pointer file \`active-feature.json\` when restoring state.
|
|
119
|
+
`;
|
|
120
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function harnessIntegrationDocMarkdown(): string;
|