@modootoday/pmcp 0.18.4 → 0.19.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.
Files changed (103) hide show
  1. package/.agents/plugins/marketplace.json +1 -1
  2. package/.claude-plugin/marketplace.json +1 -1
  3. package/.claude-plugin/plugin.json +1 -1
  4. package/.mcp.json +1 -1
  5. package/dist/{apply-75UWIUVQ.js → apply-IPTASVRS.js} +16 -17
  6. package/dist/{broadcast-CBMVOV3G.js → broadcast-56NPEJWM.js} +3 -4
  7. package/dist/{chunk-ARA4VDHD.js → chunk-2DAC45ZT.js} +2 -2
  8. package/dist/{chunk-JS5RTH4I.js → chunk-2Q6MNGU5.js} +2 -2
  9. package/dist/{chunk-ZWLUH3F2.js → chunk-2W6CEJD7.js} +2 -2
  10. package/dist/{chunk-YRGDWUFY.js → chunk-3BLHIEAK.js} +2 -2
  11. package/dist/{chunk-R26RWSFW.js → chunk-3CLLHFP7.js} +2 -2
  12. package/dist/{chunk-HE2C2S5A.js → chunk-3H5FZCKX.js} +3 -3
  13. package/dist/{chunk-TFRJ5QOS.js → chunk-7FAA32PB.js} +3 -3
  14. package/dist/{chunk-DCU2EXQV.js → chunk-D5D3V6RU.js} +4 -4
  15. package/dist/{chunk-LTZH5E3G.js → chunk-DHAPQUEF.js} +235 -30
  16. package/dist/{chunk-LBXO4VPG.js → chunk-E4FJOLPJ.js} +6 -3
  17. package/dist/{chunk-OPYFEHKG.js → chunk-G7JONWL4.js} +29 -1
  18. package/dist/{chunk-4JUSGIMX.js → chunk-G7NN23YK.js} +2 -2
  19. package/dist/chunk-GPSOPGJA.js +7 -0
  20. package/dist/{chunk-LGO2SZAS.js → chunk-IKJOXDCF.js} +2 -2
  21. package/dist/{chunk-QEW4J3IZ.js → chunk-ISNRDHSD.js} +2 -2
  22. package/dist/{chunk-S3PIAMXV.js → chunk-J5XQW2CM.js} +68 -8
  23. package/dist/{chunk-LFR245MZ.js → chunk-JAICIL6H.js} +5 -5
  24. package/dist/{chunk-GZHHEHKY.js → chunk-JJBSYUSQ.js} +19 -7
  25. package/dist/{chunk-YSUINA5Q.js → chunk-MB72PZH7.js} +8 -8
  26. package/dist/{chunk-3CA3NNVH.js → chunk-MFPQDXUQ.js} +5 -5
  27. package/dist/{chunk-VQ2HEGWH.js → chunk-OKW7VKNQ.js} +2 -2
  28. package/dist/{chunk-6UXJ62XJ.js → chunk-OWW5VY4D.js} +3 -3
  29. package/dist/{chunk-OB3P5RMN.js → chunk-U2FPMGEM.js} +2 -2
  30. package/dist/{chunk-XELAZAIM.js → chunk-UD3BEEBQ.js} +54 -12
  31. package/dist/{chunk-EAWPJHJ7.js → chunk-UGODVKBJ.js} +2 -2
  32. package/dist/{chunk-MSOZPOPX.js → chunk-UOLV2AWA.js} +7 -3
  33. package/dist/{chunk-FBIDDE3N.js → chunk-XKGS2FNF.js} +71 -51
  34. package/dist/{chunk-XMXBE5IQ.js → chunk-XS2QM6AT.js} +5 -5
  35. package/dist/{chunk-45Y3KZ3Q.js → chunk-Y65MO2SS.js} +87 -20
  36. package/dist/{chunk-DAR6RGRN.js → chunk-YTSJRA4Z.js} +2 -2
  37. package/dist/{chunk-QBJC4DRP.js → chunk-ZYMJV7YX.js} +14 -14
  38. package/dist/{cli-ZN7ZVDEZ.js → cli-MUP2NSXT.js} +10 -9
  39. package/dist/{cli-MI4ZCAZ3.js → cli-T5LHBUY2.js} +8 -8
  40. package/dist/cli.js +3 -3
  41. package/dist/{completion-WYJAKJE4.js → completion-ZY5P443T.js} +2 -2
  42. package/dist/{diagnostics-ADIVFSBW.js → diagnostics-KUNS6LCZ.js} +12 -12
  43. package/dist/{doctor-BBCS4DF5.js → doctor-UH7KEOSO.js} +18 -19
  44. package/dist/{entry-DMOTX4SS.js → entry-DOUDMRO2.js} +10 -10
  45. package/dist/{exec-mcp-OBUM3DVW.js → exec-mcp-TGW6FXGC.js} +13 -14
  46. package/dist/{harness-6AUE3I4Q.js → harness-7HC6UR2D.js} +3 -3
  47. package/dist/harness-launch-gate.js +4 -4
  48. package/dist/harness-worker.js +6 -6
  49. package/dist/hook-body.js +446 -278
  50. package/dist/{hook-spec-C5fWTSCH.d.ts → hook-spec-0aGt29Pg.d.ts} +22 -2
  51. package/dist/{hooks-HLPQPVRY.js → hooks-L2MKB75Z.js} +3 -3
  52. package/dist/{host-5Q3X6OY7.js → host-OAQZTYII.js} +15 -16
  53. package/dist/{host-LGSWU3PJ.js → host-QSBXKTWT.js} +7 -7
  54. package/dist/{host-run-4NMQQASQ.js → host-run-HFOADX32.js} +10 -6
  55. package/dist/http.js +1 -1
  56. package/dist/{import-mcp-WU7TO2RT.js → import-mcp-BCYXJAIU.js} +11 -12
  57. package/dist/index.d.ts +2 -2
  58. package/dist/index.js +17 -18
  59. package/dist/{init-XA6XXLGA.js → init-NVJVNZOD.js} +2 -2
  60. package/dist/{invoke-CYQZYU5T.js → invoke-KVTEPXSC.js} +8 -8
  61. package/dist/{list-FNGXY5D7.js → list-2VRPMASP.js} +13 -14
  62. package/dist/{logout-N753FBZP.js → logout-6T5ZDLHQ.js} +12 -13
  63. package/dist/{logs-TBUA4UWU.js → logs-H3RPKNTE.js} +3 -4
  64. package/dist/{mailbox-BMTZOSZ7.js → mailbox-O3MX6QPF.js} +3 -4
  65. package/dist/{mainline-KAD2ERLP.js → mainline-DG75NLBS.js} +306 -57
  66. package/dist/{mcp-GR4VXKTG.js → mcp-7UKG5TD3.js} +2 -2
  67. package/dist/{pause-7LILUVGL.js → pause-2HQ7CKMR.js} +3 -4
  68. package/dist/project/hook-adapter.d.ts +1 -1
  69. package/dist/{project-OEBACWEX.js → project-BPKQOSKQ.js} +4 -4
  70. package/dist/{resume-26VFAAMH.js → resume-ETFTR5V3.js} +3 -4
  71. package/dist/{run-MDRUOEFL.js → run-5JD62E7R.js} +11 -12
  72. package/dist/{run-7XNGPU2I.js → run-WGIRM6Z7.js} +4 -4
  73. package/dist/{serve-HXHNWKEK.js → serve-J575WVIU.js} +3 -3
  74. package/dist/setup-T6T2PFC4.js +20 -0
  75. package/dist/{start-login-PWCEKNED.js → start-login-2AYCHWLV.js} +12 -13
  76. package/dist/{status-QFOBQ42J.js → status-2YWTJOMH.js} +20 -27
  77. package/dist/{status-54IYX2FN.js → status-425ZKIE6.js} +12 -13
  78. package/dist/{status-RO55QPKV.js → status-GPSLH4VO.js} +3 -4
  79. package/dist/stdio.js +2 -2
  80. package/dist/{sweep-35LGQTTO.js → sweep-VY2TNOO5.js} +3 -4
  81. package/dist/{test-36ZUVALT.js → test-XBLZOX52.js} +50 -15
  82. package/dist/{tui-CSRW4DN2.js → tui-WNVBHP65.js} +4 -4
  83. package/dist/{unbroadcast-5QNGAJR2.js → unbroadcast-RKTBP57G.js} +3 -4
  84. package/dist/{worker-EODWT4KK.js → worker-CGF3UIJE.js} +8 -8
  85. package/dist/{worktree-create-PZSRB7PH.js → worktree-create-NO4UOOEP.js} +2 -2
  86. package/dist/{worktree-list-JYB6VXLW.js → worktree-list-NEIDD66X.js} +4 -4
  87. package/dist/{worktree-sync-UF5CXPWV.js → worktree-sync-W4BDDLRO.js} +8 -9
  88. package/docs/commands.md +1 -1
  89. package/docs/git-workflow.md +58 -1
  90. package/docs/hooks.md +29 -0
  91. package/docs/project-configuration.md +7 -7
  92. package/gemini-extension.json +2 -2
  93. package/mcp.json +1 -1
  94. package/package.json +5 -5
  95. package/plugin.json +1 -1
  96. package/plugins/pmcp/.claude-plugin/plugin.json +1 -1
  97. package/plugins/pmcp/.mcp.json +1 -1
  98. package/plugins/pmcp/gemini-extension.json +2 -2
  99. package/plugins/pmcp/mcp.json +1 -1
  100. package/plugins/pmcp/plugin.json +1 -1
  101. package/dist/chunk-26WLNWDG.js +0 -93
  102. package/dist/chunk-MZCRCMEY.js +0 -7
  103. package/dist/setup-DTKZLZUT.js +0 -18
@@ -32,6 +32,33 @@ function gitText(cwd, args) {
32
32
  function gitOk(cwd, args) {
33
33
  return git(cwd, args).status === 0;
34
34
  }
35
+ var TEE = `
36
+ const fs = require("node:fs");
37
+ const { spawn } = require("node:child_process");
38
+ const [log, bin, ...args] = process.argv.slice(1);
39
+ const out = fs.openSync(log, "a");
40
+ const child = spawn(bin, args, { stdio: ["ignore", "pipe", "pipe"] });
41
+ for (const stream of [child.stdout, child.stderr])
42
+ stream.on("data", (chunk) => {
43
+ process.stderr.write(chunk);
44
+ fs.writeSync(out, chunk);
45
+ });
46
+ child.on("error", (error) => {
47
+ fs.writeSync(out, String(error) + "\\n");
48
+ process.stderr.write(String(error) + "\\n");
49
+ process.exit(127);
50
+ });
51
+ child.on("close", (code) => process.exit(code ?? 1));
52
+ `;
53
+ function runCommandLogged(argv, cwd, log, extra) {
54
+ if (argv[0] === void 0) return 0;
55
+ const run = spawnSync(process.execPath, ["-e", TEE, log, ...argv], {
56
+ cwd,
57
+ stdio: ["ignore", 2, 2],
58
+ env: cleanEnv(extra)
59
+ });
60
+ return run.status ?? 1;
61
+ }
35
62
  function runCommand(argv, cwd, extra) {
36
63
  const [bin, ...rest] = argv;
37
64
  if (bin === void 0) return 0;
@@ -47,6 +74,7 @@ export {
47
74
  git,
48
75
  gitText,
49
76
  gitOk,
77
+ runCommandLogged,
50
78
  runCommand
51
79
  };
52
- //# sourceMappingURL=chunk-OPYFEHKG.js.map
80
+ //# sourceMappingURL=chunk-G7JONWL4.js.map
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-34DECPVC.js";
7
7
  import {
8
8
  ptyBinary
9
- } from "./chunk-MSOZPOPX.js";
9
+ } from "./chunk-UOLV2AWA.js";
10
10
 
11
11
  // src/harness/adapters/systemd/admission.ts
12
12
  var nativeHostTools = ["systemctl", "systemd-run"];
@@ -36,4 +36,4 @@ export {
36
36
  nativeHostTools,
37
37
  assertNativeHost
38
38
  };
39
- //# sourceMappingURL=chunk-4JUSGIMX.js.map
39
+ //# sourceMappingURL=chunk-G7NN23YK.js.map
@@ -0,0 +1,7 @@
1
+ // src/commands/version.ts
2
+ var VERSION = "0.19.1";
3
+
4
+ export {
5
+ VERSION
6
+ };
7
+ //# sourceMappingURL=chunk-GPSOPGJA.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-34DECPVC.js";
4
4
  import {
5
5
  ptyBinary
6
- } from "./chunk-MSOZPOPX.js";
6
+ } from "./chunk-UOLV2AWA.js";
7
7
  import {
8
8
  GroupStore,
9
9
  egressPolicy,
@@ -775,4 +775,4 @@ export {
775
775
  prepareBridge,
776
776
  assertBridge
777
777
  };
778
- //# sourceMappingURL=chunk-LGO2SZAS.js.map
778
+ //# sourceMappingURL=chunk-IKJOXDCF.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  git,
3
3
  gitText
4
- } from "./chunk-OPYFEHKG.js";
4
+ } from "./chunk-G7JONWL4.js";
5
5
 
6
6
  // src/git/landed.ts
7
7
  function cherry(cwd, upstream, head = "HEAD") {
@@ -71,4 +71,4 @@ export {
71
71
  isAncestor,
72
72
  distance
73
73
  };
74
- //# sourceMappingURL=chunk-QEW4J3IZ.js.map
74
+ //# sourceMappingURL=chunk-ISNRDHSD.js.map
@@ -32,6 +32,12 @@ var Reader = class {
32
32
  this.fail(key, "a non-empty string");
33
33
  return value;
34
34
  }
35
+ envName(key) {
36
+ const value = this.string(key);
37
+ if (value !== void 0 && !/^[A-Z_][A-Z0-9_]{0,127}$/u.test(value))
38
+ this.fail(key, "an environment variable name (A-Z, 0-9, _)");
39
+ return value;
40
+ }
35
41
  oneOf(key, values, fallback) {
36
42
  const value = this.table[key] ?? fallback;
37
43
  if (!values.includes(value)) this.fail(key, values.join(" | "));
@@ -48,6 +54,13 @@ var Reader = class {
48
54
  this.fail(key, "a positive integer");
49
55
  return value;
50
56
  }
57
+ positive(key) {
58
+ const value = this.table[key];
59
+ if (value === void 0) return void 0;
60
+ if (typeof value !== "number" || !(value > 0))
61
+ this.fail(key, "a positive number");
62
+ return value;
63
+ }
51
64
  list(key) {
52
65
  const value = this.table[key] ?? [];
53
66
  if (!Array.isArray(value) || !value.every((v) => typeof v === "string"))
@@ -71,6 +84,7 @@ function child(path, parent, name, key) {
71
84
  }
72
85
 
73
86
  // src/git/config/tables.ts
87
+ import { isAbsolute } from "path";
74
88
  function worktrees(path, source) {
75
89
  const read = new Reader(path, "git.worktrees", source, [
76
90
  "root",
@@ -119,13 +133,27 @@ function gate(path, dir, source) {
119
133
  const read = new Reader(path, "git.mainline.gate", source, [
120
134
  "command",
121
135
  "tree",
122
- "lock_wait_seconds"
136
+ "lock_wait_seconds",
137
+ "lock_env",
138
+ "tree_env",
139
+ "log_dir",
140
+ "max_load",
141
+ "load_wait_seconds"
123
142
  ]);
124
143
  const tree = read.string("tree");
144
+ const lockEnv = read.envName("lock_env");
145
+ const treeEnv = read.envName("tree_env");
146
+ const logDir = read.string("log_dir");
147
+ const maxLoad = read.positive("max_load");
125
148
  return {
126
149
  command: read.argv("command"),
127
150
  tree: tree === void 0 ? void 0 : expandPath(dir, tree),
128
- lockWaitSeconds: read.int("lock_wait_seconds", 5400)
151
+ lockWaitSeconds: read.int("lock_wait_seconds", 5400),
152
+ loadWaitSeconds: read.int("load_wait_seconds", 1800),
153
+ ...maxLoad ? { maxLoad } : {},
154
+ ...lockEnv ? { lockEnv } : {},
155
+ ...treeEnv ? { treeEnv } : {},
156
+ ...logDir ? { logDir: expandPath(dir, logDir) } : {}
129
157
  };
130
158
  }
131
159
  function deliver(path, source) {
@@ -149,18 +177,50 @@ function mainlineSync(path, source) {
149
177
  "install",
150
178
  "install_when_changed",
151
179
  "keep_identical_files",
152
- "refuse_with_unlanded"
180
+ "refuse_with_unlanded",
181
+ "stamp",
182
+ "stamp_hash"
153
183
  ]);
184
+ const installWhenChanged = read.list("install_when_changed");
185
+ const stamp = read.string("stamp");
186
+ const hash = read.oneOf("stamp_hash", ["pmcp", "plain"], "pmcp");
187
+ if (stamp !== void 0) {
188
+ const home = stamp.startsWith("~/") || stamp.startsWith("$HOME/");
189
+ if (!stamp.startsWith("${git_dir}/") && !home && !isAbsolute(stamp))
190
+ throw new ConfigError(
191
+ path,
192
+ "[git.mainline.sync] stamp must start with ${git_dir}/, ~/ or /"
193
+ );
194
+ if (hash === "plain" && installWhenChanged.length !== 1)
195
+ throw new ConfigError(
196
+ path,
197
+ '[git.mainline.sync] stamp_hash = "plain" needs exactly one install_when_changed path'
198
+ );
199
+ }
154
200
  return {
155
201
  install: read.argv("install"),
156
- installWhenChanged: read.list("install_when_changed"),
202
+ installWhenChanged,
157
203
  keepIdenticalFiles: read.bool("keep_identical_files", true),
158
- refuseWithUnlanded: read.bool("refuse_with_unlanded", true)
204
+ refuseWithUnlanded: read.bool("refuse_with_unlanded", true),
205
+ ...stamp !== void 0 ? {
206
+ stamp: {
207
+ path: stamp.startsWith("${git_dir}/") ? stamp : expandPath("/", stamp),
208
+ hash
209
+ }
210
+ } : {}
159
211
  };
160
212
  }
161
213
  function submodules(path, source) {
162
- const read = new Reader(path, "git.submodules", source, ["follow"]);
163
- return { follow: read.oneOf("follow", ["clean_pins", "off"], "clean_pins") };
214
+ const read = new Reader(path, "git.submodules", source, [
215
+ "follow",
216
+ "shared",
217
+ "push"
218
+ ]);
219
+ return {
220
+ follow: read.oneOf("follow", ["clean_pins", "off"], "clean_pins"),
221
+ shared: read.list("shared"),
222
+ push: read.oneOf("push", ["pins", "off"], "off")
223
+ };
164
224
  }
165
225
  function leases(path, sessions) {
166
226
  const declared = child(path, sessions, "sessions", "leases");
@@ -227,4 +287,4 @@ function readGitConfig(config) {
227
287
  export {
228
288
  readGitConfig
229
289
  };
230
- //# sourceMappingURL=chunk-S3PIAMXV.js.map
290
+ //# sourceMappingURL=chunk-J5XQW2CM.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  OPENCODE_CONFIG,
3
3
  mcpOutputs
4
- } from "./chunk-R26RWSFW.js";
4
+ } from "./chunk-3CLLHFP7.js";
5
5
  import {
6
6
  MARK,
7
7
  NATIVE_HOOK_FILES,
@@ -25,7 +25,7 @@ import {
25
25
  splitKeyed,
26
26
  uiClaudeOutputs,
27
27
  withoutBlock
28
- } from "./chunk-45Y3KZ3Q.js";
28
+ } from "./chunk-Y65MO2SS.js";
29
29
  import {
30
30
  ProjectError,
31
31
  RULES_DIR,
@@ -37,12 +37,12 @@ import {
37
37
  } from "./chunk-73AKO4UL.js";
38
38
  import {
39
39
  hostOutputs
40
- } from "./chunk-MSOZPOPX.js";
40
+ } from "./chunk-UOLV2AWA.js";
41
41
  import {
42
42
  lockVersionProblem,
43
43
  readLock,
44
44
  replaceFile
45
- } from "./chunk-FBIDDE3N.js";
45
+ } from "./chunk-XKGS2FNF.js";
46
46
  import {
47
47
  CODEX_PLUGIN_LIST,
48
48
  claudeSettings,
@@ -1022,4 +1022,4 @@ export {
1022
1022
  prepare,
1023
1023
  checkProject
1024
1024
  };
1025
- //# sourceMappingURL=chunk-LFR245MZ.js.map
1025
+ //# sourceMappingURL=chunk-JAICIL6H.js.map
@@ -1,9 +1,13 @@
1
1
  import {
2
2
  readGitConfig
3
- } from "./chunk-S3PIAMXV.js";
3
+ } from "./chunk-J5XQW2CM.js";
4
4
  import {
5
5
  detect
6
- } from "./chunk-JS5RTH4I.js";
6
+ } from "./chunk-2Q6MNGU5.js";
7
+ import {
8
+ readStoreSettings,
9
+ resolveLeaseFiles
10
+ } from "./chunk-DHAPQUEF.js";
7
11
  import {
8
12
  projectStateDir
9
13
  } from "./chunk-OEH47H6A.js";
@@ -13,21 +17,29 @@ import {
13
17
  } from "./chunk-QPL7E2HW.js";
14
18
 
15
19
  // src/git/setup.ts
16
- import { join, resolve } from "path";
20
+ import { dirname, join, resolve } from "path";
17
21
  function loadGit(cwd, configPath, env) {
18
22
  const path = configPath === void 0 ? findConfig(cwd) : resolve(cwd, configPath);
19
23
  if (path === null)
20
24
  return new Error("no pmcp.toml found; the git workflow is opt-in");
21
- const config = readGitConfig(readConfig(path));
25
+ const project = readConfig(path);
26
+ const config = readGitConfig(project);
22
27
  if (config === null)
23
28
  return new Error(`[git] is absent or disabled in ${path}`);
24
29
  const ctx = detect(cwd, { remote: config.remote, mainline: config.mainline });
25
30
  if (ctx === null) return new Error(`${cwd} is not inside a git checkout`);
26
31
  const stateDir = projectStateDir(ctx.root, config.stateDir, env);
27
- return { config, ctx, stateDir };
32
+ const override = config.gate?.treeEnv ? env[config.gate.treeEnv] : void 0;
33
+ const tree = override || (config.gate?.tree ?? join(stateDir, "gate", "tree"));
34
+ const settings = readStoreSettings(
35
+ project.raw["sessions"],
36
+ project.raw["git"]
37
+ );
38
+ const leaseFiles = resolveLeaseFiles(settings.leaseFiles, dirname(tree));
39
+ return { config, ctx, stateDir, gateTree: tree, leaseFiles };
28
40
  }
29
41
  function gateTreePath(setup) {
30
- return setup.config.gate?.tree ?? join(setup.stateDir, "gate", "tree");
42
+ return setup.gateTree;
31
43
  }
32
44
  function leaseSpecs(config) {
33
45
  if (config.leases.length > 0) return config.leases;
@@ -41,4 +53,4 @@ export {
41
53
  gateTreePath,
42
54
  leaseSpecs
43
55
  };
44
- //# sourceMappingURL=chunk-GZHHEHKY.js.map
56
+ //# sourceMappingURL=chunk-JJBSYUSQ.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  hostApprovalDoctor
3
- } from "./chunk-YRGDWUFY.js";
3
+ } from "./chunk-3BLHIEAK.js";
4
4
  import {
5
5
  project
6
- } from "./chunk-3CA3NNVH.js";
6
+ } from "./chunk-MFPQDXUQ.js";
7
7
  import {
8
8
  wakeableBy
9
9
  } from "./chunk-WIW772I3.js";
@@ -16,16 +16,16 @@ import {
16
16
  marketplaceDoctor,
17
17
  skillNames,
18
18
  splitFrontmatter
19
- } from "./chunk-LFR245MZ.js";
19
+ } from "./chunk-JAICIL6H.js";
20
20
  import {
21
21
  ANTIGRAVITY_MCP_PLUGIN,
22
22
  serversForTool
23
- } from "./chunk-R26RWSFW.js";
23
+ } from "./chunk-3CLLHFP7.js";
24
24
  import {
25
25
  permissionDoctor,
26
26
  pluginBinaryDoctor,
27
27
  uiClaudeDoctor
28
- } from "./chunk-45Y3KZ3Q.js";
28
+ } from "./chunk-Y65MO2SS.js";
29
29
  import {
30
30
  pathPmcp,
31
31
  pmcpCommand
@@ -33,12 +33,12 @@ import {
33
33
  import {
34
34
  createFilesStore,
35
35
  inboxKey
36
- } from "./chunk-LTZH5E3G.js";
36
+ } from "./chunk-DHAPQUEF.js";
37
37
  import {
38
38
  hostDoctor,
39
39
  hostEnvDoctor,
40
40
  ptyBinaryDoctor
41
- } from "./chunk-MSOZPOPX.js";
41
+ } from "./chunk-UOLV2AWA.js";
42
42
  import {
43
43
  projectStateDir
44
44
  } from "./chunk-OEH47H6A.js";
@@ -642,4 +642,4 @@ export {
642
642
  spawnRunner,
643
643
  doctor
644
644
  };
645
- //# sourceMappingURL=chunk-YSUINA5Q.js.map
645
+ //# sourceMappingURL=chunk-MB72PZH7.js.map
@@ -8,10 +8,10 @@ import {
8
8
  prepare,
9
9
  present,
10
10
  writeNative
11
- } from "./chunk-LFR245MZ.js";
11
+ } from "./chunk-JAICIL6H.js";
12
12
  import {
13
13
  ANTIGRAVITY_MCP_PLUGIN
14
- } from "./chunk-R26RWSFW.js";
14
+ } from "./chunk-3CLLHFP7.js";
15
15
  import {
16
16
  changedSincePlan,
17
17
  exists,
@@ -22,7 +22,7 @@ import {
22
22
  same,
23
23
  splitKeyed,
24
24
  withoutBlock
25
- } from "./chunk-45Y3KZ3Q.js";
25
+ } from "./chunk-Y65MO2SS.js";
26
26
  import {
27
27
  RULES_DIR,
28
28
  legacyLinks
@@ -32,7 +32,7 @@ import {
32
32
  replaceFile,
33
33
  replaceLink,
34
34
  writeLock
35
- } from "./chunk-FBIDDE3N.js";
35
+ } from "./chunk-XKGS2FNF.js";
36
36
 
37
37
  // src/project/apply/files.ts
38
38
  import { mkdirSync } from "fs";
@@ -208,4 +208,4 @@ function project(spec, options) {
208
208
  export {
209
209
  project
210
210
  };
211
- //# sourceMappingURL=chunk-3CA3NNVH.js.map
211
+ //# sourceMappingURL=chunk-MFPQDXUQ.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-7DLZC73N.js";
4
4
  import {
5
5
  readSpec
6
- } from "./chunk-45Y3KZ3Q.js";
6
+ } from "./chunk-Y65MO2SS.js";
7
7
  import {
8
8
  ArgumentError
9
9
  } from "./chunk-A4PKLESO.js";
@@ -28,4 +28,4 @@ function specFrom(context) {
28
28
  export {
29
29
  specFrom
30
30
  };
31
- //# sourceMappingURL=chunk-VQ2HEGWH.js.map
31
+ //# sourceMappingURL=chunk-OKW7VKNQ.js.map
@@ -3,13 +3,13 @@ import {
3
3
  } from "./chunk-5ZABTVSW.js";
4
4
  import {
5
5
  dependencies
6
- } from "./chunk-HE2C2S5A.js";
6
+ } from "./chunk-3H5FZCKX.js";
7
7
  import {
8
8
  interactiveEntry
9
9
  } from "./chunk-LMT3PPXJ.js";
10
10
  import {
11
11
  assertNativeHost
12
- } from "./chunk-4JUSGIMX.js";
12
+ } from "./chunk-G7NN23YK.js";
13
13
 
14
14
  // src/tui/startup/host.ts
15
15
  function terminalSupport() {
@@ -42,4 +42,4 @@ export {
42
42
  terminalSupport,
43
43
  requireTerminal
44
44
  };
45
- //# sourceMappingURL=chunk-6UXJ62XJ.js.map
45
+ //# sourceMappingURL=chunk-OWW5VY4D.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createSkillServer
3
- } from "./chunk-ARA4VDHD.js";
3
+ } from "./chunk-2DAC45ZT.js";
4
4
  import {
5
5
  attachMailbox
6
6
  } from "./chunk-NWOV2E26.js";
@@ -84,4 +84,4 @@ export {
84
84
  serveWithMailbox,
85
85
  main
86
86
  };
87
- //# sourceMappingURL=chunk-OB3P5RMN.js.map
87
+ //# sourceMappingURL=chunk-U2FPMGEM.js.map
@@ -3,12 +3,22 @@ import {
3
3
  gitOk,
4
4
  gitText,
5
5
  runCommand
6
- } from "./chunk-OPYFEHKG.js";
6
+ } from "./chunk-G7JONWL4.js";
7
7
 
8
8
  // src/git/install.ts
9
9
  import { createHash } from "crypto";
10
10
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
11
- import { join } from "path";
11
+ import { dirname, join } from "path";
12
+ function installSpec(sync, stateDir) {
13
+ if (sync?.install === void 0 || sync.installWhenChanged.length === 0)
14
+ return void 0;
15
+ return {
16
+ command: sync.install,
17
+ when: sync.installWhenChanged,
18
+ stateDir,
19
+ ...sync.stamp ? { stamp: sync.stamp } : {}
20
+ };
21
+ }
12
22
  function lockHash(root, paths) {
13
23
  const hash = createHash("sha256");
14
24
  let found = false;
@@ -21,7 +31,17 @@ function lockHash(root, paths) {
21
31
  if (!found) return null;
22
32
  return hash.digest("hex");
23
33
  }
34
+ function installedHash(root, spec) {
35
+ if (spec.stamp?.hash !== "plain") return lockHash(root, spec.when);
36
+ const file = join(root, spec.when[0] ?? "");
37
+ if (!existsSync(file)) return null;
38
+ return createHash("sha256").update(readFileSync(file)).digest("hex");
39
+ }
24
40
  function stampFile(root, spec) {
41
+ if (spec.stamp) {
42
+ const gitDir = gitText(root, ["rev-parse", "--absolute-git-dir"]);
43
+ return spec.stamp.path.replace("${git_dir}", gitDir);
44
+ }
25
45
  const key = createHash("sha256").update([root, ...spec.when].join("\0")).digest("hex");
26
46
  return join(spec.stateDir, "installed", key);
27
47
  }
@@ -29,8 +49,15 @@ function readStamp(path) {
29
49
  if (!existsSync(path)) return null;
30
50
  return readFileSync(path, "utf8").trim() || null;
31
51
  }
52
+ function installState(root, spec) {
53
+ const hash = installedHash(root, spec);
54
+ return {
55
+ hash,
56
+ installed: hash !== null && readStamp(stampFile(root, spec)) === hash
57
+ };
58
+ }
32
59
  function installIfStale(root, spec, report) {
33
- const hash = lockHash(root, spec.when);
60
+ const hash = installedHash(root, spec);
34
61
  const stamp = stampFile(root, spec);
35
62
  if (hash === null || readStamp(stamp) === hash) return null;
36
63
  report.info(
@@ -41,7 +68,7 @@ function installIfStale(root, spec, report) {
41
68
  report.warn(`the install exited ${status}; the next sync runs it again`);
42
69
  return status;
43
70
  }
44
- mkdirSync(join(spec.stateDir, "installed"), { recursive: true });
71
+ mkdirSync(dirname(stamp), { recursive: true });
45
72
  writeFileSync(stamp, `${hash}
46
73
  `);
47
74
  return 0;
@@ -57,24 +84,34 @@ function clean(dir) {
57
84
  function hasCommit(dir, sha) {
58
85
  return gitOk(dir, ["cat-file", "-e", `${sha}^{commit}`]);
59
86
  }
60
- function followOne(dir, oldPin, newPin) {
87
+ function blocking(dir, head, pin) {
88
+ const local = git(dir, ["status", "--porcelain", "--untracked-files=all"]).stdout.split("\n").filter(Boolean).map((line) => line.slice(3).split(" -> ").pop());
89
+ const changed = new Set(
90
+ gitText(dir, ["diff", "--name-only", head, pin]).split("\n").filter(Boolean)
91
+ );
92
+ return local.filter((path) => changed.has(path));
93
+ }
94
+ function followOne(dir, oldPin, newPin, shared) {
61
95
  const short = newPin.slice(0, 10);
62
96
  if (!existsSync2(join2(dir, ".git"))) return "not checked out, left alone";
63
97
  const head = gitText(dir, ["rev-parse", "HEAD"]);
64
98
  if (head === newPin) return `already at ${short}`;
65
99
  if (head !== oldPin)
66
100
  return `left at ${head.slice(0, 10)}: it was not on the old pin, so it holds other work`;
67
- if (!clean(dir)) return `left at the old pin: it has uncommitted changes`;
101
+ if (!shared && !clean(dir))
102
+ return `left at the old pin: it has uncommitted changes`;
68
103
  if (!hasCommit(dir, newPin)) git(dir, ["fetch", "-q", "origin"]);
69
104
  if (!hasCommit(dir, newPin))
70
105
  return `left at the old pin: ${short} is not fetchable`;
71
106
  const branch = gitText(dir, ["symbolic-ref", "--short", "-q", "HEAD"]);
72
107
  const args = branch ? ["merge", "-q", "--ff-only", newPin] : ["checkout", "-q", "--detach", newPin];
73
- if (!gitOk(dir, args))
74
- return `left at the old pin: it cannot move to ${short}`;
75
- return `moved to ${short}`;
108
+ if (!gitOk(dir, args)) {
109
+ const files = shared ? blocking(dir, head, newPin) : [];
110
+ return files.length > 0 ? `left at the old pin: local edits to ${files.join(", ")} conflict with ${short}; commit or move them, then sync again` : `left at the old pin: it cannot move to ${short}`;
111
+ }
112
+ return clean(dir) ? `moved to ${short}` : `moved to ${short}, keeping its local edits`;
76
113
  }
77
- function followPins(root, from, to) {
114
+ function followPins(root, from, to, shared = []) {
78
115
  const raw = gitText(root, [
79
116
  "diff",
80
117
  "--raw",
@@ -88,7 +125,9 @@ function followPins(root, from, to) {
88
125
  const match = GITLINK.exec(entry);
89
126
  if (!match) continue;
90
127
  const [, oldPin = "", newPin = "", path = ""] = match;
91
- lines.push(`${path}: ${followOne(join2(root, path), oldPin, newPin)}`);
128
+ lines.push(
129
+ `${path}: ${followOne(join2(root, path), oldPin, newPin, shared.includes(path))}`
130
+ );
92
131
  }
93
132
  return lines;
94
133
  }
@@ -128,9 +167,12 @@ function updateToPins(root, paths) {
128
167
  }
129
168
 
130
169
  export {
170
+ installSpec,
171
+ lockHash,
172
+ installState,
131
173
  installIfStale,
132
174
  followPins,
133
175
  movableSubmodules,
134
176
  updateToPins
135
177
  };
136
- //# sourceMappingURL=chunk-XELAZAIM.js.map
178
+ //# sourceMappingURL=chunk-UD3BEEBQ.js.map
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-HQOB7OQS.js";
6
6
  import {
7
7
  readStoreSettings
8
- } from "./chunk-26WLNWDG.js";
8
+ } from "./chunk-DHAPQUEF.js";
9
9
  import {
10
10
  expandPath,
11
11
  projectStateDir
@@ -152,4 +152,4 @@ export {
152
152
  tail,
153
153
  logLocation
154
154
  };
155
- //# sourceMappingURL=chunk-EAWPJHJ7.js.map
155
+ //# sourceMappingURL=chunk-UGODVKBJ.js.map
@@ -1,7 +1,11 @@
1
1
  import {
2
+ missingBinary,
2
3
  nativeBinary,
3
4
  readLock
4
- } from "./chunk-FBIDDE3N.js";
5
+ } from "./chunk-XKGS2FNF.js";
6
+ import {
7
+ VERSION
8
+ } from "./chunk-GPSOPGJA.js";
5
9
  import {
6
10
  pickEnv
7
11
  } from "./chunk-J6KL3COD.js";
@@ -68,7 +72,7 @@ function ptyBinaryDoctor(env) {
68
72
  tool: "project",
69
73
  check: "pmcp-pty binary",
70
74
  status: "warn",
71
- detail: "pmcp-pty not found; set PMCP_PTY_BIN or put it on PATH"
75
+ detail: missingBinary("pmcp-pty", "PMCP_PTY_BIN", VERSION)
72
76
  };
73
77
  }
74
78
  function hostEnvDoctor(spec, env) {
@@ -123,4 +127,4 @@ export {
123
127
  hostEnvDoctor,
124
128
  hostDoctor
125
129
  };
126
- //# sourceMappingURL=chunk-MSOZPOPX.js.map
130
+ //# sourceMappingURL=chunk-UOLV2AWA.js.map