cclaw-cli 0.48.30 → 0.48.31

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.
@@ -1,22 +1,20 @@
1
1
  import { RUNTIME_ROOT, STAGE_TO_SKILL_FOLDER } from "../constants.js";
2
- import { STAGE_EXAMPLES_REFERENCE_DIR, stageDomainExamples, stageExamples, stageGoodBadExamples } from "./examples.js";
2
+ import { STAGE_EXAMPLES_REFERENCE_DIR, stageExamples } from "./examples.js";
3
3
  import { STAGE_COMMON_GUIDANCE_REL_PATH } from "./stage-common-guidance.js";
4
4
  import { stageAutoSubagentDispatch, stageSchema } from "./stage-schema.js";
5
5
  const VERIFICATION_STAGES = ["tdd", "review", "ship"];
6
6
  const DECISION_PROTOCOL_PATH = `${RUNTIME_ROOT}/references/protocols/decision.md`;
7
7
  const COMPLETION_PROTOCOL_PATH = `${RUNTIME_ROOT}/references/protocols/completion.md`;
8
- function whenNotToUseBlock(stage, track) {
9
- const schema = stageSchema(stage, track);
10
- if (schema.whenNotToUse.length === 0) {
8
+ function whenNotToUseBlock(items) {
9
+ if (items.length === 0) {
11
10
  return "";
12
11
  }
13
12
  return `## When Not to Use
14
- ${schema.whenNotToUse.map((item) => `- ${item}`).join("\n")}
13
+ ${items.map((item) => `- ${item}`).join("\n")}
15
14
 
16
15
  `;
17
16
  }
18
- function contextLoadingBlock(stage, track) {
19
- const trace = stageSchema(stage, track).crossStageTrace;
17
+ function contextLoadingBlock(trace) {
20
18
  const readLines = trace.readsFrom.length > 0
21
19
  ? trace.readsFrom.map((value) => `- \`${value}\``).join("\n")
22
20
  : "- (first stage — no upstream artifacts)";
@@ -54,8 +52,7 @@ Mandatory delegations for this stage: ${mandatoryList}.
54
52
  Record completion/waiver in \`${delegationLogRel}\` before stage completion.
55
53
  `;
56
54
  }
57
- function researchPlaybooksBlock(stage, track) {
58
- const playbooks = stageSchema(stage, track).researchPlaybooks ?? [];
55
+ function researchPlaybooksBlock(playbooks) {
59
56
  if (playbooks.length === 0)
60
57
  return "";
61
58
  const rows = playbooks
@@ -70,11 +67,10 @@ and record outcomes in the stage artifact when relevant.
70
67
  ${rows}
71
68
  `;
72
69
  }
73
- function reviewSectionsBlock(stage, track) {
74
- const schema = stageSchema(stage, track);
75
- if (schema.reviewSections.length === 0)
70
+ function reviewSectionsBlock(sectionsInput) {
71
+ if (sectionsInput.length === 0)
76
72
  return "";
77
- const sections = schema.reviewSections
73
+ const sections = sectionsInput
78
74
  .map((sec) => {
79
75
  const points = sec.evaluationPoints.map((p) => `- ${p}`).join("\n");
80
76
  const title = sec.stopGate ? `${sec.title} (STOP gate)` : sec.title;
@@ -116,8 +112,7 @@ Detailed walkthrough:
116
112
  \`.cclaw/${STAGE_EXAMPLES_REFERENCE_DIR}/tdd-batch-walkthrough.md\`
117
113
  `;
118
114
  }
119
- function crossStageTraceBlock(stage, track) {
120
- const trace = stageSchema(stage, track).crossStageTrace;
115
+ function crossStageTraceBlock(trace) {
121
116
  const reads = trace.readsFrom.length > 0
122
117
  ? trace.readsFrom.map((r) => `- ${r}`).join("\n")
123
118
  : "- (first stage — no upstream artifacts)";
@@ -135,8 +130,7 @@ ${writes}
135
130
  Rule: ${trace.traceabilityRule}
136
131
  `;
137
132
  }
138
- function artifactValidationBlock(stage, track) {
139
- const validations = stageSchema(stage, track).artifactValidation;
133
+ function artifactValidationBlock(validations) {
140
134
  if (validations.length === 0)
141
135
  return "";
142
136
  const rows = validations
@@ -152,10 +146,10 @@ function artifactValidationBlock(stage, track) {
152
146
  ${rows}
153
147
  `;
154
148
  }
155
- function mergedAntiPatterns(schema) {
149
+ function mergedAntiPatterns(philosophy, execution) {
156
150
  const merged = [];
157
151
  const seen = new Set();
158
- for (const item of [...schema.commonRationalizations, ...schema.blockers]) {
152
+ for (const item of [...philosophy.commonRationalizations, ...execution.blockers]) {
159
153
  const key = item.trim().toLowerCase();
160
154
  if (seen.has(key))
161
155
  continue;
@@ -205,9 +199,9 @@ function stageSpecificSeeAlso(stage) {
205
199
  return refs[stage];
206
200
  }
207
201
  function completionParametersBlock(schema, track) {
208
- const gateList = schema.requiredGates.map((g) => `\`${g.id}\``).join(", ");
209
- const mandatory = schema.mandatoryDelegations.length > 0
210
- ? schema.mandatoryDelegations.map((a) => `\`${a}\``).join(", ")
202
+ const gateList = schema.executionModel.requiredGates.map((g) => `\`${g.id}\``).join(", ");
203
+ const mandatory = schema.reviewLens.mandatoryDelegations.length > 0
204
+ ? schema.reviewLens.mandatoryDelegations.map((a) => `\`${a}\``).join(", ")
211
205
  : "none";
212
206
  const nextStage = schema.next === "done" ? "done" : schema.next;
213
207
  const nextDescription = schema.next === "done"
@@ -218,25 +212,24 @@ function completionParametersBlock(schema, track) {
218
212
  - \`stage\`: \`${schema.stage}\`
219
213
  - \`next\`: \`${nextStage}\` (${nextDescription})
220
214
  - \`gates\`: ${gateList}
221
- - \`artifact\`: \`${RUNTIME_ROOT}/artifacts/${schema.artifactFile}\`
215
+ - \`artifact\`: \`${RUNTIME_ROOT}/artifacts/${schema.artifactRules.artifactFile}\`
222
216
  - \`mandatory delegations\`: ${mandatory}
223
217
  - \`completion helper\`: \`node .cclaw/hooks/stage-complete.mjs ${schema.stage}\`
224
218
  - Fill \`## Learnings\` before closeout: either \`- None this stage.\` or JSON bullets with required keys \`type\`, \`trigger\`, \`action\`, \`confidence\` (knowledge-schema compatible).
225
219
  - Record mandatory delegation completion/waiver in \`${RUNTIME_ROOT}/state/delegation-log.json\` with rationale as needed.
226
220
  - Use the completion helper instead of raw \`flow-state.json\` edits (legacy direct edits trigger workflow-guard warnings or strict-mode blocks).
227
- Apply shared completion logic from:
228
- \`${COMPLETION_PROTOCOL_PATH}\`
221
+ - Completion protocol reference: \`${COMPLETION_PROTOCOL_PATH}\`
229
222
  `;
230
223
  }
231
224
  function quickStartBlock(stage, track) {
232
225
  const schema = stageSchema(stage, track);
233
- const gatePreview = schema.requiredGates.slice(0, 3).map((g) => `\`${g.id}\``).join(", ");
226
+ const gatePreview = schema.executionModel.requiredGates.slice(0, 3).map((g) => `\`${g.id}\``).join(", ");
234
227
  return `## Quick Start
235
228
 
236
- 1. Announce at start: "Using \`${schema.skillName}\` to ${schema.purpose}".
229
+ 1. Announce at start: "Using \`${schema.skillName}\` to ${schema.philosophy.purpose}".
237
230
  2. Obey HARD-GATE and Iron Law.
238
- 3. Execute checklist in order and persist \`${RUNTIME_ROOT}/artifacts/${schema.artifactFile}\`.
239
- 4. Satisfy gates (${gatePreview}${schema.requiredGates.length > 3 ? ` +${schema.requiredGates.length - 3}` : ""}).
231
+ 3. Execute checklist in order and persist \`${RUNTIME_ROOT}/artifacts/${schema.artifactRules.artifactFile}\`.
232
+ 4. Satisfy gates (${gatePreview}${schema.executionModel.requiredGates.length > 3 ? ` +${schema.executionModel.requiredGates.length - 3}` : ""}).
240
233
  `;
241
234
  }
242
235
  /**
@@ -325,21 +318,26 @@ function dedupeGuidance(items, blockedBy) {
325
318
  }
326
319
  export function stageSkillMarkdown(stage, track = "standard") {
327
320
  const schema = stageSchema(stage, track);
328
- const gateList = schema.requiredGates
321
+ const philosophy = schema.philosophy;
322
+ const executionModel = schema.executionModel;
323
+ const artifactRules = schema.artifactRules;
324
+ const reviewLens = schema.reviewLens;
325
+ const mandatoryDelegations = reviewLens.mandatoryDelegations;
326
+ const gateList = executionModel.requiredGates
329
327
  .map((g) => `- \`${g.id}\` — ${g.description}`)
330
328
  .join("\n");
331
- const evidenceList = schema.requiredEvidence
329
+ const evidenceList = executionModel.requiredEvidence
332
330
  .map((e) => `- [ ] ${e}`)
333
331
  .join("\n");
334
- const checklistItems = schema.checklist
332
+ const checklistItems = executionModel.checklist
335
333
  .map((item, i) => `${i + 1}. ${item}`)
336
334
  .join("\n");
337
- const interactionFocus = dedupeGuidance(schema.interactionProtocol, [...schema.checklist, ...schema.process]).slice(0, 5);
338
- const processSummary = dedupeGuidance(schema.process, schema.checklist).slice(0, 5);
339
- const processNote = schema.process.length > processSummary.length
340
- ? `- Follow the Checklist above for remaining execution detail (+${schema.process.length - processSummary.length} condensed step${schema.process.length - processSummary.length === 1 ? "" : "s"}).`
341
- : "";
335
+ const interactionFocus = dedupeGuidance(executionModel.interactionProtocol, [...executionModel.checklist, ...executionModel.process]).slice(0, 5);
336
+ const processSummary = dedupeGuidance(executionModel.process, executionModel.checklist).slice(0, 5);
342
337
  const stageRefs = stageSpecificSeeAlso(stage);
338
+ const mandatoryDelegationSummary = mandatoryDelegations.length > 0
339
+ ? mandatoryDelegations.map((name) => `\`${name}\``).join(", ")
340
+ : "none";
343
341
  return `---
344
342
  name: ${schema.skillName}
345
343
  description: "${schema.skillDescription}"
@@ -349,7 +347,7 @@ description: "${schema.skillDescription}"
349
347
 
350
348
  <EXTREMELY-IMPORTANT>
351
349
 
352
- **IRON LAW — ${stage.toUpperCase()}:** ${schema.ironLaw}
350
+ **IRON LAW — ${stage.toUpperCase()}:** ${philosophy.ironLaw}
353
351
 
354
352
  If you are about to violate the Iron Law, STOP. No amount of urgency, partial progress, or clever reinterpretation overrides it. Escalate via the Decision Protocol or abandon the stage.
355
353
 
@@ -357,28 +355,35 @@ If you are about to violate the Iron Law, STOP. No amount of urgency, partial pr
357
355
 
358
356
  ${quickStartBlock(stage, track)}
359
357
 
360
- ## Overview
361
- ${schema.purpose}
358
+ ## Philosophy
359
+ ${philosophy.purpose}
360
+
361
+ ## Complexity Tier
362
+ - Active tier: \`${schema.complexityTier}\`
363
+ - Mandatory delegations at this tier: ${mandatoryDelegationSummary}
362
364
 
363
365
  ## When to Use
364
- ${schema.whenToUse.map((item) => `- ${item}`).join("\n")}
366
+ ${philosophy.whenToUse.map((item) => `- ${item}`).join("\n")}
367
+
368
+ ${whenNotToUseBlock(philosophy.whenNotToUse)}
369
+ ## HARD-GATE
370
+ ${philosophy.hardGate}
371
+
372
+ ## Anti-Patterns & Red Flags
373
+ ${mergedAntiPatterns(philosophy, executionModel)}
374
+
375
+ ## Process
376
+ ${processSummary.length > 0 ? processSummary.map((item, i) => `${i + 1}. ${item}`).join("\n") : "1. Execute the Checklist in order.\n2. Satisfy every required gate.\n3. Complete verification before stage closeout."}
365
377
 
366
- ${whenNotToUseBlock(stage, track)}
367
378
  ## Inputs
368
- ${schema.inputs.length > 0 ? schema.inputs.map((item) => `- ${item}`).join("\n") : "- (first stage — no required inputs)"}
379
+ ${executionModel.inputs.length > 0 ? executionModel.inputs.map((item) => `- ${item}`).join("\n") : "- (first stage — no required inputs)"}
369
380
 
370
381
  ## Required Context
371
- ${schema.requiredContext.length > 0 ? schema.requiredContext.map((item) => `- ${item}`).join("\n") : "- None beyond this skill"}
382
+ ${executionModel.requiredContext.length > 0 ? executionModel.requiredContext.map((item) => `- ${item}`).join("\n") : "- None beyond this skill"}
372
383
 
373
- ${contextLoadingBlock(stage, track)}
384
+ ${contextLoadingBlock(artifactRules.crossStageTrace)}
374
385
  ${autoSubagentDispatchBlock(stage, track)}
375
- ${researchPlaybooksBlock(stage, track)}
376
-
377
- ## Outputs
378
- ${schema.outputs.map((item) => `- ${item}`).join("\n")}
379
-
380
- ## HARD-GATE
381
- ${schema.hardGate}
386
+ ${researchPlaybooksBlock(executionModel.researchPlaybooks ?? [])}
382
387
 
383
388
  ## Checklist
384
389
 
@@ -386,15 +391,12 @@ You MUST complete these steps in order:
386
391
 
387
392
  ${checklistItems}
388
393
 
389
- ${stageGoodBadExamples(stage)}
390
- ${stageDomainExamples(stage)}
391
394
  ${stageExamples(stage)}
392
395
 
393
396
  ## Interaction Protocol
394
397
  ${interactionFocus.length > 0 ? interactionFocus.map((item, i) => `${i + 1}. ${item}`).join("\n") : "- Keep communication concise and decision-focused; rely on the Checklist for execution order."}
395
398
 
396
- Shared decision/ask-user protocol:
397
- \`${DECISION_PROTOCOL_PATH}\`
399
+ Decision protocol reference: \`${DECISION_PROTOCOL_PATH}\`
398
400
 
399
401
  ${batchExecutionModeBlock(stage, track)}
400
402
  ## Required Gates
@@ -403,22 +405,24 @@ ${gateList}
403
405
  ## Required Evidence
404
406
  ${evidenceList}
405
407
 
406
- ## Process
407
- ${processSummary.length > 0 ? processSummary.map((item, i) => `${i + 1}. ${item}`).join("\n") : "1. Execute the Checklist in order.\n2. Satisfy every required gate.\n3. Complete verification before stage closeout."}
408
- ${processNote.length > 0 ? `\n${processNote}` : ""}
409
-
410
- ${reviewSectionsBlock(stage, track)}
411
408
  ${verificationBlock(stage)}
412
- ${crossStageTraceBlock(stage, track)}
413
- ${artifactValidationBlock(stage, track)}
414
-
415
- ## Anti-Patterns & Red Flags
416
- ${mergedAntiPatterns(schema)}
417
409
 
418
410
  ## Verification
419
- ${schema.exitCriteria.map((item) => `- [ ] ${item}`).join("\n")}
411
+ ${executionModel.exitCriteria.map((item) => `- [ ] ${item}`).join("\n")}
420
412
 
421
413
  ${completionParametersBlock(schema, track)}
414
+ ## Artifact Rules
415
+ - Artifact target: \`${RUNTIME_ROOT}/artifacts/${artifactRules.artifactFile}\`
416
+
417
+ ${crossStageTraceBlock(artifactRules.crossStageTrace)}
418
+ ${artifactValidationBlock(artifactRules.artifactValidation)}
419
+
420
+ ## Review Lens
421
+ ## Outputs
422
+ ${reviewLens.outputs.map((item) => `- ${item}`).join("\n")}
423
+
424
+ ${reviewSectionsBlock(reviewLens.reviewSections)}
425
+
422
426
  ## Shared Stage Guidance
423
427
  See:
424
428
  - \`${STAGE_COMMON_GUIDANCE_REL_PATH}\`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cclaw-cli",
3
- "version": "0.48.30",
3
+ "version": "0.48.31",
4
4
  "description": "Installer-first flow toolkit for coding agents",
5
5
  "type": "module",
6
6
  "bin": {