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.
- package/README.md +211 -134
- package/dist/artifact-frontmatter.d.ts +51 -0
- package/dist/artifact-frontmatter.js +131 -0
- package/dist/artifact-paths.d.ts +7 -27
- package/dist/artifact-paths.js +20 -249
- package/dist/cancel.d.ts +16 -0
- package/dist/cancel.js +66 -0
- package/dist/cli.d.ts +2 -27
- package/dist/cli.js +107 -511
- package/dist/compound.d.ts +26 -0
- package/dist/compound.js +96 -0
- package/dist/config.d.ts +14 -51
- package/dist/config.js +23 -359
- package/dist/constants.d.ts +11 -18
- package/dist/constants.js +19 -106
- package/dist/content/antipatterns.d.ts +1 -0
- package/dist/content/antipatterns.js +109 -0
- package/dist/content/artifact-templates.d.ts +10 -0
- package/dist/content/artifact-templates.js +550 -0
- package/dist/content/cancel-command.d.ts +2 -2
- package/dist/content/cancel-command.js +25 -17
- package/dist/content/core-agents.d.ts +9 -233
- package/dist/content/core-agents.js +39 -768
- package/dist/content/decision-protocol.d.ts +1 -12
- package/dist/content/decision-protocol.js +27 -20
- package/dist/content/examples.d.ts +8 -42
- package/dist/content/examples.js +293 -425
- package/dist/content/idea-command.d.ts +2 -0
- package/dist/content/idea-command.js +38 -0
- package/dist/content/iron-laws.d.ts +4 -138
- package/dist/content/iron-laws.js +18 -197
- package/dist/content/meta-skill.d.ts +1 -3
- package/dist/content/meta-skill.js +57 -134
- package/dist/content/node-hooks.d.ts +12 -8
- package/dist/content/node-hooks.js +188 -838
- package/dist/content/recovery.d.ts +8 -0
- package/dist/content/recovery.js +179 -0
- package/dist/content/reference-patterns.d.ts +4 -13
- package/dist/content/reference-patterns.js +260 -389
- package/dist/content/research-playbooks.d.ts +8 -8
- package/dist/content/research-playbooks.js +108 -121
- package/dist/content/review-loop.d.ts +6 -192
- package/dist/content/review-loop.js +29 -731
- package/dist/content/skills.d.ts +8 -38
- package/dist/content/skills.js +681 -732
- package/dist/content/specialist-prompts/architect.d.ts +1 -0
- package/dist/content/specialist-prompts/architect.js +225 -0
- package/dist/content/specialist-prompts/brainstormer.d.ts +1 -0
- package/dist/content/specialist-prompts/brainstormer.js +168 -0
- package/dist/content/specialist-prompts/index.d.ts +2 -0
- package/dist/content/specialist-prompts/index.js +14 -0
- package/dist/content/specialist-prompts/planner.d.ts +1 -0
- package/dist/content/specialist-prompts/planner.js +182 -0
- package/dist/content/specialist-prompts/reviewer.d.ts +1 -0
- package/dist/content/specialist-prompts/reviewer.js +193 -0
- package/dist/content/specialist-prompts/security-reviewer.d.ts +1 -0
- package/dist/content/specialist-prompts/security-reviewer.js +133 -0
- package/dist/content/specialist-prompts/slice-builder.d.ts +1 -0
- package/dist/content/specialist-prompts/slice-builder.js +232 -0
- package/dist/content/stage-playbooks.d.ts +8 -0
- package/dist/content/stage-playbooks.js +404 -0
- package/dist/content/start-command.d.ts +2 -12
- package/dist/content/start-command.js +221 -207
- package/dist/flow-state.d.ts +21 -178
- package/dist/flow-state.js +67 -170
- package/dist/fs-utils.d.ts +6 -26
- package/dist/fs-utils.js +29 -162
- package/dist/gitignore.d.ts +2 -1
- package/dist/gitignore.js +51 -34
- package/dist/harness-detect.d.ts +10 -0
- package/dist/harness-detect.js +29 -0
- package/dist/harness-prompt.d.ts +26 -0
- package/dist/harness-prompt.js +142 -0
- package/dist/install.d.ts +35 -15
- package/dist/install.js +238 -1347
- package/dist/knowledge-store.d.ts +19 -163
- package/dist/knowledge-store.js +56 -590
- package/dist/logger.d.ts +8 -3
- package/dist/logger.js +13 -4
- package/dist/orchestrator-routing.d.ts +29 -0
- package/dist/orchestrator-routing.js +156 -0
- package/dist/run-persistence.d.ts +7 -118
- package/dist/run-persistence.js +29 -845
- package/dist/runtime/run-hook.entry.d.ts +1 -3
- package/dist/runtime/run-hook.entry.js +19 -4
- package/dist/runtime/run-hook.mjs +13 -1024
- package/dist/types.d.ts +25 -261
- package/dist/types.js +8 -36
- package/package.json +6 -3
- package/dist/artifact-linter/brainstorm.d.ts +0 -2
- package/dist/artifact-linter/brainstorm.js +0 -353
- package/dist/artifact-linter/design.d.ts +0 -18
- package/dist/artifact-linter/design.js +0 -444
- package/dist/artifact-linter/findings-dedup.d.ts +0 -56
- package/dist/artifact-linter/findings-dedup.js +0 -232
- package/dist/artifact-linter/plan.d.ts +0 -2
- package/dist/artifact-linter/plan.js +0 -826
- package/dist/artifact-linter/review-army.d.ts +0 -49
- package/dist/artifact-linter/review-army.js +0 -520
- package/dist/artifact-linter/review.d.ts +0 -2
- package/dist/artifact-linter/review.js +0 -113
- package/dist/artifact-linter/scope.d.ts +0 -2
- package/dist/artifact-linter/scope.js +0 -158
- package/dist/artifact-linter/shared.d.ts +0 -637
- package/dist/artifact-linter/shared.js +0 -2163
- package/dist/artifact-linter/ship.d.ts +0 -2
- package/dist/artifact-linter/ship.js +0 -250
- package/dist/artifact-linter/spec.d.ts +0 -2
- package/dist/artifact-linter/spec.js +0 -176
- package/dist/artifact-linter/tdd.d.ts +0 -118
- package/dist/artifact-linter/tdd.js +0 -1404
- package/dist/artifact-linter.d.ts +0 -15
- package/dist/artifact-linter.js +0 -517
- package/dist/codex-feature-flag.d.ts +0 -58
- package/dist/codex-feature-flag.js +0 -193
- package/dist/content/closeout-guidance.d.ts +0 -14
- package/dist/content/closeout-guidance.js +0 -44
- package/dist/content/diff-command.d.ts +0 -1
- package/dist/content/diff-command.js +0 -43
- package/dist/content/harness-doc.d.ts +0 -1
- package/dist/content/harness-doc.js +0 -65
- package/dist/content/hook-events.d.ts +0 -9
- package/dist/content/hook-events.js +0 -23
- package/dist/content/hook-manifest.d.ts +0 -81
- package/dist/content/hook-manifest.js +0 -156
- package/dist/content/hooks.d.ts +0 -11
- package/dist/content/hooks.js +0 -1972
- package/dist/content/idea.d.ts +0 -60
- package/dist/content/idea.js +0 -416
- package/dist/content/language-policy.d.ts +0 -2
- package/dist/content/language-policy.js +0 -13
- package/dist/content/learnings.d.ts +0 -6
- package/dist/content/learnings.js +0 -141
- package/dist/content/observe.d.ts +0 -19
- package/dist/content/observe.js +0 -86
- package/dist/content/opencode-plugin.d.ts +0 -1
- package/dist/content/opencode-plugin.js +0 -635
- package/dist/content/review-prompts.d.ts +0 -1
- package/dist/content/review-prompts.js +0 -104
- package/dist/content/runtime-shared-snippets.d.ts +0 -8
- package/dist/content/runtime-shared-snippets.js +0 -80
- package/dist/content/session-hooks.d.ts +0 -7
- package/dist/content/session-hooks.js +0 -107
- package/dist/content/skills-elicitation.d.ts +0 -1
- package/dist/content/skills-elicitation.js +0 -167
- package/dist/content/stage-command.d.ts +0 -2
- package/dist/content/stage-command.js +0 -17
- package/dist/content/stage-schema.d.ts +0 -117
- package/dist/content/stage-schema.js +0 -955
- package/dist/content/stages/_lint-metadata/index.d.ts +0 -2
- package/dist/content/stages/_lint-metadata/index.js +0 -97
- package/dist/content/stages/brainstorm.d.ts +0 -2
- package/dist/content/stages/brainstorm.js +0 -184
- package/dist/content/stages/design.d.ts +0 -2
- package/dist/content/stages/design.js +0 -288
- package/dist/content/stages/index.d.ts +0 -8
- package/dist/content/stages/index.js +0 -11
- package/dist/content/stages/plan.d.ts +0 -2
- package/dist/content/stages/plan.js +0 -191
- package/dist/content/stages/review.d.ts +0 -2
- package/dist/content/stages/review.js +0 -240
- package/dist/content/stages/schema-types.d.ts +0 -203
- package/dist/content/stages/schema-types.js +0 -1
- package/dist/content/stages/scope.d.ts +0 -2
- package/dist/content/stages/scope.js +0 -254
- package/dist/content/stages/ship.d.ts +0 -2
- package/dist/content/stages/ship.js +0 -159
- package/dist/content/stages/spec.d.ts +0 -2
- package/dist/content/stages/spec.js +0 -170
- package/dist/content/stages/tdd.d.ts +0 -4
- package/dist/content/stages/tdd.js +0 -273
- package/dist/content/state-contracts.d.ts +0 -1
- package/dist/content/state-contracts.js +0 -63
- package/dist/content/status-command.d.ts +0 -4
- package/dist/content/status-command.js +0 -109
- package/dist/content/subagent-context-skills.d.ts +0 -4
- package/dist/content/subagent-context-skills.js +0 -279
- package/dist/content/subagents.d.ts +0 -3
- package/dist/content/subagents.js +0 -997
- package/dist/content/templates.d.ts +0 -26
- package/dist/content/templates.js +0 -1692
- package/dist/content/track-render-context.d.ts +0 -18
- package/dist/content/track-render-context.js +0 -53
- package/dist/content/tree-command.d.ts +0 -1
- package/dist/content/tree-command.js +0 -64
- package/dist/content/utility-skills.d.ts +0 -30
- package/dist/content/utility-skills.js +0 -160
- package/dist/content/view-command.d.ts +0 -2
- package/dist/content/view-command.js +0 -92
- package/dist/delegation.d.ts +0 -649
- package/dist/delegation.js +0 -1539
- package/dist/early-loop.d.ts +0 -70
- package/dist/early-loop.js +0 -302
- package/dist/execution-topology.d.ts +0 -44
- package/dist/execution-topology.js +0 -95
- package/dist/gate-evidence.d.ts +0 -85
- package/dist/gate-evidence.js +0 -631
- package/dist/harness-adapters.d.ts +0 -151
- package/dist/harness-adapters.js +0 -756
- package/dist/harness-selection.d.ts +0 -31
- package/dist/harness-selection.js +0 -214
- package/dist/hook-schema.d.ts +0 -6
- package/dist/hook-schema.js +0 -114
- package/dist/hook-schemas/claude-hooks.v1.json +0 -10
- package/dist/hook-schemas/codex-hooks.v1.json +0 -10
- package/dist/hook-schemas/cursor-hooks.v1.json +0 -13
- package/dist/init-detect.d.ts +0 -2
- package/dist/init-detect.js +0 -50
- package/dist/internal/advance-stage/advance.d.ts +0 -89
- package/dist/internal/advance-stage/advance.js +0 -655
- package/dist/internal/advance-stage/cancel-run.d.ts +0 -8
- package/dist/internal/advance-stage/cancel-run.js +0 -19
- package/dist/internal/advance-stage/flow-state-coercion.d.ts +0 -3
- package/dist/internal/advance-stage/flow-state-coercion.js +0 -81
- package/dist/internal/advance-stage/helpers.d.ts +0 -14
- package/dist/internal/advance-stage/helpers.js +0 -145
- package/dist/internal/advance-stage/hook.d.ts +0 -8
- package/dist/internal/advance-stage/hook.js +0 -40
- package/dist/internal/advance-stage/parsers.d.ts +0 -72
- package/dist/internal/advance-stage/parsers.js +0 -357
- package/dist/internal/advance-stage/proactive-delegation-trace.d.ts +0 -24
- package/dist/internal/advance-stage/proactive-delegation-trace.js +0 -56
- package/dist/internal/advance-stage/review-loop.d.ts +0 -16
- package/dist/internal/advance-stage/review-loop.js +0 -199
- package/dist/internal/advance-stage/rewind.d.ts +0 -14
- package/dist/internal/advance-stage/rewind.js +0 -108
- package/dist/internal/advance-stage/start-flow.d.ts +0 -13
- package/dist/internal/advance-stage/start-flow.js +0 -241
- package/dist/internal/advance-stage/verify.d.ts +0 -21
- package/dist/internal/advance-stage/verify.js +0 -185
- package/dist/internal/advance-stage.d.ts +0 -7
- package/dist/internal/advance-stage.js +0 -138
- package/dist/internal/cohesion-contract-stub.d.ts +0 -24
- package/dist/internal/cohesion-contract-stub.js +0 -148
- package/dist/internal/compound-readiness.d.ts +0 -23
- package/dist/internal/compound-readiness.js +0 -102
- package/dist/internal/detect-public-api-changes.d.ts +0 -5
- package/dist/internal/detect-public-api-changes.js +0 -45
- package/dist/internal/detect-supply-chain-changes.d.ts +0 -6
- package/dist/internal/detect-supply-chain-changes.js +0 -138
- package/dist/internal/early-loop-status.d.ts +0 -7
- package/dist/internal/early-loop-status.js +0 -93
- package/dist/internal/envelope-validate.d.ts +0 -7
- package/dist/internal/envelope-validate.js +0 -66
- package/dist/internal/flow-state-repair.d.ts +0 -20
- package/dist/internal/flow-state-repair.js +0 -104
- package/dist/internal/plan-split-waves.d.ts +0 -190
- package/dist/internal/plan-split-waves.js +0 -764
- package/dist/internal/runtime-integrity.d.ts +0 -7
- package/dist/internal/runtime-integrity.js +0 -268
- package/dist/internal/slice-commit.d.ts +0 -7
- package/dist/internal/slice-commit.js +0 -619
- package/dist/internal/tdd-loop-status.d.ts +0 -14
- package/dist/internal/tdd-loop-status.js +0 -68
- package/dist/internal/tdd-red-evidence.d.ts +0 -7
- package/dist/internal/tdd-red-evidence.js +0 -153
- package/dist/internal/waiver-grant.d.ts +0 -62
- package/dist/internal/waiver-grant.js +0 -294
- package/dist/internal/wave-status.d.ts +0 -74
- package/dist/internal/wave-status.js +0 -506
- package/dist/managed-resources.d.ts +0 -53
- package/dist/managed-resources.js +0 -313
- package/dist/policy.d.ts +0 -10
- package/dist/policy.js +0 -167
- package/dist/retro-gate.d.ts +0 -9
- package/dist/retro-gate.js +0 -47
- package/dist/run-archive.d.ts +0 -61
- package/dist/run-archive.js +0 -391
- package/dist/runs.d.ts +0 -2
- package/dist/runs.js +0 -2
- package/dist/stack-detection.d.ts +0 -116
- package/dist/stack-detection.js +0 -489
- package/dist/streaming/event-stream.d.ts +0 -31
- package/dist/streaming/event-stream.js +0 -114
- package/dist/tdd-cycle.d.ts +0 -107
- package/dist/tdd-cycle.js +0 -289
- package/dist/tdd-verification-evidence.d.ts +0 -17
- package/dist/tdd-verification-evidence.js +0 -122
- package/dist/track-heuristics.d.ts +0 -27
- package/dist/track-heuristics.js +0 -154
- package/dist/util/slice-id.d.ts +0 -58
- package/dist/util/slice-id.js +0 -89
- package/dist/worktree-manager.d.ts +0 -20
- package/dist/worktree-manager.js +0 -108
package/dist/compound.js
ADDED
|
@@ -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
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export declare
|
|
12
|
-
export declare
|
|
13
|
-
export declare
|
|
14
|
-
export declare
|
|
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
|
|
4
|
-
import { CCLAW_VERSION,
|
|
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
|
-
|
|
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:
|
|
103
|
-
harnesses
|
|
104
|
-
|
|
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
|
|
122
|
-
|
|
123
|
-
|
|
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
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
|
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
|
|
192
|
-
|
|
193
|
-
return [];
|
|
24
|
+
export function renderConfig(config) {
|
|
25
|
+
return YAML.stringify(config);
|
|
194
26
|
}
|
|
195
|
-
export async function readConfig(projectRoot
|
|
196
|
-
const
|
|
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
|
-
|
|
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
|
-
|
|
269
|
-
(
|
|
270
|
-
|
|
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
|
}
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
|
|
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
|
|
5
|
-
export declare const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export declare const
|
|
11
|
-
export
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
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"];
|