cclaw-cli 7.7.1 → 8.1.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.
Files changed (284) hide show
  1. package/README.md +211 -134
  2. package/dist/artifact-frontmatter.d.ts +51 -0
  3. package/dist/artifact-frontmatter.js +131 -0
  4. package/dist/artifact-paths.d.ts +7 -27
  5. package/dist/artifact-paths.js +20 -249
  6. package/dist/cancel.d.ts +16 -0
  7. package/dist/cancel.js +66 -0
  8. package/dist/cli.d.ts +2 -27
  9. package/dist/cli.js +107 -511
  10. package/dist/compound.d.ts +26 -0
  11. package/dist/compound.js +96 -0
  12. package/dist/config.d.ts +14 -51
  13. package/dist/config.js +23 -359
  14. package/dist/constants.d.ts +11 -18
  15. package/dist/constants.js +19 -106
  16. package/dist/content/antipatterns.d.ts +1 -0
  17. package/dist/content/antipatterns.js +109 -0
  18. package/dist/content/artifact-templates.d.ts +10 -0
  19. package/dist/content/artifact-templates.js +550 -0
  20. package/dist/content/cancel-command.d.ts +2 -2
  21. package/dist/content/cancel-command.js +25 -17
  22. package/dist/content/core-agents.d.ts +9 -233
  23. package/dist/content/core-agents.js +39 -768
  24. package/dist/content/decision-protocol.d.ts +1 -12
  25. package/dist/content/decision-protocol.js +27 -20
  26. package/dist/content/examples.d.ts +8 -42
  27. package/dist/content/examples.js +293 -425
  28. package/dist/content/idea-command.d.ts +2 -0
  29. package/dist/content/idea-command.js +38 -0
  30. package/dist/content/iron-laws.d.ts +4 -138
  31. package/dist/content/iron-laws.js +18 -197
  32. package/dist/content/meta-skill.d.ts +1 -3
  33. package/dist/content/meta-skill.js +57 -134
  34. package/dist/content/node-hooks.d.ts +12 -8
  35. package/dist/content/node-hooks.js +188 -838
  36. package/dist/content/recovery.d.ts +8 -0
  37. package/dist/content/recovery.js +179 -0
  38. package/dist/content/reference-patterns.d.ts +4 -13
  39. package/dist/content/reference-patterns.js +260 -389
  40. package/dist/content/research-playbooks.d.ts +8 -8
  41. package/dist/content/research-playbooks.js +108 -121
  42. package/dist/content/review-loop.d.ts +6 -192
  43. package/dist/content/review-loop.js +29 -731
  44. package/dist/content/skills.d.ts +8 -38
  45. package/dist/content/skills.js +681 -732
  46. package/dist/content/specialist-prompts/architect.d.ts +1 -0
  47. package/dist/content/specialist-prompts/architect.js +225 -0
  48. package/dist/content/specialist-prompts/brainstormer.d.ts +1 -0
  49. package/dist/content/specialist-prompts/brainstormer.js +168 -0
  50. package/dist/content/specialist-prompts/index.d.ts +2 -0
  51. package/dist/content/specialist-prompts/index.js +14 -0
  52. package/dist/content/specialist-prompts/planner.d.ts +1 -0
  53. package/dist/content/specialist-prompts/planner.js +182 -0
  54. package/dist/content/specialist-prompts/reviewer.d.ts +1 -0
  55. package/dist/content/specialist-prompts/reviewer.js +193 -0
  56. package/dist/content/specialist-prompts/security-reviewer.d.ts +1 -0
  57. package/dist/content/specialist-prompts/security-reviewer.js +133 -0
  58. package/dist/content/specialist-prompts/slice-builder.d.ts +1 -0
  59. package/dist/content/specialist-prompts/slice-builder.js +232 -0
  60. package/dist/content/stage-playbooks.d.ts +8 -0
  61. package/dist/content/stage-playbooks.js +404 -0
  62. package/dist/content/start-command.d.ts +2 -12
  63. package/dist/content/start-command.js +221 -207
  64. package/dist/flow-state.d.ts +21 -178
  65. package/dist/flow-state.js +67 -170
  66. package/dist/fs-utils.d.ts +6 -26
  67. package/dist/fs-utils.js +29 -162
  68. package/dist/gitignore.d.ts +2 -1
  69. package/dist/gitignore.js +51 -34
  70. package/dist/harness-detect.d.ts +10 -0
  71. package/dist/harness-detect.js +29 -0
  72. package/dist/harness-prompt.d.ts +26 -0
  73. package/dist/harness-prompt.js +142 -0
  74. package/dist/install.d.ts +35 -15
  75. package/dist/install.js +238 -1347
  76. package/dist/knowledge-store.d.ts +19 -163
  77. package/dist/knowledge-store.js +56 -590
  78. package/dist/logger.d.ts +8 -3
  79. package/dist/logger.js +13 -4
  80. package/dist/orchestrator-routing.d.ts +29 -0
  81. package/dist/orchestrator-routing.js +156 -0
  82. package/dist/run-persistence.d.ts +7 -118
  83. package/dist/run-persistence.js +29 -845
  84. package/dist/runtime/run-hook.entry.d.ts +1 -3
  85. package/dist/runtime/run-hook.entry.js +19 -4
  86. package/dist/runtime/run-hook.mjs +13 -1024
  87. package/dist/types.d.ts +25 -261
  88. package/dist/types.js +8 -36
  89. package/package.json +6 -3
  90. package/dist/artifact-linter/brainstorm.d.ts +0 -2
  91. package/dist/artifact-linter/brainstorm.js +0 -353
  92. package/dist/artifact-linter/design.d.ts +0 -18
  93. package/dist/artifact-linter/design.js +0 -444
  94. package/dist/artifact-linter/findings-dedup.d.ts +0 -56
  95. package/dist/artifact-linter/findings-dedup.js +0 -232
  96. package/dist/artifact-linter/plan.d.ts +0 -2
  97. package/dist/artifact-linter/plan.js +0 -826
  98. package/dist/artifact-linter/review-army.d.ts +0 -49
  99. package/dist/artifact-linter/review-army.js +0 -520
  100. package/dist/artifact-linter/review.d.ts +0 -2
  101. package/dist/artifact-linter/review.js +0 -113
  102. package/dist/artifact-linter/scope.d.ts +0 -2
  103. package/dist/artifact-linter/scope.js +0 -158
  104. package/dist/artifact-linter/shared.d.ts +0 -637
  105. package/dist/artifact-linter/shared.js +0 -2163
  106. package/dist/artifact-linter/ship.d.ts +0 -2
  107. package/dist/artifact-linter/ship.js +0 -250
  108. package/dist/artifact-linter/spec.d.ts +0 -2
  109. package/dist/artifact-linter/spec.js +0 -176
  110. package/dist/artifact-linter/tdd.d.ts +0 -118
  111. package/dist/artifact-linter/tdd.js +0 -1404
  112. package/dist/artifact-linter.d.ts +0 -15
  113. package/dist/artifact-linter.js +0 -517
  114. package/dist/codex-feature-flag.d.ts +0 -58
  115. package/dist/codex-feature-flag.js +0 -193
  116. package/dist/content/closeout-guidance.d.ts +0 -14
  117. package/dist/content/closeout-guidance.js +0 -44
  118. package/dist/content/diff-command.d.ts +0 -1
  119. package/dist/content/diff-command.js +0 -43
  120. package/dist/content/harness-doc.d.ts +0 -1
  121. package/dist/content/harness-doc.js +0 -65
  122. package/dist/content/hook-events.d.ts +0 -9
  123. package/dist/content/hook-events.js +0 -23
  124. package/dist/content/hook-manifest.d.ts +0 -81
  125. package/dist/content/hook-manifest.js +0 -156
  126. package/dist/content/hooks.d.ts +0 -11
  127. package/dist/content/hooks.js +0 -1972
  128. package/dist/content/idea.d.ts +0 -60
  129. package/dist/content/idea.js +0 -416
  130. package/dist/content/language-policy.d.ts +0 -2
  131. package/dist/content/language-policy.js +0 -13
  132. package/dist/content/learnings.d.ts +0 -6
  133. package/dist/content/learnings.js +0 -141
  134. package/dist/content/observe.d.ts +0 -19
  135. package/dist/content/observe.js +0 -86
  136. package/dist/content/opencode-plugin.d.ts +0 -1
  137. package/dist/content/opencode-plugin.js +0 -635
  138. package/dist/content/review-prompts.d.ts +0 -1
  139. package/dist/content/review-prompts.js +0 -104
  140. package/dist/content/runtime-shared-snippets.d.ts +0 -8
  141. package/dist/content/runtime-shared-snippets.js +0 -80
  142. package/dist/content/session-hooks.d.ts +0 -7
  143. package/dist/content/session-hooks.js +0 -107
  144. package/dist/content/skills-elicitation.d.ts +0 -1
  145. package/dist/content/skills-elicitation.js +0 -167
  146. package/dist/content/stage-command.d.ts +0 -2
  147. package/dist/content/stage-command.js +0 -17
  148. package/dist/content/stage-schema.d.ts +0 -117
  149. package/dist/content/stage-schema.js +0 -955
  150. package/dist/content/stages/_lint-metadata/index.d.ts +0 -2
  151. package/dist/content/stages/_lint-metadata/index.js +0 -97
  152. package/dist/content/stages/brainstorm.d.ts +0 -2
  153. package/dist/content/stages/brainstorm.js +0 -184
  154. package/dist/content/stages/design.d.ts +0 -2
  155. package/dist/content/stages/design.js +0 -288
  156. package/dist/content/stages/index.d.ts +0 -8
  157. package/dist/content/stages/index.js +0 -11
  158. package/dist/content/stages/plan.d.ts +0 -2
  159. package/dist/content/stages/plan.js +0 -191
  160. package/dist/content/stages/review.d.ts +0 -2
  161. package/dist/content/stages/review.js +0 -240
  162. package/dist/content/stages/schema-types.d.ts +0 -203
  163. package/dist/content/stages/schema-types.js +0 -1
  164. package/dist/content/stages/scope.d.ts +0 -2
  165. package/dist/content/stages/scope.js +0 -254
  166. package/dist/content/stages/ship.d.ts +0 -2
  167. package/dist/content/stages/ship.js +0 -159
  168. package/dist/content/stages/spec.d.ts +0 -2
  169. package/dist/content/stages/spec.js +0 -170
  170. package/dist/content/stages/tdd.d.ts +0 -4
  171. package/dist/content/stages/tdd.js +0 -273
  172. package/dist/content/state-contracts.d.ts +0 -1
  173. package/dist/content/state-contracts.js +0 -63
  174. package/dist/content/status-command.d.ts +0 -4
  175. package/dist/content/status-command.js +0 -109
  176. package/dist/content/subagent-context-skills.d.ts +0 -4
  177. package/dist/content/subagent-context-skills.js +0 -279
  178. package/dist/content/subagents.d.ts +0 -3
  179. package/dist/content/subagents.js +0 -997
  180. package/dist/content/templates.d.ts +0 -26
  181. package/dist/content/templates.js +0 -1692
  182. package/dist/content/track-render-context.d.ts +0 -18
  183. package/dist/content/track-render-context.js +0 -53
  184. package/dist/content/tree-command.d.ts +0 -1
  185. package/dist/content/tree-command.js +0 -64
  186. package/dist/content/utility-skills.d.ts +0 -30
  187. package/dist/content/utility-skills.js +0 -160
  188. package/dist/content/view-command.d.ts +0 -2
  189. package/dist/content/view-command.js +0 -92
  190. package/dist/delegation.d.ts +0 -649
  191. package/dist/delegation.js +0 -1539
  192. package/dist/early-loop.d.ts +0 -70
  193. package/dist/early-loop.js +0 -302
  194. package/dist/execution-topology.d.ts +0 -44
  195. package/dist/execution-topology.js +0 -95
  196. package/dist/gate-evidence.d.ts +0 -85
  197. package/dist/gate-evidence.js +0 -631
  198. package/dist/harness-adapters.d.ts +0 -151
  199. package/dist/harness-adapters.js +0 -756
  200. package/dist/harness-selection.d.ts +0 -31
  201. package/dist/harness-selection.js +0 -214
  202. package/dist/hook-schema.d.ts +0 -6
  203. package/dist/hook-schema.js +0 -114
  204. package/dist/hook-schemas/claude-hooks.v1.json +0 -10
  205. package/dist/hook-schemas/codex-hooks.v1.json +0 -10
  206. package/dist/hook-schemas/cursor-hooks.v1.json +0 -13
  207. package/dist/init-detect.d.ts +0 -2
  208. package/dist/init-detect.js +0 -50
  209. package/dist/internal/advance-stage/advance.d.ts +0 -89
  210. package/dist/internal/advance-stage/advance.js +0 -655
  211. package/dist/internal/advance-stage/cancel-run.d.ts +0 -8
  212. package/dist/internal/advance-stage/cancel-run.js +0 -19
  213. package/dist/internal/advance-stage/flow-state-coercion.d.ts +0 -3
  214. package/dist/internal/advance-stage/flow-state-coercion.js +0 -81
  215. package/dist/internal/advance-stage/helpers.d.ts +0 -14
  216. package/dist/internal/advance-stage/helpers.js +0 -145
  217. package/dist/internal/advance-stage/hook.d.ts +0 -8
  218. package/dist/internal/advance-stage/hook.js +0 -40
  219. package/dist/internal/advance-stage/parsers.d.ts +0 -72
  220. package/dist/internal/advance-stage/parsers.js +0 -357
  221. package/dist/internal/advance-stage/proactive-delegation-trace.d.ts +0 -24
  222. package/dist/internal/advance-stage/proactive-delegation-trace.js +0 -56
  223. package/dist/internal/advance-stage/review-loop.d.ts +0 -16
  224. package/dist/internal/advance-stage/review-loop.js +0 -199
  225. package/dist/internal/advance-stage/rewind.d.ts +0 -14
  226. package/dist/internal/advance-stage/rewind.js +0 -108
  227. package/dist/internal/advance-stage/start-flow.d.ts +0 -13
  228. package/dist/internal/advance-stage/start-flow.js +0 -241
  229. package/dist/internal/advance-stage/verify.d.ts +0 -21
  230. package/dist/internal/advance-stage/verify.js +0 -185
  231. package/dist/internal/advance-stage.d.ts +0 -7
  232. package/dist/internal/advance-stage.js +0 -138
  233. package/dist/internal/cohesion-contract-stub.d.ts +0 -24
  234. package/dist/internal/cohesion-contract-stub.js +0 -148
  235. package/dist/internal/compound-readiness.d.ts +0 -23
  236. package/dist/internal/compound-readiness.js +0 -102
  237. package/dist/internal/detect-public-api-changes.d.ts +0 -5
  238. package/dist/internal/detect-public-api-changes.js +0 -45
  239. package/dist/internal/detect-supply-chain-changes.d.ts +0 -6
  240. package/dist/internal/detect-supply-chain-changes.js +0 -138
  241. package/dist/internal/early-loop-status.d.ts +0 -7
  242. package/dist/internal/early-loop-status.js +0 -93
  243. package/dist/internal/envelope-validate.d.ts +0 -7
  244. package/dist/internal/envelope-validate.js +0 -66
  245. package/dist/internal/flow-state-repair.d.ts +0 -20
  246. package/dist/internal/flow-state-repair.js +0 -104
  247. package/dist/internal/plan-split-waves.d.ts +0 -190
  248. package/dist/internal/plan-split-waves.js +0 -764
  249. package/dist/internal/runtime-integrity.d.ts +0 -7
  250. package/dist/internal/runtime-integrity.js +0 -268
  251. package/dist/internal/slice-commit.d.ts +0 -7
  252. package/dist/internal/slice-commit.js +0 -619
  253. package/dist/internal/tdd-loop-status.d.ts +0 -14
  254. package/dist/internal/tdd-loop-status.js +0 -68
  255. package/dist/internal/tdd-red-evidence.d.ts +0 -7
  256. package/dist/internal/tdd-red-evidence.js +0 -153
  257. package/dist/internal/waiver-grant.d.ts +0 -62
  258. package/dist/internal/waiver-grant.js +0 -294
  259. package/dist/internal/wave-status.d.ts +0 -74
  260. package/dist/internal/wave-status.js +0 -506
  261. package/dist/managed-resources.d.ts +0 -53
  262. package/dist/managed-resources.js +0 -313
  263. package/dist/policy.d.ts +0 -10
  264. package/dist/policy.js +0 -167
  265. package/dist/retro-gate.d.ts +0 -9
  266. package/dist/retro-gate.js +0 -47
  267. package/dist/run-archive.d.ts +0 -61
  268. package/dist/run-archive.js +0 -391
  269. package/dist/runs.d.ts +0 -2
  270. package/dist/runs.js +0 -2
  271. package/dist/stack-detection.d.ts +0 -116
  272. package/dist/stack-detection.js +0 -489
  273. package/dist/streaming/event-stream.d.ts +0 -31
  274. package/dist/streaming/event-stream.js +0 -114
  275. package/dist/tdd-cycle.d.ts +0 -107
  276. package/dist/tdd-cycle.js +0 -289
  277. package/dist/tdd-verification-evidence.d.ts +0 -17
  278. package/dist/tdd-verification-evidence.js +0 -122
  279. package/dist/track-heuristics.d.ts +0 -27
  280. package/dist/track-heuristics.js +0 -154
  281. package/dist/util/slice-id.d.ts +0 -58
  282. package/dist/util/slice-id.js +0 -89
  283. package/dist/worktree-manager.d.ts +0 -20
  284. package/dist/worktree-manager.js +0 -108
@@ -0,0 +1,96 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { ARTIFACT_FILE_NAMES, activeArtifactDir, activeArtifactPath, shippedArtifactDir, shippedArtifactPath } from "./artifact-paths.js";
4
+ import { FLOWS_ROOT } from "./constants.js";
5
+ import { exists, ensureDir, removePath, writeFileSafe } from "./fs-utils.js";
6
+ import { readFlowState, resetFlowState, writeFlowState } from "./run-persistence.js";
7
+ import { manifestTemplate, templateBody } from "./content/artifact-templates.js";
8
+ import { appendKnowledgeEntry } from "./knowledge-store.js";
9
+ export class CompoundError extends Error {
10
+ }
11
+ export function shouldCaptureLearning(signals) {
12
+ if (signals.userRequestedCapture)
13
+ return true;
14
+ if (signals.hasArchitectDecision)
15
+ return true;
16
+ if (signals.reviewIterations >= 3)
17
+ return true;
18
+ if (signals.securityFlag)
19
+ return true;
20
+ return false;
21
+ }
22
+ function pendingAc(ac) {
23
+ return ac.filter((item) => item.status !== "committed");
24
+ }
25
+ async function moveIfExists(source, destination) {
26
+ if (!(await exists(source)))
27
+ return false;
28
+ await ensureDir(path.dirname(destination));
29
+ await fs.rename(source, destination);
30
+ return true;
31
+ }
32
+ function renderManifest(slug, shipCommit, shippedAt, ac, moved, refines) {
33
+ const base = manifestTemplate(slug, shipCommit, shippedAt);
34
+ const acLines = ac
35
+ .map((item) => `- ${item.id}: ${item.text}${item.commit ? ` (commit ${item.commit})` : ""}`)
36
+ .join("\n");
37
+ const movedLines = moved.map((stage) => `- ${ARTIFACT_FILE_NAMES[stage]}`).join("\n");
38
+ const refinesBlock = refines
39
+ ? `## Refines\n\nThis run refines [${refines}](../${refines}/manifest.md).\n`
40
+ : "";
41
+ return base
42
+ .replace(/## Acceptance Criteria[\s\S]*?(?=\n## Artifacts)/u, `## Acceptance Criteria\n\n${acLines}\n\n`)
43
+ .replace(/## Artifacts[\s\S]*?(?=\n## Refines)/u, `## Artifacts\n\n${movedLines}\n\n`)
44
+ .replace(/## Refines[\s\S]*?(?=\n## Knowledge index)/u, refinesBlock || `## Refines\n\n_None._\n\n`);
45
+ }
46
+ export async function runCompoundAndShip(projectRoot, options) {
47
+ const state = await readFlowState(projectRoot);
48
+ if (!state.currentSlug)
49
+ throw new CompoundError("No active slug; cannot ship.");
50
+ const slug = state.currentSlug;
51
+ const pending = pendingAc(state.ac);
52
+ if (pending.length > 0) {
53
+ throw new CompoundError(`Cannot ship ${slug}: AC traceability gate failed. Pending AC: ${pending.map((item) => item.id).join(", ")}.`);
54
+ }
55
+ const shippedAt = new Date().toISOString();
56
+ const learningCaptured = shouldCaptureLearning(options.signals);
57
+ let knowledgeEntry;
58
+ if (learningCaptured) {
59
+ const learningPath = activeArtifactPath(projectRoot, "learnings", slug);
60
+ if (!(await exists(learningPath))) {
61
+ await writeFileSafe(learningPath, templateBody("learnings", { "SLUG-PLACEHOLDER": slug }));
62
+ }
63
+ knowledgeEntry = {
64
+ slug,
65
+ ship_commit: options.shipCommit,
66
+ shipped_at: shippedAt,
67
+ signals: { ...options.signals },
68
+ refines: options.refines ?? null,
69
+ notes: options.notes
70
+ };
71
+ await appendKnowledgeEntry(projectRoot, knowledgeEntry);
72
+ }
73
+ await writeFlowState(projectRoot, { ...state, currentStage: "ship" });
74
+ const shippedDir = shippedArtifactDir(projectRoot, slug);
75
+ await ensureDir(shippedDir);
76
+ const moved = [];
77
+ const allStages = ["plan", "build", "review", "ship", "decisions", "learnings"];
78
+ for (const stage of allStages) {
79
+ const source = activeArtifactPath(projectRoot, stage, slug);
80
+ const destination = shippedArtifactPath(projectRoot, slug, stage);
81
+ if (await moveIfExists(source, destination))
82
+ moved.push(stage);
83
+ }
84
+ await writeFileSafe(path.join(shippedDir, "manifest.md"), renderManifest(slug, options.shipCommit, shippedAt, state.ac, moved, options.refines));
85
+ const activeDir = activeArtifactDir(projectRoot, slug);
86
+ if (await exists(activeDir)) {
87
+ const remaining = await fs.readdir(activeDir);
88
+ if (remaining.length === 0)
89
+ await removePath(activeDir);
90
+ }
91
+ await resetFlowState(projectRoot);
92
+ return { slug, shippedDir, learningCaptured, movedArtifacts: moved, knowledgeEntry };
93
+ }
94
+ export async function defaultPathsToCheck(projectRoot) {
95
+ return [path.join(projectRoot, FLOWS_ROOT)];
96
+ }
package/dist/config.d.ts CHANGED
@@ -1,51 +1,14 @@
1
- import type { CclawConfig, ExecutionStrictnessProfile, ExecutionTopology, FlowTrack, HarnessId, LanguageRulePack, LockfileTwinPolicy, PlanMicroTaskPolicy, PlanSliceGranularity, TddCommitMode, TddIsolationMode } from "./types.js";
2
- export declare const TDD_COMMIT_MODES: readonly ["managed-per-slice", "agent-required", "checkpoint-only", "off"];
3
- export declare const DEFAULT_TDD_COMMIT_MODE: TddCommitMode;
4
- export declare const TDD_ISOLATION_MODES: readonly ["worktree", "in-place", "auto"];
5
- export declare const DEFAULT_TDD_ISOLATION_MODE: TddIsolationMode;
6
- export declare const DEFAULT_TDD_WORKTREE_ROOT = ".cclaw/worktrees";
7
- export declare const LOCKFILE_TWIN_POLICIES: readonly ["auto-include", "auto-revert", "strict-fence"];
8
- export declare const DEFAULT_LOCKFILE_TWIN_POLICY: LockfileTwinPolicy;
9
- export declare const EXECUTION_TOPOLOGIES: readonly ["auto", "inline", "single-builder", "parallel-builders", "strict-micro"];
10
- export declare const DEFAULT_EXECUTION_TOPOLOGY: ExecutionTopology;
11
- export declare const EXECUTION_STRICTNESS_PROFILES: readonly ["fast", "balanced", "strict"];
12
- export declare const DEFAULT_EXECUTION_STRICTNESS: ExecutionStrictnessProfile;
13
- export declare const DEFAULT_MAX_BUILDERS = 5;
14
- export declare const PLAN_SLICE_GRANULARITIES: readonly ["feature-atomic", "strict-micro"];
15
- export declare const DEFAULT_PLAN_SLICE_GRANULARITY: PlanSliceGranularity;
16
- export declare const PLAN_MICRO_TASK_POLICIES: readonly ["advisory", "strict"];
17
- export declare const DEFAULT_PLAN_MICRO_TASK_POLICY: PlanMicroTaskPolicy;
18
- export declare const DEFAULT_TDD_TEST_PATH_PATTERNS: readonly string[];
19
- export declare const DEFAULT_TDD_TEST_GLOBS: readonly string[];
20
- export declare const DEFAULT_TDD_PRODUCTION_PATH_PATTERNS: readonly string[];
21
- export declare const DEFAULT_COMPOUND_RECURRENCE_THRESHOLD = 3;
22
- export declare const DEFAULT_EARLY_LOOP_MAX_ITERATIONS = 3;
23
- export interface ConfigWarningState {
24
- emitted: Set<string>;
25
- }
26
- export interface ReadConfigOptions {
27
- warningState?: ConfigWarningState;
28
- }
29
- export declare function createConfigWarningState(): ConfigWarningState;
30
- export declare class InvalidConfigError extends Error {
31
- constructor(message: string);
32
- }
33
- export declare function configPath(projectRoot: string): string;
34
- export declare function createDefaultConfig(harnesses?: HarnessId[], _defaultTrack?: FlowTrack): CclawConfig;
35
- export declare function resolveTddCommitMode(config: Pick<CclawConfig, "tdd"> | null | undefined): TddCommitMode;
36
- export declare function resolveTddIsolationMode(config: Pick<CclawConfig, "tdd"> | null | undefined): TddIsolationMode;
37
- export declare function resolveTddWorktreeRoot(config: Pick<CclawConfig, "tdd"> | null | undefined): string;
38
- export declare function resolveLockfileTwinPolicy(config: Pick<CclawConfig, "tdd"> | null | undefined): LockfileTwinPolicy;
39
- export declare function resolveExecutionTopology(config: Pick<CclawConfig, "execution"> | null | undefined): ExecutionTopology;
40
- export declare function resolveExecutionStrictness(config: Pick<CclawConfig, "execution"> | null | undefined): ExecutionStrictnessProfile;
41
- export declare function resolveMaxBuilders(config: Pick<CclawConfig, "execution"> | null | undefined): number;
42
- export declare function resolvePlanSliceGranularity(config: Pick<CclawConfig, "plan"> | null | undefined): PlanSliceGranularity;
43
- export declare function resolvePlanMicroTaskPolicy(config: Pick<CclawConfig, "plan"> | null | undefined): PlanMicroTaskPolicy;
44
- export declare function detectLanguageRulePacks(_projectRoot: string): Promise<LanguageRulePack[]>;
45
- export declare function readConfig(projectRoot: string, _options?: ReadConfigOptions): Promise<CclawConfig>;
46
- export interface WriteConfigOptions {
47
- mode?: "full" | "minimal";
48
- advancedKeysPresent?: ReadonlySet<never>;
49
- }
50
- export declare function writeConfig(projectRoot: string, config: CclawConfig, _options?: WriteConfigOptions): Promise<void>;
51
- export declare function detectAdvancedKeys(_projectRoot: string): Promise<ReadonlySet<never>>;
1
+ import { type HarnessId } from "./types.js";
2
+ export type HookProfile = "minimal" | "strict";
3
+ export interface CclawConfig {
4
+ version: string;
5
+ flowVersion: "8";
6
+ harnesses: HarnessId[];
7
+ hooks: {
8
+ profile: HookProfile;
9
+ };
10
+ }
11
+ export declare function createDefaultConfig(harnesses?: HarnessId[]): CclawConfig;
12
+ export declare function validateHarnesses(value: string[]): HarnessId[];
13
+ export declare function renderConfig(config: CclawConfig): string;
14
+ export declare function readConfig(projectRoot: string): Promise<CclawConfig | null>;
package/dist/config.js CHANGED
@@ -1,374 +1,38 @@
1
1
  import fs from "node:fs/promises";
2
2
  import path from "node:path";
3
- import { parse, stringify } from "yaml";
4
- import { CCLAW_VERSION, DEFAULT_HARNESSES, FLOW_VERSION, RUNTIME_ROOT } from "./constants.js";
5
- import { exists, writeFileSafe } from "./fs-utils.js";
3
+ import YAML from "yaml";
4
+ import { CCLAW_VERSION, RUNTIME_ROOT } from "./constants.js";
6
5
  import { HARNESS_IDS } from "./types.js";
7
- const CONFIG_PATH = `${RUNTIME_ROOT}/config.yaml`;
8
- const HARNESS_ID_SET = new Set(HARNESS_IDS);
9
- const ALLOWED_CONFIG_KEYS = new Set([
10
- "version",
11
- "flowVersion",
12
- "harnesses",
13
- "tdd",
14
- "execution",
15
- "plan"
16
- ]);
17
- const SUPPORTED_HARNESSES_TEXT = HARNESS_IDS.join(", ");
18
- export const TDD_COMMIT_MODES = [
19
- "managed-per-slice",
20
- "agent-required",
21
- "checkpoint-only",
22
- "off"
23
- ];
24
- const TDD_COMMIT_MODE_SET = new Set(TDD_COMMIT_MODES);
25
- export const DEFAULT_TDD_COMMIT_MODE = "managed-per-slice";
26
- export const TDD_ISOLATION_MODES = ["worktree", "in-place", "auto"];
27
- const TDD_ISOLATION_MODE_SET = new Set(TDD_ISOLATION_MODES);
28
- export const DEFAULT_TDD_ISOLATION_MODE = "worktree";
29
- export const DEFAULT_TDD_WORKTREE_ROOT = `${RUNTIME_ROOT}/worktrees`;
30
- export const LOCKFILE_TWIN_POLICIES = ["auto-include", "auto-revert", "strict-fence"];
31
- const LOCKFILE_TWIN_POLICY_SET = new Set(LOCKFILE_TWIN_POLICIES);
32
- export const DEFAULT_LOCKFILE_TWIN_POLICY = "auto-include";
33
- export const EXECUTION_TOPOLOGIES = [
34
- "auto",
35
- "inline",
36
- "single-builder",
37
- "parallel-builders",
38
- "strict-micro"
39
- ];
40
- const EXECUTION_TOPOLOGY_SET = new Set(EXECUTION_TOPOLOGIES);
41
- export const DEFAULT_EXECUTION_TOPOLOGY = "auto";
42
- export const EXECUTION_STRICTNESS_PROFILES = ["fast", "balanced", "strict"];
43
- const EXECUTION_STRICTNESS_PROFILE_SET = new Set(EXECUTION_STRICTNESS_PROFILES);
44
- export const DEFAULT_EXECUTION_STRICTNESS = "balanced";
45
- export const DEFAULT_MAX_BUILDERS = 5;
46
- export const PLAN_SLICE_GRANULARITIES = ["feature-atomic", "strict-micro"];
47
- const PLAN_SLICE_GRANULARITY_SET = new Set(PLAN_SLICE_GRANULARITIES);
48
- export const DEFAULT_PLAN_SLICE_GRANULARITY = "feature-atomic";
49
- export const PLAN_MICRO_TASK_POLICIES = ["advisory", "strict"];
50
- const PLAN_MICRO_TASK_POLICY_SET = new Set(PLAN_MICRO_TASK_POLICIES);
51
- export const DEFAULT_PLAN_MICRO_TASK_POLICY = "advisory";
52
- // Kept for runtime modules that use these defaults directly.
53
- export const DEFAULT_TDD_TEST_PATH_PATTERNS = [
54
- "**/*.test.*",
55
- "**/tests/**",
56
- "**/__tests__/**"
57
- ];
58
- export const DEFAULT_TDD_TEST_GLOBS = [...DEFAULT_TDD_TEST_PATH_PATTERNS];
59
- export const DEFAULT_TDD_PRODUCTION_PATH_PATTERNS = [];
60
- export const DEFAULT_COMPOUND_RECURRENCE_THRESHOLD = 3;
61
- export const DEFAULT_EARLY_LOOP_MAX_ITERATIONS = 3;
62
- export function createConfigWarningState() {
63
- return { emitted: new Set() };
64
- }
65
- export class InvalidConfigError extends Error {
66
- constructor(message) {
67
- super(message);
68
- this.name = "InvalidConfigError";
69
- }
70
- }
71
- function configFixExample() {
72
- return `harnesses:
73
- - claude
74
- - cursor
75
- tdd:
76
- commitMode: managed-per-slice
77
- isolationMode: worktree
78
- worktreeRoot: .cclaw/worktrees
79
- execution:
80
- topology: auto
81
- strictness: balanced
82
- maxBuilders: 5
83
- plan:
84
- sliceGranularity: feature-atomic
85
- microTaskPolicy: advisory`;
86
- }
87
- function configValidationError(configFilePath, reason) {
88
- return new InvalidConfigError(`Invalid cclaw config at ${configFilePath}: ${reason}\n` +
89
- `Supported harnesses: ${SUPPORTED_HARNESSES_TEXT}\n` +
90
- `Example config:\n${configFixExample()}\n` +
91
- `After fixing, run: cclaw sync`);
92
- }
93
- function isRecord(value) {
94
- return typeof value === "object" && value !== null && !Array.isArray(value);
95
- }
96
- export function configPath(projectRoot) {
97
- return path.join(projectRoot, CONFIG_PATH);
98
- }
99
- export function createDefaultConfig(harnesses = DEFAULT_HARNESSES, _defaultTrack = "standard") {
6
+ export function createDefaultConfig(harnesses = ["cursor"]) {
100
7
  return {
101
8
  version: CCLAW_VERSION,
102
- flowVersion: FLOW_VERSION,
103
- harnesses: [...new Set(harnesses)],
104
- tdd: {
105
- commitMode: DEFAULT_TDD_COMMIT_MODE,
106
- isolationMode: DEFAULT_TDD_ISOLATION_MODE,
107
- worktreeRoot: DEFAULT_TDD_WORKTREE_ROOT,
108
- lockfileTwinPolicy: DEFAULT_LOCKFILE_TWIN_POLICY
109
- },
110
- execution: {
111
- topology: DEFAULT_EXECUTION_TOPOLOGY,
112
- strictness: DEFAULT_EXECUTION_STRICTNESS,
113
- maxBuilders: DEFAULT_MAX_BUILDERS
114
- },
115
- plan: {
116
- sliceGranularity: DEFAULT_PLAN_SLICE_GRANULARITY,
117
- microTaskPolicy: DEFAULT_PLAN_MICRO_TASK_POLICY
118
- }
9
+ flowVersion: "8",
10
+ harnesses,
11
+ hooks: { profile: "minimal" }
119
12
  };
120
13
  }
121
- export function resolveTddCommitMode(config) {
122
- const raw = config?.tdd?.commitMode;
123
- if (typeof raw === "string" && TDD_COMMIT_MODE_SET.has(raw)) {
124
- return raw;
125
- }
126
- return DEFAULT_TDD_COMMIT_MODE;
127
- }
128
- export function resolveTddIsolationMode(config) {
129
- const raw = config?.tdd?.isolationMode;
130
- if (typeof raw === "string" && TDD_ISOLATION_MODE_SET.has(raw)) {
131
- return raw;
14
+ export function validateHarnesses(value) {
15
+ if (value.length === 0) {
16
+ throw new Error("At least one harness must be selected.");
132
17
  }
133
- return DEFAULT_TDD_ISOLATION_MODE;
134
- }
135
- export function resolveTddWorktreeRoot(config) {
136
- const raw = config?.tdd?.worktreeRoot;
137
- if (typeof raw === "string" && raw.trim().length > 0) {
138
- return raw.trim();
139
- }
140
- return DEFAULT_TDD_WORKTREE_ROOT;
141
- }
142
- export function resolveLockfileTwinPolicy(config) {
143
- const raw = config?.tdd?.lockfileTwinPolicy;
144
- if (typeof raw === "string" && LOCKFILE_TWIN_POLICY_SET.has(raw)) {
145
- return raw;
18
+ const invalid = value.filter((item) => !HARNESS_IDS.includes(item));
19
+ if (invalid.length > 0) {
20
+ throw new Error(`Unknown harnesses: ${invalid.join(", ")}. Supported: ${HARNESS_IDS.join(", ")}`);
146
21
  }
147
- return DEFAULT_LOCKFILE_TWIN_POLICY;
148
- }
149
- export function resolveExecutionTopology(config) {
150
- const raw = config?.execution?.topology;
151
- if (typeof raw === "string" && EXECUTION_TOPOLOGY_SET.has(raw)) {
152
- return raw;
153
- }
154
- return DEFAULT_EXECUTION_TOPOLOGY;
155
- }
156
- export function resolveExecutionStrictness(config) {
157
- const raw = config?.execution?.strictness;
158
- if (typeof raw === "string" && EXECUTION_STRICTNESS_PROFILE_SET.has(raw)) {
159
- return raw;
160
- }
161
- return DEFAULT_EXECUTION_STRICTNESS;
162
- }
163
- export function resolveMaxBuilders(config) {
164
- const raw = config?.execution?.maxBuilders;
165
- if (typeof raw === "number" && Number.isInteger(raw) && raw >= 1) {
166
- return raw;
167
- }
168
- return DEFAULT_MAX_BUILDERS;
169
- }
170
- export function resolvePlanSliceGranularity(config) {
171
- const raw = config?.plan?.sliceGranularity;
172
- if (typeof raw === "string" && PLAN_SLICE_GRANULARITY_SET.has(raw)) {
173
- return raw;
174
- }
175
- return DEFAULT_PLAN_SLICE_GRANULARITY;
176
- }
177
- export function resolvePlanMicroTaskPolicy(config) {
178
- const raw = config?.plan?.microTaskPolicy;
179
- if (typeof raw === "string" && PLAN_MICRO_TASK_POLICY_SET.has(raw)) {
180
- return raw;
181
- }
182
- return DEFAULT_PLAN_MICRO_TASK_POLICY;
183
- }
184
- function assertOnlySupportedKeys(parsed, fullPath) {
185
- const unknownKeys = Object.keys(parsed).filter((key) => !ALLOWED_CONFIG_KEYS.has(key));
186
- if (unknownKeys.length === 0)
187
- return;
188
- const keyList = unknownKeys.join(", ");
189
- throw configValidationError(fullPath, `key(s) ${keyList} are no longer supported in cclaw 3.0.0; see CHANGELOG.md`);
22
+ return value;
190
23
  }
191
- export async function detectLanguageRulePacks(_projectRoot) {
192
- // Harness-only config. Language packs are no longer configurable.
193
- return [];
24
+ export function renderConfig(config) {
25
+ return YAML.stringify(config);
194
26
  }
195
- export async function readConfig(projectRoot, _options = {}) {
196
- const fullPath = configPath(projectRoot);
197
- if (!(await exists(fullPath))) {
198
- return createDefaultConfig();
199
- }
200
- let parsedUnknown;
27
+ export async function readConfig(projectRoot) {
28
+ const configPath = path.join(projectRoot, RUNTIME_ROOT, "config.yaml");
201
29
  try {
202
- parsedUnknown = parse(await fs.readFile(fullPath, "utf8"));
203
- }
204
- catch (error) {
205
- const reason = error instanceof Error ? error.message : "unknown parse error";
206
- throw configValidationError(fullPath, `failed to parse YAML (${reason})`);
207
- }
208
- if (parsedUnknown !== null && parsedUnknown !== undefined && !isRecord(parsedUnknown)) {
209
- throw configValidationError(fullPath, "top-level config must be a YAML mapping/object");
210
- }
211
- const parsed = (isRecord(parsedUnknown) ? parsedUnknown : {});
212
- assertOnlySupportedKeys(parsed, fullPath);
213
- if (Object.prototype.hasOwnProperty.call(parsed, "harnesses") &&
214
- !Array.isArray(parsed.harnesses)) {
215
- throw configValidationError(fullPath, `"harnesses" must be an array`);
216
- }
217
- if (Object.prototype.hasOwnProperty.call(parsed, "tdd") &&
218
- !isRecord(parsed.tdd)) {
219
- throw configValidationError(fullPath, `"tdd" must be an object when provided`);
220
- }
221
- if (Object.prototype.hasOwnProperty.call(parsed, "execution") &&
222
- !isRecord(parsed.execution)) {
223
- throw configValidationError(fullPath, `"execution" must be an object when provided`);
224
- }
225
- if (Object.prototype.hasOwnProperty.call(parsed, "plan") &&
226
- !isRecord(parsed.plan)) {
227
- throw configValidationError(fullPath, `"plan" must be an object when provided`);
228
- }
229
- const rawHarnesses = Array.isArray(parsed.harnesses) ? parsed.harnesses : DEFAULT_HARNESSES;
230
- const normalizedHarnesses = [];
231
- for (const harness of rawHarnesses) {
232
- if (typeof harness !== "string" || !HARNESS_ID_SET.has(harness)) {
233
- throw configValidationError(fullPath, `unknown harness id "${String(harness)}"`);
234
- }
235
- if (!normalizedHarnesses.includes(harness)) {
236
- normalizedHarnesses.push(harness);
237
- }
238
- }
239
- if (normalizedHarnesses.length === 0) {
240
- throw configValidationError(fullPath, `"harnesses" must include at least one harness`);
241
- }
242
- const version = typeof parsed.version === "string" && parsed.version.trim().length > 0
243
- ? parsed.version
244
- : CCLAW_VERSION;
245
- const flowVersion = typeof parsed.flowVersion === "string" && parsed.flowVersion.trim().length > 0
246
- ? parsed.flowVersion
247
- : FLOW_VERSION;
248
- const parsedTdd = isRecord(parsed.tdd) ? parsed.tdd : {};
249
- const rawCommitMode = parsedTdd.commitMode;
250
- const rawIsolationMode = parsedTdd.isolationMode;
251
- const rawWorktreeRoot = parsedTdd.worktreeRoot;
252
- const rawLockfileTwinPolicy = parsedTdd.lockfileTwinPolicy;
253
- const parsedExecution = isRecord(parsed.execution) ? parsed.execution : {};
254
- const rawExecutionTopology = parsedExecution.topology;
255
- const rawExecutionStrictness = parsedExecution.strictness;
256
- const rawMaxBuilders = parsedExecution.maxBuilders;
257
- const parsedPlan = isRecord(parsed.plan) ? parsed.plan : {};
258
- const rawPlanSliceGranularity = parsedPlan.sliceGranularity;
259
- const rawPlanMicroTaskPolicy = parsedPlan.microTaskPolicy;
260
- if (rawCommitMode !== undefined &&
261
- (typeof rawCommitMode !== "string" || !TDD_COMMIT_MODE_SET.has(rawCommitMode))) {
262
- throw configValidationError(fullPath, `"tdd.commitMode" must be one of: ${TDD_COMMIT_MODES.join(", ")}`);
263
- }
264
- if (rawIsolationMode !== undefined &&
265
- (typeof rawIsolationMode !== "string" || !TDD_ISOLATION_MODE_SET.has(rawIsolationMode))) {
266
- throw configValidationError(fullPath, `"tdd.isolationMode" must be one of: ${TDD_ISOLATION_MODES.join(", ")}`);
30
+ const raw = await fs.readFile(configPath, "utf8");
31
+ return YAML.parse(raw);
267
32
  }
268
- if (rawWorktreeRoot !== undefined &&
269
- (typeof rawWorktreeRoot !== "string" || rawWorktreeRoot.trim().length === 0)) {
270
- throw configValidationError(fullPath, `"tdd.worktreeRoot" must be a non-empty string when provided`);
33
+ catch (err) {
34
+ if (err instanceof Error && "code" in err && err.code === "ENOENT")
35
+ return null;
36
+ throw err;
271
37
  }
272
- if (rawLockfileTwinPolicy !== undefined &&
273
- (typeof rawLockfileTwinPolicy !== "string" || !LOCKFILE_TWIN_POLICY_SET.has(rawLockfileTwinPolicy))) {
274
- throw configValidationError(fullPath, `"tdd.lockfileTwinPolicy" must be one of: ${LOCKFILE_TWIN_POLICIES.join(", ")}`);
275
- }
276
- if (rawExecutionTopology !== undefined &&
277
- (typeof rawExecutionTopology !== "string" || !EXECUTION_TOPOLOGY_SET.has(rawExecutionTopology))) {
278
- throw configValidationError(fullPath, `"execution.topology" must be one of: ${EXECUTION_TOPOLOGIES.join(", ")}`);
279
- }
280
- if (rawExecutionStrictness !== undefined &&
281
- (typeof rawExecutionStrictness !== "string" ||
282
- !EXECUTION_STRICTNESS_PROFILE_SET.has(rawExecutionStrictness))) {
283
- throw configValidationError(fullPath, `"execution.strictness" must be one of: ${EXECUTION_STRICTNESS_PROFILES.join(", ")}`);
284
- }
285
- if (rawMaxBuilders !== undefined &&
286
- (!Number.isInteger(rawMaxBuilders) || rawMaxBuilders < 1)) {
287
- throw configValidationError(fullPath, `"execution.maxBuilders" must be an integer >= 1 when provided`);
288
- }
289
- if (rawPlanSliceGranularity !== undefined &&
290
- (typeof rawPlanSliceGranularity !== "string" ||
291
- !PLAN_SLICE_GRANULARITY_SET.has(rawPlanSliceGranularity))) {
292
- throw configValidationError(fullPath, `"plan.sliceGranularity" must be one of: ${PLAN_SLICE_GRANULARITIES.join(", ")}`);
293
- }
294
- if (rawPlanMicroTaskPolicy !== undefined &&
295
- (typeof rawPlanMicroTaskPolicy !== "string" ||
296
- !PLAN_MICRO_TASK_POLICY_SET.has(rawPlanMicroTaskPolicy))) {
297
- throw configValidationError(fullPath, `"plan.microTaskPolicy" must be one of: ${PLAN_MICRO_TASK_POLICIES.join(", ")}`);
298
- }
299
- const commitMode = typeof rawCommitMode === "string"
300
- ? rawCommitMode
301
- : DEFAULT_TDD_COMMIT_MODE;
302
- const isolationMode = typeof rawIsolationMode === "string"
303
- ? rawIsolationMode
304
- : DEFAULT_TDD_ISOLATION_MODE;
305
- const worktreeRoot = typeof rawWorktreeRoot === "string" && rawWorktreeRoot.trim().length > 0
306
- ? rawWorktreeRoot.trim()
307
- : DEFAULT_TDD_WORKTREE_ROOT;
308
- const lockfileTwinPolicy = typeof rawLockfileTwinPolicy === "string"
309
- ? rawLockfileTwinPolicy
310
- : DEFAULT_LOCKFILE_TWIN_POLICY;
311
- const executionTopology = typeof rawExecutionTopology === "string"
312
- ? rawExecutionTopology
313
- : DEFAULT_EXECUTION_TOPOLOGY;
314
- const executionStrictness = typeof rawExecutionStrictness === "string"
315
- ? rawExecutionStrictness
316
- : DEFAULT_EXECUTION_STRICTNESS;
317
- const maxBuilders = typeof rawMaxBuilders === "number" &&
318
- Number.isInteger(rawMaxBuilders) &&
319
- rawMaxBuilders >= 1
320
- ? rawMaxBuilders
321
- : DEFAULT_MAX_BUILDERS;
322
- const planSliceGranularity = typeof rawPlanSliceGranularity === "string"
323
- ? rawPlanSliceGranularity
324
- : DEFAULT_PLAN_SLICE_GRANULARITY;
325
- const planMicroTaskPolicy = typeof rawPlanMicroTaskPolicy === "string"
326
- ? rawPlanMicroTaskPolicy
327
- : DEFAULT_PLAN_MICRO_TASK_POLICY;
328
- return {
329
- version,
330
- flowVersion,
331
- harnesses: normalizedHarnesses,
332
- tdd: {
333
- commitMode,
334
- isolationMode,
335
- worktreeRoot,
336
- lockfileTwinPolicy
337
- },
338
- execution: {
339
- topology: executionTopology,
340
- strictness: executionStrictness,
341
- maxBuilders
342
- },
343
- plan: {
344
- sliceGranularity: planSliceGranularity,
345
- microTaskPolicy: planMicroTaskPolicy
346
- }
347
- };
348
- }
349
- export async function writeConfig(projectRoot, config, _options = {}) {
350
- const serialisable = {
351
- version: config.version,
352
- flowVersion: config.flowVersion,
353
- harnesses: config.harnesses,
354
- tdd: {
355
- commitMode: resolveTddCommitMode(config),
356
- isolationMode: resolveTddIsolationMode(config),
357
- worktreeRoot: resolveTddWorktreeRoot(config),
358
- lockfileTwinPolicy: resolveLockfileTwinPolicy(config)
359
- },
360
- execution: {
361
- topology: resolveExecutionTopology(config),
362
- strictness: resolveExecutionStrictness(config),
363
- maxBuilders: resolveMaxBuilders(config)
364
- },
365
- plan: {
366
- sliceGranularity: resolvePlanSliceGranularity(config),
367
- microTaskPolicy: resolvePlanMicroTaskPolicy(config)
368
- }
369
- };
370
- await writeFileSafe(configPath(projectRoot), stringify(serialisable));
371
- }
372
- export async function detectAdvancedKeys(_projectRoot) {
373
- return new Set();
374
38
  }
@@ -1,19 +1,12 @@
1
- import type { FlowStage, HarnessId } from "./types.js";
2
- /** Hidden runtime directory at project root (dot-prefixed). */
1
+ export declare const CCLAW_VERSION = "8.1.1";
3
2
  export declare const RUNTIME_ROOT = ".cclaw";
4
- export declare const CCLAW_VERSION: string;
5
- export declare const FLOW_VERSION = "1.0.0";
6
- /**
7
- * Canonical ship finalization enums used across stage schema, linting, and
8
- * runtime gate evidence checks.
9
- */
10
- export declare const SHIP_FINALIZATION_MODES: readonly ["FINALIZE_MERGE_LOCAL", "FINALIZE_OPEN_PR", "FINALIZE_KEEP_BRANCH", "FINALIZE_DISCARD_BRANCH", "FINALIZE_NO_VCS"];
11
- export type ShipFinalizationMode = (typeof SHIP_FINALIZATION_MODES)[number];
12
- export declare const DEFAULT_HARNESSES: HarnessId[];
13
- export declare const REQUIRED_DIRS: readonly [".cclaw", ".cclaw/commands", ".cclaw/skills", ".cclaw/templates", ".cclaw/templates/state-contracts", ".cclaw/artifacts", ".cclaw/wave-plans", ".cclaw/archive", ".cclaw/worktrees", ".cclaw/state", ".cclaw/rules", ".cclaw/agents", ".cclaw/hooks", ".cclaw/skills/review-prompts"];
14
- export declare const REQUIRED_GITIGNORE_PATTERNS: readonly ["# cclaw generated artifacts", ".cclaw/", ".claude/commands/cc-*.md", ".claude/commands/cc.md", ".cursor/commands/cc-*.md", ".cursor/commands/cc.md", ".opencode/commands/cc-*.md", ".opencode/commands/cc.md", ".agents/skills/cc/SKILL.md", ".agents/skills/cc-*/SKILL.md", ".claude/hooks/hooks.json", ".cursor/hooks.json", ".codex/hooks.json", ".opencode/plugins/cclaw-plugin.mjs", ".cursor/rules/cclaw-workflow.mdc"];
15
- /**
16
- * Canonical stage -> skill folder mapping.
17
- */
18
- export declare const STAGE_TO_SKILL_FOLDER: Record<FlowStage, string>;
19
- export declare const SUBAGENT_SKILL_FOLDERS: readonly ["subagent-dev", "parallel-dispatch"];
3
+ export declare const STATE_REL_PATH = ".cclaw/state";
4
+ export declare const HOOKS_REL_PATH = ".cclaw/hooks";
5
+ export declare const FLOWS_ROOT = ".cclaw/flows";
6
+ export declare const LIB_ROOT = ".cclaw/lib";
7
+ export declare const FLOW_STATE_REL_PATH = ".cclaw/state/flow-state.json";
8
+ export declare const KNOWLEDGE_LOG_REL_PATH = ".cclaw/knowledge.jsonl";
9
+ export declare const IDEAS_REL_PATH = ".cclaw/ideas.md";
10
+ export declare const SHIPPED_DIR_REL_PATH = ".cclaw/flows/shipped";
11
+ export declare const CANCELLED_DIR_REL_PATH = ".cclaw/flows/cancelled";
12
+ export declare const LIB_DIRS: readonly ["agents", "skills", "templates", "runbooks", "patterns", "research", "recovery", "examples"];