cclaw-cli 0.4.0 → 0.5.1
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 +7 -7
- package/dist/constants.d.ts +2 -2
- package/dist/constants.js +6 -3
- package/dist/content/agents.d.ts +1 -1
- package/dist/content/agents.js +12 -16
- package/dist/content/examples.js +4 -3
- package/dist/content/hooks.js +4 -6
- package/dist/content/learnings.js +1 -1
- package/dist/content/meta-skill.js +21 -32
- package/dist/content/next-command.js +2 -2
- package/dist/content/observe.js +22 -8
- package/dist/content/session-hooks.js +1 -1
- package/dist/content/skills.js +13 -10
- package/dist/content/stage-schema.d.ts +1 -1
- package/dist/content/stage-schema.js +110 -179
- package/dist/content/start-command.d.ts +10 -0
- package/dist/content/start-command.js +109 -0
- package/dist/content/subagents.js +3 -3
- package/dist/content/templates.d.ts +2 -2
- package/dist/content/templates.js +22 -11
- package/dist/content/utility-skills.js +2 -2
- package/dist/doctor.js +10 -41
- package/dist/harness-adapters.js +13 -42
- package/dist/install.js +10 -10
- package/dist/policy.js +1 -10
- package/dist/runs.js +2 -14
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -2
- package/package.json +1 -1
- package/dist/content/autoplan.d.ts +0 -7
- package/dist/content/autoplan.js +0 -344
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const ARTIFACT_TEMPLATES: Record<string, string>;
|
|
2
|
-
export declare const RULEBOOK_MARKDOWN = "# Cclaw Rulebook\n\n## MUST_ALWAYS\n- Follow flow order: brainstorm -> scope -> design -> spec -> plan ->
|
|
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- Follow stage order: brainstorm -> scope -> design -> spec -> plan ->
|
|
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- Follow stage order: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship.\n- Read `.cclaw/state/flow-state.json` before acting; continue from current stage when active.\n- Use `/cc-next` only after required gates pass; never bypass explicit pause/approval rules.\n- Keep evidence in `.cclaw/artifacts/` and canonical run copies in `.cclaw/runs/<activeRunId>/artifacts/`.\n- For machine-only checks in design/plan/tdd/review/ship, dispatch required specialists automatically when tooling supports it.\n- Ask for user input only at explicit approval gates (scope mode, plan approval, user challenge resolution, ship finalization).\n- Treat `.cclaw/skills/using-cclaw/SKILL.md` as routing source of truth; load contextual utility skills only when their triggers apply.\n";
|
|
4
4
|
export declare function buildRulesJson(): Record<string, unknown>;
|
|
@@ -4,9 +4,16 @@ export const ARTIFACT_TEMPLATES = {
|
|
|
4
4
|
"01-brainstorm.md": `# Brainstorm Artifact
|
|
5
5
|
|
|
6
6
|
## Problem Statement
|
|
7
|
-
- User problem
|
|
8
|
-
-
|
|
9
|
-
-
|
|
7
|
+
- **User problem:**
|
|
8
|
+
- **Who benefits:**
|
|
9
|
+
- **Why now:**
|
|
10
|
+
- **Success signal:**
|
|
11
|
+
- **Constraints:**
|
|
12
|
+
|
|
13
|
+
## Known Context
|
|
14
|
+
- **Explored files/patterns:**
|
|
15
|
+
- **Existing behavior:**
|
|
16
|
+
- **Relevant dependencies:**
|
|
10
17
|
|
|
11
18
|
## Alternatives Table
|
|
12
19
|
| Option | Summary | Trade-offs | Recommendation |
|
|
@@ -16,9 +23,13 @@ export const ARTIFACT_TEMPLATES = {
|
|
|
16
23
|
| C | | | |
|
|
17
24
|
|
|
18
25
|
## Approved Direction
|
|
19
|
-
- Selected option
|
|
20
|
-
- Why selected
|
|
21
|
-
-
|
|
26
|
+
- **Selected option:**
|
|
27
|
+
- **Why selected:**
|
|
28
|
+
- **What was approved:** (state the specific decision)
|
|
29
|
+
- **Approval marker:**
|
|
30
|
+
|
|
31
|
+
## Assumptions & Risks
|
|
32
|
+
-
|
|
22
33
|
|
|
23
34
|
## Open Questions
|
|
24
35
|
- None
|
|
@@ -292,8 +303,8 @@ Execution rule: complete and verify each wave before starting the next wave.
|
|
|
292
303
|
export const RULEBOOK_MARKDOWN = `# Cclaw Rulebook
|
|
293
304
|
|
|
294
305
|
## MUST_ALWAYS
|
|
295
|
-
- Follow flow order: brainstorm -> scope -> design -> spec -> plan ->
|
|
296
|
-
- Require explicit user confirmation after
|
|
306
|
+
- Follow flow order: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship
|
|
307
|
+
- Require explicit user confirmation after plan before TDD
|
|
297
308
|
- Keep evidence artifacts in \`.cclaw/artifacts/\`
|
|
298
309
|
- Enforce RED before GREEN in TDD
|
|
299
310
|
- Run two-layer review (spec_compliance and code_quality) before ship
|
|
@@ -304,7 +315,7 @@ export const RULEBOOK_MARKDOWN = `# Cclaw Rulebook
|
|
|
304
315
|
- Use conventional commits: \`type(scope): description\` (feat, fix, refactor, test, docs, chore)
|
|
305
316
|
|
|
306
317
|
## MUST_NEVER
|
|
307
|
-
- Skip
|
|
318
|
+
- Skip RED phase and jump directly to GREEN in TDD
|
|
308
319
|
- Ship with critical review findings
|
|
309
320
|
- Start implementation during /brainstorm
|
|
310
321
|
- Modify generated cclaw files manually when CLI can regenerate them
|
|
@@ -333,11 +344,11 @@ alwaysApply: true
|
|
|
333
344
|
|
|
334
345
|
# Cclaw Workflow Guardrails
|
|
335
346
|
|
|
336
|
-
- Follow stage order: brainstorm -> scope -> design -> spec -> plan ->
|
|
347
|
+
- Follow stage order: brainstorm -> scope -> design -> spec -> plan -> tdd -> review -> ship.
|
|
337
348
|
- Read \`.cclaw/state/flow-state.json\` before acting; continue from current stage when active.
|
|
338
349
|
- Use \`/cc-next\` only after required gates pass; never bypass explicit pause/approval rules.
|
|
339
350
|
- Keep evidence in \`.cclaw/artifacts/\` and canonical run copies in \`.cclaw/runs/<activeRunId>/artifacts/\`.
|
|
340
|
-
- For machine-only checks in design/plan/
|
|
351
|
+
- For machine-only checks in design/plan/tdd/review/ship, dispatch required specialists automatically when tooling supports it.
|
|
341
352
|
- Ask for user input only at explicit approval gates (scope mode, plan approval, user challenge resolution, ship finalization).
|
|
342
353
|
- Treat \`.cclaw/skills/using-cclaw/SKILL.md\` as routing source of truth; load contextual utility skills only when their triggers apply.
|
|
343
354
|
`;
|
|
@@ -26,7 +26,7 @@ Do not approve code with known Critical security issues. No exceptions.
|
|
|
26
26
|
- Before shipping any user-facing feature
|
|
27
27
|
- When adding authentication, authorization, or secrets handling
|
|
28
28
|
- When handling user input, file uploads, or external API data
|
|
29
|
-
- During the review stage (\`/cc-
|
|
29
|
+
- During the review stage (entered via \`/cc-next\`) as a specialist lens
|
|
30
30
|
- When the security-reviewer agent persona is activated
|
|
31
31
|
|
|
32
32
|
## Checklist
|
|
@@ -534,7 +534,7 @@ Do not keep stale or oversized context loaded when task intent changes. Context
|
|
|
534
534
|
|
|
535
535
|
Modes are stored in \`.cclaw/contexts/\`:
|
|
536
536
|
- \`default\` — balanced execution
|
|
537
|
-
- \`execution\` — fast plan/
|
|
537
|
+
- \`execution\` — fast plan/tdd throughput
|
|
538
538
|
- \`review\` — defect/risk discovery
|
|
539
539
|
- \`incident\` — stabilization and recovery
|
|
540
540
|
|
package/dist/doctor.js
CHANGED
|
@@ -304,23 +304,12 @@ export async function doctorChecks(projectRoot, options = {}) {
|
|
|
304
304
|
});
|
|
305
305
|
continue;
|
|
306
306
|
}
|
|
307
|
-
for (const
|
|
308
|
-
const shimPath = path.join(projectRoot, adapter.commandDir,
|
|
309
|
-
let shimOk = await exists(shimPath);
|
|
310
|
-
let details = shimPath;
|
|
311
|
-
if (shimOk) {
|
|
312
|
-
const content = await fs.readFile(shimPath, "utf8");
|
|
313
|
-
const hasSkillReference = content.includes(`.cclaw/skills/${stageSkillFolder(stage)}/SKILL.md`);
|
|
314
|
-
const hasCommandReference = content.includes(`.cclaw/commands/${stage}.md`);
|
|
315
|
-
shimOk = hasSkillReference && hasCommandReference;
|
|
316
|
-
details = hasSkillReference && hasCommandReference
|
|
317
|
-
? `${shimPath} aligned`
|
|
318
|
-
: `${shimPath} missing stage references`;
|
|
319
|
-
}
|
|
307
|
+
for (const shim of ["cc.md", "cc-next.md", "cc-learn.md"]) {
|
|
308
|
+
const shimPath = path.join(projectRoot, adapter.commandDir, shim);
|
|
320
309
|
checks.push({
|
|
321
|
-
name: `shim:${harness}:${
|
|
322
|
-
ok:
|
|
323
|
-
details
|
|
310
|
+
name: `shim:${harness}:${shim.replace(".md", "")}`,
|
|
311
|
+
ok: await exists(shimPath),
|
|
312
|
+
details: shimPath
|
|
324
313
|
});
|
|
325
314
|
}
|
|
326
315
|
}
|
|
@@ -329,12 +318,13 @@ export async function doctorChecks(projectRoot, options = {}) {
|
|
|
329
318
|
if (await exists(agentsFile)) {
|
|
330
319
|
const content = await fs.readFile(agentsFile, "utf8");
|
|
331
320
|
const hasMarkers = content.includes(CCLAW_MARKER_START) && content.includes(CCLAW_MARKER_END);
|
|
332
|
-
const
|
|
333
|
-
const
|
|
321
|
+
const hasCcCommand = content.includes("/cc");
|
|
322
|
+
const hasCcNext = content.includes("/cc-next");
|
|
323
|
+
const hasCcLearn = content.includes("/cc-learn");
|
|
334
324
|
const hasVerification = content.includes("Verification Discipline");
|
|
335
325
|
const hasMinimalMarker = content.includes("intentionally minimal for cross-project use");
|
|
336
326
|
const hasMetaSkillPointer = content.includes(".cclaw/skills/using-cclaw/SKILL.md");
|
|
337
|
-
agentsBlockOk = hasMarkers &&
|
|
327
|
+
agentsBlockOk = hasMarkers && hasCcCommand && hasCcNext && hasCcLearn && hasVerification && hasMinimalMarker && hasMetaSkillPointer;
|
|
338
328
|
}
|
|
339
329
|
checks.push({
|
|
340
330
|
name: "agents:cclaw_block",
|
|
@@ -342,7 +332,7 @@ export async function doctorChecks(projectRoot, options = {}) {
|
|
|
342
332
|
details: `${agentsFile} must contain the managed cclaw marker block with routing, verification, and minimal detail pointer`
|
|
343
333
|
});
|
|
344
334
|
// Utility commands
|
|
345
|
-
for (const cmd of ["learn"
|
|
335
|
+
for (const cmd of ["learn"]) {
|
|
346
336
|
const cmdPath = path.join(projectRoot, RUNTIME_ROOT, "commands", `${cmd}.md`);
|
|
347
337
|
checks.push({
|
|
348
338
|
name: `utility_command:${cmd}`,
|
|
@@ -353,7 +343,6 @@ export async function doctorChecks(projectRoot, options = {}) {
|
|
|
353
343
|
// Utility skills
|
|
354
344
|
for (const [folder, label] of [
|
|
355
345
|
["learnings", "learnings"],
|
|
356
|
-
["autoplan", "autoplan"],
|
|
357
346
|
["subagent-dev", "sdd"],
|
|
358
347
|
["parallel-dispatch", "parallel-agents"],
|
|
359
348
|
["session", "session"],
|
|
@@ -782,26 +771,6 @@ export async function doctorChecks(projectRoot, options = {}) {
|
|
|
782
771
|
? `stage "${gateEvidence.stage}" gate evidence is consistent (required=${gateEvidence.requiredCount}, passed=${gateEvidence.passedCount}, blocked=${gateEvidence.blockedCount})`
|
|
783
772
|
: gateEvidence.issues.join(" ")
|
|
784
773
|
});
|
|
785
|
-
// Utility shims in harness dirs
|
|
786
|
-
for (const harness of configuredHarnesses) {
|
|
787
|
-
const adapter = HARNESS_ADAPTERS[harness];
|
|
788
|
-
if (!adapter) {
|
|
789
|
-
checks.push({
|
|
790
|
-
name: `harness:${harness}:supported`,
|
|
791
|
-
ok: false,
|
|
792
|
-
details: `Unsupported harness "${harness}" in ${RUNTIME_ROOT}/config.yaml`
|
|
793
|
-
});
|
|
794
|
-
continue;
|
|
795
|
-
}
|
|
796
|
-
for (const cmd of ["learn", "autoplan"]) {
|
|
797
|
-
const shimPath = path.join(projectRoot, adapter.commandDir, `cc-${cmd}.md`);
|
|
798
|
-
checks.push({
|
|
799
|
-
name: `shim:${harness}:${cmd}`,
|
|
800
|
-
ok: await exists(shimPath),
|
|
801
|
-
details: shimPath
|
|
802
|
-
});
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
774
|
// Self-improvement block in stage skills
|
|
806
775
|
for (const stage of COMMAND_FILE_ORDER) {
|
|
807
776
|
const skillPath = path.join(projectRoot, RUNTIME_ROOT, "skills", stageSkillFolder(stage), "SKILL.md");
|
package/dist/harness-adapters.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import { RUNTIME_ROOT } from "./constants.js";
|
|
4
4
|
import { CCLAW_AGENTS, agentMarkdown } from "./content/agents.js";
|
|
5
|
-
import { stageSkillFolder } from "./content/skills.js";
|
|
6
5
|
import { ensureDir, exists, writeFileSafe } from "./fs-utils.js";
|
|
7
6
|
export const CCLAW_MARKER_START = "<!-- cclaw-start -->";
|
|
8
7
|
export const CCLAW_MARKER_END = "<!-- cclaw-end -->";
|
|
@@ -18,30 +17,7 @@ export const HARNESS_ADAPTERS = {
|
|
|
18
17
|
opencode: { id: "opencode", commandDir: ".opencode/commands" },
|
|
19
18
|
codex: { id: "codex", commandDir: ".codex/commands" }
|
|
20
19
|
};
|
|
21
|
-
function shimFileName(stage) {
|
|
22
|
-
return `cc-${stage}.md`;
|
|
23
|
-
}
|
|
24
|
-
function shimContent(harness, stage) {
|
|
25
|
-
const skillFolder = stageSkillFolder(stage);
|
|
26
|
-
return `---
|
|
27
|
-
name: cc-${stage}
|
|
28
|
-
description: Generated shim for ${harness}. Runs one flow stage with command+skill context.
|
|
29
|
-
source: generated-by-cclaw
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
# cclaw ${stage}
|
|
33
|
-
|
|
34
|
-
Load and execute:
|
|
35
|
-
1. \`.cclaw/skills/${skillFolder}/SKILL.md\`
|
|
36
|
-
2. \`.cclaw/commands/${stage}.md\`
|
|
37
|
-
|
|
38
|
-
This command is stage-scoped: do only this stage and then hand off to the next one.
|
|
39
|
-
Use \`.cclaw/state/flow-state.json\` for transition guards and status tracking.
|
|
40
|
-
Do not skip required handoff gates.
|
|
41
|
-
`;
|
|
42
|
-
}
|
|
43
20
|
function agentsMdBlock() {
|
|
44
|
-
const stageList = COMMAND_FILE_ORDER.map((s) => `| \`/cc-${s}\` | \`.cclaw/skills/${stageSkillFolder(s)}/SKILL.md\` + \`.cclaw/commands/${s}.md\` |`).join("\n");
|
|
45
21
|
return `${CCLAW_MARKER_START}
|
|
46
22
|
## Cclaw — Workflow Adapter
|
|
47
23
|
|
|
@@ -52,20 +28,19 @@ function agentsMdBlock() {
|
|
|
52
28
|
|
|
53
29
|
Before responding to a coding request:
|
|
54
30
|
1. Read \`.cclaw/state/flow-state.json\` for the current stage.
|
|
55
|
-
2.
|
|
31
|
+
2. Use \`/cc\` to start or \`/cc-next\` to continue the flow.
|
|
56
32
|
3. If no stage applies, respond normally.
|
|
57
33
|
|
|
58
|
-
###
|
|
34
|
+
### Commands (3 total)
|
|
59
35
|
|
|
60
|
-
| Command |
|
|
36
|
+
| Command | Purpose |
|
|
61
37
|
|---|---|
|
|
62
|
-
|
|
63
|
-
| \`/cc-
|
|
64
|
-
| \`/cc-
|
|
65
|
-
| \`/cc-next\` | \`.cclaw/skills/flow-next-step/SKILL.md\` + \`.cclaw/commands/next.md\` |
|
|
38
|
+
| \`/cc\` | **Entry point.** No args = resume current stage. With prompt = start brainstorm with idea. |
|
|
39
|
+
| \`/cc-next\` | **Progression.** Advances to the next stage when current is complete. |
|
|
40
|
+
| \`/cc-learn\` | **Cross-cutting.** Capture or review project learnings. |
|
|
66
41
|
|
|
67
|
-
**Stage order:** brainstorm > scope > design > spec > plan >
|
|
68
|
-
|
|
42
|
+
**Stage order:** brainstorm > scope > design > spec > plan > tdd > review > ship.
|
|
43
|
+
\`/cc-next\` loads the right stage skill automatically. Gates must pass before handoff.
|
|
69
44
|
|
|
70
45
|
### Verification Discipline
|
|
71
46
|
|
|
@@ -115,8 +90,9 @@ export async function removeCclawFromAgentsMd(projectRoot) {
|
|
|
115
90
|
}
|
|
116
91
|
}
|
|
117
92
|
function utilityShimContent(harness, command, skillFolder, commandFile) {
|
|
93
|
+
const shimName = command === "cc" ? "cc" : `cc-${command}`;
|
|
118
94
|
return `---
|
|
119
|
-
name:
|
|
95
|
+
name: ${shimName}
|
|
120
96
|
description: Generated shim for ${harness}. Utility command — not a flow stage.
|
|
121
97
|
source: generated-by-cclaw
|
|
122
98
|
---
|
|
@@ -145,14 +121,9 @@ export async function syncHarnessShims(projectRoot, harnesses) {
|
|
|
145
121
|
}
|
|
146
122
|
const commandDir = path.join(projectRoot, adapter.commandDir);
|
|
147
123
|
await ensureDir(commandDir);
|
|
148
|
-
|
|
149
|
-
const fullPath = path.join(commandDir, shimFileName(stage));
|
|
150
|
-
await writeFileSafe(fullPath, shimContent(harness, stage));
|
|
151
|
-
}
|
|
152
|
-
// Utility command shims
|
|
153
|
-
await writeFileSafe(path.join(commandDir, "cc-learn.md"), utilityShimContent(harness, "learn", "learnings", "learn.md"));
|
|
154
|
-
await writeFileSafe(path.join(commandDir, "cc-autoplan.md"), utilityShimContent(harness, "autoplan", "autoplan", "autoplan.md"));
|
|
124
|
+
await writeFileSafe(path.join(commandDir, "cc.md"), utilityShimContent(harness, "cc", "flow-start", "start.md"));
|
|
155
125
|
await writeFileSafe(path.join(commandDir, "cc-next.md"), utilityShimContent(harness, "next", "flow-next-step", "next.md"));
|
|
126
|
+
await writeFileSafe(path.join(commandDir, "cc-learn.md"), utilityShimContent(harness, "learn", "learnings", "learn.md"));
|
|
156
127
|
}
|
|
157
128
|
await syncAgentFiles(projectRoot);
|
|
158
129
|
await syncAgentsMd(projectRoot);
|
package/dist/install.js
CHANGED
|
@@ -6,10 +6,10 @@ import { promisify } from "node:util";
|
|
|
6
6
|
import { COMMAND_FILE_ORDER, REQUIRED_DIRS, RUNTIME_ROOT, UTILITY_COMMANDS } from "./constants.js";
|
|
7
7
|
import { writeConfig, createDefaultConfig, readConfig, configPath } from "./config.js";
|
|
8
8
|
import { commandContract } from "./content/contracts.js";
|
|
9
|
-
import { autoplanSkillMarkdown, autoplanCommandContract } from "./content/autoplan.js";
|
|
10
9
|
import { contextModeFiles, createInitialContextModeState } from "./content/contexts.js";
|
|
11
10
|
import { learnSkillMarkdown, learnCommandContract } from "./content/learnings.js";
|
|
12
11
|
import { nextCommandContract, nextCommandSkillMarkdown } from "./content/next-command.js";
|
|
12
|
+
import { startCommandContract, startCommandSkillMarkdown } from "./content/start-command.js";
|
|
13
13
|
import { subagentDrivenDevSkill, parallelAgentsSkill } from "./content/subagents.js";
|
|
14
14
|
import { sessionHooksSkillMarkdown } from "./content/session-hooks.js";
|
|
15
15
|
import { sessionStartScript, stopCheckpointScript, opencodePluginJs, claudeHooksJson, cursorHooksJson, codexHooksJson } from "./content/hooks.js";
|
|
@@ -179,10 +179,6 @@ async function writeCommandContracts(projectRoot) {
|
|
|
179
179
|
async function writeArtifactTemplates(projectRoot) {
|
|
180
180
|
for (const [fileName, content] of Object.entries(ARTIFACT_TEMPLATES)) {
|
|
181
181
|
await writeFileSafe(runtimePath(projectRoot, "templates", fileName), content);
|
|
182
|
-
const artifactPath = runtimePath(projectRoot, "artifacts", fileName);
|
|
183
|
-
if (!(await exists(artifactPath))) {
|
|
184
|
-
await writeFileSafe(artifactPath, content);
|
|
185
|
-
}
|
|
186
182
|
}
|
|
187
183
|
}
|
|
188
184
|
async function writeSkills(projectRoot) {
|
|
@@ -192,8 +188,8 @@ async function writeSkills(projectRoot) {
|
|
|
192
188
|
}
|
|
193
189
|
// Utility skills (not flow stages)
|
|
194
190
|
await writeFileSafe(runtimePath(projectRoot, "skills", "learnings", "SKILL.md"), learnSkillMarkdown());
|
|
195
|
-
await writeFileSafe(runtimePath(projectRoot, "skills", "autoplan", "SKILL.md"), autoplanSkillMarkdown());
|
|
196
191
|
await writeFileSafe(runtimePath(projectRoot, "skills", "flow-next-step", "SKILL.md"), nextCommandSkillMarkdown());
|
|
192
|
+
await writeFileSafe(runtimePath(projectRoot, "skills", "flow-start", "SKILL.md"), startCommandSkillMarkdown());
|
|
197
193
|
await writeFileSafe(runtimePath(projectRoot, "skills", "subagent-dev", "SKILL.md"), subagentDrivenDevSkill());
|
|
198
194
|
await writeFileSafe(runtimePath(projectRoot, "skills", "parallel-dispatch", "SKILL.md"), parallelAgentsSkill());
|
|
199
195
|
await writeFileSafe(runtimePath(projectRoot, "skills", "session", "SKILL.md"), sessionHooksSkillMarkdown());
|
|
@@ -205,8 +201,8 @@ async function writeSkills(projectRoot) {
|
|
|
205
201
|
}
|
|
206
202
|
async function writeUtilityCommands(projectRoot) {
|
|
207
203
|
await writeFileSafe(runtimePath(projectRoot, "commands", "learn.md"), learnCommandContract());
|
|
208
|
-
await writeFileSafe(runtimePath(projectRoot, "commands", "autoplan.md"), autoplanCommandContract());
|
|
209
204
|
await writeFileSafe(runtimePath(projectRoot, "commands", "next.md"), nextCommandContract());
|
|
205
|
+
await writeFileSafe(runtimePath(projectRoot, "commands", "start.md"), startCommandContract());
|
|
210
206
|
}
|
|
211
207
|
function toObject(value) {
|
|
212
208
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -688,6 +684,9 @@ async function cleanLegacyArtifacts(projectRoot) {
|
|
|
688
684
|
for (const legacyFolder of [
|
|
689
685
|
"project-learnings",
|
|
690
686
|
"auto-orchestration",
|
|
687
|
+
"autoplan",
|
|
688
|
+
"red-first-testing",
|
|
689
|
+
"incremental-implementation",
|
|
691
690
|
"subagent-driven-development",
|
|
692
691
|
"dispatching-parallel-agents",
|
|
693
692
|
"session-guidelines",
|
|
@@ -730,7 +729,8 @@ async function cleanStaleFiles(projectRoot) {
|
|
|
730
729
|
...COMMAND_FILE_ORDER.map((stage) => `viby-${stage}.md`),
|
|
731
730
|
...UTILITY_COMMANDS.map((cmd) => `viby-${cmd}.md`),
|
|
732
731
|
...COMMAND_FILE_ORDER.map((stage) => `cc-${stage}.md`),
|
|
733
|
-
...UTILITY_COMMANDS.map((cmd) => `cc-${cmd}.md`)
|
|
732
|
+
...UTILITY_COMMANDS.map((cmd) => `cc-${cmd}.md`),
|
|
733
|
+
"cc.md"
|
|
734
734
|
]);
|
|
735
735
|
for (const adapter of Object.values(HARNESS_ADAPTERS)) {
|
|
736
736
|
const commandDir = path.join(projectRoot, adapter.commandDir);
|
|
@@ -744,7 +744,7 @@ async function cleanStaleFiles(projectRoot) {
|
|
|
744
744
|
entries = [];
|
|
745
745
|
}
|
|
746
746
|
for (const entry of entries) {
|
|
747
|
-
if (!/^cc
|
|
747
|
+
if (!/^cc(?:-.*)?\.md$/u.test(entry))
|
|
748
748
|
continue;
|
|
749
749
|
if (expectedShimFiles.has(entry))
|
|
750
750
|
continue;
|
|
@@ -930,7 +930,7 @@ export async function uninstallCclaw(projectRoot) {
|
|
|
930
930
|
try {
|
|
931
931
|
const entries = await fs.readdir(fullDir);
|
|
932
932
|
for (const entry of entries) {
|
|
933
|
-
if (/^(?:viby|cc)
|
|
933
|
+
if (/^(?:viby|cc)(?:-.*)?\.md$/u.test(entry)) {
|
|
934
934
|
await fs.rm(path.join(fullDir, entry), { force: true });
|
|
935
935
|
}
|
|
936
936
|
}
|
package/dist/policy.js
CHANGED
|
@@ -66,7 +66,7 @@ export async function policyChecks(projectRoot, options = {}) {
|
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
// --- verification section for build/review/ship skills ---
|
|
69
|
-
if (["
|
|
69
|
+
if (["tdd", "review", "ship"].includes(stage)) {
|
|
70
70
|
rules.push({
|
|
71
71
|
filePath: skillFile,
|
|
72
72
|
needle: "## Verification Before Completion",
|
|
@@ -89,16 +89,7 @@ export async function policyChecks(projectRoot, options = {}) {
|
|
|
89
89
|
{ file: runtimeFile("skills/learnings/SKILL.md"), needle: "## Subcommands", name: "utility_skill:learnings:subcommands" },
|
|
90
90
|
{ file: runtimeFile("skills/learnings/SKILL.md"), needle: "## Confidence Decay", name: "utility_skill:learnings:decay" },
|
|
91
91
|
{ file: runtimeFile("skills/learnings/SKILL.md"), needle: "## HARD-GATE", name: "utility_skill:learnings:hard_gate" },
|
|
92
|
-
{ file: runtimeFile("skills/autoplan/SKILL.md"), needle: "## Phase Sequence", name: "utility_skill:autoplan:phases" },
|
|
93
|
-
{ file: runtimeFile("skills/autoplan/SKILL.md"), needle: "Decision Principles", name: "utility_skill:autoplan:principles" },
|
|
94
|
-
{ file: runtimeFile("skills/autoplan/SKILL.md"), needle: "## Decision Taxonomy", name: "utility_skill:autoplan:taxonomy" },
|
|
95
|
-
{ file: runtimeFile("skills/autoplan/SKILL.md"), needle: "## HARD-GATE", name: "utility_skill:autoplan:hard_gate" },
|
|
96
|
-
{ file: runtimeFile("skills/autoplan/SKILL.md"), needle: "## Restore Points", name: "utility_skill:autoplan:restore_points" },
|
|
97
|
-
{ file: runtimeFile("skills/autoplan/SKILL.md"), needle: "## Scope Mode Heuristics (Phase 2)", name: "utility_skill:autoplan:scope_heuristics" },
|
|
98
92
|
{ file: runtimeFile("commands/learn.md"), needle: "## Subcommands", name: "utility_command:learn:subcommands" },
|
|
99
|
-
{ file: runtimeFile("commands/autoplan.md"), needle: "## Phase Sequence", name: "utility_command:autoplan:phases" },
|
|
100
|
-
{ file: runtimeFile("commands/autoplan.md"), needle: "## Decision Principles", name: "utility_command:autoplan:principles" },
|
|
101
|
-
{ file: runtimeFile("commands/autoplan.md"), needle: "## Scope Mode Heuristics (Phase 2)", name: "utility_command:autoplan:scope_heuristics" },
|
|
102
93
|
{ file: runtimeFile("skills/subagent-dev/SKILL.md"), needle: "## HARD-GATE", name: "utility_skill:sdd:hard_gate" },
|
|
103
94
|
{ file: runtimeFile("skills/subagent-dev/SKILL.md"), needle: "## Status Contract", name: "utility_skill:sdd:status_contract" },
|
|
104
95
|
{ file: runtimeFile("skills/subagent-dev/SKILL.md"), needle: "Implementer", name: "utility_skill:sdd:implementer_template" },
|
package/dist/runs.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { COMMAND_FILE_ORDER, RUNTIME_ROOT } from "./constants.js";
|
|
4
|
-
import { ARTIFACT_TEMPLATES } from "./content/templates.js";
|
|
5
4
|
import { createInitialFlowState } from "./flow-state.js";
|
|
6
5
|
import { ensureDir, exists, withDirectoryLock, writeFileSafe } from "./fs-utils.js";
|
|
7
6
|
const FLOW_STATE_REL_PATH = `${RUNTIME_ROOT}/state/flow-state.json`;
|
|
@@ -287,12 +286,6 @@ async function persistRunStateSnapshot(projectRoot, runId, state) {
|
|
|
287
286
|
stateSnapshot: snapshotState(safeState)
|
|
288
287
|
});
|
|
289
288
|
}
|
|
290
|
-
async function seedArtifactsFromTemplates(targetDir) {
|
|
291
|
-
await ensureDir(targetDir);
|
|
292
|
-
for (const [fileName, content] of Object.entries(ARTIFACT_TEMPLATES)) {
|
|
293
|
-
await writeFileSafe(path.join(targetDir, fileName), content);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
289
|
async function syncActiveArtifactsToRun(projectRoot, runId) {
|
|
297
290
|
const fromDir = activeArtifactsPath(projectRoot);
|
|
298
291
|
const toDir = runArtifactsPath(projectRoot, runId);
|
|
@@ -317,13 +310,10 @@ async function createRun(projectRoot, options) {
|
|
|
317
310
|
await ensureDir(runRoot(projectRoot, runId));
|
|
318
311
|
await ensureRunMetadata(projectRoot, meta);
|
|
319
312
|
const runArtifactsDir = runArtifactsPath(projectRoot, runId);
|
|
313
|
+
await ensureDir(runArtifactsDir);
|
|
320
314
|
if (options?.seedFromActiveArtifacts && (await exists(activeArtifactsPath(projectRoot)))) {
|
|
321
|
-
await ensureDir(runArtifactsDir);
|
|
322
315
|
await copyImmediateFiles(activeArtifactsPath(projectRoot), runArtifactsDir);
|
|
323
316
|
}
|
|
324
|
-
else {
|
|
325
|
-
await seedArtifactsFromTemplates(runArtifactsDir);
|
|
326
|
-
}
|
|
327
317
|
return meta;
|
|
328
318
|
}
|
|
329
319
|
async function ensureRunHandoff(projectRoot, runId) {
|
|
@@ -350,9 +340,7 @@ export async function ensureRunSystem(projectRoot) {
|
|
|
350
340
|
await writeFlowState(projectRoot, state);
|
|
351
341
|
}
|
|
352
342
|
const runArtifactsDir = runArtifactsPath(projectRoot, activeRunId);
|
|
353
|
-
|
|
354
|
-
await seedArtifactsFromTemplates(runArtifactsDir);
|
|
355
|
-
}
|
|
343
|
+
await ensureDir(runArtifactsDir);
|
|
356
344
|
if ((await listImmediateFiles(activeArtifactsPath(projectRoot))).length === 0) {
|
|
357
345
|
await loadRunArtifactsToActive(projectRoot, activeRunId);
|
|
358
346
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const FLOW_STAGES: readonly ["brainstorm", "scope", "design", "spec", "plan", "
|
|
1
|
+
export declare const FLOW_STAGES: readonly ["brainstorm", "scope", "design", "spec", "plan", "tdd", "review", "ship"];
|
|
2
2
|
export type FlowStage = (typeof FLOW_STAGES)[number];
|
|
3
3
|
export declare const HARNESS_IDS: readonly ["claude", "cursor", "opencode", "codex"];
|
|
4
4
|
export type HarnessId = (typeof HARNESS_IDS)[number];
|
package/dist/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Autoplan orchestrator content for cclaw.
|
|
3
|
-
* Generates markdown instructions that AI agents follow; cclaw does not execute the pipeline.
|
|
4
|
-
*/
|
|
5
|
-
export declare function autoplanSkillMarkdown(): string;
|
|
6
|
-
export declare function autoplanCommandContract(): string;
|
|
7
|
-
export declare function autoplanAgentsMdBlock(): string;
|