cclaw-cli 0.15.0 → 0.18.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.
Files changed (51) hide show
  1. package/dist/artifact-linter.js +154 -0
  2. package/dist/cli.js +2 -1
  3. package/dist/constants.d.ts +2 -2
  4. package/dist/constants.js +2 -3
  5. package/dist/content/contracts.js +1 -1
  6. package/dist/content/doctor-references.js +7 -6
  7. package/dist/content/feature-command.js +54 -51
  8. package/dist/content/harnesses-doc.js +2 -2
  9. package/dist/content/hooks.js +2 -2
  10. package/dist/content/learnings.d.ts +1 -1
  11. package/dist/content/learnings.js +22 -5
  12. package/dist/content/meta-skill.js +2 -2
  13. package/dist/content/next-command.js +2 -2
  14. package/dist/content/observe.js +3 -2
  15. package/dist/content/ops-command.js +1 -3
  16. package/dist/content/protocols.js +6 -34
  17. package/dist/content/rewind-command.d.ts +0 -1
  18. package/dist/content/rewind-command.js +19 -33
  19. package/dist/content/skills.js +2 -3
  20. package/dist/content/stage-schema.d.ts +2 -92
  21. package/dist/content/stage-schema.js +10 -1379
  22. package/dist/content/stages/brainstorm.d.ts +2 -0
  23. package/dist/content/stages/brainstorm.js +136 -0
  24. package/dist/content/stages/design.d.ts +2 -0
  25. package/dist/content/stages/design.js +215 -0
  26. package/dist/content/stages/index.d.ts +8 -0
  27. package/dist/content/stages/index.js +11 -0
  28. package/dist/content/stages/plan.d.ts +2 -0
  29. package/dist/content/stages/plan.js +157 -0
  30. package/dist/content/stages/review.d.ts +2 -0
  31. package/dist/content/stages/review.js +197 -0
  32. package/dist/content/stages/schema-types.d.ts +94 -0
  33. package/dist/content/stages/schema-types.js +1 -0
  34. package/dist/content/stages/scope.d.ts +2 -0
  35. package/dist/content/stages/scope.js +194 -0
  36. package/dist/content/stages/ship.d.ts +2 -0
  37. package/dist/content/stages/ship.js +142 -0
  38. package/dist/content/stages/spec.d.ts +2 -0
  39. package/dist/content/stages/spec.js +136 -0
  40. package/dist/content/stages/tdd.d.ts +2 -0
  41. package/dist/content/stages/tdd.js +185 -0
  42. package/dist/content/templates.js +105 -9
  43. package/dist/content/utility-skills.js +1 -1
  44. package/dist/delegation.d.ts +33 -3
  45. package/dist/delegation.js +56 -3
  46. package/dist/doctor.js +147 -88
  47. package/dist/feature-system.d.ts +22 -5
  48. package/dist/feature-system.js +267 -126
  49. package/dist/install.js +4 -8
  50. package/dist/policy.js +3 -4
  51. package/package.json +1 -1
@@ -90,42 +90,14 @@ Before adding new code/templates/rules:
90
90
  - Evidence beats volume.
91
91
  - Keep stage output concrete and testable.
92
92
 
93
- ## Preamble budget
93
+ ## Turn announce discipline
94
94
 
95
- This section is the single source of truth for preamble behavior.
96
- Do not duplicate preamble rules in AGENTS.md, harness adapters, or stage-local docs.
95
+ Keep orchestration visible without maintaining a dedicated preamble runtime log.
97
96
 
98
- ### Emit when
99
-
100
- | Trigger | Machine-verifiable condition |
101
- |---|---|
102
- | Stage transition | \`flow-state.currentStage\` changes in this turn |
103
- | Non-trivial implementation turn | agent is about to run source-editing tools outside \`.cclaw/\` |
104
- | Multi-step risky operation | planned sequence contains 2+ commands with rollback/risk potential |
105
-
106
- ### Skip when
107
-
108
- | Skip reason | Condition |
109
- |---|---|
110
- | Pure Q&A | no filesystem or runtime mutation planned |
111
- | Trivial change | single low-risk edit with no stage or plan drift |
112
- | Subagent dispatch payload | prompt is for spawned agent/tool call only |
113
- | Cooldown hit | same stage + same trigger emitted within cooldown window |
114
-
115
- ### Form contract (max 4 lines)
116
-
117
- 1. \`Stage:\` current stage id
118
- 2. \`Goal:\` concrete objective for this turn
119
- 3. \`Plan:\` next 1-3 actions
120
- 4. \`Guardrails:\` key constraints / non-goals
121
-
122
- ### Cooldown
123
-
124
- - Record each emitted preamble in \`.cclaw/state/preamble-log.jsonl\` as JSON line:
125
- \`{"ts","stage","runId","trigger","hash"}\`.
126
- - Default cooldown: 15 minutes for identical \`stage + trigger + hash\`.
127
- - TDD wave mode uses stricter dedupe: one preamble per wave unless scope changes.
128
- - If the plan changes materially, a new preamble is allowed inside cooldown.
97
+ - Start substantial turns with a 1-2 sentence announce: current stage, intent, next action.
98
+ - Skip announce for trivial single-command actions.
99
+ - Never repeat boilerplate announces when the intent did not change.
100
+ - If plan or risk changes materially, post a fresh announce before executing.
129
101
 
130
102
  ## Operational learning
131
103
 
@@ -1,3 +1,2 @@
1
1
  export declare function rewindCommandContract(): string;
2
- export declare function rewindAcknowledgeCommandContract(): string;
3
2
  export declare function rewindCommandSkillMarkdown(): string;
@@ -15,7 +15,8 @@ export function rewindCommandContract() {
15
15
 
16
16
  ## Purpose
17
17
 
18
- Rewind active flow to an earlier stage and atomically invalidate downstream work.
18
+ Rewind active flow to an earlier stage, or acknowledge stale markers after
19
+ intentional rework.
19
20
 
20
21
  ## HARD-GATE
21
22
 
@@ -26,9 +27,12 @@ Rewind active flow to an earlier stage and atomically invalidate downstream work
26
27
  ## Inputs
27
28
 
28
29
  \`/cc-ops rewind <target-stage> [reason]\`
30
+ or
31
+ \`/cc-ops rewind --ack <stage>\`
29
32
 
30
33
  ## Algorithm
31
34
 
35
+ ### rewind mode
32
36
  1. Read \`${flowStatePath()}\` and current track.
33
37
  2. Validate \`target-stage\` belongs to the active track and is not ahead of current stage.
34
38
  3. Compute downstream stages to invalidate (all stages after target that were completed or current).
@@ -42,42 +46,24 @@ Rewind active flow to an earlier stage and atomically invalidate downstream work
42
46
  - append \`rewinds[]\` record
43
47
  7. Append JSON line to \`${rewindLogPath()}\`.
44
48
 
45
- ## Output
46
-
47
- - Rewind id
48
- - from -> to stage
49
- - Invalidated stages list
50
- - Number of stale artifacts
51
-
52
- ## Primary skill
53
-
54
- **${RUNTIME_ROOT}/skills/${REWIND_SKILL_FOLDER}/SKILL.md**
55
- `;
56
- }
57
- export function rewindAcknowledgeCommandContract() {
58
- return `# /cc-ops rewind-ack
59
-
60
- ## Purpose
61
-
62
- Acknowledge and clear stale-stage markers after downstream work is intentionally redone.
63
-
64
- ## Input
65
-
66
- \`/cc-ops rewind-ack <stage>\`
67
-
68
- ## HARD-GATE
69
-
70
- - Only clear stale marker for the requested stage.
71
- - Never modify completedStages from this command.
72
-
73
- ## Algorithm
74
-
49
+ ### acknowledge mode (\`--ack\`)
75
50
  1. Read \`${flowStatePath()}\`.
76
51
  2. If \`staleStages.<stage>\` is missing, report no-op.
77
52
  3. Remove \`staleStages.<stage>\`.
78
53
  4. Write updated flow-state.
79
54
  5. Print remaining stale stages (if any).
80
55
 
56
+ ## Output
57
+
58
+ - In rewind mode:
59
+ - rewind id
60
+ - from -> to stage
61
+ - invalidated stages list
62
+ - number of stale artifacts
63
+ - In acknowledge mode:
64
+ - acknowledged stage
65
+ - remaining stale stages
66
+
81
67
  ## Primary skill
82
68
 
83
69
  **${RUNTIME_ROOT}/skills/${REWIND_SKILL_FOLDER}/SKILL.md**
@@ -89,7 +75,7 @@ name: ${REWIND_SKILL_NAME}
89
75
  description: "Rewind active flow stage safely and acknowledge stale invalidations."
90
76
  ---
91
77
 
92
- # /cc-ops rewind + /cc-ops rewind-ack
78
+ # /cc-ops rewind
93
79
 
94
80
  ## HARD-GATE
95
81
 
@@ -105,7 +91,7 @@ Rewind is an atomic state transition. Never leave flow-state half-updated (for e
105
91
  5. Record \`rewinds[]\` and \`staleStages\` in flow-state.
106
92
  6. Append rewind entry into \`${rewindLogPath()}\`.
107
93
 
108
- ### rewind-ack
94
+ ### rewind --ack <stage>
109
95
  1. Load flow-state stale map.
110
96
  2. Remove exactly one stale stage marker.
111
97
  3. Report remaining stale stages.
@@ -108,9 +108,8 @@ function waveExecutionModeBlock(stage) {
108
108
 
109
109
  Execute the current dependency wave task-by-task (RED -> GREEN -> REFACTOR).
110
110
  Stop on BLOCKED status or when user input is required.
111
- Apply preamble budget discipline: one preamble per wave, then continue without
112
- repeating it for each task. Re-emit only when the wave boundary changes or the
113
- plan changes materially.
111
+ Apply concise turn announces: one announce per wave boundary (or when risk/plan
112
+ changes materially), then execute tasks without repetitive boilerplate.
114
113
 
115
114
  Detailed walkthrough:
116
115
  \`.cclaw/${STAGE_EXAMPLES_REFERENCE_DIR}/tdd-wave-walkthrough.md\`
@@ -1,96 +1,6 @@
1
1
  import type { FlowStage, TransitionRule } from "../types.js";
2
- export interface StageGate {
3
- id: string;
4
- description: string;
5
- tier?: "required" | "recommended" | "conditional";
6
- /** Used when tier=conditional. Predicate syntax mirrors conditional delegation rules. */
7
- condition?: string;
8
- }
9
- export interface ReviewSection {
10
- title: string;
11
- evaluationPoints: string[];
12
- stopGate: boolean;
13
- }
14
- export interface CrossStageTrace {
15
- readsFrom: string[];
16
- writesTo: string[];
17
- traceabilityRule: string;
18
- }
19
- export interface ArtifactValidation {
20
- section: string;
21
- required: boolean;
22
- tier?: "required" | "recommended" | "conditional";
23
- /** Optional predicate for conditional validations. */
24
- condition?: string;
25
- validationRule: string;
26
- }
27
- export interface StageAutoSubagentDispatch {
28
- agent: "planner" | "reviewer" | "security-reviewer" | "test-author" | "doc-updater";
29
- /**
30
- * - `mandatory` — must be dispatched (or explicitly waived) before stage transition.
31
- * - `proactive` — should be dispatched automatically when context matches `when`.
32
- * - `conditional` — dispatched only when `condition` evaluates true at runtime; counted as
33
- * mandatory **only when the condition holds**.
34
- */
35
- mode: "mandatory" | "proactive" | "conditional";
36
- when: string;
37
- purpose: string;
38
- requiresUserGate: boolean;
39
- /**
40
- * Optional machine-friendly trigger expression for `conditional` rows.
41
- * Supported predicates: `diff_lines_gt:<N>`, `files_touched_gt:<N>`,
42
- * `trust_boundary_changed`, `release_blast_radius_high`.
43
- * Multiple predicates joined by `||` mean ANY trigger satisfies the condition.
44
- */
45
- condition?: string;
46
- /** Optional skill folder the dispatched agent should load as additional context. */
47
- skill?: string;
48
- }
49
- export interface StageSchema {
50
- stage: FlowStage;
51
- skillFolder: string;
52
- skillName: string;
53
- skillDescription: string;
54
- hardGate: string;
55
- /**
56
- * One-line "Iron Law" punchcard — the single rule that, if broken,
57
- * invalidates the stage outright. Rendered in ALL-CAPS wrapped in
58
- * <EXTREMELY-IMPORTANT> XML markers at the very top of the skill body.
59
- * Reference: Superpowers (obra) "NO PRODUCTION CODE WITHOUT A FAILING
60
- * TEST FIRST".
61
- */
62
- ironLaw: string;
63
- purpose: string;
64
- whenToUse: string[];
65
- whenNotToUse: string[];
66
- interactionProtocol: string[];
67
- process: string[];
68
- requiredGates: StageGate[];
69
- requiredEvidence: string[];
70
- inputs: string[];
71
- requiredContext: string[];
72
- /** In-thread research procedures for this stage (`.cclaw/skills/research/*.md`). */
73
- researchPlaybooks?: string[];
74
- outputs: string[];
75
- blockers: string[];
76
- exitCriteria: string[];
77
- antiPatterns: string[];
78
- redFlags: string[];
79
- policyNeedles: string[];
80
- artifactFile: string;
81
- next: FlowStage | "done";
82
- checklist: string[];
83
- reviewSections: ReviewSection[];
84
- completionStatus: string[];
85
- crossStageTrace: CrossStageTrace;
86
- artifactValidation: ArtifactValidation[];
87
- /** When true, stage skill includes wave auto-execute guidance (tdd). */
88
- waveExecutionAllowed?: boolean;
89
- /** Sections that remain required even when the trivial-change escape hatch is active (design only). */
90
- trivialOverrideSections?: string[];
91
- /** Agent names that MUST be dispatched (or waived) before stage transition — derived from mandatory auto-subagent rows. */
92
- mandatoryDelegations: string[];
93
- }
2
+ import type { StageAutoSubagentDispatch, StageSchema } from "./stages/schema-types.js";
3
+ export type { ArtifactValidation, CrossStageTrace, ReviewSection, StageAutoSubagentDispatch, StageGate, StageSchema, StageSchemaInput } from "./stages/schema-types.js";
94
4
  /** Transition guard: agents with `mode: "mandatory"` in auto-subagent dispatch for this stage. */
95
5
  export declare function mandatoryDelegationsForStage(stage: FlowStage): string[];
96
6
  /** Conditional dispatches that become mandatory only when their `condition` predicate evaluates true. */