@claudexor/delivery 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 joi-lab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # @claudexor/delivery
2
+
3
+ Internal package of [Claudexor](https://github.com/razzant/claudexor) — Apply a WorkProduct patch: dry-run / apply / branch / commit / pr.
4
+
5
+ Published as part of the Claudexor toolchain; it follows the monorepo's
6
+ lockstep version and has no separate semver contract. Use the `claudexor`
7
+ CLI (or `@claudexor/cli`) as the supported entry point.
package/dist/gate.d.ts ADDED
@@ -0,0 +1,38 @@
1
+ import type { ApplyEligibility, DecisionRecord, WorkProduct } from "@claudexor/schema";
2
+ /**
3
+ * Single owner of the apply gate (CLAUDEXOR_BIBLE §11): apply is allowed only
4
+ * for successful runs with a successful decision record and a patch
5
+ * WorkProduct bound (by hash) to the original verified repo root. Both
6
+ * surfaces (CLI `claudexor apply` and the Control API apply endpoints) MUST
7
+ * call this instead of re-implementing the policy.
8
+ */
9
+ export interface ApplyGateInput {
10
+ /** Daemon job state when known; the artifact-only CLI path passes null. */
11
+ state?: string | null;
12
+ decision: DecisionRecord | null;
13
+ workProduct: WorkProduct | null;
14
+ patch: string;
15
+ /** Repo root recorded by the run (contract/params); null when unknown. */
16
+ originalRepoRoot: string | null;
17
+ /** Repo the caller wants to apply into. */
18
+ targetRepoRoot: string;
19
+ /**
20
+ * A persisted, auditable operator decision (arbitration/operator_decision.yaml)
21
+ * that explicitly accepts the blocking risk for THIS patch. The override is
22
+ * valid only when its recorded patch hash matches the artifact — a typed,
23
+ * server-owned unblock, never client-faked state.
24
+ */
25
+ operatorDecision?: {
26
+ action: string;
27
+ patch_sha256?: string;
28
+ } | null;
29
+ }
30
+ export declare function validateApplyGate(input: ApplyGateInput): string | null;
31
+ /**
32
+ * Derived ApplyEligibility (the ONE producer): runs the same gate the apply
33
+ * endpoints enforce and projects a typed verdict for surfaces (GET /runs/:id,
34
+ * MCP structured results, CLI --json) — {eligible, state, reason,
35
+ * requiredAction} instead of every consumer re-implying eligibility.
36
+ */
37
+ export declare function deriveApplyEligibility(input: ApplyGateInput): ApplyEligibility;
38
+ //# sourceMappingURL=gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../src/gate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKvF;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;IAChC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,2CAA2C;IAC3C,cAAc,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACrE;AAuBD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,CA8DtE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,GAAG,gBAAgB,CAY9E"}
package/dist/gate.js ADDED
@@ -0,0 +1,128 @@
1
+ import { realpathSync } from "node:fs";
2
+ import { parseUnifiedDiff } from "@claudexor/core";
3
+ import { pathGuard } from "@claudexor/policy";
4
+ import { sha256 } from "@claudexor/util";
5
+ /**
6
+ * Honest, state-specific guidance for why a run is not applyable and what
7
+ * actually unblocks it. The operator risk override (accept_risk /
8
+ * override_needs_human) unblocks ONLY a `blocked` run (CLAUDEXOR_BIBLE §11) — so
9
+ * never point an operator at a decision the daemon will refuse for this state
10
+ * (a fixed contradiction: apply used to suggest accept_risk for ungated runs).
11
+ */
12
+ function applyHint(state) {
13
+ switch (state) {
14
+ case "blocked":
15
+ return "an operator accept_risk/override_needs_human decision (POST /runs/:id/decision) can unblock apply for this patch";
16
+ case "ungated":
17
+ case "review_not_run":
18
+ return "not verified-applyable — add a --test gate or obtain a clean cross-family review, then re-run (risk overrides apply only to blocked runs)";
19
+ case "no_op":
20
+ return "the run made no changes; nothing to apply";
21
+ default:
22
+ return "re-run to reach a successful, verified outcome";
23
+ }
24
+ }
25
+ export function validateApplyGate(input) {
26
+ // An operator risk override is meaningful ONLY on a BLOCKED run (INV-111,
27
+ // Bible §11): the decision endpoint records decisions exclusively for
28
+ // blocked runs, so a succeeded-state override is an unreachable combination
29
+ // this gate must not honor either. Blocked evidence: the caller-known run
30
+ // state, or — on the artifact-only CLI path where live state is unknown —
31
+ // the persisted decision verdict (the orchestrator overrides decision.yaml
32
+ // to `blocked` whenever the run terminal is blocked).
33
+ const blockedEvidence = input.state === "blocked" || (input.state == null && input.decision?.status === "blocked");
34
+ const override = blockedEvidence &&
35
+ input.operatorDecision &&
36
+ (input.operatorDecision.action === "accept_risk" || input.operatorDecision.action === "override_needs_human") &&
37
+ typeof input.operatorDecision.patch_sha256 === "string" &&
38
+ input.operatorDecision.patch_sha256 === sha256(input.patch);
39
+ if (input.state && input.state !== "succeeded" && !override) {
40
+ return `run is not applyable while state is ${input.state}; ${applyHint(input.state)}`;
41
+ }
42
+ if (!input.decision)
43
+ return "decision record is required before apply";
44
+ if (input.decision.status !== "success" && !override) {
45
+ return `decision status is ${input.decision.status}; refusing apply (${applyHint(input.decision.status)})`;
46
+ }
47
+ // FinalVerifier consumer (INV-115): a patch that FAILED to apply onto a
48
+ // fresh tree at its own base is factually undeliverable — no operator
49
+ // override can change that. Failed verify GATES may be overridden through
50
+ // the same accept_risk path as any blocked run.
51
+ const fv = input.decision.final_verify;
52
+ if (fv?.attempted) {
53
+ if (fv.applied_cleanly === false) {
54
+ return `final verify: the patch did not apply onto a fresh tree at its base (${fv.reason ?? "conflict"}); re-run the task`;
55
+ }
56
+ // FAIL CLOSED (INV-115): null means the verifier ERRORED — the patch was
57
+ // never proven against a clean base. Unlike a proven conflict this is an
58
+ // infra failure, so accept_risk may override it.
59
+ if (fv.applied_cleanly === null && !override) {
60
+ return `final verify: the verifier errored before proving the patch against a clean base (${fv.reason ?? "verify infrastructure error"}); refusing apply (an operator accept_risk decision can override)`;
61
+ }
62
+ if (fv.gates_passed === false && !override) {
63
+ return "final verify: deterministic gates failed on the fresh verify tree; refusing apply (an operator accept_risk decision can override)";
64
+ }
65
+ }
66
+ if (!input.workProduct)
67
+ return "work product is required before apply";
68
+ if (input.workProduct.kind !== "patch")
69
+ return `work product kind ${input.workProduct.kind} is not applyable as a patch`;
70
+ const recorded = input.workProduct.meta?.["patch_sha256"];
71
+ if (typeof recorded !== "string" || recorded.length === 0)
72
+ return "work product patch hash is required before apply";
73
+ if (recorded !== sha256(input.patch))
74
+ return "patch artifact hash does not match the reviewed work product";
75
+ if (!input.originalRepoRoot)
76
+ return "run original project is unknown; refusing apply";
77
+ try {
78
+ if (realpathSync(input.originalRepoRoot) !== realpathSync(input.targetRepoRoot)) {
79
+ return "target repo does not match the run's original project; refusing apply";
80
+ }
81
+ }
82
+ catch {
83
+ return "run original project cannot be verified; refusing apply";
84
+ }
85
+ // Workspace confinement (defense-in-depth on top of `git apply`): every
86
+ // patched path must resolve INSIDE the target repo root.
87
+ for (const path of patchPaths(input.patch)) {
88
+ const guard = pathGuard(input.targetRepoRoot, path);
89
+ if (!guard.allowed)
90
+ return `patch path escapes the target repo: ${guard.reason}`;
91
+ }
92
+ return null;
93
+ }
94
+ /**
95
+ * Derived ApplyEligibility (the ONE producer): runs the same gate the apply
96
+ * endpoints enforce and projects a typed verdict for surfaces (GET /runs/:id,
97
+ * MCP structured results, CLI --json) — {eligible, state, reason,
98
+ * requiredAction} instead of every consumer re-implying eligibility.
99
+ */
100
+ export function deriveApplyEligibility(input) {
101
+ const reason = validateApplyGate(input);
102
+ const state = input.state ?? input.decision?.status ?? null;
103
+ if (reason === null) {
104
+ return { eligible: true, state, reason: null, requiredAction: null };
105
+ }
106
+ return {
107
+ eligible: false,
108
+ state,
109
+ reason,
110
+ requiredAction: applyHint(state ?? ""),
111
+ };
112
+ }
113
+ /** Paths touched by a unified git diff (both old and new sides, excluding /dev/null). */
114
+ function patchPaths(patch) {
115
+ // Shared structural parser: header lines are honored only in
116
+ // header position, so removed CONTENT starting with `-- ` (SQL comments)
117
+ // can never masquerade as a path and false-refuse the apply; quoted
118
+ // non-ASCII paths are C-unquoted to their real on-disk form.
119
+ const paths = new Set();
120
+ for (const f of parseUnifiedDiff(patch).files) {
121
+ if (f.oldPath)
122
+ paths.add(f.oldPath);
123
+ if (f.newPath)
124
+ paths.add(f.newPath);
125
+ }
126
+ return [...paths];
127
+ }
128
+ //# sourceMappingURL=gate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gate.js","sourceRoot":"","sources":["../src/gate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AA4BzC;;;;;;GAMG;AACH,SAAS,SAAS,CAAC,KAAa;IAC9B,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,SAAS;YACZ,OAAO,kHAAkH,CAAC;QAC5H,KAAK,SAAS,CAAC;QACf,KAAK,gBAAgB;YACnB,OAAO,2IAA2I,CAAC;QACrJ,KAAK,OAAO;YACV,OAAO,2CAA2C,CAAC;QACrD;YACE,OAAO,gDAAgD,CAAC;IAC5D,CAAC;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAqB;IACrD,0EAA0E;IAC1E,sEAAsE;IACtE,4EAA4E;IAC5E,0EAA0E;IAC1E,0EAA0E;IAC1E,2EAA2E;IAC3E,sDAAsD;IACtD,MAAM,eAAe,GACnB,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,QAAQ,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC;IAC7F,MAAM,QAAQ,GACZ,eAAe;QACf,KAAK,CAAC,gBAAgB;QACtB,CAAC,KAAK,CAAC,gBAAgB,CAAC,MAAM,KAAK,aAAa,IAAI,KAAK,CAAC,gBAAgB,CAAC,MAAM,KAAK,sBAAsB,CAAC;QAC7G,OAAO,KAAK,CAAC,gBAAgB,CAAC,YAAY,KAAK,QAAQ;QACvD,KAAK,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AI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;IACvE,CAAC;IACD,OAAO;QACL,QAAQ,EAAE,KAAK;QACf,KAAK;QACL,MAAM;QACN,cAAc,EAAE,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC;KACvC,CAAC;AACJ,CAAC;AAED,yFAAyF;AACzF,SAAS,UAAU,CAAC,KAAa;IAC/B,6DAA6D;IAC7D,yEAAyE;IACzE,oEAAoE;IACpE,6DAA6D;IAC7D,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,KAAK,MAAM,CAAC,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC;QAC9C,IAAI,CAAC,CAAC,OAAO;YAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,CAAC,OAAO;YAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;AACpB,CAAC"}
@@ -0,0 +1,37 @@
1
+ export * from "./gate.js";
2
+ export { revertWorkingTreeTo as revertInPlace, type RevertResult } from "@claudexor/workspace";
3
+ export interface ApplyResult {
4
+ ok: boolean;
5
+ code: number | null;
6
+ stderr: string;
7
+ }
8
+ /** Dry-run: does this patch apply cleanly? (git apply --check) */
9
+ export declare function checkPatch(repoRoot: string, patch: string): Promise<ApplyResult>;
10
+ export type DeliverMode = "artifact_only" | "apply" | "branch" | "commit" | "pr";
11
+ export declare const DELIVER_MODES: Set<DeliverMode>;
12
+ export interface DeliverOptions {
13
+ mode: DeliverMode;
14
+ branch?: string;
15
+ message?: string;
16
+ prBodyFile?: string;
17
+ }
18
+ export interface DeliverResult {
19
+ mode: DeliverMode;
20
+ applied: boolean;
21
+ branch?: string;
22
+ commit?: string;
23
+ prUrl?: string;
24
+ detail?: string;
25
+ /** True when a FAILED delivery left the tree mutated (restore failed);
26
+ * `applied:false, treeMutated:false` guarantees the tree is untouched. */
27
+ treeMutated?: boolean;
28
+ }
29
+ /**
30
+ * Deliver a WorkProduct patch according to a mutation mode. `pr` requires `gh`
31
+ * and a configured remote. Commit identity is set per-command (no global config
32
+ * mutation). Protected path: `--check` before any mutation, restore
33
+ * on failure (detached-HEAD safe), and HONEST `treeMutated` when a restore
34
+ * itself fails — never a clean-looking result over a conflicted tree.
35
+ */
36
+ export declare function deliver(repoRoot: string, patch: string, opts: DeliverOptions): Promise<DeliverResult>;
37
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,cAAc,WAAW,CAAC;AAK1B,OAAO,EAAE,mBAAmB,IAAI,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAO/F,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,kEAAkE;AAClE,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAGtF;AAGD,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,IAAI,CAAC;AACjF,eAAO,MAAM,aAAa,kBAA6E,CAAC;AAExG,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;8EAC0E;IAC1E,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAsB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAsH3G"}
package/dist/index.js ADDED
@@ -0,0 +1,151 @@
1
+ import { rmSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { parseUnifiedDiff, runCapture, runCaptureRaw } from "@claudexor/core";
4
+ import { applyPatchProtected, stageAllExcludingArtifacts, statusPorcelainMeaningful } from "@claudexor/workspace";
5
+ import { newId } from "@claudexor/util";
6
+ export * from "./gate.js";
7
+ // Server-owned in-place revert (restore the live tree to a run's pre-turn
8
+ // snapshot, refusing if the tree diverged). Co-located with apply; control-api
9
+ // calls it for the revert_run operator decision.
10
+ export { revertWorkingTreeTo as revertInPlace } from "@claudexor/workspace";
11
+ async function git(repo, args, input) {
12
+ // Raw capture: the patch rides stdin already; stdout may carry diffs too.
13
+ return runCaptureRaw("git", ["-C", repo, ...args], { timeoutMs: 60_000, input });
14
+ }
15
+ /** Dry-run: does this patch apply cleanly? (git apply --check) */
16
+ export async function checkPatch(repoRoot, patch) {
17
+ const r = await git(repoRoot, ["apply", "--check", "-"], patch);
18
+ return { ok: r.code === 0, code: r.code, stderr: r.stderr };
19
+ }
20
+ export const DELIVER_MODES = new Set(["artifact_only", "apply", "branch", "commit", "pr"]);
21
+ /**
22
+ * Deliver a WorkProduct patch according to a mutation mode. `pr` requires `gh`
23
+ * and a configured remote. Commit identity is set per-command (no global config
24
+ * mutation). Protected path: `--check` before any mutation, restore
25
+ * on failure (detached-HEAD safe), and HONEST `treeMutated` when a restore
26
+ * itself fails — never a clean-looking result over a conflicted tree.
27
+ */
28
+ export async function deliver(repoRoot, patch, opts) {
29
+ if (!DELIVER_MODES.has(opts.mode))
30
+ return { mode: "artifact_only", applied: false, detail: `unsupported delivery mode: ${opts.mode}` };
31
+ if (opts.mode === "artifact_only") {
32
+ return { mode: "artifact_only", applied: false, detail: "patch emitted; working tree untouched" };
33
+ }
34
+ // Claudexor's own run/workspace artifacts are not user working-tree state
35
+ // (single owner: workspace artifact-paths — the `:(exclude)` pathspec used
36
+ // here before HARD-ERRORS when the project gitignores `.claudexor`, which
37
+ // Claudexor-initialized repos DO, and it missed `.claudexor-review-evidence`).
38
+ const dirty = await statusPorcelainMeaningful(repoRoot).catch((err) => {
39
+ return err instanceof Error ? err : new Error(String(err));
40
+ });
41
+ if (dirty instanceof Error)
42
+ return { mode: opts.mode, applied: false, detail: `status failed: ${dirty.message}` };
43
+ if (dirty.length > 0)
44
+ return { mode: opts.mode, applied: false, detail: "working tree is dirty; refusing delivery mutation" };
45
+ // Detached-HEAD safe restore point: `--abbrev-ref HEAD` on a detached head
46
+ // yields the literal "HEAD" (useless for checkout-restore); capture the sha.
47
+ const branchName = (await git(repoRoot, ["rev-parse", "--abbrev-ref", "HEAD"])).stdout.trim();
48
+ const headSha = (await git(repoRoot, ["rev-parse", "HEAD"])).stdout.trim();
49
+ const restoreRef = branchName && branchName !== "HEAD" ? branchName : headSha;
50
+ const restoreDetached = !branchName || branchName === "HEAD";
51
+ let branch = opts.branch;
52
+ let onNewBranch = false;
53
+ if (opts.mode === "branch" || opts.mode === "pr") {
54
+ branch = branch ?? `claudexor/${newId("wp")}`;
55
+ const cb = await git(repoRoot, ["checkout", "-b", branch]);
56
+ if (cb.code !== 0)
57
+ return { mode: opts.mode, applied: false, detail: `branch failed: ${cb.stderr.trim()}` };
58
+ onNewBranch = true;
59
+ }
60
+ /** Leave the fresh branch and delete it; report honestly if that fails. */
61
+ const cleanupBranch = async () => {
62
+ if (!onNewBranch || !branch)
63
+ return null;
64
+ const back = restoreDetached
65
+ ? await git(repoRoot, ["checkout", "--detach", restoreRef])
66
+ : await git(repoRoot, ["checkout", restoreRef]);
67
+ if (back.code !== 0)
68
+ return `failed to leave branch ${branch}: ${back.stderr.trim()}`;
69
+ const del = await git(repoRoot, ["branch", "-D", branch]);
70
+ if (del.code !== 0)
71
+ return `failed to delete branch ${branch}: ${del.stderr.trim()}`;
72
+ onNewBranch = false;
73
+ return null;
74
+ };
75
+ const ap = await applyPatchProtected(repoRoot, patch);
76
+ if (!ap.ok) {
77
+ const cleanupIssue = await cleanupBranch();
78
+ return {
79
+ mode: opts.mode,
80
+ applied: false,
81
+ branch,
82
+ treeMutated: ap.treeMutated || cleanupIssue !== null,
83
+ detail: [ap.detail ?? "apply failed", cleanupIssue].filter(Boolean).join("; "),
84
+ };
85
+ }
86
+ if (opts.mode === "apply")
87
+ return { mode: "apply", applied: true };
88
+ /** Post-apply failure: the patch IS in the tree — restore before reporting. */
89
+ const restoreAppliedTree = async (why) => {
90
+ const added = parseUnifiedDiff(patch)
91
+ .files.filter((f) => f.added && f.newPath)
92
+ .map((f) => f.newPath);
93
+ for (const rel of added) {
94
+ try {
95
+ rmSync(join(repoRoot, rel), { force: true });
96
+ }
97
+ catch {
98
+ /* verified below */
99
+ }
100
+ }
101
+ await git(repoRoot, ["reset", "--quiet"]);
102
+ await git(repoRoot, ["checkout", "--", "."]);
103
+ const cleanupIssue = await cleanupBranch();
104
+ const residue = await statusPorcelainMeaningful(repoRoot).catch(() => ["status failed"]);
105
+ const treeMutated = residue.length > 0 || cleanupIssue !== null;
106
+ return {
107
+ mode: opts.mode,
108
+ applied: false,
109
+ branch,
110
+ treeMutated,
111
+ detail: [why, cleanupIssue, treeMutated ? "RESTORE INCOMPLETE — inspect the tree manually" : "tree restored"].filter(Boolean).join("; "),
112
+ };
113
+ };
114
+ try {
115
+ await stageAllExcludingArtifacts(repoRoot);
116
+ }
117
+ catch (err) {
118
+ return restoreAppliedTree(`staging failed: ${err instanceof Error ? err.message : String(err)}`);
119
+ }
120
+ const message = opts.message ?? "claudexor: apply work product";
121
+ const commitRes = await git(repoRoot, [
122
+ "-c",
123
+ "user.email=claudexor@local",
124
+ "-c",
125
+ "user.name=claudexor",
126
+ "commit",
127
+ "-m",
128
+ message,
129
+ ]);
130
+ if (commitRes.code !== 0) {
131
+ return restoreAppliedTree(`commit failed: ${commitRes.stderr.trim()}`);
132
+ }
133
+ const commit = (await git(repoRoot, ["rev-parse", "HEAD"])).stdout.trim();
134
+ if (opts.mode === "commit" || opts.mode === "branch") {
135
+ return { mode: opts.mode, applied: true, branch, commit };
136
+ }
137
+ // pr
138
+ const push = await git(repoRoot, ["push", "-u", "origin", branch]);
139
+ if (push.code !== 0) {
140
+ return { mode: "pr", applied: false, branch, commit, treeMutated: true, detail: `push failed: ${push.stderr.trim()}; the local branch keeps the committed work` };
141
+ }
142
+ const ghArgs = ["pr", "create", "--head", branch, "--title", message];
143
+ if (opts.prBodyFile)
144
+ ghArgs.push("--body-file", opts.prBodyFile);
145
+ else
146
+ ghArgs.push("--body", "Created by Claudexor.");
147
+ const pr = await runCapture("gh", ghArgs, { cwd: repoRoot, timeoutMs: 60_000 }).catch(() => null);
148
+ const prUrl = pr && pr.code === 0 ? pr.stdout.trim() : undefined;
149
+ return { mode: "pr", applied: Boolean(prUrl), branch, commit, prUrl, detail: prUrl ? undefined : "gh pr create unavailable" };
150
+ }
151
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EA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C,IAAI,CAAC,QAAQ,EAAE,uBAAuB,CAAC,CAAC;IACpD,MAAM,EAAE,GAAG,MAAM,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAClG,MAAM,KAAK,GAAG,EAAE,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACjE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,0BAA0B,EAAE,CAAC;AAChI,CAAC"}
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@claudexor/delivery",
3
+ "version": "1.0.1",
4
+ "license": "MIT",
5
+ "description": "Apply a WorkProduct patch: dry-run / apply / branch / commit / pr.",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "dependencies": {
19
+ "@claudexor/core": "1.0.1",
20
+ "@claudexor/util": "1.0.1",
21
+ "@claudexor/policy": "1.0.1",
22
+ "@claudexor/schema": "1.0.1",
23
+ "@claudexor/workspace": "1.0.1"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/razzant/claudexor.git",
28
+ "directory": "packages/delivery"
29
+ },
30
+ "homepage": "https://github.com/razzant/claudexor#readme",
31
+ "bugs": {
32
+ "url": "https://github.com/razzant/claudexor/issues"
33
+ },
34
+ "engines": {
35
+ "node": ">=20.19"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "scripts": {
41
+ "build": "tsc",
42
+ "typecheck": "tsc --noEmit"
43
+ }
44
+ }