@ornexus/neocortex 4.66.0 → 4.66.1
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/dist/release-source.json +1 -1
- package/dist/sbom.cdx.json +1206 -1193
- package/install.ps1 +1 -1
- package/install.sh +2 -2
- package/package.json +2 -2
- package/packages/client/dist/commands/doctor.d.ts +26 -1
- package/packages/client/dist/commands/doctor.js +2 -2
- package/packages/client/dist/commands/invoke.d.ts +149 -1
- package/packages/client/dist/commands/invoke.js +88 -83
- package/packages/client/dist/commands/planning-qa.d.ts +57 -0
- package/packages/client/dist/commands/planning-qa.js +1 -1
- package/packages/client/dist/commands/story-checkpoint.d.ts +2 -0
- package/packages/client/dist/commands/story-checkpoint.js +1 -1
- package/packages/client/dist/commands/story-worktree.d.ts +1 -1
- package/packages/client/dist/commands/story-worktree.js +1 -1
- package/packages/client/dist/git/direct-yolo-checkpoint.d.ts +51 -0
- package/packages/client/dist/git/direct-yolo-checkpoint.js +4 -3
- package/packages/client/dist/git/epic-lifecycle-evidence.d.ts +184 -0
- package/packages/client/dist/git/epic-lifecycle-evidence.js +6 -0
- package/packages/client/dist/git/git-lifecycle-store.d.ts +9 -0
- package/packages/client/dist/git/git-lifecycle-store.js +9 -8
- package/packages/client/dist/git/story-worktree-cleanup.js +1 -1
- package/packages/client/dist/git/story-worktree-integration.js +3 -3
- package/packages/client/dist/git/story-worktree-manager.d.ts +39 -0
- package/packages/client/dist/git/story-worktree-manager.js +3 -3
- package/packages/client/dist/git/story-write-set-extension.d.ts +62 -0
- package/packages/client/dist/git/story-write-set-extension.js +1 -1
- package/packages/client/dist/private-execution/codex-executor.d.ts +13 -0
- package/packages/client/dist/private-execution/codex-executor.js +4 -4
- package/packages/client/dist/private-execution/harness-adapters/antigravity.d.ts +9 -0
- package/packages/client/dist/private-execution/harness-adapters/antigravity.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/claude-code.d.ts +8 -0
- package/packages/client/dist/private-execution/harness-adapters/claude-code.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/codex.d.ts +7 -0
- package/packages/client/dist/private-execution/harness-adapters/codex.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/copilot-cli.d.ts +8 -0
- package/packages/client/dist/private-execution/harness-adapters/copilot-cli.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/cursor.d.ts +9 -0
- package/packages/client/dist/private-execution/harness-adapters/cursor.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/deepseek.d.ts +9 -0
- package/packages/client/dist/private-execution/harness-adapters/deepseek.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/gemini.d.ts +8 -0
- package/packages/client/dist/private-execution/harness-adapters/gemini.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/grok.d.ts +9 -0
- package/packages/client/dist/private-execution/harness-adapters/grok.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/index.d.ts +73 -0
- package/packages/client/dist/private-execution/harness-adapters/index.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/kimi.d.ts +9 -0
- package/packages/client/dist/private-execution/harness-adapters/kimi.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/openclaw.d.ts +9 -0
- package/packages/client/dist/private-execution/harness-adapters/openclaw.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/opencode.d.ts +7 -0
- package/packages/client/dist/private-execution/harness-adapters/opencode.js +1 -0
- package/packages/client/dist/private-execution/harness-ephemeral-home.d.ts +19 -0
- package/packages/client/dist/private-execution/harness-ephemeral-home.js +1 -0
- package/packages/client/dist/private-execution/harness-executor.d.ts +79 -0
- package/packages/client/dist/private-execution/harness-executor.js +1 -0
- package/packages/client/dist/private-execution/harness-process.d.ts +43 -0
- package/packages/client/dist/private-execution/harness-process.js +1 -0
- package/packages/client/dist/private-execution/isolated-admission.js +12 -12
- package/packages/client/dist/private-execution/isolated-workspace.d.ts +16 -1
- package/packages/client/dist/private-execution/isolated-workspace.js +1 -1
- package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.d.ts +1 -22
- package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.js +6 -10
- package/packages/client/dist/state/project-state-snapshot.d.ts +10 -0
- package/packages/client/dist/state/project-state-snapshot.js +1 -1
- package/packages/client/dist/state/structural-dag-projection.d.ts +26 -0
- package/packages/client/dist/state/structural-dag-projection.js +1 -1
- package/packages/client/dist/yoloop/yoloop-client-state-store.d.ts +67 -0
- package/packages/client/dist/yoloop/yoloop-client-state-store.js +1 -1
- package/packages/shared/dist/compatibility/index.js +28 -0
- package/targets-stubs/antigravity/gemini.md +1 -1
- package/targets-stubs/antigravity/skill/SKILL.md +1 -1
- package/targets-stubs/claude-code/neocortex-root.agent.yaml +1 -1
- package/targets-stubs/claude-code/neocortex-root.md +2 -2
- package/targets-stubs/claude-code/neocortex-sentinel.md +1 -1
- package/targets-stubs/claude-code/neocortex.agent.yaml +1 -1
- package/targets-stubs/claude-code/neocortex.md +2 -2
- package/targets-stubs/codex/AGENTS.md +1 -1
- package/targets-stubs/cursor/agent.md +2 -2
- package/targets-stubs/gemini-cli/agent.md +2 -2
- package/targets-stubs/gemini-cli/agents/neocortex.md +2 -2
- package/targets-stubs/grok/SKILL.md +3 -3
- package/targets-stubs/grok/agents/{neocortex.md → neocortex-sentinel.md} +2 -2
- package/targets-stubs/grok/install-grok.sh +45 -8
- package/targets-stubs/lib/managed-config-merge.js +21 -1
- package/targets-stubs/lib/mcp-merge.js +12 -3
- package/targets-stubs/opencode/neocortex-root.md +1 -1
- package/targets-stubs/opencode/neocortex.md +1 -1
- package/targets-stubs/vscode/neocortex.agent.md +2 -2
|
@@ -1,3 +1,60 @@
|
|
|
1
|
+
import { type PlanningQaEvidenceBindingV1, type PlanningQaPhase } from '../private-execution/planning-diagnosis-checkpoint.js';
|
|
2
|
+
/** P229.05 public receipt fragment; the seal stays root-owned and recomputes the binding. */
|
|
3
|
+
export interface PlanningQaAdmissionEvidenceV1 {
|
|
4
|
+
readonly schemaVersion: 1;
|
|
5
|
+
readonly phase: PlanningQaPhase;
|
|
6
|
+
readonly epicId: string;
|
|
7
|
+
readonly qaEvidenceId: string;
|
|
8
|
+
readonly rootSealRequired: true;
|
|
9
|
+
readonly publicSafe: true;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* P229.05 (P228-CON-QA-EVIDENCE): the binding the root review of an admitted P01-P03
|
|
13
|
+
* workspace carries. `sourceHead` is the admission base (the reviews require
|
|
14
|
+
* `admission.baseSha === sourceHead`) and the artifact digests are read from `root`, where
|
|
15
|
+
* the admission already applied the patch; the names match each phase's root review.
|
|
16
|
+
*/
|
|
17
|
+
export declare function planningQaAdmissionBinding(phase: PlanningQaPhase, input: {
|
|
18
|
+
readonly root: string;
|
|
19
|
+
readonly claimId: string;
|
|
20
|
+
readonly epicId: string;
|
|
21
|
+
readonly admission: {
|
|
22
|
+
readonly baseSha: string;
|
|
23
|
+
readonly patchSha256: string;
|
|
24
|
+
readonly changedPaths: readonly string[];
|
|
25
|
+
};
|
|
26
|
+
}): PlanningQaEvidenceBindingV1;
|
|
27
|
+
/**
|
|
28
|
+
* P229.05 (P222.20, P228-CON-QA-EVIDENCE): digest-bound QA evidence published after a
|
|
29
|
+
* planning admission on the executor port. `qaEvidenceId === planningQaEvidenceId(phase,
|
|
30
|
+
* binding)`; it grants no seal and the root review/seal recompute and compare it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function derivePlanningQaEvidenceForAdmission(phase: PlanningQaPhase, binding: PlanningQaEvidenceBindingV1): PlanningQaAdmissionEvidenceV1;
|
|
33
|
+
/** P229.05: published when the evidence cannot be derived after an already-effective admission. */
|
|
34
|
+
export interface PlanningQaUnavailableV1 {
|
|
35
|
+
readonly schemaVersion: 1;
|
|
36
|
+
readonly phase: PlanningQaPhase;
|
|
37
|
+
readonly status: 'unavailable';
|
|
38
|
+
readonly reasonCode: 'private-execution-planning-qa-unavailable';
|
|
39
|
+
readonly rootSealRequired: true;
|
|
40
|
+
readonly publicSafe: true;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* P229.05: the `planningQa` receipt fragment for an admitted port step. The admission
|
|
44
|
+
* already applied the patch and the lease is consumed, so a derivation failure never
|
|
45
|
+
* fails the step: it publishes a bounded `unavailable` status (no qaEvidenceId) and the
|
|
46
|
+
* root review/seal stays required.
|
|
47
|
+
*/
|
|
48
|
+
export declare function planningQaReceiptFragment(phase: PlanningQaPhase, input: {
|
|
49
|
+
readonly root: string;
|
|
50
|
+
readonly claimId: string;
|
|
51
|
+
readonly epicId: string;
|
|
52
|
+
readonly admission: {
|
|
53
|
+
readonly baseSha: string;
|
|
54
|
+
readonly patchSha256: string;
|
|
55
|
+
readonly changedPaths: readonly string[];
|
|
56
|
+
};
|
|
57
|
+
}): PlanningQaAdmissionEvidenceV1 | PlanningQaUnavailableV1;
|
|
1
58
|
/**
|
|
2
59
|
* P228-CON-QA-EVIDENCE: the root records host-neutral QA for an admitted planning artifact.
|
|
3
60
|
* The command is read-only; it prints a `qaEvidenceId` bound to the admission patch and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{recordPlanningDiagnosisQaEvidence as
|
|
1
|
+
import{createHash as h}from"node:crypto";import{lstatSync as g,readFileSync as m}from"node:fs";import{join as f}from"node:path";import{planningQaEvidenceId as I,recordPlanningDiagnosisQaEvidence as E}from"../private-execution/planning-diagnosis-checkpoint.js";import{recordPlanningResearchQaEvidence as w}from"../private-execution/planning-research-checkpoint.js";import{recordPlanningGenerationQaEvidence as v}from"../private-execution/planning-generation-checkpoint.js";const S=64*1024,c=["diagnosis","research","generation"],y=1024*1024,q=24,d=".neocortex/planning/planning.json",$=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,p=/^P[1-9][0-9]{0,11}$/;function A(n,e){try{const r=g(f(n,e));if(!r.isFile()||r.isSymbolicLink()||r.size<1||r.size>y)throw new Error("artifact");return h("sha256").update(m(f(n,e))).digest("hex")}catch{throw new Error("planning-qa-artifact-unavailable")}}function P(n,e){if(!c.includes(n)||!p.test(e.epicId))throw new Error("planning-qa-admission-invalid");const r=`.neocortex/planning/epic-${e.epicId}`,t=a=>A(e.root,a);let i;if(n==="diagnosis")i={idea:t(`${r}/idea.json`),diagnosis:t(`${r}/diagnosis.md`),enrichment:t(`${r}/enriched-prompt.md`),index:t(d)};else if(n==="research")i={research:t(`${r}/research.md`),index:t(d)};else{const a=new RegExp(`^docs/stories/${e.epicId}\\.[0-9]{2}\\.story\\.md$`),s=e.admission.changedPaths.filter(o=>a.test(o)).length,l=Array.from({length:s},(o,u)=>`docs/stories/${e.epicId}.${String(u+1).padStart(2,"0")}.story.md`);if(s<1||s>q||l.some(o=>!e.admission.changedPaths.includes(o)))throw new Error("planning-qa-artifact-unavailable");i={epic:t(`docs/epics/epic-${e.epicId}.md`),index:t(d),stories:Object.fromEntries(l.map(o=>[o,t(o)]))}}return{claimId:e.claimId,epicId:e.epicId,sourceHead:e.admission.baseSha,admissionPatchSha256:e.admission.patchSha256,artifactDigests:i}}function x(n,e){if(!c.includes(n)||typeof e!="object"||e===null||typeof e.claimId!="string"||!$.test(e.claimId)||typeof e.epicId!="string"||!p.test(e.epicId)||typeof e.sourceHead!="string"||!/^[a-f0-9]{40,64}$/.test(e.sourceHead)||typeof e.admissionPatchSha256!="string"||!/^[a-f0-9]{64}$/.test(e.admissionPatchSha256)||typeof e.artifactDigests!="object"||e.artifactDigests===null)throw new Error("planning-qa-admission-invalid");let r;try{r=I(n,e)}catch{throw new Error("planning-qa-admission-invalid")}return{schemaVersion:1,phase:n,epicId:e.epicId,qaEvidenceId:r,rootSealRequired:!0,publicSafe:!0}}function k(n,e){try{return x(n,P(n,e))}catch{return{schemaVersion:1,phase:n,status:"unavailable",reasonCode:"private-execution-planning-qa-unavailable",rootSealRequired:!0,publicSafe:!0}}}const R="usage: planning-qa record --phase <diagnosis|research|generation> [--project-root <path>] < review.json";async function _(n){const e=[];let r=0;for await(const t of n){const i=Buffer.isBuffer(t)?t:Buffer.from(t);if(r+=i.length,r>S)throw new Error("planning-qa-review-too-large");e.push(i)}if(r===0)throw new Error("planning-qa-review-missing");try{return JSON.parse(Buffer.concat(e).toString("utf8"))}catch{throw new Error("planning-qa-review-invalid")}}function N(n){if(n[0]!=="record")return null;let e,r;for(let t=1;t<n.length;t+=2){const i=n[t],a=n[t+1];if(a===void 0)return null;if(i==="--phase"&&e===void 0&&c.includes(a))e=a;else if(i==="--project-root"&&r===void 0)r=a;else return null}return e?{phase:e,...r===void 0?{}:{projectRoot:r}}:null}function j(n,e){if(/^planning-qa-[a-z-]+$/.test(n))return n;const r=`planning-${e}-`;return n.startsWith(r)&&/^[a-z-]+$/.test(n.slice(r.length))?`planning-qa-${n.slice(r.length)}`:/^planning-(research|generation)-predecessor-invalid$/.test(n)?"planning-qa-predecessor-invalid":"planning-qa-record-failed"}async function z(n){return T(n,process.stdin,console)}async function T(n,e,r){const t=N(n);if(!t)return r.error(R),1;try{const i=await _(e),a=t.projectRoot??process.cwd(),s=t.phase==="diagnosis"?E(a,i):t.phase==="research"?w(a,i):v(a,i);return r.log(JSON.stringify({ok:!0,phase:t.phase,epicId:s.epicId,qaEvidenceId:s.qaEvidenceId,publicSafe:!0})),0}catch(i){const a=i instanceof Error?i.message:"";return r.error(JSON.stringify({ok:!1,reasonCode:j(a,t.phase),publicSafe:!0})),1}}export{x as derivePlanningQaEvidenceForAdmission,P as planningQaAdmissionBinding,z as planningQaCliHandler,T as planningQaCliHandlerWithIO,k as planningQaReceiptFragment};
|
|
@@ -16,6 +16,8 @@ interface StoryCheckpointCliOptions {
|
|
|
16
16
|
readonly storyIds?: readonly string[];
|
|
17
17
|
/** `extend-write-set --paths a,b`: root-authorized write-set extension (hotfix 4.61.6). */
|
|
18
18
|
readonly paths?: readonly string[];
|
|
19
|
+
/** P230.02 (DEC-01): `extend-write-set --request`: child mode, typed request without any write. */
|
|
20
|
+
readonly request?: boolean;
|
|
19
21
|
}
|
|
20
22
|
export declare function parseStoryCheckpointArgs(args: readonly string[]): StoryCheckpointCliOptions;
|
|
21
23
|
export declare function storyCheckpointCliHandler(args: readonly string[]): Promise<number>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFile as
|
|
1
|
+
import{readFile as E}from"node:fs/promises";import{resolve as S}from"node:path";import{acceptDirectYoloSetupCheckpoint as I,beginDirectYoloStoryCommit as C,captureDirectYoloStoryGovernance as R,finalizeDirectYoloStoryCheckpoint as W,issueDirectYoloSetupLeaseHandoff as x,prepareDirectYoloSetup as q,recoverLegacyDirectYoloStoryCheckpoint as H}from"../git/direct-yolo-checkpoint.js";import{applyDirectYoloC01Retry as D,inspectDirectYoloC01Retry as z}from"../git/direct-yolo-c01-retry.js";import{integrateStoryWorktree as Y,integrateStoryWorktreeWave as b}from"../git/story-worktree-integration.js";import{detectStoryWriteSetManualEdit as j,extendStoryWriteSet as J,requestStoryWriteSetExtension as N,storyWorktreeTemporaryBranchForManualEditGate as O}from"../git/story-write-set-extension.js";function F(n){const e=n[0];if(e!=="setup"&&e!=="accept-setup"&&e!=="handoff"&&e!=="begin"&&e!=="finalize"&&e!=="recover"&&e!=="retry-c01"&&e!=="integrate-worktree"&&e!=="extend-write-set"&&e!=="capture-governance")throw new Error("story-checkpoint-action-invalid");let s="",c=process.cwd(),r,o="origin",i=!1,p="plain",u,y,g,k=!1,f,v,m,$=!1;for(let a=1;a<n.length;a++){const t=n[a],l=()=>n[++a]??"";if(t==="--story")s=l();else if(t.startsWith("--story="))s=t.slice(8);else if(t==="--paths")m=l();else if(t.startsWith("--paths="))m=t.slice(8);else if(t==="--stories")v=l();else if(t.startsWith("--stories="))v=t.slice(10);else if(t==="--project-root")c=l()||c;else if(t.startsWith("--project-root="))c=t.slice(15);else if(t==="--commit")r=l();else if(t.startsWith("--commit="))r=t.slice(9);else if(t==="--remote")o=l();else if(t.startsWith("--remote="))o=t.slice(9);else if(t==="--push"||t==="--require-remote")i=!0;else if(t==="--setup-handoff-session")u=l();else if(t.startsWith("--setup-handoff-session="))u=t.slice(24);else if(t==="--setup-handoff-token-file")y=l();else if(t.startsWith("--setup-handoff-token-file="))y=t.slice(27);else if(t==="--expected-head")g=l();else if(t.startsWith("--expected-head="))g=t.slice(16);else if(t==="--apply")k=!0;else if(t==="--request")$=!0;else if(t==="--lease")f=l();else if(t.startsWith("--lease="))f=t.slice(8);else if(t==="--format"){const d=l();if(d!=="json"&&d!=="plain")throw new Error("story-checkpoint-format-invalid");p=d}else if(t.startsWith("--format=")){const d=t.slice(9);if(d!=="json"&&d!=="plain")throw new Error("story-checkpoint-format-invalid");p=d}else throw new Error("story-checkpoint-argument-invalid")}let h;if(v!==void 0){if(e!=="integrate-worktree"||s||f!==void 0)throw new Error("story-checkpoint-option-invalid");if(h=v.split(",").map(a=>a.trim()),h.length===0||h.some(a=>!/^P[1-9][0-9]*(?:\.[0-9]+)+$/.test(a))||new Set(h).size!==h.length)throw new Error("story-checkpoint-stories-invalid")}if(!s&&!h)throw new Error("story-checkpoint-story-required");let w;if(e==="extend-write-set"){if(m===void 0)throw new Error("story-checkpoint-paths-required");if(r||i||o!=="origin"||f!==void 0)throw new Error("story-checkpoint-option-invalid");if(w=m.split(",").map(a=>a.trim()),w.length===0||w.some(a=>a.length===0))throw new Error("story-checkpoint-paths-invalid")}else if(m!==void 0||$)throw new Error("story-checkpoint-option-invalid");if(e==="recover"&&!r)throw new Error("story-checkpoint-commit-required");if(e==="recover"&&!i)throw new Error("story-checkpoint-remote-proof-required");if(e==="finalize"&&!i)throw new Error("story-checkpoint-push-required");if(e==="integrate-worktree"&&(!i||r))throw new Error(i?"story-checkpoint-option-invalid":"story-checkpoint-push-required");if(f!==void 0&&(e!=="integrate-worktree"||!/^swt-[a-f0-9]{24}$/.test(f)))throw new Error("story-checkpoint-option-invalid");if(e==="begin"&&(r||i||o!=="origin"))throw new Error("story-checkpoint-option-invalid");if((e==="setup"||e==="accept-setup"||e==="handoff"||e==="capture-governance")&&(r||i||o!=="origin"||f!==void 0))throw new Error("story-checkpoint-option-invalid");if(e==="finalize"&&r)throw new Error("story-checkpoint-option-invalid");if(u===void 0!=(y===void 0))throw new Error("story-checkpoint-setup-handoff-incomplete");if(e!=="begin"&&(u||y))throw new Error("story-checkpoint-option-invalid");if(e!=="retry-c01"&&(g||k))throw new Error("story-checkpoint-option-invalid");if(e==="retry-c01"&&(r||i||o!=="origin"||k&&!/^[a-f0-9]{40,64}$/.test(g??"")))throw new Error("story-checkpoint-option-invalid");return{action:e,storyId:s,projectRoot:S(c),commitSha:r,remote:o,push:i,format:p,...g?{expectedHeadSha:g}:{},...k?{apply:k}:{},...f?{leaseId:f}:{},...h?{storyIds:h}:{},...w?{paths:w}:{},...$?{request:$}:{},...u?{setupHandoffSessionId:u}:{},...y?{setupHandoffTokenFile:S(y)}:{}}}async function K(n){let e;try{e=F(n)}catch(o){return console.error(o instanceof Error?o.message:"story-checkpoint-arguments-invalid"),1}if(e.action==="retry-c01")try{const o=e.apply?await D(e.projectRoot,e.storyId,e.expectedHeadSha):await z(e.projectRoot,e.storyId);return console.log(e.format==="json"?JSON.stringify(o,null,2):`story-checkpoint retry-c01: ${e.apply?"committed":"eligible"}`),0}catch(o){return console.error(o instanceof Error?o.message:"direct-yolo-retry-unverified"),1}let s;if(e.setupHandoffSessionId&&e.setupHandoffTokenFile)try{s={sessionId:e.setupHandoffSessionId,token:(await E(e.setupHandoffTokenFile,"utf8")).trim()}}catch{return console.error("story-checkpoint-setup-handoff-read-failed"),1}if(e.action==="extend-write-set"&&e.request){const o=await N({projectRoot:e.projectRoot,storyId:e.storyId,paths:e.paths??[]});return e.format==="json"?console.log(JSON.stringify({action:e.action,mode:"request",...o},null,2)):o.ok?(console.log(`story-checkpoint ${e.action}: ${o.value.outcome}`),console.log(`paths=${o.value.paths.length} requested=${o.value.requestedPathCount}`),o.value.applyCommand&&console.log(`root-apply=${o.value.applyCommand}`)):console.error(`story-checkpoint ${e.action}: ${o.reasonCode}`),o.ok?0:1}const c=await L(e);if(c)return e.format==="json"?console.log(JSON.stringify({action:e.action,ok:!1,reasonCode:c},null,2)):console.error(`story-checkpoint ${e.action}: ${c}`),1;if(e.action==="extend-write-set"){const o=await J({projectRoot:e.projectRoot,storyId:e.storyId,paths:e.paths??[]});return e.format==="json"?console.log(JSON.stringify({action:e.action,...o},null,2)):o.ok?(console.log(`story-checkpoint ${e.action}: ${o.value.outcome}`),console.log(`paths=${o.value.extensionPathCount} authorized=${o.value.authorizedPathCount}`),console.log(`claim=${o.value.claimRevision}`)):console.error(`story-checkpoint ${e.action}: ${o.reasonCode}`),o.ok?0:1}if(e.action==="integrate-worktree"&&e.storyIds){const o=await b({projectRoot:e.projectRoot,storyIds:e.storyIds,push:e.push,remote:e.remote});if(e.format==="json")console.log(JSON.stringify({action:e.action,mode:"wave",...o},null,2));else if(o.ok){const i=o.value;console.log(`story-checkpoint ${e.action}: wave ${i.outcome}`),console.log(`integrated=${i.integratedStoryIds.length} gate-runs=${i.gateRuns}/${i.gateRunCap}`),console.log(`head=${i.epicHeadAfterSha}`);for(const p of i.stories)console.log(`story=${p.storyId} ${p.outcome}${p.reasonCode?` ${p.reasonCode}`:""}`)}else console.error(`story-checkpoint ${e.action}: ${o.reasonCode}`);return o.ok&&o.value.outcome!=="gate-failed"?0:1}if(e.action==="integrate-worktree"){const o=await Y({projectRoot:e.projectRoot,storyId:e.storyId,push:e.push,remote:e.remote,...e.leaseId?{leaseId:e.leaseId}:{}});if(e.format==="json")console.log(JSON.stringify({action:e.action,...o},null,2));else if(o.ok){console.log(`story-checkpoint ${e.action}: ${o.value.outcome}`),o.value.checkpointHeadSha&&console.log(`head=${o.value.checkpointHeadSha}`);for(const i of o.value.conflictPaths??[])console.log(`conflict=${i}`)}else console.error(`story-checkpoint ${e.action}: ${o.reasonCode}`);return o.ok?0:1}if(e.action==="capture-governance"){const o=await R(e);return e.format==="json"?console.log(JSON.stringify({action:e.action,...o},null,2)):o.ok?(console.log(`story-checkpoint ${e.action}: ok`),console.log(`governance=${o.value.governanceDigest} revision=${o.value.revision}`)):console.error(`story-checkpoint ${e.action}: ${o.reasonCode}`),o.ok?0:1}const r=e.action==="setup"?await q(e):e.action==="accept-setup"?await I(e):e.action==="handoff"?await x(e):e.action==="begin"?await C({...e,...s?{setupLeaseHandoff:s}:{}}):e.action==="finalize"?await W(e):await H({...e,commitSha:e.commitSha});if(e.format==="json")console.log(JSON.stringify({action:e.action,...r},null,2));else if(r.ok)if(console.log(`story-checkpoint ${e.action}: ok`),e.action==="begin"&&"trailers"in r.value)for(const o of r.value.trailers)console.log(o);else"headSha"in r.value&&console.log(`head=${r.value.headSha}`);else console.error(`story-checkpoint ${e.action}: ${r.reasonCode}`);return r.ok?0:1}async function L(n){if(n.action==="begin"||n.action==="finalize"){const e=await j({projectRoot:n.projectRoot,storyId:n.storyId});return e.ok?void 0:e.reasonCode}if(n.action==="integrate-worktree")for(const e of n.storyIds??[n.storyId]){const s=await O(n.projectRoot,e);if(!s)continue;const c=await j({projectRoot:n.projectRoot,storyId:e,candidateRef:s});if(!c.ok)return c.reasonCode}}export{F as parseStoryCheckpointArgs,K as storyCheckpointCliHandler};
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { StoryWorktreeCleanup } from '../git/story-worktree-cleanup.js';
|
|
14
14
|
import { StoryWorktreeManager } from '../git/story-worktree-manager.js';
|
|
15
|
-
export declare const STORY_WORKTREE_ACTIONS: readonly ["create", "adopt", "sync", "status", "release", "cleanup", "recover", "record-push"];
|
|
15
|
+
export declare const STORY_WORKTREE_ACTIONS: readonly ["create", "adopt", "sync", "status", "release", "cleanup", "recover", "record-push", "assert-phase-two"];
|
|
16
16
|
export type StoryWorktreeAction = (typeof STORY_WORKTREE_ACTIONS)[number];
|
|
17
17
|
export interface StoryWorktreeCliOptions {
|
|
18
18
|
readonly action: StoryWorktreeAction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{readFile as g,stat as f,writeFile as m}from"node:fs/promises";import{dirname as
|
|
1
|
+
import{readFile as g,stat as f,writeFile as m}from"node:fs/promises";import{dirname as b,isAbsolute as S,resolve as C}from"node:path";import{STORY_WORKTREE_CLEANUP_TRIGGERS as j,StoryWorktreeCleanup as F}from"../git/story-worktree-cleanup.js";import{StoryWorktreeManager as O}from"../git/story-worktree-manager.js";const y=Object.freeze(["create","adopt","sync","status","release","cleanup","recover","record-push","assert-phase-two"]),x=j.filter(e=>e!=="orphan-recovery"),E=Object.freeze({"--project-root":"projectRoot","--format":"format","--epic":"epicId","--story":"storyId","--dispatch":"dispatchId","--base-sha":"baseSha","--graph-revision":"graphRevision","--owner":"ownerId","--lease":"leaseId","--sha":"sha","--directive-file":"directiveFile","--worktree-path":"worktreePath","--path-file":"pathFile","--trigger":"trigger","--remote":"remote"}),P=Object.freeze({"--dry-run":"dryRun"}),u=Object.freeze({create:["epicId","storyId","dispatchId","baseSha","graphRevision"],adopt:["epicId","storyId","dispatchId","baseSha","graphRevision","worktreePath"],sync:["leaseId"],status:[],release:["leaseId"],cleanup:["leaseId","trigger"],recover:[],"record-push":["leaseId","remote"],"assert-phase-two":["storyId"]}),A=Object.freeze({create:[...u.create,"ownerId","pathFile"],adopt:[...u.adopt,"ownerId","pathFile"],sync:["leaseId","sha","directiveFile"],status:["leaseId","epicId","storyId"],release:["leaseId"],cleanup:["leaseId","trigger","dryRun"],recover:["epicId","dryRun"],"record-push":["leaseId","remote"],"assert-phase-two":["storyId"]});class o extends Error{reasonCode;constructor(t){super(t),this.reasonCode=t}}function W(e,t=process.cwd()){const a=e[0];if(!y.includes(a))throw new o("story-worktree-action-invalid");const r={};for(let s=1;s<e.length;s++){const d=e[s],l=P[d];if(l){if(r[l]!==void 0)throw new o("story-worktree-argument-invalid");r[l]="true";continue}const c=d.indexOf("="),R=c>0?d.slice(0,c):d,w=E[R];if(!w)throw new o("story-worktree-argument-invalid");const h=c>0?d.slice(c+1):e[++s];if(h===void 0||h===""||r[w]!==void 0)throw new o("story-worktree-argument-invalid");r[w]=h}const i=a,p=new Set([...A[i],"projectRoot","format"]);if(Object.keys(r).some(s=>!p.has(s)))throw new o("story-worktree-option-invalid");if(u[i].some(s=>r[s]===void 0))throw new o("story-worktree-option-required");if(i==="sync"&&r.sha===void 0==(r.directiveFile===void 0))throw new o("story-worktree-sync-source-invalid");if(i==="status"&&[r.leaseId,r.epicId,r.storyId].filter(s=>s!==void 0).length!==1)throw new o("story-worktree-status-selector-invalid");if(i==="cleanup"&&!x.includes(r.trigger))throw new o("story-worktree-trigger-invalid");const n=r.format??"json";if(n!=="json"&&n!=="plain")throw new o("story-worktree-format-invalid");for(const s of["directiveFile","worktreePath","pathFile"])if(r[s]!==void 0&&!S(r[s]))throw new o("story-worktree-path-argument-invalid");const{dryRun:k,...v}=r;return{...v,...k?{dryRun:!0}:{},action:i,projectRoot:C(t,r.projectRoot??"."),format:n}}async function L(e){try{await f(e)}catch{try{if((await f(b(e))).isDirectory())return}catch{}throw new o("story-worktree-path-file-invalid")}throw new o("story-worktree-path-file-exists")}async function _(e,t=new O({projectRoot:e.projectRoot}),a=new F({projectRoot:e.projectRoot,manager:t})){e.pathFile&&await L(e.pathFile);let r;switch(e.action){case"create":r=await t.create({epicId:e.epicId,storyId:e.storyId,dispatchId:e.dispatchId,baseSha:e.baseSha,graphRevision:e.graphRevision,...e.ownerId?{ownerId:e.ownerId}:{}});break;case"adopt":r=await t.adopt({epicId:e.epicId,storyId:e.storyId,dispatchId:e.dispatchId,baseSha:e.baseSha,graphRevision:e.graphRevision,worktreePath:e.worktreePath,...e.ownerId?{ownerId:e.ownerId}:{}});break;case"sync":{let i;if(e.directiveFile)try{i=JSON.parse(await g(e.directiveFile,"utf8"))}catch{return{exitCode:1,payload:{action:"sync",ok:!1,reasonCode:"story-worktree-directive-invalid"}}}r=await t.sync({leaseId:e.leaseId,...e.sha?{integratedSha:e.sha}:{},...i!==void 0?{directive:i}:{}});break}case"status":r=await t.status(e.leaseId?{leaseId:e.leaseId}:e.storyId?{storyId:e.storyId}:{epicId:e.epicId});break;case"release":r=await t.release({leaseId:e.leaseId});break;case"cleanup":r=await a.cleanup({leaseId:e.leaseId,trigger:e.trigger,...e.dryRun?{dryRun:!0}:{}});break;case"recover":r=await a.sweep({...e.epicId?{epicId:e.epicId}:{},...e.dryRun?{dryRun:!0}:{}});break;case"record-push":r=await a.recordPush({leaseId:e.leaseId,remote:e.remote});break;case"assert-phase-two":r=await t.assertPhaseTwo({storyId:e.storyId});break}if(!r.ok)return{exitCode:1,payload:{action:e.action,ok:!1,reasonCode:r.reasonCode,...r.conflictPaths?{conflictPaths:r.conflictPaths}:{}}};if(e.pathFile&&r.privatePath)try{await m(e.pathFile,`${r.privatePath}
|
|
2
2
|
`,{flag:"wx",mode:384})}catch{return{exitCode:1,payload:{action:e.action,ok:!1,reasonCode:"story-worktree-path-file-invalid"}}}return{exitCode:0,payload:{action:e.action,ok:!0,value:r.value}}}function I(e,t){if(t==="json")return JSON.stringify(e,null,2);const a=[`story-worktree ${String(e.action)}: ${e.ok?"ok":"refused"}`];return e.reasonCode&&a.push(`reason=${String(e.reasonCode)}`),a.join(" ")}async function z(e){let t;try{t=W(e)}catch(a){const r=a instanceof o?a.reasonCode:"story-worktree-argument-invalid",i=y.includes(e[0])?e[0]:null;return process.stdout.write(`${JSON.stringify({action:i,ok:!1,reasonCode:r})}
|
|
3
3
|
`),2}try{const{exitCode:a,payload:r}=await _(t);return process.stdout.write(`${I(r,t.format)}
|
|
4
4
|
`),a}catch(a){const r=a instanceof o?a.reasonCode:"story-worktree-internal-error";return process.stdout.write(`${I({action:t.action,ok:!1,reasonCode:r},t.format)}
|
|
@@ -97,6 +97,30 @@ export interface DirectYoloCheckpointOptions {
|
|
|
97
97
|
readonly beforeCheckpointPersist?: () => Promise<void>;
|
|
98
98
|
/** Test seam for crash-window reproduction after durable CAS and before release. */
|
|
99
99
|
readonly afterCheckpointPersist?: () => Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* P230.05 (REQ-03): write-set read by the story-worktree integrator before
|
|
102
|
+
* its fast-forward. When set, finalize binds the claim and the accepted
|
|
103
|
+
* checkpoint to it instead of the write-set re-read from the post-ff state.
|
|
104
|
+
* Internal integrator input only; the CLI never supplies it.
|
|
105
|
+
*/
|
|
106
|
+
readonly preFastForwardAuthorizedWriteSet?: readonly string[];
|
|
107
|
+
}
|
|
108
|
+
/** P230.05: verified bindings of one story commit (trailers, claim, graph epoch, bundle, review). */
|
|
109
|
+
export interface DirectYoloVerifiedCommit {
|
|
110
|
+
readonly baseSha: string;
|
|
111
|
+
readonly changedPaths: readonly string[];
|
|
112
|
+
readonly bundleDigest: string;
|
|
113
|
+
readonly graphRevision: string;
|
|
114
|
+
readonly claimRevision: string;
|
|
115
|
+
readonly idempotencyKey: string;
|
|
116
|
+
readonly governance?: StoryGovernanceReceipt;
|
|
117
|
+
}
|
|
118
|
+
/** P230.05: optional, restricting verification inputs supplied by the integrator. */
|
|
119
|
+
export interface DirectYoloCommitVerificationOptions {
|
|
120
|
+
/** Write-set the claim and changed paths are bound to (pre-ff integrator authority). */
|
|
121
|
+
readonly claimWriteSet?: readonly string[];
|
|
122
|
+
/** Graph revision this commit must carry (per-commit epoch). */
|
|
123
|
+
readonly expectedGraphRevision?: string;
|
|
100
124
|
}
|
|
101
125
|
/**
|
|
102
126
|
* Productive P207 setup boundary. It owns only the current checkout and the
|
|
@@ -113,9 +137,20 @@ export declare function acceptDirectYoloSetupCheckpoint(options: Pick<DirectYolo
|
|
|
113
137
|
export declare function issueDirectYoloSetupLeaseHandoff(options: Pick<DirectYoloCheckpointOptions, 'projectRoot' | 'storyId' | 'nowIso'>): Promise<DirectYoloCheckpointResult<DirectYoloSetupHandoffReceipt>>;
|
|
114
138
|
export declare function beginDirectYoloStoryCommit(options: Pick<DirectYoloCheckpointOptions, 'projectRoot' | 'storyId' | 'nowIso' | 'setupLeaseHandoff' | 'setupHandoffFault'>): Promise<DirectYoloCheckpointResult<DirectYoloCommitPlan>>;
|
|
115
139
|
export declare function finalizeDirectYoloStoryCheckpoint(options: DirectYoloCheckpointOptions): Promise<DirectYoloCheckpointResult<StoryCommitCheckpoint>>;
|
|
140
|
+
/** Authority shape the verifier consumes (logical authority; the branch check is the caller's). */
|
|
141
|
+
type DirectYoloCommitAuthority = Pick<LogicalAuthority, 'projectRoot' | 'epicId' | 'executionBranch' | 'graphRevision' | 'authorizedWriteSet' | 'rootMemoryEffect' | 'governanceMode'>;
|
|
142
|
+
/**
|
|
143
|
+
* P230.05 (REQ-01/REQ-04): verify one story-worktree integration commit with
|
|
144
|
+
* the integrator's pre-fast-forward authority, before any effect on
|
|
145
|
+
* `epic/<ID>` or the remote. Pure: reads Git objects and private plans only.
|
|
146
|
+
*/
|
|
147
|
+
export declare function verifyDirectYoloIntegrationCommit(authority: DirectYoloCommitAuthority, storyId: string, headSha: string, options?: {
|
|
148
|
+
readonly expectedGraphRevision?: string;
|
|
149
|
+
}): Promise<DirectYoloCheckpointResult<DirectYoloVerifiedCommit>>;
|
|
116
150
|
export declare function recoverLegacyDirectYoloStoryCheckpoint(options: DirectYoloCheckpointOptions & {
|
|
117
151
|
readonly commitSha: string;
|
|
118
152
|
}): Promise<DirectYoloCheckpointResult<StoryCommitCheckpoint>>;
|
|
153
|
+
type LogicalAuthority = Awaited<ReturnType<typeof resolveLogicalAuthority>>;
|
|
119
154
|
/**
|
|
120
155
|
* P225.07 root integration authority: the same logical authority as direct
|
|
121
156
|
* C08, required from the root checkout on the execution branch.
|
|
@@ -219,7 +254,23 @@ export declare function persistDirectYoloWaveStoryCheckpoint(input: {
|
|
|
219
254
|
};
|
|
220
255
|
readonly remote?: string;
|
|
221
256
|
readonly nowIso?: string;
|
|
257
|
+
/** P230.05 (REQ-03): the integrator's pre-fast-forward write-set (claim binding). */
|
|
258
|
+
readonly authorizedWriteSet?: readonly string[];
|
|
259
|
+
/** P230.05 (REQ-04): the graph revision this commit was verified against before any effect. */
|
|
260
|
+
readonly expectedGraphRevision?: string;
|
|
222
261
|
}): Promise<DirectYoloCheckpointResult<StoryCommitCheckpoint>>;
|
|
262
|
+
declare function resolveLogicalAuthority(projectRootInput: string, storyId: string): Promise<{
|
|
263
|
+
projectRoot: string;
|
|
264
|
+
storyId: string;
|
|
265
|
+
story: Record<string, unknown>;
|
|
266
|
+
epicId: string;
|
|
267
|
+
executionBranch: string;
|
|
268
|
+
originBranch: string;
|
|
269
|
+
graphRevision: string;
|
|
270
|
+
authorizedWriteSet: readonly string[];
|
|
271
|
+
rootMemoryEffect: import("../private-execution/shared-root-memory-types.js").RootProjectMemoryEffect | undefined;
|
|
272
|
+
governanceMode: GovernanceMode;
|
|
273
|
+
}>;
|
|
223
274
|
/**
|
|
224
275
|
* P228.26 (DEC-04): capture the local governance of a story into the runtime
|
|
225
276
|
* store from the root checkout. `tracked` projects keep governance in Git and
|