cclaw-cli 7.7.1 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +210 -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 +90 -508
- 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/install.d.ts +27 -15
- package/dist/install.js +230 -1342
- 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
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { FlowTrack } from "../types.js";
|
|
2
|
-
export interface TrackRenderContext {
|
|
3
|
-
track: FlowTrack;
|
|
4
|
-
usesPlanTerminology: boolean;
|
|
5
|
-
traceabilitySourceNoun: string;
|
|
6
|
-
traceabilityIdNoun: string;
|
|
7
|
-
traceabilitySliceNoun: string;
|
|
8
|
-
safetySummary: string;
|
|
9
|
-
upstreamArtifactLabel: string;
|
|
10
|
-
upstreamArtifactPath: string;
|
|
11
|
-
}
|
|
12
|
-
export declare function trackRenderContext(track: FlowTrack): TrackRenderContext;
|
|
13
|
-
/**
|
|
14
|
-
* Render track-aware terminology for text that defaults to standard-track plan
|
|
15
|
-
* wording. Keep this centralized so quick-track rewrites do not drift across
|
|
16
|
-
* stage content generators.
|
|
17
|
-
*/
|
|
18
|
-
export declare function renderTrackTerminology(value: string, context: TrackRenderContext): string;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
function artifactFileName(path) {
|
|
2
|
-
return path.split("/").pop() ?? path;
|
|
3
|
-
}
|
|
4
|
-
export function trackRenderContext(track) {
|
|
5
|
-
if (track === "quick") {
|
|
6
|
-
return {
|
|
7
|
-
track,
|
|
8
|
-
usesPlanTerminology: false,
|
|
9
|
-
traceabilitySourceNoun: "acceptance criterion",
|
|
10
|
-
traceabilityIdNoun: "acceptance criterion ID",
|
|
11
|
-
traceabilitySliceNoun: "acceptance slice",
|
|
12
|
-
safetySummary: "quick skips ceremony, not safety: spec approval, TDD, review, and ship gates remain mandatory",
|
|
13
|
-
upstreamArtifactLabel: "spec artifact",
|
|
14
|
-
upstreamArtifactPath: ".cclaw/artifacts/04-spec.md"
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
track,
|
|
19
|
-
usesPlanTerminology: true,
|
|
20
|
-
traceabilitySourceNoun: "plan task",
|
|
21
|
-
traceabilityIdNoun: "plan task ID",
|
|
22
|
-
traceabilitySliceNoun: "plan slice",
|
|
23
|
-
safetySummary: "full upstream planning safety remains in the active track",
|
|
24
|
-
upstreamArtifactLabel: "plan artifact",
|
|
25
|
-
upstreamArtifactPath: ".cclaw/artifacts/05-plan.md"
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Render track-aware terminology for text that defaults to standard-track plan
|
|
30
|
-
* wording. Keep this centralized so quick-track rewrites do not drift across
|
|
31
|
-
* stage content generators.
|
|
32
|
-
*/
|
|
33
|
-
export function renderTrackTerminology(value, context) {
|
|
34
|
-
if (context.usesPlanTerminology) {
|
|
35
|
-
return value;
|
|
36
|
-
}
|
|
37
|
-
return value
|
|
38
|
-
.replace(/\btask from the plan\b/giu, `${context.traceabilitySourceNoun} from the spec`)
|
|
39
|
-
.replace(/\bplan confirmation\b/giu, "spec approval")
|
|
40
|
-
.replace(/\bplan approval\b/giu, "spec approval")
|
|
41
|
-
.replace(/\bapproved plan slice\b/giu, `approved ${context.traceabilitySliceNoun}`)
|
|
42
|
-
.replace(/\bplanned slice\b/giu, context.traceabilitySliceNoun)
|
|
43
|
-
.replace(/\bplan task ID\b/giu, context.traceabilityIdNoun)
|
|
44
|
-
.replace(/\bplan task\b/giu, context.traceabilitySourceNoun)
|
|
45
|
-
.replace(/\bplan-task\b/giu, "acceptance-criterion")
|
|
46
|
-
.replace(/\btask coverage\b/giu, "source item coverage")
|
|
47
|
-
.replace(/\borphaned tasks\b/giu, "orphaned source items")
|
|
48
|
-
.replace(/\bplan row\b/giu, "acceptance row")
|
|
49
|
-
.replace(/\btraceable to plan slice\b/giu, `traceable to ${context.traceabilitySliceNoun}`)
|
|
50
|
-
.replace(/\bplan slice\b/giu, context.traceabilitySliceNoun)
|
|
51
|
-
.replace(/\bplan artifact\b/giu, context.upstreamArtifactLabel)
|
|
52
|
-
.replace(/05-plan\.md/gu, artifactFileName(context.upstreamArtifactPath));
|
|
53
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function treeSubcommandMarkdown(): string;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { RUNTIME_ROOT } from "../constants.js";
|
|
2
|
-
function flowStatePath() {
|
|
3
|
-
return `${RUNTIME_ROOT}/state/flow-state.json`;
|
|
4
|
-
}
|
|
5
|
-
function delegationLogPath() {
|
|
6
|
-
return `${RUNTIME_ROOT}/state/delegation-log.json`;
|
|
7
|
-
}
|
|
8
|
-
function delegationEventsPath() {
|
|
9
|
-
return `${RUNTIME_ROOT}/state/delegation-events.jsonl`;
|
|
10
|
-
}
|
|
11
|
-
function subagentsPath() {
|
|
12
|
-
return `${RUNTIME_ROOT}/state/subagents.json`;
|
|
13
|
-
}
|
|
14
|
-
function artifactsPath() {
|
|
15
|
-
return `${RUNTIME_ROOT}/artifacts`;
|
|
16
|
-
}
|
|
17
|
-
function rewindLogPath() {
|
|
18
|
-
return `${RUNTIME_ROOT}/state/rewind-log.jsonl`;
|
|
19
|
-
}
|
|
20
|
-
export function treeSubcommandMarkdown() {
|
|
21
|
-
return `# /cc-view tree
|
|
22
|
-
|
|
23
|
-
## HARD-GATE
|
|
24
|
-
|
|
25
|
-
Do not modify state in this command. It is a pure read/render operation.
|
|
26
|
-
|
|
27
|
-
## Protocol
|
|
28
|
-
|
|
29
|
-
1. Read \`${flowStatePath()}\` as source of truth (including \`closeout\`).
|
|
30
|
-
2. Read \`${delegationLogPath()}\` for current-stage delegation status plus
|
|
31
|
-
\`fulfillmentMode\` / \`evidenceRefs\`.
|
|
32
|
-
3. Inspect \`${artifactsPath()}\` for per-stage artifact presence and stale copies,
|
|
33
|
-
and for the retro artifact \`09-retro.md\`.
|
|
34
|
-
4. Use \`npx cclaw-cli sync\` for harness capability status when needed.
|
|
35
|
-
5. Render one compact tree:
|
|
36
|
-
- stage marker: passed/current/pending/skipped/stale,
|
|
37
|
-
- gates summary,
|
|
38
|
-
- artifact summary,
|
|
39
|
-
- delegation branch for current stage with fulfillmentMode, dispatchSurface, proof status, and active tracker labels,
|
|
40
|
-
6. When \`closeout.shipSubstate !== "idle"\` or \`currentStage === "ship"\`, add
|
|
41
|
-
a closeout sub-tree:
|
|
42
|
-
- \`retro:\` line derived from \`closeout.retroDraftedAt\` /
|
|
43
|
-
\`closeout.retroAcceptedAt\` / \`closeout.retroSkipped\` and artifact presence,
|
|
44
|
-
- \`compound:\` line derived from \`closeout.compoundPromoted\` /
|
|
45
|
-
\`closeout.compoundSkipped\` / \`closeout.compoundCompletedAt\`,
|
|
46
|
-
- \`archive:\` line — \`pending\` until \`shipSubstate === "ready_to_archive"\`,
|
|
47
|
-
then \`next\`; the transient \`archived\` substate surfaces only if the
|
|
48
|
-
archive step failed mid-run.
|
|
49
|
-
7. Append a \`harnesses:\` branch. For each installed harness derive the tier
|
|
50
|
-
and fallback from cclaw capability metadata; use \`npx cclaw-cli sync\`
|
|
51
|
-
for remediation details when needed.
|
|
52
|
-
8. If rewind records exist in \`${rewindLogPath()}\`, include latest rewind note in footer.
|
|
53
|
-
|
|
54
|
-
## Validation
|
|
55
|
-
|
|
56
|
-
- Output must mention the active \`track\` and \`currentStage\`.
|
|
57
|
-
- Exactly one stage is marked current.
|
|
58
|
-
- Missing files are reported explicitly; never guessed as complete.
|
|
59
|
-
- Delegation rows always carry a fulfillmentMode label (or \`mode=?\` when the
|
|
60
|
-
ledger entry is legacy and the mode is inferred).
|
|
61
|
-
- Closeout sub-tree is present iff ship is reached; it cannot be omitted while
|
|
62
|
-
\`shipSubstate !== "idle"\`.
|
|
63
|
-
`;
|
|
64
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Opt-in language rule packs for stage hooks and the meta-skill router.
|
|
3
|
-
* These are generated under `.cclaw/rules/lang`, not as default skills.
|
|
4
|
-
*/
|
|
5
|
-
export declare function languageTypescriptSkill(): string;
|
|
6
|
-
export declare function languagePythonSkill(): string;
|
|
7
|
-
export declare function languageGoSkill(): string;
|
|
8
|
-
/**
|
|
9
|
-
* Language rule packs live under `.cclaw/rules/lang/<pack>.md`. They are NOT
|
|
10
|
-
* skills (no folder, no `SKILL.md`) — they are opt-in **rule files** that the
|
|
11
|
-
* meta-skill router and stage hooks consult when the corresponding language
|
|
12
|
-
* appears in a diff. The pack id doubles as the on-disk filename stem.
|
|
13
|
-
*/
|
|
14
|
-
export declare const LANGUAGE_RULE_PACK_FILES: {
|
|
15
|
-
readonly typescript: "typescript.md";
|
|
16
|
-
readonly python: "python.md";
|
|
17
|
-
readonly go: "go.md";
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Folder (relative to runtime root) that holds every enabled language rule
|
|
21
|
-
* pack. A single folder keeps discovery trivial for hooks and for `sync`.
|
|
22
|
-
*/
|
|
23
|
-
export declare const LANGUAGE_RULE_PACK_DIR: readonly ["rules", "lang"];
|
|
24
|
-
export declare const LANGUAGE_RULE_PACK_GENERATORS: Record<string, () => string>;
|
|
25
|
-
/**
|
|
26
|
-
* Older per-language folders under `.cclaw/skills/`. Listed
|
|
27
|
-
* here so `cclaw sync` and `sync` can surface drift and the installer can
|
|
28
|
-
* clean them up after the move to `.cclaw/rules/lang/`.
|
|
29
|
-
*/
|
|
30
|
-
export declare const LEGACY_LANGUAGE_RULE_PACK_FOLDERS: readonly ["language-typescript", "language-python", "language-go"];
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Opt-in language rule packs for stage hooks and the meta-skill router.
|
|
3
|
-
* These are generated under `.cclaw/rules/lang`, not as default skills.
|
|
4
|
-
*/
|
|
5
|
-
export function languageTypescriptSkill() {
|
|
6
|
-
return `---
|
|
7
|
-
name: language-typescript
|
|
8
|
-
description: "TypeScript rule pack. Compact opt-in lens for tdd/review when diffs touch TS/JS files."
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# TypeScript Rule Pack
|
|
12
|
-
|
|
13
|
-
Use this only when a diff includes \`.ts\`, \`.tsx\`, \`.mts\`, \`.cts\`, or \`.js\`.
|
|
14
|
-
|
|
15
|
-
## Blocking rules
|
|
16
|
-
|
|
17
|
-
1. **No silent \`any\` or blanket \`@ts-ignore\`.** Unknown input starts as \`unknown\` and gets narrowed.
|
|
18
|
-
2. **Validate trust boundaries at runtime.** HTTP/env/file/IPC payloads require schema parse before typed use.
|
|
19
|
-
3. **No floating promises.** Await promises or explicitly document fire-and-forget behavior.
|
|
20
|
-
4. **Exhaustive union handling.** Discriminated-union switches must fail loudly on missing branches.
|
|
21
|
-
|
|
22
|
-
## Follow-up rules
|
|
23
|
-
|
|
24
|
-
- Prefer immutable/readonly data by default.
|
|
25
|
-
- Keep types local and explicit at module boundaries.
|
|
26
|
-
- Add/adjust tests when changing inferred public behavior.
|
|
27
|
-
|
|
28
|
-
## Output format
|
|
29
|
-
|
|
30
|
-
\`file:line — rule id — concise remediation\`
|
|
31
|
-
`;
|
|
32
|
-
}
|
|
33
|
-
export function languagePythonSkill() {
|
|
34
|
-
return `---
|
|
35
|
-
name: language-python
|
|
36
|
-
description: "Python rule pack. Compact opt-in lens for tdd/review when diffs touch Python files."
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
# Python Rule Pack
|
|
40
|
-
|
|
41
|
-
Use this only when a diff includes \`.py\` / \`.pyi\`.
|
|
42
|
-
|
|
43
|
-
## Blocking rules
|
|
44
|
-
|
|
45
|
-
1. **No broad silent catches.** Avoid bare \`except\` / \`except Exception\` unless re-raised or justified.
|
|
46
|
-
2. **No mutable defaults.** Use \`None\` + local initialization.
|
|
47
|
-
3. **Type exported surfaces.** Public functions/classes include clear type hints.
|
|
48
|
-
4. **Resource safety by default.** File/DB/network handles use context managers.
|
|
49
|
-
|
|
50
|
-
## Follow-up rules
|
|
51
|
-
|
|
52
|
-
- Prefer explicit, narrow exceptions.
|
|
53
|
-
- Keep async and sync I/O models separated.
|
|
54
|
-
- Add/adjust tests with behavior changes.
|
|
55
|
-
|
|
56
|
-
## Output format
|
|
57
|
-
|
|
58
|
-
\`file:line — rule id — concise remediation\`
|
|
59
|
-
`;
|
|
60
|
-
}
|
|
61
|
-
export function languageGoSkill() {
|
|
62
|
-
return `---
|
|
63
|
-
name: language-go
|
|
64
|
-
description: "Go rule pack. Opt-in language lens. Use when reviewing or writing Go diffs during tdd or review — enforces error handling discipline, concurrency safety, and idiomatic patterns."
|
|
65
|
-
---
|
|
66
|
-
|
|
67
|
-
# Go Rule Pack
|
|
68
|
-
|
|
69
|
-
## Quick Start
|
|
70
|
-
|
|
71
|
-
> 1. Activate during tdd or review whenever the diff touches \`.go\` files.
|
|
72
|
-
> 2. Walk the rule tiers in order. Tier-1 violations block merge. Tier-2 need a named follow-up.
|
|
73
|
-
> 3. Cite each finding as \`file:line — <rule id> — <one-line remediation>\`.
|
|
74
|
-
|
|
75
|
-
## HARD-GATE
|
|
76
|
-
|
|
77
|
-
Do not approve a Go change that discards an \`error\` return value with \`_ = ...\`
|
|
78
|
-
in production code *without* a comment explaining why the error is provably
|
|
79
|
-
irrelevant. Discarded errors are Go's #1 source of silent data loss.
|
|
80
|
-
|
|
81
|
-
## Tier 1 — blocking rules
|
|
82
|
-
|
|
83
|
-
1. **Every \`error\` is checked or explicitly wrapped with \`fmt.Errorf("%w", err)\`.**
|
|
84
|
-
2. **No goroutine leaks.** Every \`go func()\` must have a stop condition visible in
|
|
85
|
-
the diff: a \`context.Context\` cancellation, a \`done\` channel, or a bounded
|
|
86
|
-
input channel that will close.
|
|
87
|
-
3. **Context propagation.** Any function that does I/O, RPC, or long work must take
|
|
88
|
-
\`ctx context.Context\` as the first parameter.
|
|
89
|
-
4. **No mutex by value.** Fields of type \`sync.Mutex\` / \`sync.RWMutex\` must be
|
|
90
|
-
pointers *or* the containing struct must be used only via pointer receivers.
|
|
91
|
-
5. **Defer placement.** \`defer file.Close()\` must immediately follow a successful
|
|
92
|
-
open, before any code path that can return early.
|
|
93
|
-
6. **\`for range\` capture hygiene** (pre-Go 1.22): copy loop variables before
|
|
94
|
-
capturing in goroutines or deferred functions. From Go 1.22+ the language fixes
|
|
95
|
-
this, but confirm the repo's \`go\` directive in \`go.mod\`.
|
|
96
|
-
|
|
97
|
-
## Tier 2 — follow-up rules
|
|
98
|
-
|
|
99
|
-
7. Prefer small interfaces defined at the consumer site, not upstream.
|
|
100
|
-
8. Prefer \`errors.Is\` / \`errors.As\` over string matching.
|
|
101
|
-
9. Avoid \`init()\` except for registering with a framework.
|
|
102
|
-
10. Use \`t.Helper()\` inside test helpers so failure lines point at the caller.
|
|
103
|
-
11. Use \`//go:build\` tags for OS-specific code, not runtime \`runtime.GOOS\` checks.
|
|
104
|
-
|
|
105
|
-
## Concurrency-specific
|
|
106
|
-
|
|
107
|
-
- Buffered channels are a performance hint, not a correctness fix. Unbuffered first.
|
|
108
|
-
- \`sync.WaitGroup\` \`Add\` must happen **before** \`go\`, not inside the goroutine.
|
|
109
|
-
- \`atomic\` operations must be paired on the same variable — do not mix \`atomic.Load\`
|
|
110
|
-
with plain reads of the same field.
|
|
111
|
-
- Shared maps require a mutex or \`sync.Map\`; Go's race detector in CI is non-negotiable.
|
|
112
|
-
|
|
113
|
-
## Anti-patterns
|
|
114
|
-
|
|
115
|
-
- Returning \`interface{}\` / \`any\` to "keep options open" — narrow it now.
|
|
116
|
-
- Building "smart" error types that lose the wrapped chain.
|
|
117
|
-
- Using \`panic\` for control flow in library code (allowed only for unrecoverable invariants).
|
|
118
|
-
- Ignoring \`go vet\` warnings because "the code works".
|
|
119
|
-
|
|
120
|
-
## Review output shape
|
|
121
|
-
|
|
122
|
-
\`\`\`
|
|
123
|
-
- **Rule:** G1-2 (no goroutine leaks)
|
|
124
|
-
- **File:line:** internal/worker/pool.go:57
|
|
125
|
-
- **Finding:** \`go w.loop()\` has no stop condition; context is not threaded through.
|
|
126
|
-
- **Remediation:** Accept \`ctx\` in \`Start\` and select on \`ctx.Done()\` inside \`loop\`.
|
|
127
|
-
\`\`\`
|
|
128
|
-
`;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Language rule packs live under `.cclaw/rules/lang/<pack>.md`. They are NOT
|
|
132
|
-
* skills (no folder, no `SKILL.md`) — they are opt-in **rule files** that the
|
|
133
|
-
* meta-skill router and stage hooks consult when the corresponding language
|
|
134
|
-
* appears in a diff. The pack id doubles as the on-disk filename stem.
|
|
135
|
-
*/
|
|
136
|
-
export const LANGUAGE_RULE_PACK_FILES = {
|
|
137
|
-
typescript: "typescript.md",
|
|
138
|
-
python: "python.md",
|
|
139
|
-
go: "go.md"
|
|
140
|
-
};
|
|
141
|
-
/**
|
|
142
|
-
* Folder (relative to runtime root) that holds every enabled language rule
|
|
143
|
-
* pack. A single folder keeps discovery trivial for hooks and for `sync`.
|
|
144
|
-
*/
|
|
145
|
-
export const LANGUAGE_RULE_PACK_DIR = ["rules", "lang"];
|
|
146
|
-
export const LANGUAGE_RULE_PACK_GENERATORS = {
|
|
147
|
-
typescript: languageTypescriptSkill,
|
|
148
|
-
python: languagePythonSkill,
|
|
149
|
-
go: languageGoSkill
|
|
150
|
-
};
|
|
151
|
-
/**
|
|
152
|
-
* Older per-language folders under `.cclaw/skills/`. Listed
|
|
153
|
-
* here so `cclaw sync` and `sync` can surface drift and the installer can
|
|
154
|
-
* clean them up after the move to `.cclaw/rules/lang/`.
|
|
155
|
-
*/
|
|
156
|
-
export const LEGACY_LANGUAGE_RULE_PACK_FOLDERS = [
|
|
157
|
-
"language-typescript",
|
|
158
|
-
"language-python",
|
|
159
|
-
"language-go"
|
|
160
|
-
];
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { RUNTIME_ROOT } from "../constants.js";
|
|
2
|
-
import { diffSubcommandMarkdown } from "./diff-command.js";
|
|
3
|
-
import { statusSubcommandMarkdown } from "./status-command.js";
|
|
4
|
-
import { treeSubcommandMarkdown } from "./tree-command.js";
|
|
5
|
-
import { conversationLanguagePolicyMarkdown } from "./language-policy.js";
|
|
6
|
-
const VIEW_SKILL_FOLDER = "flow-view";
|
|
7
|
-
const VIEW_SKILL_NAME = "flow-view";
|
|
8
|
-
export function viewCommandContract() {
|
|
9
|
-
return `# /cc-view
|
|
10
|
-
|
|
11
|
-
## Purpose
|
|
12
|
-
|
|
13
|
-
Unified read-only command surface for flow visibility.
|
|
14
|
-
|
|
15
|
-
Subcommands:
|
|
16
|
-
- \`/cc-view\` or \`/cc-view status\` -> status snapshot
|
|
17
|
-
- \`/cc-view tree\` -> structural flow tree
|
|
18
|
-
- \`/cc-view diff\` -> read-only git delta map
|
|
19
|
-
|
|
20
|
-
## HARD-GATE
|
|
21
|
-
|
|
22
|
-
${conversationLanguagePolicyMarkdown()}
|
|
23
|
-
- \`/cc-view\` is strictly read-only at wrapper level.
|
|
24
|
-
- Do not mutate flow-state or derived state from any subcommand.
|
|
25
|
-
|
|
26
|
-
## Routing
|
|
27
|
-
|
|
28
|
-
1. Parse subcommand (default \`status\`).
|
|
29
|
-
2. Route:
|
|
30
|
-
- \`status\` -> use the **Status Subcommand** section in \`${RUNTIME_ROOT}/skills/${VIEW_SKILL_FOLDER}/SKILL.md\`
|
|
31
|
-
- \`tree\` -> use the **Tree Subcommand** section in \`${RUNTIME_ROOT}/skills/${VIEW_SKILL_FOLDER}/SKILL.md\`
|
|
32
|
-
- \`diff\` -> use the **Diff Subcommand** section in \`${RUNTIME_ROOT}/skills/${VIEW_SKILL_FOLDER}/SKILL.md\`
|
|
33
|
-
3. Unknown subcommand -> print supported values and stop.
|
|
34
|
-
|
|
35
|
-
## Headless mode (CI/automation only)
|
|
36
|
-
|
|
37
|
-
Headless envelopes are a machine-mode exception for CI/automation orchestration.
|
|
38
|
-
In normal interactive runs, respond with concise read-only prose instead.
|
|
39
|
-
For machine orchestration, emit one JSON envelope:
|
|
40
|
-
|
|
41
|
-
\`\`\`json
|
|
42
|
-
{"version":"1","kind":"stage-output","stage":"non-flow","payload":{"command":"/cc-view <status|tree|diff>","subcommand":"<status|tree|diff>","summary":"<short>"},"emittedAt":"<ISO-8601>"}
|
|
43
|
-
\`\`\`
|
|
44
|
-
|
|
45
|
-
Use the parsed/defaulted subcommand in both \`payload.command\` and \`payload.subcommand\`; do not collapse \`tree\` or \`diff\` responses to \`status\`.
|
|
46
|
-
|
|
47
|
-
Validate envelopes with:
|
|
48
|
-
\`npx cclaw-cli internal envelope-validate --stdin\`
|
|
49
|
-
|
|
50
|
-
## Primary skill
|
|
51
|
-
|
|
52
|
-
**${RUNTIME_ROOT}/skills/${VIEW_SKILL_FOLDER}/SKILL.md**
|
|
53
|
-
`;
|
|
54
|
-
}
|
|
55
|
-
export function viewCommandSkillMarkdown() {
|
|
56
|
-
const status = statusSubcommandMarkdown();
|
|
57
|
-
const tree = treeSubcommandMarkdown();
|
|
58
|
-
const diff = diffSubcommandMarkdown();
|
|
59
|
-
return `---
|
|
60
|
-
name: ${VIEW_SKILL_NAME}
|
|
61
|
-
description: "Unified read-only view skill for status/tree/diff flow visibility commands."
|
|
62
|
-
---
|
|
63
|
-
|
|
64
|
-
# /cc-view
|
|
65
|
-
|
|
66
|
-
## HARD-GATE
|
|
67
|
-
|
|
68
|
-
Wrapper is read-only and dispatch-only. It must not mutate flow state directly.
|
|
69
|
-
|
|
70
|
-
## Protocol
|
|
71
|
-
|
|
72
|
-
1. Parse optional subcommand token:
|
|
73
|
-
- missing -> \`status\`
|
|
74
|
-
- \`status\` -> run **Status Subcommand** below
|
|
75
|
-
- \`tree\` -> run **Tree Subcommand** below
|
|
76
|
-
- \`diff\` -> run **Diff Subcommand** below
|
|
77
|
-
2. Execute only the chosen subcommand section.
|
|
78
|
-
3. Return concise output and suggest \`/cc-view <subcommand>\` variants for navigation.
|
|
79
|
-
|
|
80
|
-
## Status Subcommand
|
|
81
|
-
|
|
82
|
-
${status}
|
|
83
|
-
|
|
84
|
-
## Tree Subcommand
|
|
85
|
-
|
|
86
|
-
${tree}
|
|
87
|
-
|
|
88
|
-
## Diff Subcommand
|
|
89
|
-
|
|
90
|
-
${diff}
|
|
91
|
-
`;
|
|
92
|
-
}
|