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.
- package/README.md +24 -18
- package/dist/artifact-linter/brainstorm.d.ts +2 -0
- package/dist/artifact-linter/brainstorm.js +289 -0
- package/dist/artifact-linter/design.d.ts +2 -0
- package/dist/artifact-linter/design.js +354 -0
- package/dist/artifact-linter/plan.d.ts +2 -0
- package/dist/artifact-linter/plan.js +183 -0
- package/dist/artifact-linter/review-army.d.ts +24 -0
- package/dist/artifact-linter/review-army.js +365 -0
- package/dist/artifact-linter/review.d.ts +2 -0
- package/dist/artifact-linter/review.js +99 -0
- package/dist/artifact-linter/scope.d.ts +2 -0
- package/dist/artifact-linter/scope.js +125 -0
- package/dist/artifact-linter/shared.d.ts +247 -0
- package/dist/artifact-linter/shared.js +1517 -0
- package/dist/artifact-linter/ship.d.ts +2 -0
- package/dist/artifact-linter/ship.js +82 -0
- package/dist/artifact-linter/spec.d.ts +2 -0
- package/dist/artifact-linter/spec.js +130 -0
- package/dist/artifact-linter/tdd.d.ts +2 -0
- package/dist/artifact-linter/tdd.js +198 -0
- package/dist/artifact-linter.d.ts +4 -76
- package/dist/artifact-linter.js +56 -2949
- package/dist/cli.d.ts +1 -6
- package/dist/cli.js +4 -159
- package/dist/codex-feature-flag.d.ts +1 -1
- package/dist/codex-feature-flag.js +1 -1
- package/dist/config.d.ts +3 -2
- package/dist/config.js +67 -3
- package/dist/constants.d.ts +1 -7
- package/dist/constants.js +10 -15
- package/dist/content/cancel-command.js +2 -2
- package/dist/content/closeout-guidance.d.ts +1 -1
- package/dist/content/closeout-guidance.js +15 -13
- package/dist/content/core-agents.d.ts +46 -29
- package/dist/content/core-agents.js +216 -82
- package/dist/content/decision-protocol.d.ts +1 -1
- package/dist/content/decision-protocol.js +1 -1
- package/dist/content/diff-command.js +1 -1
- package/dist/content/examples.d.ts +0 -3
- package/dist/content/examples.js +197 -752
- package/dist/content/harness-doc.js +20 -2
- package/dist/content/hook-manifest.d.ts +2 -2
- package/dist/content/hook-manifest.js +2 -2
- package/dist/content/hooks.d.ts +1 -0
- package/dist/content/hooks.js +32 -137
- package/dist/content/idea.d.ts +60 -0
- package/dist/content/idea.js +404 -0
- package/dist/content/iron-laws.d.ts +0 -1
- package/dist/content/iron-laws.js +31 -16
- package/dist/content/learnings.d.ts +2 -4
- package/dist/content/learnings.js +11 -27
- package/dist/content/meta-skill.js +7 -7
- package/dist/content/node-hooks.d.ts +10 -0
- package/dist/content/node-hooks.js +163 -95
- package/dist/content/opencode-plugin.js +15 -29
- package/dist/content/reference-patterns.js +2 -2
- package/dist/content/runtime-shared-snippets.d.ts +8 -0
- package/dist/content/runtime-shared-snippets.js +80 -0
- package/dist/content/session-hooks.js +1 -1
- package/dist/content/skills.d.ts +1 -0
- package/dist/content/skills.js +69 -7
- package/dist/content/stage-schema.js +147 -61
- package/dist/content/stages/_lint-metadata/index.js +26 -2
- package/dist/content/stages/brainstorm.js +13 -7
- package/dist/content/stages/design.js +16 -11
- package/dist/content/stages/plan.js +7 -4
- package/dist/content/stages/review.js +12 -12
- package/dist/content/stages/schema-types.d.ts +2 -2
- package/dist/content/stages/scope.js +15 -12
- package/dist/content/stages/ship.js +3 -3
- package/dist/content/stages/spec.js +9 -3
- package/dist/content/stages/tdd.js +14 -4
- package/dist/content/start-command.js +11 -10
- package/dist/content/status-command.js +5 -5
- package/dist/content/subagent-context-skills.js +156 -1
- package/dist/content/subagents.d.ts +0 -5
- package/dist/content/subagents.js +65 -81
- package/dist/content/templates.d.ts +1 -1
- package/dist/content/templates.js +187 -154
- package/dist/content/tree-command.js +2 -2
- package/dist/content/utility-skills.d.ts +2 -2
- package/dist/content/utility-skills.js +28 -99
- package/dist/content/view-command.js +4 -2
- package/dist/delegation.d.ts +2 -0
- package/dist/delegation.js +2 -1
- package/dist/early-loop.d.ts +66 -0
- package/dist/early-loop.js +275 -0
- package/dist/flow-state.d.ts +5 -6
- package/dist/flow-state.js +4 -6
- package/dist/gate-evidence.d.ts +0 -23
- package/dist/gate-evidence.js +111 -153
- package/dist/harness-adapters.d.ts +2 -2
- package/dist/harness-adapters.js +48 -19
- package/dist/install.js +190 -32
- package/dist/internal/advance-stage/advance.d.ts +50 -0
- package/dist/internal/advance-stage/advance.js +479 -0
- package/dist/internal/advance-stage/cancel-run.d.ts +8 -0
- package/dist/internal/advance-stage/cancel-run.js +19 -0
- package/dist/internal/advance-stage/flow-state-coercion.d.ts +3 -0
- package/dist/internal/advance-stage/flow-state-coercion.js +81 -0
- package/dist/internal/advance-stage/helpers.d.ts +14 -0
- package/dist/internal/advance-stage/helpers.js +145 -0
- package/dist/internal/advance-stage/hook.d.ts +8 -0
- package/dist/internal/advance-stage/hook.js +40 -0
- package/dist/internal/advance-stage/parsers.d.ts +54 -0
- package/dist/internal/advance-stage/parsers.js +307 -0
- package/dist/internal/advance-stage/review-loop.d.ts +7 -0
- package/dist/internal/advance-stage/review-loop.js +161 -0
- package/dist/internal/advance-stage/rewind.d.ts +14 -0
- package/dist/internal/advance-stage/rewind.js +108 -0
- package/dist/internal/advance-stage/start-flow.d.ts +11 -0
- package/dist/internal/advance-stage/start-flow.js +136 -0
- package/dist/internal/advance-stage/verify.d.ts +29 -0
- package/dist/internal/advance-stage/verify.js +225 -0
- package/dist/internal/advance-stage.js +21 -1470
- package/dist/internal/compound-readiness.d.ts +1 -1
- package/dist/internal/compound-readiness.js +2 -2
- package/dist/internal/early-loop-status.d.ts +7 -0
- package/dist/internal/early-loop-status.js +90 -0
- package/dist/internal/runtime-integrity.d.ts +7 -0
- package/dist/internal/runtime-integrity.js +288 -0
- package/dist/internal/tdd-red-evidence.js +1 -1
- package/dist/knowledge-store.d.ts +5 -28
- package/dist/knowledge-store.js +57 -84
- package/dist/managed-resources.js +24 -2
- package/dist/policy.js +7 -9
- package/dist/retro-gate.js +8 -90
- package/dist/run-archive.d.ts +1 -1
- package/dist/run-archive.js +13 -16
- package/dist/run-persistence.js +20 -15
- package/dist/runtime/run-hook.entry.d.ts +3 -0
- package/dist/runtime/run-hook.entry.js +5 -0
- package/dist/runtime/run-hook.mjs +9477 -0
- package/dist/tdd-cycle.d.ts +3 -3
- package/dist/tdd-cycle.js +1 -1
- package/dist/types.d.ts +18 -10
- package/package.json +4 -2
- package/dist/content/hook-inline-snippets.d.ts +0 -83
- package/dist/content/hook-inline-snippets.js +0 -302
- package/dist/content/ideate-command.d.ts +0 -8
- package/dist/content/ideate-command.js +0 -315
- package/dist/content/ideate-frames.d.ts +0 -31
- package/dist/content/ideate-frames.js +0 -140
- package/dist/content/ideate-ranking.d.ts +0 -25
- package/dist/content/ideate-ranking.js +0 -65
- package/dist/content/next-command.d.ts +0 -20
- package/dist/content/next-command.js +0 -298
- package/dist/content/seed-shelf.d.ts +0 -36
- package/dist/content/seed-shelf.js +0 -301
- package/dist/content/stage-common-guidance.d.ts +0 -1
- package/dist/content/stage-common-guidance.js +0 -106
- package/dist/doctor-registry.d.ts +0 -10
- package/dist/doctor-registry.js +0 -186
- package/dist/doctor.d.ts +0 -17
- package/dist/doctor.js +0 -2201
- package/dist/internal/hook-manifest.d.ts +0 -16
- package/dist/internal/hook-manifest.js +0 -77
- package/dist/trace-matrix.d.ts +0 -27
- package/dist/trace-matrix.js +0 -226
package/dist/run-persistence.js
CHANGED
|
@@ -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
|
|
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
|
|
73
|
-
return path.join(projectRoot,
|
|
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
|
-
|
|
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 (
|
|
292
|
-
shipSubstate = "
|
|
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
|
-
|
|
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
|
|
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(
|
|
436
|
+
await ensureDir(archiveRoot(projectRoot));
|
|
432
437
|
await ensureDir(activeArtifactsPath(projectRoot));
|
|
433
438
|
const statePath = flowStatePath(projectRoot);
|
|
434
439
|
const state = await readFlowState(projectRoot);
|