@modootoday/pmcp 0.17.3 → 0.18.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/.agents/plugins/marketplace.json +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +60 -0
- package/README.md +29 -24
- package/dist/apply-4IGTXOCQ.js +242 -0
- package/dist/{attachment-tU5FZrgZ.d.ts → attachment-D84OGI6n.d.ts} +1 -1
- package/dist/available-DBSIVVJ6.js +73 -0
- package/dist/broadcast-3RY3OZGY.js +18 -0
- package/dist/chunk-25GHX674.js +1246 -0
- package/dist/chunk-2P4Z2NUX.js +28 -0
- package/dist/chunk-34DECPVC.js +22 -0
- package/dist/chunk-3NYG4SGU.js +45 -0
- package/dist/chunk-3PW4FI7U.js +32 -0
- package/dist/chunk-3Y3HDMHA.js +108 -0
- package/dist/chunk-47O3X4VS.js +113 -0
- package/dist/chunk-4NDEP7HU.js +26 -0
- package/dist/chunk-4VCC2NXE.js +104 -0
- package/dist/chunk-5OMOPUE6.js +39 -0
- package/dist/chunk-5QQWS4US.js +53 -0
- package/dist/chunk-5ZABTVSW.js +48 -0
- package/dist/chunk-65ZHM5RH.js +4985 -0
- package/dist/chunk-665TA55Z.js +419 -0
- package/dist/chunk-6STKGOCW.js +27 -0
- package/dist/chunk-6WXMJOMI.js +9 -0
- package/dist/chunk-73AKO4UL.js +24 -0
- package/dist/chunk-7BLPN3W6.js +31 -0
- package/dist/chunk-7DLZC73N.js +29 -0
- package/dist/chunk-7GBYECSK.js +72 -0
- package/dist/chunk-7TD53M7L.js +13 -0
- package/dist/chunk-A4PKLESO.js +112 -0
- package/dist/chunk-ABTJQ4QV.js +74 -0
- package/dist/chunk-BBTBJCFA.js +380 -0
- package/dist/chunk-BU65MNVU.js +13 -0
- package/dist/chunk-BVCTKPT3.js +83 -0
- package/dist/chunk-C4NHQGHL.js +142 -0
- package/dist/chunk-CJTKR6K6.js +1213 -0
- package/dist/chunk-DCU2EXQV.js +78 -0
- package/dist/chunk-DZ2MRTYT.js +135 -0
- package/dist/chunk-E2YOZ2FF.js +207 -0
- package/dist/chunk-E3DQB5LS.js +48 -0
- package/dist/chunk-E7OOHLQR.js +7 -0
- package/dist/chunk-EATCUWGG.js +66 -0
- package/dist/chunk-EIDIVIAD.js +33 -0
- package/dist/chunk-EJBZGIDK.js +1934 -0
- package/dist/chunk-ELAGZ635.js +252 -0
- package/dist/chunk-GZHHEHKY.js +44 -0
- package/dist/chunk-HDMBVLCZ.js +53 -0
- package/dist/chunk-HQOB7OQS.js +81 -0
- package/dist/chunk-IGYRMM62.js +28 -0
- package/dist/chunk-IJBSOWHK.js +86 -0
- package/dist/chunk-INT7QLEU.js +114 -0
- package/dist/chunk-J6QLLQVL.js +1025 -0
- package/dist/chunk-J7UYNJCR.js +9 -0
- package/dist/chunk-JEL35P7S.js +53 -0
- package/dist/chunk-JGJ4INEN.js +32 -0
- package/dist/chunk-JS5RTH4I.js +84 -0
- package/dist/chunk-JUXNIXN4.js +42 -0
- package/dist/chunk-JWRZDYB5.js +59 -0
- package/dist/chunk-KMXRRSKT.js +660 -0
- package/dist/chunk-LAZQBMAU.js +67 -0
- package/dist/chunk-LLBPVZXM.js +67 -0
- package/dist/chunk-LLT5FQBE.js +57 -0
- package/dist/chunk-LMT3PPXJ.js +17 -0
- package/dist/chunk-MM2Y43LC.js +87 -0
- package/dist/chunk-MPSQXSC6.js +346 -0
- package/dist/chunk-MVFH26QT.js +97 -0
- package/dist/chunk-MWFOUBFC.js +39 -0
- package/dist/chunk-N5AQ3PP7.js +211 -0
- package/dist/chunk-NQPURJT5.js +44 -0
- package/dist/chunk-NRBQK6UX.js +105 -0
- package/dist/chunk-NZS5CD72.js +333 -0
- package/dist/chunk-OEH47H6A.js +48 -0
- package/dist/chunk-OG7QR2DP.js +75 -0
- package/dist/chunk-OPYFEHKG.js +52 -0
- package/dist/chunk-P4N7DBD5.js +83 -0
- package/dist/chunk-PAX3QXX2.js +140 -0
- package/dist/chunk-PLX3BOOS.js +396 -0
- package/dist/chunk-PMJG2CXF.js +122 -0
- package/dist/chunk-PWSJJXLQ.js +643 -0
- package/dist/chunk-Q5H3L6Y4.js +23 -0
- package/dist/chunk-Q65R3XKX.js +155 -0
- package/dist/chunk-QEW4J3IZ.js +74 -0
- package/dist/chunk-QPL7E2HW.js +464 -0
- package/dist/chunk-R2GPCZUX.js +22 -0
- package/dist/chunk-R4L6LJJ2.js +778 -0
- package/dist/chunk-R5MT42JS.js +284 -0
- package/dist/chunk-RK4PYD7L.js +73 -0
- package/dist/chunk-RMATE45Z.js +197 -0
- package/dist/chunk-S3PIAMXV.js +230 -0
- package/dist/chunk-SG5TPMKH.js +93 -0
- package/dist/chunk-T3LKX23M.js +168 -0
- package/dist/chunk-T6GOWHK6.js +30 -0
- package/dist/chunk-TIA4SPU2.js +10 -0
- package/dist/chunk-TNCZ6444.js +57 -0
- package/dist/chunk-TVL5RTE6.js +269 -0
- package/dist/chunk-UOCLRM7P.js +151 -0
- package/dist/chunk-UPQTAHUK.js +189 -0
- package/dist/chunk-V4NPDK6X.js +14 -0
- package/dist/chunk-VJFEN6DJ.js +38 -0
- package/dist/chunk-WIW772I3.js +25 -0
- package/dist/chunk-XELAZAIM.js +136 -0
- package/dist/chunk-XNML2KIC.js +23 -0
- package/dist/chunk-XP2U3LO3.js +30 -0
- package/dist/chunk-YGOWIJPE.js +51 -0
- package/dist/chunk-YIXDHQYE.js +11 -0
- package/dist/chunk-YMHUM7AV.js +22 -0
- package/dist/chunk-YSAWTGNA.js +117 -0
- package/dist/chunk-Z4HRRXRF.js +478 -0
- package/dist/chunk-ZH6R642Z.js +102 -0
- package/dist/claude-U2JC2DNQ.js +77 -0
- package/dist/cli-VYCQJZ5X.js +41 -0
- package/dist/cli-ZTCBSDW4.js +46 -0
- package/dist/cli.js +144 -16160
- package/dist/completion-E7RRG3ZT.js +142 -0
- package/dist/config-DnpLL2kT.d.ts +46 -0
- package/dist/{service-qpCsOXkQ.d.ts → core-C1LPjxK6.d.ts} +2 -6
- package/dist/diagnostics-XXH4FLUG.js +93 -0
- package/dist/doctor-ZIOESU3N.js +538 -0
- package/dist/entry-ZNFCTDVE.js +305 -0
- package/dist/exec-mcp-X6372BLE.js +365 -0
- package/dist/harness-F2XFDYXF.js +177 -0
- package/dist/harness-egress-bridge.js +4 -4
- package/dist/harness-launch-gate.js +47 -940
- package/dist/harness-pane-runner.js +13 -80
- package/dist/harness-worker.js +21 -2703
- package/dist/hook-body.js +5221 -0
- package/dist/hook-spec-C5fWTSCH.d.ts +100 -0
- package/dist/hook.js +26 -0
- package/dist/hooks-FYE2L5RW.js +21 -0
- package/dist/host-GRY3VAHH.js +22 -0
- package/dist/host-X6BR6X4O.js +200 -0
- package/dist/host-run-GCA6H6SR.js +307 -0
- package/dist/http.d.ts +5 -42
- package/dist/http.js +21 -2234
- package/dist/import-mcp-2TTBPVLY.js +400 -0
- package/dist/index.d.ts +146 -168
- package/dist/index.js +133 -4911
- package/dist/init-627KFXTG.js +14 -0
- package/dist/install-GG7HHZK2.js +796 -0
- package/dist/invoke-LW22Z6ET.js +23 -0
- package/dist/list-MCP2FXUF.js +68 -0
- package/dist/list-NGMSQ5SH.js +65 -0
- package/dist/load-BEUBABtB.d.ts +21 -0
- package/dist/logout-6CSHUWWE.js +44 -0
- package/dist/logs-SPB6AANY.js +107 -0
- package/dist/mailbox/index.d.ts +10 -5
- package/dist/mailbox/index.js +53 -1572
- package/dist/mailbox-7BV54Q4R.js +285 -0
- package/dist/mailbox-GDJ7BWQN.js +189 -0
- package/dist/mainline-JQTTYJMI.js +639 -0
- package/dist/marketplace-G4VQET5W.js +191 -0
- package/dist/mcp-2DKVU3SW.js +15 -0
- package/dist/mcp-V23HC3LB.js +193 -0
- package/dist/models-ISU4DCMA.js +32 -0
- package/dist/opencode-CN7JLQYO.js +60 -0
- package/dist/pause-FFAYRBWI.js +18 -0
- package/dist/preview-DT7DWG5F.js +91 -0
- package/dist/project/hook-adapter.d.ts +6 -3
- package/dist/project/hook-adapter.js +66 -35
- package/dist/project-FY62G55N.js +70 -0
- package/dist/pty-XTJ4MIWK.js +94 -0
- package/dist/recovery-U6QB3PMT.js +100 -0
- package/dist/reindex-Y27QJFDB.js +22 -0
- package/dist/resume-UU4HZIUP.js +18 -0
- package/dist/run-HALGEJNJ.js +19 -0
- package/dist/run-OGA3P7FC.js +126 -0
- package/dist/serve-NBKT5BKY.js +104 -0
- package/dist/session-XM2CR425.js +159 -0
- package/dist/setup-DTKZLZUT.js +18 -0
- package/dist/start-login-UIQYQBMC.js +416 -0
- package/dist/status-A2OUTNGK.js +9 -0
- package/dist/status-H2VAHIDV.js +10 -0
- package/dist/status-NOOHW5WA.js +43 -0
- package/dist/status-VHODZPXB.js +55 -0
- package/dist/status-XQANBVXW.js +286 -0
- package/dist/stdio.d.ts +3 -13
- package/dist/stdio.js +16 -3186
- package/dist/sweep-64JDCGK6.js +18 -0
- package/dist/test-MKAXFJOL.js +561 -0
- package/dist/tools-gpHNq9Dh.d.ts +328 -0
- package/dist/tui-MWKAXE4K.js +153 -0
- package/dist/unbroadcast-KPUEFLZD.js +18 -0
- package/dist/validate-5GZ5YWNA.js +46 -0
- package/dist/worker-RQ575EJL.js +80 -0
- package/dist/worktree-create-PZSRB7PH.js +89 -0
- package/dist/worktree-list-JYB6VXLW.js +51 -0
- package/dist/worktree-sync-UF5CXPWV.js +30 -0
- package/docs/hooks/capabilities/antigravity.json +199 -0
- package/docs/hooks/capabilities/claude.json +179 -0
- package/docs/hooks/capabilities/codex.json +179 -0
- package/docs/hooks/capabilities/gemini.json +196 -0
- package/docs/hooks/capabilities/grok.json +192 -0
- package/docs/hooks/capabilities/opencode.json +184 -0
- package/docs/project-configuration.md +844 -4
- package/docs/terminal-harness.md +71 -28
- package/docs/terminal-workspace.md +91 -170
- package/gemini-extension.json +1 -1
- package/package.json +13 -1
- package/plugin.json +1 -1
- package/plugins/pmcp/.claude-plugin/plugin.json +4 -2
- package/plugins/pmcp/gemini-extension.json +1 -1
- package/plugins/pmcp/mod/commands.ts +72 -0
- package/plugins/pmcp/mod/contract.d.ts +39 -0
- package/plugins/pmcp/mod/draw.tsx +216 -0
- package/plugins/pmcp/mod/guard.ts +42 -0
- package/plugins/pmcp/mod/hooks.json +4 -0
- package/plugins/pmcp/mod/host.ts +46 -0
- package/plugins/pmcp/mod/model.ts +144 -0
- package/plugins/pmcp/mod/reader/index.ts +18 -0
- package/plugins/pmcp/mod/reader/read.ts +76 -0
- package/plugins/pmcp/mod/reader/settings.ts +54 -0
- package/plugins/pmcp/mod/reader/types.ts +38 -0
- package/plugins/pmcp/mod/register.tsx +73 -0
- package/plugins/pmcp/mod/sessions/format.ts +91 -0
- package/plugins/pmcp/mod/sessions/types.ts +162 -0
- package/plugins/pmcp/mod/snapshot.ts +75 -0
- package/plugins/pmcp/mod/spinner.tsx +30 -0
- package/plugins/pmcp/mod/state.ts +28 -0
- package/plugins/pmcp/plugin.json +1 -1
- package/plugins/pmcp/skills/agent-assets-migrate/SKILL.md +96 -0
- package/plugins/pmcp/skills/headless-agents-ci-scaffold/SKILL.md +100 -0
- package/plugins/pmcp/skills/marketplace-plugin-scaffold/SKILL.md +87 -0
- package/plugins/pmcp/skills/package-skill-catalog/SKILL.md +51 -11
- package/plugins/pmcp/skills/pmcp-project-init/SKILL.md +145 -0
- package/plugins/pmcp/skills/pmcp-sessions-and-git/SKILL.md +104 -0
- package/plugins/pmcp/skills/skill-package-scaffold/SKILL.md +88 -0
- package/schema/catalog-v1.json +158 -0
- package/schema/library.json +164 -0
- package/schema/marketplace-manifest.json +130 -0
- package/schema/plugin-manifest.json +55 -0
- package/schema/skill-frontmatter.json +144 -0
- package/schema/skill-metadata-core.json +110 -0
- package/skills/agent-assets-migrate/SKILL.md +96 -0
- package/skills/headless-agents-ci-scaffold/SKILL.md +100 -0
- package/skills/marketplace-plugin-scaffold/SKILL.md +87 -0
- package/skills/package-skill-catalog/SKILL.md +51 -11
- package/skills/pmcp-project-init/SKILL.md +145 -0
- package/skills/pmcp-sessions-and-git/SKILL.md +104 -0
- package/skills/skill-package-scaffold/SKILL.md +88 -0
- package/dist/config-BkSpjUG6.d.ts +0 -50
- package/dist/embed-DRROSD3F.d.ts +0 -53
- package/dist/hook-spec-PRSnYGLV.d.ts +0 -10
- package/dist/server-VWSY3Shw.d.ts +0 -543
- package/dist/tui-worker.js +0 -6549
- /package/dist/{tui-worker.d.ts → hook.d.ts} +0 -0
|
@@ -0,0 +1,639 @@
|
|
|
1
|
+
import {
|
|
2
|
+
gateTreePath,
|
|
3
|
+
leaseSpecs
|
|
4
|
+
} from "./chunk-GZHHEHKY.js";
|
|
5
|
+
import {
|
|
6
|
+
off
|
|
7
|
+
} from "./chunk-YIXDHQYE.js";
|
|
8
|
+
import {
|
|
9
|
+
flockAvailable,
|
|
10
|
+
lockFile
|
|
11
|
+
} from "./chunk-DZ2MRTYT.js";
|
|
12
|
+
import "./chunk-S3PIAMXV.js";
|
|
13
|
+
import "./chunk-JS5RTH4I.js";
|
|
14
|
+
import {
|
|
15
|
+
followPins,
|
|
16
|
+
installIfStale
|
|
17
|
+
} from "./chunk-XELAZAIM.js";
|
|
18
|
+
import {
|
|
19
|
+
cherry,
|
|
20
|
+
isAncestor,
|
|
21
|
+
touchedPaths,
|
|
22
|
+
undelivered
|
|
23
|
+
} from "./chunk-QEW4J3IZ.js";
|
|
24
|
+
import {
|
|
25
|
+
git,
|
|
26
|
+
gitOk,
|
|
27
|
+
gitText,
|
|
28
|
+
runCommand
|
|
29
|
+
} from "./chunk-OPYFEHKG.js";
|
|
30
|
+
import {
|
|
31
|
+
createFilesStore
|
|
32
|
+
} from "./chunk-Z4HRRXRF.js";
|
|
33
|
+
import "./chunk-C4NHQGHL.js";
|
|
34
|
+
import "./chunk-OEH47H6A.js";
|
|
35
|
+
import "./chunk-IJBSOWHK.js";
|
|
36
|
+
import "./chunk-QPL7E2HW.js";
|
|
37
|
+
import "./chunk-PMJG2CXF.js";
|
|
38
|
+
|
|
39
|
+
// src/git/mainline/gate.ts
|
|
40
|
+
import { existsSync, mkdirSync, symlinkSync } from "fs";
|
|
41
|
+
import { dirname, join } from "path";
|
|
42
|
+
function gateTree(tree) {
|
|
43
|
+
return { tree, lock: join(dirname(tree), "lock") };
|
|
44
|
+
}
|
|
45
|
+
function submodules(mainRoot, tree) {
|
|
46
|
+
const listed = gitText(tree, ["ls-files", "-s"]).split("\n");
|
|
47
|
+
for (const line of listed) {
|
|
48
|
+
if (!line.startsWith("160000 ")) continue;
|
|
49
|
+
const path = line.split(" ")[1] ?? "";
|
|
50
|
+
const local = join(mainRoot, path);
|
|
51
|
+
if (!path || !existsSync(join(local, ".git"))) continue;
|
|
52
|
+
const pin = gitText(tree, ["rev-parse", `HEAD:${path}`]);
|
|
53
|
+
if (pin && !gitOk(local, ["cat-file", "-e", `${pin}^{commit}`]))
|
|
54
|
+
git(local, ["fetch", "-q", "origin"]);
|
|
55
|
+
const fromLocal = [
|
|
56
|
+
"-c",
|
|
57
|
+
"protocol.file.allow=always",
|
|
58
|
+
"-c",
|
|
59
|
+
`submodule.${path}.url=${local}`
|
|
60
|
+
];
|
|
61
|
+
const update = ["submodule", "update", "--init", "--force", "-q", path];
|
|
62
|
+
if (gitOk(tree, [...fromLocal, ...update])) continue;
|
|
63
|
+
const remote = git(tree, update);
|
|
64
|
+
if (remote.status !== 0)
|
|
65
|
+
return `submodule ${path} failed: ${remote.stderr.trim()}`;
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
function prepareGateTree(mainRoot, tree, tip, links) {
|
|
70
|
+
if (!existsSync(join(tree, ".git"))) {
|
|
71
|
+
git(mainRoot, ["worktree", "prune"]);
|
|
72
|
+
mkdirSync(dirname(tree), { recursive: true });
|
|
73
|
+
const added = git(mainRoot, [
|
|
74
|
+
"worktree",
|
|
75
|
+
"add",
|
|
76
|
+
"-q",
|
|
77
|
+
"--detach",
|
|
78
|
+
tree,
|
|
79
|
+
tip
|
|
80
|
+
]);
|
|
81
|
+
if (added.status !== 0)
|
|
82
|
+
return `gate tree add failed: ${added.stderr.trim()}`;
|
|
83
|
+
}
|
|
84
|
+
if (existsSync(join(tree, ".git"))) {
|
|
85
|
+
const moved = git(tree, ["checkout", "-q", "--detach", "--force", tip]);
|
|
86
|
+
if (moved.status !== 0)
|
|
87
|
+
return `gate tree checkout failed: ${moved.stderr.trim()}`;
|
|
88
|
+
git(tree, ["clean", "-fdq"]);
|
|
89
|
+
}
|
|
90
|
+
const problem = submodules(mainRoot, tree);
|
|
91
|
+
if (problem !== null) return problem;
|
|
92
|
+
for (const name of links) {
|
|
93
|
+
const source = join(mainRoot, name);
|
|
94
|
+
const target = join(tree, name);
|
|
95
|
+
if (existsSync(source) && !existsSync(target)) symlinkSync(source, target);
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
function runGate(mainRoot, tree, tip, command, links, report) {
|
|
100
|
+
const problem = prepareGateTree(mainRoot, tree, tip, links);
|
|
101
|
+
if (problem !== null) {
|
|
102
|
+
report.warn(`the gate did not run: ${problem}`);
|
|
103
|
+
return 1;
|
|
104
|
+
}
|
|
105
|
+
report.info(`gate on ${tip.slice(0, 10)} in ${tree}`);
|
|
106
|
+
return runCommand(command, tree, {
|
|
107
|
+
PMCP_GATE_TIP: tip,
|
|
108
|
+
PMCP_GATE_MAIN: mainRoot
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// src/git/mainline/lock.ts
|
|
113
|
+
import { spawnSync } from "child_process";
|
|
114
|
+
import {
|
|
115
|
+
closeSync,
|
|
116
|
+
mkdirSync as mkdirSync2,
|
|
117
|
+
openSync,
|
|
118
|
+
readFileSync,
|
|
119
|
+
writeFileSync
|
|
120
|
+
} from "fs";
|
|
121
|
+
import { dirname as dirname2, join as join2 } from "path";
|
|
122
|
+
function flock(fd, args) {
|
|
123
|
+
const run = spawnSync("flock", [...args, "3"], {
|
|
124
|
+
stdio: ["ignore", "ignore", "pipe", fd]
|
|
125
|
+
});
|
|
126
|
+
if (run.error !== void 0)
|
|
127
|
+
throw new Error(`flock (util-linux) is required: ${run.error.message}`);
|
|
128
|
+
return run.status ?? 1;
|
|
129
|
+
}
|
|
130
|
+
function acquireHostLock(path, waitSeconds, onWait) {
|
|
131
|
+
mkdirSync2(dirname2(path), { recursive: true });
|
|
132
|
+
if (!flockAvailable()) {
|
|
133
|
+
const now = lockFile(path, 0);
|
|
134
|
+
if (now) return now;
|
|
135
|
+
onWait?.();
|
|
136
|
+
return lockFile(path, waitSeconds * 1e3);
|
|
137
|
+
}
|
|
138
|
+
const fd = openSync(path, "a");
|
|
139
|
+
try {
|
|
140
|
+
if (flock(fd, ["-n"]) !== 0) {
|
|
141
|
+
onWait?.();
|
|
142
|
+
if (flock(fd, ["-w", String(waitSeconds)]) !== 0) {
|
|
143
|
+
closeSync(fd);
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
} catch (error) {
|
|
148
|
+
closeSync(fd);
|
|
149
|
+
throw error;
|
|
150
|
+
}
|
|
151
|
+
let open = true;
|
|
152
|
+
return {
|
|
153
|
+
release: () => {
|
|
154
|
+
if (!open) return;
|
|
155
|
+
open = false;
|
|
156
|
+
closeSync(fd);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function holderFile(lockPath) {
|
|
161
|
+
return join2(dirname2(lockPath), "holder.json");
|
|
162
|
+
}
|
|
163
|
+
function writeHolder(lockPath, holder) {
|
|
164
|
+
const record = {
|
|
165
|
+
...holder,
|
|
166
|
+
pid: process.pid,
|
|
167
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
168
|
+
};
|
|
169
|
+
writeFileSync(holderFile(lockPath), `${JSON.stringify(record)}
|
|
170
|
+
`);
|
|
171
|
+
}
|
|
172
|
+
function readHolder(lockPath) {
|
|
173
|
+
try {
|
|
174
|
+
return JSON.parse(readFileSync(holderFile(lockPath), "utf8"));
|
|
175
|
+
} catch {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// src/git/mainline/lease-wait.ts
|
|
181
|
+
function foreign(store, specs) {
|
|
182
|
+
for (const spec of specs) {
|
|
183
|
+
const lease = store.leases.read(spec.name);
|
|
184
|
+
if (lease !== null && lease.pid !== process.pid)
|
|
185
|
+
return { name: spec.name, lease };
|
|
186
|
+
}
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
function sleep(ms) {
|
|
190
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
191
|
+
}
|
|
192
|
+
function waitForLeases(store, specs, waitSeconds, report, pollMs = 1e3) {
|
|
193
|
+
const deadline = Date.now() + waitSeconds * 1e3;
|
|
194
|
+
let announced = false;
|
|
195
|
+
for (; ; ) {
|
|
196
|
+
const held = foreign(store, specs);
|
|
197
|
+
if (held === null) return null;
|
|
198
|
+
const { name, lease } = held;
|
|
199
|
+
const who = `${lease.subject} (pid ${lease.pid}, since ${lease.since})`;
|
|
200
|
+
if (!announced) {
|
|
201
|
+
report.info(`waiting for lease ${name}: ${who}`);
|
|
202
|
+
announced = true;
|
|
203
|
+
}
|
|
204
|
+
const left = deadline - Date.now();
|
|
205
|
+
if (left <= 0)
|
|
206
|
+
return `lease ${name} is still held after ${waitSeconds}s by ${who}; ask its owner`;
|
|
207
|
+
sleep(Math.min(pollMs, left));
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// src/git/mainline/replay.ts
|
|
212
|
+
import { mkdtempSync, rmdirSync, rmSync } from "fs";
|
|
213
|
+
import { tmpdir } from "os";
|
|
214
|
+
import { join as join3 } from "path";
|
|
215
|
+
function remove(root, dir) {
|
|
216
|
+
const removed = git(root, ["worktree", "remove", "--force", dir]);
|
|
217
|
+
if (removed.status !== 0)
|
|
218
|
+
return `worktree cleanup failed; preserved ${dir}: ${removed.stderr.trim()}`;
|
|
219
|
+
rmSync(dir, { recursive: true, force: true });
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
function pick(dir, commits) {
|
|
223
|
+
const picked = git(dir, [
|
|
224
|
+
"-c",
|
|
225
|
+
"core.hooksPath=/dev/null",
|
|
226
|
+
"cherry-pick",
|
|
227
|
+
...commits
|
|
228
|
+
]);
|
|
229
|
+
if (picked.status === 0) return { tip: gitText(dir, ["rev-parse", "HEAD"]) };
|
|
230
|
+
const conflicted = gitText(dir, ["diff", "--name-only", "--diff-filter=U"]).split("\n").filter(Boolean);
|
|
231
|
+
git(dir, ["cherry-pick", "--abort"]);
|
|
232
|
+
return {
|
|
233
|
+
error: `the replay conflicts with the upstream in ${conflicted.join(", ") || "unknown files"}:
|
|
234
|
+
${picked.stderr.trim()}`
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function replay(root, base, commits) {
|
|
238
|
+
const dir = mkdtempSync(join3(tmpdir(), "pmcp-deliver-"));
|
|
239
|
+
const added = git(root, ["worktree", "add", "-q", "--detach", dir, base]);
|
|
240
|
+
if (added.status !== 0) {
|
|
241
|
+
rmdirSync(dir);
|
|
242
|
+
return { error: `worktree add failed: ${added.stderr.trim()}` };
|
|
243
|
+
}
|
|
244
|
+
const result = pick(dir, commits);
|
|
245
|
+
const cleanup = remove(root, dir);
|
|
246
|
+
if (cleanup === null) return result;
|
|
247
|
+
const prior = "error" in result ? `${result.error}
|
|
248
|
+
` : "";
|
|
249
|
+
return { error: `${prior}${cleanup}` };
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// src/git/mainline/deliver.ts
|
|
253
|
+
function subject(cwd, sha) {
|
|
254
|
+
return gitText(cwd, ["log", "-1", "--format=%s", sha]);
|
|
255
|
+
}
|
|
256
|
+
function fetch(ctx) {
|
|
257
|
+
return git(ctx.root, ["fetch", "-q", ctx.remote, ctx.mainline]).status === 0;
|
|
258
|
+
}
|
|
259
|
+
function attempts(options) {
|
|
260
|
+
const { ctx, report } = options;
|
|
261
|
+
const { lock, tree } = gateTree(options.tree);
|
|
262
|
+
for (let attempt = 1; attempt <= options.deliver.attempts; attempt += 1) {
|
|
263
|
+
if (!fetch(ctx)) {
|
|
264
|
+
report.warn(`fetch from ${ctx.remote} failed`);
|
|
265
|
+
return 2;
|
|
266
|
+
}
|
|
267
|
+
const commits = undelivered(ctx.root, ctx.upstream, options.named);
|
|
268
|
+
if (commits.length === 0) {
|
|
269
|
+
report.info(`nothing that ${ctx.upstream} lacks`);
|
|
270
|
+
return 0;
|
|
271
|
+
}
|
|
272
|
+
const first = commits[0] ?? "";
|
|
273
|
+
writeHolder(lock, {
|
|
274
|
+
tip: first,
|
|
275
|
+
subject: subject(ctx.root, first),
|
|
276
|
+
checkout: ctx.root
|
|
277
|
+
});
|
|
278
|
+
report.info(
|
|
279
|
+
`attempt ${attempt}: replaying ${commits.length} commit(s) onto ${ctx.upstream}`
|
|
280
|
+
);
|
|
281
|
+
const replayed = replay(ctx.root, ctx.upstream, commits);
|
|
282
|
+
if ("error" in replayed) {
|
|
283
|
+
report.warn(replayed.error);
|
|
284
|
+
return 1;
|
|
285
|
+
}
|
|
286
|
+
const command = options.gate?.command;
|
|
287
|
+
if (command !== void 0 && runGate(
|
|
288
|
+
ctx.mainRoot,
|
|
289
|
+
tree,
|
|
290
|
+
replayed.tip,
|
|
291
|
+
command,
|
|
292
|
+
options.links,
|
|
293
|
+
report
|
|
294
|
+
) !== 0) {
|
|
295
|
+
report.warn("the gate failed; nothing was pushed");
|
|
296
|
+
return 1;
|
|
297
|
+
}
|
|
298
|
+
const pushed = git(
|
|
299
|
+
ctx.root,
|
|
300
|
+
["push", ctx.remote, `${replayed.tip}:refs/heads/${ctx.mainline}`],
|
|
301
|
+
{
|
|
302
|
+
PMCP_GIT_DELIVER: "1"
|
|
303
|
+
}
|
|
304
|
+
);
|
|
305
|
+
if (pushed.status === 0) {
|
|
306
|
+
report.info(`delivered ${replayed.tip.slice(0, 10)} to ${ctx.upstream}`);
|
|
307
|
+
return 0;
|
|
308
|
+
}
|
|
309
|
+
fetch(ctx);
|
|
310
|
+
if (isAncestor(ctx.root, ctx.upstream, replayed.tip)) {
|
|
311
|
+
report.warn(
|
|
312
|
+
`the push failed for a reason other than a newer ${ctx.upstream}:
|
|
313
|
+
${pushed.stderr.trim()}`
|
|
314
|
+
);
|
|
315
|
+
return 1;
|
|
316
|
+
}
|
|
317
|
+
report.info(`${ctx.upstream} moved while the gate ran; replaying again`);
|
|
318
|
+
}
|
|
319
|
+
report.warn(
|
|
320
|
+
`${ctx.upstream} kept moving; gave up after ${options.deliver.attempts} attempts`
|
|
321
|
+
);
|
|
322
|
+
return 1;
|
|
323
|
+
}
|
|
324
|
+
function underLock(options) {
|
|
325
|
+
const { lock } = gateTree(options.tree);
|
|
326
|
+
const wait = options.gate?.lockWaitSeconds ?? 5400;
|
|
327
|
+
const held = acquireHostLock(lock, wait, () => {
|
|
328
|
+
const holder = readHolder(lock);
|
|
329
|
+
const who = holder === null ? "another delivery" : `${holder.tip.slice(0, 10)} "${holder.subject}" (pid ${holder.pid})`;
|
|
330
|
+
options.report.info(`waiting for the gate of ${who}`);
|
|
331
|
+
});
|
|
332
|
+
if (held === null) {
|
|
333
|
+
options.report.warn(`the gate lock stayed held for ${wait}s`);
|
|
334
|
+
return 1;
|
|
335
|
+
}
|
|
336
|
+
try {
|
|
337
|
+
return attempts(options);
|
|
338
|
+
} finally {
|
|
339
|
+
held.release();
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
function blocked(options) {
|
|
343
|
+
const pause = options.store.pause.read();
|
|
344
|
+
const pauseAllowed = options.deliver.duringPause === "allow" || options.duringPause === true;
|
|
345
|
+
if (pause !== null && !pauseAllowed)
|
|
346
|
+
return `the sessions are paused (${pause.reason}, since ${pause.since}); deliver after resume, or pass --during-pause if this delivery is the fix`;
|
|
347
|
+
return waitForLeases(
|
|
348
|
+
options.store,
|
|
349
|
+
options.leases,
|
|
350
|
+
options.deliver.leaseWaitSeconds,
|
|
351
|
+
options.report,
|
|
352
|
+
options.leasePollMs
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
function deliver(options) {
|
|
356
|
+
const { ctx, report } = options;
|
|
357
|
+
const refusal2 = blocked(options);
|
|
358
|
+
if (refusal2 !== null) {
|
|
359
|
+
report.warn(refusal2);
|
|
360
|
+
return 1;
|
|
361
|
+
}
|
|
362
|
+
if (!fetch(ctx)) {
|
|
363
|
+
report.warn(`fetch from ${ctx.remote} failed`);
|
|
364
|
+
return 2;
|
|
365
|
+
}
|
|
366
|
+
const commits = undelivered(ctx.root, ctx.upstream, options.named);
|
|
367
|
+
const touched = touchedPaths(ctx.root, commits);
|
|
368
|
+
const leased = options.leases.filter(
|
|
369
|
+
(spec) => spec.paths.some((path) => touched.has(path))
|
|
370
|
+
);
|
|
371
|
+
const last = commits.at(-1) ?? "HEAD";
|
|
372
|
+
const lease = {
|
|
373
|
+
pid: process.pid,
|
|
374
|
+
subject: subject(ctx.root, last),
|
|
375
|
+
cwd: ctx.root,
|
|
376
|
+
since: (/* @__PURE__ */ new Date()).toISOString()
|
|
377
|
+
};
|
|
378
|
+
const taken = [];
|
|
379
|
+
try {
|
|
380
|
+
for (const spec of leased) {
|
|
381
|
+
if (!options.store.leases.take(spec.name, lease)) {
|
|
382
|
+
report.warn(`lease ${spec.name} is held by another session`);
|
|
383
|
+
return 1;
|
|
384
|
+
}
|
|
385
|
+
taken.push(spec.name);
|
|
386
|
+
report.info(`took lease ${spec.name}`);
|
|
387
|
+
}
|
|
388
|
+
const code = underLock(options);
|
|
389
|
+
if (code !== 0) return code;
|
|
390
|
+
options.afterDeliver?.();
|
|
391
|
+
if (options.deliver.notify !== void 0 && commits.length > 0)
|
|
392
|
+
runCommand(options.deliver.notify, ctx.root, {
|
|
393
|
+
PMCP_DELIVERED: gitText(ctx.root, ["rev-parse", ctx.upstream])
|
|
394
|
+
});
|
|
395
|
+
return 0;
|
|
396
|
+
} finally {
|
|
397
|
+
for (const name of taken) options.store.leases.release(name);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// src/git/mainline/store.ts
|
|
402
|
+
function filesSessionGate(stateDir) {
|
|
403
|
+
const store = createFilesStore(stateDir);
|
|
404
|
+
return {
|
|
405
|
+
pause: store.pause,
|
|
406
|
+
leases: {
|
|
407
|
+
read: (name) => store.leases.read(name),
|
|
408
|
+
take: (name, lease) => store.leases.take(name, lease),
|
|
409
|
+
release: (name) => store.leases.release(name)
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// src/git/mainline/sync.ts
|
|
415
|
+
import { existsSync as existsSync3 } from "fs";
|
|
416
|
+
import { join as join5 } from "path";
|
|
417
|
+
|
|
418
|
+
// src/git/mainline/identical-files.ts
|
|
419
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
420
|
+
import {
|
|
421
|
+
closeSync as closeSync2,
|
|
422
|
+
copyFileSync,
|
|
423
|
+
existsSync as existsSync2,
|
|
424
|
+
lstatSync,
|
|
425
|
+
mkdtempSync as mkdtempSync2,
|
|
426
|
+
openSync as openSync2,
|
|
427
|
+
readFileSync as readFileSync2,
|
|
428
|
+
renameSync,
|
|
429
|
+
rmSync as rmSync2
|
|
430
|
+
} from "fs";
|
|
431
|
+
import { join as join4 } from "path";
|
|
432
|
+
var FILE_MODES = /* @__PURE__ */ new Set(["100644", "100755"]);
|
|
433
|
+
function refuse(path) {
|
|
434
|
+
return {
|
|
435
|
+
status: 1,
|
|
436
|
+
stdout: "",
|
|
437
|
+
stderr: `untracked file differs from the target: ${path}
|
|
438
|
+
`
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
function identical(cwd, path, mode, oid) {
|
|
442
|
+
if (!FILE_MODES.has(mode)) return false;
|
|
443
|
+
let current = cwd;
|
|
444
|
+
for (const segment of path.split("/")) {
|
|
445
|
+
current = join4(current, segment);
|
|
446
|
+
if (lstatSync(current).isSymbolicLink()) return false;
|
|
447
|
+
}
|
|
448
|
+
const stat = lstatSync(current);
|
|
449
|
+
if (!stat.isFile()) return false;
|
|
450
|
+
if (Boolean(stat.mode & 73) !== (mode === "100755")) return false;
|
|
451
|
+
const blob = spawnSync2("git", ["cat-file", "blob", oid], { cwd });
|
|
452
|
+
return blob.status === 0 && readFileSync2(current).equals(blob.stdout);
|
|
453
|
+
}
|
|
454
|
+
function adopt(cwd, target, env) {
|
|
455
|
+
const incoming = git(cwd, ["ls-tree", "-rz", "--full-tree", target], env);
|
|
456
|
+
const tracked = git(cwd, ["ls-tree", "-rz", "--name-only", "HEAD"], env);
|
|
457
|
+
const indexed = git(cwd, ["ls-files", "--cached", "-z"], env);
|
|
458
|
+
for (const run of [incoming, tracked, indexed]) {
|
|
459
|
+
if (run.status !== 0) return run;
|
|
460
|
+
}
|
|
461
|
+
const existing = /* @__PURE__ */ new Set([
|
|
462
|
+
...tracked.stdout.split("\0"),
|
|
463
|
+
...indexed.stdout.split("\0")
|
|
464
|
+
]);
|
|
465
|
+
for (const entry of incoming.stdout.split("\0")) {
|
|
466
|
+
const match = /^(\d+) \w+ ([0-9a-f]+)\t([\s\S]+)$/u.exec(entry);
|
|
467
|
+
if (!match) continue;
|
|
468
|
+
const [, mode = "", oid = "", path = ""] = match;
|
|
469
|
+
if (existing.has(path)) continue;
|
|
470
|
+
if (!lstatSync(join4(cwd, path), { throwIfNoEntry: false })) continue;
|
|
471
|
+
if (!identical(cwd, path, mode, oid)) return refuse(path);
|
|
472
|
+
const added = git(
|
|
473
|
+
cwd,
|
|
474
|
+
["update-index", "--add", "--cacheinfo", `${mode},${oid},${path}`],
|
|
475
|
+
env
|
|
476
|
+
);
|
|
477
|
+
if (added.status !== 0) return added;
|
|
478
|
+
}
|
|
479
|
+
return null;
|
|
480
|
+
}
|
|
481
|
+
function resetKeepingIdenticalFiles(cwd, target) {
|
|
482
|
+
const located = git(cwd, [
|
|
483
|
+
"rev-parse",
|
|
484
|
+
"--path-format=absolute",
|
|
485
|
+
"--git-path",
|
|
486
|
+
"index"
|
|
487
|
+
]);
|
|
488
|
+
if (located.status !== 0) return located;
|
|
489
|
+
const index = located.stdout.trim();
|
|
490
|
+
const lock = `${index}.lock`;
|
|
491
|
+
let fd;
|
|
492
|
+
let temporary;
|
|
493
|
+
let movedHead = false;
|
|
494
|
+
try {
|
|
495
|
+
fd = openSync2(lock, "wx");
|
|
496
|
+
temporary = mkdtempSync2(`${index}.sync-`);
|
|
497
|
+
const scratch = join4(temporary, "index");
|
|
498
|
+
copyFileSync(index, scratch);
|
|
499
|
+
const env = { GIT_INDEX_FILE: scratch };
|
|
500
|
+
const refused = adopt(cwd, target, env);
|
|
501
|
+
if (refused !== null) return refused;
|
|
502
|
+
const moved = git(cwd, ["reset", "--keep", target], env);
|
|
503
|
+
if (moved.status !== 0) return moved;
|
|
504
|
+
movedHead = true;
|
|
505
|
+
copyFileSync(scratch, lock);
|
|
506
|
+
closeSync2(fd);
|
|
507
|
+
fd = void 0;
|
|
508
|
+
renameSync(lock, index);
|
|
509
|
+
rmSync2(temporary, { recursive: true, force: true });
|
|
510
|
+
return moved;
|
|
511
|
+
} catch (error) {
|
|
512
|
+
const recovery = movedHead ? `; HEAD moved, recovery index kept at ${temporary}/index` : "";
|
|
513
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
514
|
+
return { status: 1, stdout: "", stderr: `${reason}${recovery}
|
|
515
|
+
` };
|
|
516
|
+
} finally {
|
|
517
|
+
if (fd !== void 0) closeSync2(fd);
|
|
518
|
+
if (temporary !== void 0 && !movedHead)
|
|
519
|
+
rmSync2(temporary, { recursive: true, force: true });
|
|
520
|
+
if (fd !== void 0 && !movedHead && existsSync2(lock)) rmSync2(lock);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// src/git/mainline/sync.ts
|
|
525
|
+
var IN_PROGRESS = [
|
|
526
|
+
"index.lock",
|
|
527
|
+
"MERGE_HEAD",
|
|
528
|
+
"rebase-merge",
|
|
529
|
+
"rebase-apply",
|
|
530
|
+
"CHERRY_PICK_HEAD",
|
|
531
|
+
"REVERT_HEAD",
|
|
532
|
+
"BISECT_LOG"
|
|
533
|
+
];
|
|
534
|
+
function refusal(ctx) {
|
|
535
|
+
if (ctx.linked)
|
|
536
|
+
return "this is a linked worktree; sync moves only the main checkout";
|
|
537
|
+
const branch = gitText(ctx.root, ["symbolic-ref", "--short", "-q", "HEAD"]);
|
|
538
|
+
if (branch !== ctx.mainline)
|
|
539
|
+
return `the main checkout is on ${branch || "a detached HEAD"}, not ${ctx.mainline}`;
|
|
540
|
+
for (const marker of IN_PROGRESS) {
|
|
541
|
+
if (existsSync3(join5(ctx.gitDir, marker)))
|
|
542
|
+
return `${marker} is present; another git command is running or unfinished`;
|
|
543
|
+
}
|
|
544
|
+
return null;
|
|
545
|
+
}
|
|
546
|
+
function install(options) {
|
|
547
|
+
const { ctx, sync, report } = options;
|
|
548
|
+
if (sync.install === void 0 || sync.installWhenChanged.length === 0)
|
|
549
|
+
return 0;
|
|
550
|
+
const spec = {
|
|
551
|
+
command: sync.install,
|
|
552
|
+
when: sync.installWhenChanged,
|
|
553
|
+
stateDir: options.stateDir
|
|
554
|
+
};
|
|
555
|
+
const status = installIfStale(ctx.root, spec, report);
|
|
556
|
+
if (status === null || status === 0) return 0;
|
|
557
|
+
return 1;
|
|
558
|
+
}
|
|
559
|
+
function syncMainline(options) {
|
|
560
|
+
const { ctx, sync, report } = options;
|
|
561
|
+
const blocked2 = refusal(ctx);
|
|
562
|
+
if (blocked2 !== null) {
|
|
563
|
+
report.warn(blocked2);
|
|
564
|
+
return 2;
|
|
565
|
+
}
|
|
566
|
+
if (git(ctx.root, ["fetch", "-q", ctx.remote, ctx.mainline]).status !== 0) {
|
|
567
|
+
report.warn(`fetch from ${ctx.remote} failed`);
|
|
568
|
+
return 2;
|
|
569
|
+
}
|
|
570
|
+
const { carried, missing } = cherry(ctx.root, ctx.upstream);
|
|
571
|
+
if (missing.length > 0) {
|
|
572
|
+
const listed = missing.map((line) => ` ${line}`).join("\n");
|
|
573
|
+
report.warn(
|
|
574
|
+
`${ctx.mainline} carries ${missing.length} commit(s) ${ctx.upstream} lacks; deliver or move them first:
|
|
575
|
+
${listed}`
|
|
576
|
+
);
|
|
577
|
+
return sync.refuseWithUnlanded ? 1 : 0;
|
|
578
|
+
}
|
|
579
|
+
const head = gitText(ctx.root, ["rev-parse", "HEAD"]);
|
|
580
|
+
const target = gitText(ctx.root, ["rev-parse", ctx.upstream]);
|
|
581
|
+
if (head === target) {
|
|
582
|
+
report.info(`${ctx.mainline} already equals ${ctx.upstream}`);
|
|
583
|
+
return install(options);
|
|
584
|
+
}
|
|
585
|
+
const moved = sync.keepIdenticalFiles ? resetKeepingIdenticalFiles(ctx.root, target) : git(ctx.root, ["reset", "--keep", target]);
|
|
586
|
+
if (moved.status !== 0) {
|
|
587
|
+
report.warn(
|
|
588
|
+
`reset --keep refused; local edits or an index operation need attention:
|
|
589
|
+
${moved.stderr.trim()}`
|
|
590
|
+
);
|
|
591
|
+
return 1;
|
|
592
|
+
}
|
|
593
|
+
report.info(
|
|
594
|
+
`${ctx.mainline} ${head.slice(0, 10)} -> ${target.slice(0, 10)}; dropped ${carried.length} landed duplicate(s), uncommitted edits kept`
|
|
595
|
+
);
|
|
596
|
+
if (options.followSubmodules) {
|
|
597
|
+
for (const line of followPins(ctx.root, head, target)) report.info(line);
|
|
598
|
+
}
|
|
599
|
+
return install(options);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// src/git/cli/mainline.ts
|
|
603
|
+
var mainlineSync = (setup, _context, report) => {
|
|
604
|
+
const sync = setup.config.sync ?? off("git.mainline.sync");
|
|
605
|
+
const followSubmodules = setup.config.submodules?.follow === "clean_pins";
|
|
606
|
+
const { ctx, stateDir } = setup;
|
|
607
|
+
return syncMainline({ ctx, sync, followSubmodules, stateDir, report });
|
|
608
|
+
};
|
|
609
|
+
var mainlineDeliver = (setup, context, report) => {
|
|
610
|
+
const { config, ctx, stateDir } = setup;
|
|
611
|
+
const settings = config.deliver ?? off("git.mainline.deliver");
|
|
612
|
+
const sync = config.sync;
|
|
613
|
+
const afterDeliver = () => {
|
|
614
|
+
if (sync === void 0 || ctx.linked) return;
|
|
615
|
+
const followSubmodules = config.submodules?.follow === "clean_pins";
|
|
616
|
+
if (syncMainline({ ctx, sync, followSubmodules, stateDir, report }) !== 0)
|
|
617
|
+
report.warn(
|
|
618
|
+
"delivered; only the main checkout did not catch up, run pmcp git sync after the refusal above is cleared"
|
|
619
|
+
);
|
|
620
|
+
};
|
|
621
|
+
return deliver({
|
|
622
|
+
ctx,
|
|
623
|
+
named: context.args.positional.slice(1),
|
|
624
|
+
deliver: settings,
|
|
625
|
+
...config.gate === void 0 ? {} : { gate: config.gate },
|
|
626
|
+
tree: gateTreePath(setup),
|
|
627
|
+
links: config.worktrees?.linkFromMain ?? [],
|
|
628
|
+
leases: leaseSpecs(config),
|
|
629
|
+
store: filesSessionGate(setup.stateDir),
|
|
630
|
+
duringPause: context.args.flags.has("during-pause"),
|
|
631
|
+
afterDeliver,
|
|
632
|
+
report
|
|
633
|
+
});
|
|
634
|
+
};
|
|
635
|
+
export {
|
|
636
|
+
mainlineDeliver,
|
|
637
|
+
mainlineSync
|
|
638
|
+
};
|
|
639
|
+
//# sourceMappingURL=mainline-JQTTYJMI.js.map
|