cclaw-cli 0.51.30 → 1.0.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 (160) hide show
  1. package/README.md +24 -18
  2. package/dist/artifact-linter/brainstorm.d.ts +2 -0
  3. package/dist/artifact-linter/brainstorm.js +289 -0
  4. package/dist/artifact-linter/design.d.ts +2 -0
  5. package/dist/artifact-linter/design.js +354 -0
  6. package/dist/artifact-linter/plan.d.ts +2 -0
  7. package/dist/artifact-linter/plan.js +183 -0
  8. package/dist/artifact-linter/review-army.d.ts +24 -0
  9. package/dist/artifact-linter/review-army.js +365 -0
  10. package/dist/artifact-linter/review.d.ts +2 -0
  11. package/dist/artifact-linter/review.js +99 -0
  12. package/dist/artifact-linter/scope.d.ts +2 -0
  13. package/dist/artifact-linter/scope.js +125 -0
  14. package/dist/artifact-linter/shared.d.ts +247 -0
  15. package/dist/artifact-linter/shared.js +1517 -0
  16. package/dist/artifact-linter/ship.d.ts +2 -0
  17. package/dist/artifact-linter/ship.js +82 -0
  18. package/dist/artifact-linter/spec.d.ts +2 -0
  19. package/dist/artifact-linter/spec.js +130 -0
  20. package/dist/artifact-linter/tdd.d.ts +2 -0
  21. package/dist/artifact-linter/tdd.js +198 -0
  22. package/dist/artifact-linter.d.ts +4 -76
  23. package/dist/artifact-linter.js +56 -2949
  24. package/dist/cli.d.ts +1 -6
  25. package/dist/cli.js +4 -159
  26. package/dist/codex-feature-flag.d.ts +1 -1
  27. package/dist/codex-feature-flag.js +1 -1
  28. package/dist/config.d.ts +3 -2
  29. package/dist/config.js +67 -3
  30. package/dist/constants.d.ts +1 -7
  31. package/dist/constants.js +10 -15
  32. package/dist/content/cancel-command.js +2 -2
  33. package/dist/content/closeout-guidance.d.ts +1 -1
  34. package/dist/content/closeout-guidance.js +15 -13
  35. package/dist/content/core-agents.d.ts +46 -29
  36. package/dist/content/core-agents.js +216 -82
  37. package/dist/content/decision-protocol.d.ts +1 -1
  38. package/dist/content/decision-protocol.js +1 -1
  39. package/dist/content/diff-command.js +1 -1
  40. package/dist/content/examples.d.ts +0 -3
  41. package/dist/content/examples.js +197 -752
  42. package/dist/content/harness-doc.js +20 -2
  43. package/dist/content/hook-manifest.d.ts +2 -2
  44. package/dist/content/hook-manifest.js +2 -2
  45. package/dist/content/hooks.d.ts +1 -0
  46. package/dist/content/hooks.js +32 -137
  47. package/dist/content/idea.d.ts +60 -0
  48. package/dist/content/idea.js +404 -0
  49. package/dist/content/iron-laws.d.ts +0 -1
  50. package/dist/content/iron-laws.js +31 -16
  51. package/dist/content/learnings.d.ts +2 -4
  52. package/dist/content/learnings.js +11 -27
  53. package/dist/content/meta-skill.js +7 -7
  54. package/dist/content/node-hooks.d.ts +10 -0
  55. package/dist/content/node-hooks.js +163 -95
  56. package/dist/content/opencode-plugin.js +15 -29
  57. package/dist/content/reference-patterns.js +2 -2
  58. package/dist/content/runtime-shared-snippets.d.ts +8 -0
  59. package/dist/content/runtime-shared-snippets.js +80 -0
  60. package/dist/content/session-hooks.js +1 -1
  61. package/dist/content/skills.d.ts +1 -0
  62. package/dist/content/skills.js +69 -7
  63. package/dist/content/stage-schema.js +147 -61
  64. package/dist/content/stages/_lint-metadata/index.js +26 -2
  65. package/dist/content/stages/brainstorm.js +13 -7
  66. package/dist/content/stages/design.js +16 -11
  67. package/dist/content/stages/plan.js +7 -4
  68. package/dist/content/stages/review.js +12 -12
  69. package/dist/content/stages/schema-types.d.ts +2 -2
  70. package/dist/content/stages/scope.js +15 -12
  71. package/dist/content/stages/ship.js +3 -3
  72. package/dist/content/stages/spec.js +9 -3
  73. package/dist/content/stages/tdd.js +14 -4
  74. package/dist/content/start-command.js +11 -10
  75. package/dist/content/status-command.js +5 -5
  76. package/dist/content/subagent-context-skills.js +156 -1
  77. package/dist/content/subagents.d.ts +0 -5
  78. package/dist/content/subagents.js +65 -81
  79. package/dist/content/templates.d.ts +1 -1
  80. package/dist/content/templates.js +187 -154
  81. package/dist/content/tree-command.js +2 -2
  82. package/dist/content/utility-skills.d.ts +2 -2
  83. package/dist/content/utility-skills.js +28 -99
  84. package/dist/content/view-command.js +4 -2
  85. package/dist/delegation.d.ts +2 -0
  86. package/dist/delegation.js +2 -1
  87. package/dist/early-loop.d.ts +66 -0
  88. package/dist/early-loop.js +275 -0
  89. package/dist/flow-state.d.ts +5 -6
  90. package/dist/flow-state.js +4 -6
  91. package/dist/gate-evidence.d.ts +0 -23
  92. package/dist/gate-evidence.js +111 -153
  93. package/dist/harness-adapters.d.ts +2 -2
  94. package/dist/harness-adapters.js +48 -19
  95. package/dist/install.js +190 -32
  96. package/dist/internal/advance-stage/advance.d.ts +50 -0
  97. package/dist/internal/advance-stage/advance.js +479 -0
  98. package/dist/internal/advance-stage/cancel-run.d.ts +8 -0
  99. package/dist/internal/advance-stage/cancel-run.js +19 -0
  100. package/dist/internal/advance-stage/flow-state-coercion.d.ts +3 -0
  101. package/dist/internal/advance-stage/flow-state-coercion.js +81 -0
  102. package/dist/internal/advance-stage/helpers.d.ts +14 -0
  103. package/dist/internal/advance-stage/helpers.js +145 -0
  104. package/dist/internal/advance-stage/hook.d.ts +8 -0
  105. package/dist/internal/advance-stage/hook.js +40 -0
  106. package/dist/internal/advance-stage/parsers.d.ts +54 -0
  107. package/dist/internal/advance-stage/parsers.js +307 -0
  108. package/dist/internal/advance-stage/review-loop.d.ts +7 -0
  109. package/dist/internal/advance-stage/review-loop.js +161 -0
  110. package/dist/internal/advance-stage/rewind.d.ts +14 -0
  111. package/dist/internal/advance-stage/rewind.js +108 -0
  112. package/dist/internal/advance-stage/start-flow.d.ts +11 -0
  113. package/dist/internal/advance-stage/start-flow.js +136 -0
  114. package/dist/internal/advance-stage/verify.d.ts +29 -0
  115. package/dist/internal/advance-stage/verify.js +225 -0
  116. package/dist/internal/advance-stage.js +21 -1470
  117. package/dist/internal/compound-readiness.d.ts +1 -1
  118. package/dist/internal/compound-readiness.js +2 -2
  119. package/dist/internal/early-loop-status.d.ts +7 -0
  120. package/dist/internal/early-loop-status.js +90 -0
  121. package/dist/internal/runtime-integrity.d.ts +7 -0
  122. package/dist/internal/runtime-integrity.js +288 -0
  123. package/dist/internal/tdd-red-evidence.js +1 -1
  124. package/dist/knowledge-store.d.ts +5 -28
  125. package/dist/knowledge-store.js +57 -84
  126. package/dist/managed-resources.js +24 -2
  127. package/dist/policy.js +7 -9
  128. package/dist/retro-gate.js +8 -90
  129. package/dist/run-archive.d.ts +1 -1
  130. package/dist/run-archive.js +13 -16
  131. package/dist/run-persistence.js +20 -15
  132. package/dist/runtime/run-hook.entry.d.ts +3 -0
  133. package/dist/runtime/run-hook.entry.js +5 -0
  134. package/dist/runtime/run-hook.mjs +9477 -0
  135. package/dist/tdd-cycle.d.ts +3 -3
  136. package/dist/tdd-cycle.js +1 -1
  137. package/dist/types.d.ts +18 -10
  138. package/package.json +4 -2
  139. package/dist/content/hook-inline-snippets.d.ts +0 -83
  140. package/dist/content/hook-inline-snippets.js +0 -302
  141. package/dist/content/ideate-command.d.ts +0 -8
  142. package/dist/content/ideate-command.js +0 -315
  143. package/dist/content/ideate-frames.d.ts +0 -31
  144. package/dist/content/ideate-frames.js +0 -140
  145. package/dist/content/ideate-ranking.d.ts +0 -25
  146. package/dist/content/ideate-ranking.js +0 -65
  147. package/dist/content/next-command.d.ts +0 -20
  148. package/dist/content/next-command.js +0 -298
  149. package/dist/content/seed-shelf.d.ts +0 -36
  150. package/dist/content/seed-shelf.js +0 -301
  151. package/dist/content/stage-common-guidance.d.ts +0 -1
  152. package/dist/content/stage-common-guidance.js +0 -106
  153. package/dist/doctor-registry.d.ts +0 -10
  154. package/dist/doctor-registry.js +0 -186
  155. package/dist/doctor.d.ts +0 -17
  156. package/dist/doctor.js +0 -2201
  157. package/dist/internal/hook-manifest.d.ts +0 -16
  158. package/dist/internal/hook-manifest.js +0 -77
  159. package/dist/trace-matrix.d.ts +0 -27
  160. package/dist/trace-matrix.js +0 -226
@@ -15,7 +15,7 @@ export class InvalidStageTransitionError extends Error {
15
15
  }
16
16
  }
17
17
  const FLOW_STATE_REL_PATH = `${RUNTIME_ROOT}/state/flow-state.json`;
18
- const RUNS_DIR_REL_PATH = `${RUNTIME_ROOT}/runs`;
18
+ const ARCHIVE_DIR_REL_PATH = `${RUNTIME_ROOT}/archive`;
19
19
  const ACTIVE_ARTIFACTS_REL_PATH = `${RUNTIME_ROOT}/artifacts`;
20
20
  const FLOW_STAGE_SET = new Set(FLOW_STAGES);
21
21
  function validateFlowTransition(prev, next) {
@@ -69,8 +69,8 @@ function flowStatePath(projectRoot) {
69
69
  function flowStateLockPath(projectRoot) {
70
70
  return path.join(projectRoot, RUNTIME_ROOT, "state", ".flow-state.lock");
71
71
  }
72
- function runsRoot(projectRoot) {
73
- return path.join(projectRoot, RUNS_DIR_REL_PATH);
72
+ function archiveRoot(projectRoot) {
73
+ return path.join(projectRoot, ARCHIVE_DIR_REL_PATH);
74
74
  }
75
75
  function activeArtifactsPath(projectRoot) {
76
76
  return path.join(projectRoot, ACTIVE_ARTIFACTS_REL_PATH);
@@ -263,7 +263,14 @@ function sanitizeCloseoutState(value) {
263
263
  return fallback;
264
264
  }
265
265
  const typed = value;
266
- let shipSubstate = isShipSubstate(typed.shipSubstate) ? typed.shipSubstate : fallback.shipSubstate;
266
+ const rawShipSubstate = typeof typed.shipSubstate === "string" ? typed.shipSubstate : undefined;
267
+ let shipSubstate;
268
+ if (rawShipSubstate === "retro_review" || rawShipSubstate === "compound_review") {
269
+ shipSubstate = "post_ship_review";
270
+ }
271
+ else {
272
+ shipSubstate = isShipSubstate(rawShipSubstate) ? rawShipSubstate : fallback.shipSubstate;
273
+ }
267
274
  const retroDraftedAt = typeof typed.retroDraftedAt === "string" ? typed.retroDraftedAt : undefined;
268
275
  const retroAcceptedAt = typeof typed.retroAcceptedAt === "string" ? typed.retroAcceptedAt : undefined;
269
276
  const retroSkipReason = typeof typed.retroSkipReason === "string"
@@ -288,11 +295,8 @@ function sanitizeCloseoutState(value) {
288
295
  // the compound leg, which would let `archive` skip durable closeout proof.
289
296
  const retroDone = retroAcceptedAt !== undefined || retroSkipped === true;
290
297
  const compoundDone = compoundCompletedAt !== undefined || compoundPromoted > 0 || compoundSkipped === true;
291
- if (!retroDone && (shipSubstate === "ready_to_archive" || shipSubstate === "compound_review")) {
292
- shipSubstate = "retro_review";
293
- }
294
- else if (shipSubstate === "ready_to_archive" && !compoundDone) {
295
- shipSubstate = "compound_review";
298
+ if (shipSubstate === "ready_to_archive" && (!retroDone || !compoundDone)) {
299
+ shipSubstate = "post_ship_review";
296
300
  }
297
301
  return {
298
302
  shipSubstate,
@@ -313,7 +317,7 @@ function coerceFlowState(parsed) {
313
317
  const activeRunId = typeof activeRunIdRaw === "string" && activeRunIdRaw.trim().length > 0
314
318
  ? activeRunIdRaw.trim()
315
319
  : next.activeRunId;
316
- return {
320
+ const state = {
317
321
  schemaVersion: FLOW_STATE_SCHEMA_VERSION,
318
322
  activeRunId,
319
323
  currentStage: isFlowStage(parsed.currentStage) ? parsed.currentStage : next.currentStage,
@@ -327,6 +331,7 @@ function coerceFlowState(parsed) {
327
331
  retro: sanitizeRetroState(parsed.retro),
328
332
  closeout: sanitizeCloseoutState(parsed.closeout)
329
333
  };
334
+ return { state };
330
335
  }
331
336
  export class CorruptFlowStateError extends Error {
332
337
  statePath;
@@ -388,7 +393,7 @@ export async function readFlowState(projectRoot, options = {}) {
388
393
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
389
394
  await quarantineCorruptState(statePath, new Error("flow-state.json did not deserialize to a JSON object"));
390
395
  }
391
- return coerceFlowState(parsed);
396
+ return coerceFlowState(parsed).state;
392
397
  }
393
398
  export async function writeFlowState(projectRoot, state, options = {}) {
394
399
  const doWrite = async () => {
@@ -398,7 +403,7 @@ export async function writeFlowState(projectRoot, state, options = {}) {
398
403
  const raw = await fs.readFile(statePath, "utf8");
399
404
  const parsed = JSON.parse(raw);
400
405
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
401
- const prev = coerceFlowState(parsed);
406
+ const prev = coerceFlowState(parsed).state;
402
407
  validateFlowTransition(prev, state);
403
408
  }
404
409
  }
@@ -406,10 +411,10 @@ export async function writeFlowState(projectRoot, state, options = {}) {
406
411
  if (err instanceof InvalidStageTransitionError) {
407
412
  throw err;
408
413
  }
409
- throw new Error(`cannot validate flow-state transition because ${FLOW_STATE_REL_PATH} is unreadable or corrupt (${err instanceof Error ? err.message : String(err)}). Run \`cclaw doctor\` and reconcile the state before retrying.`);
414
+ throw new Error(`cannot validate flow-state transition because ${FLOW_STATE_REL_PATH} is unreadable or corrupt (${err instanceof Error ? err.message : String(err)}). Run \`npx cclaw-cli sync\` and reconcile the state before retrying.`);
410
415
  }
411
416
  }
412
- const safe = coerceFlowState({ ...state });
417
+ const safe = coerceFlowState({ ...state }).state;
413
418
  await writeFileSafe(statePath, `${JSON.stringify(safe, null, 2)}\n`, { mode: 0o600 });
414
419
  };
415
420
  if (options.skipLock) {
@@ -428,7 +433,7 @@ export function flowStateLockPathFor(projectRoot) {
428
433
  return flowStateLockPath(projectRoot);
429
434
  }
430
435
  export async function ensureRunSystem(projectRoot, _options = {}) {
431
- await ensureDir(runsRoot(projectRoot));
436
+ await ensureDir(archiveRoot(projectRoot));
432
437
  await ensureDir(activeArtifactsPath(projectRoot));
433
438
  const statePath = flowStatePath(projectRoot);
434
439
  const state = await readFlowState(projectRoot);
@@ -0,0 +1,3 @@
1
+ import { type NodeHookRuntimeOptions } from "../content/node-hooks.js";
2
+ export declare function buildRunHookRuntimeScript(options?: NodeHookRuntimeOptions): string;
3
+ export default buildRunHookRuntimeScript;
@@ -0,0 +1,5 @@
1
+ import { nodeHookRuntimeScript } from "../content/node-hooks.js";
2
+ export function buildRunHookRuntimeScript(options = {}) {
3
+ return nodeHookRuntimeScript(options);
4
+ }
5
+ export default buildRunHookRuntimeScript;