@modootoday/pmcp 0.18.3 → 0.19.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.
Files changed (111) 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-S2QI72W3.js → apply-JVLYYXAG.js} +17 -17
  6. package/dist/{broadcast-CBMVOV3G.js → broadcast-56NPEJWM.js} +3 -4
  7. package/dist/{chunk-JS5RTH4I.js → chunk-2Q6MNGU5.js} +2 -2
  8. package/dist/{chunk-QK4G7FCU.js → chunk-3O3FS6KM.js} +10 -8
  9. package/dist/{chunk-3MEYKFFO.js → chunk-3TG3KVHZ.js} +3 -3
  10. package/dist/{chunk-FX3LTTMB.js → chunk-47ZGCZQA.js} +3 -3
  11. package/dist/{chunk-6BN35BHI.js → chunk-4LV7KDTS.js} +67 -17
  12. package/dist/{chunk-CKTN6LKP.js → chunk-6MZTOC6H.js} +2 -2
  13. package/dist/{chunk-JM2KR2WJ.js → chunk-CYQIAEQT.js} +5 -5
  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-FGEBSQQJ.js +7 -0
  18. package/dist/{chunk-OPYFEHKG.js → chunk-G7JONWL4.js} +29 -1
  19. package/dist/{chunk-HFE4QDJQ.js → chunk-HEPSITZX.js} +2 -2
  20. package/dist/{chunk-4GSGT55G.js → chunk-IEK4U5RR.js} +2 -2
  21. package/dist/{chunk-QEW4J3IZ.js → chunk-ISNRDHSD.js} +2 -2
  22. package/dist/{chunk-TVL5RTE6.js → chunk-ITDJ2EXN.js} +11 -1
  23. package/dist/{chunk-S3PIAMXV.js → chunk-J5XQW2CM.js} +68 -8
  24. package/dist/{chunk-PAX3QXX2.js → chunk-J5ZS7GLA.js} +2 -2
  25. package/dist/chunk-J6KL3COD.js +34 -0
  26. package/dist/{chunk-GZHHEHKY.js → chunk-JJBSYUSQ.js} +19 -7
  27. package/dist/{chunk-XJUNAVU2.js → chunk-KHQQGBFJ.js} +107 -20
  28. package/dist/{chunk-7PTG42QU.js → chunk-LCENQ6JR.js} +6 -6
  29. package/dist/{chunk-WM2RF2MI.js → chunk-NLKAEKSG.js} +3 -3
  30. package/dist/{chunk-7DEYLLIE.js → chunk-OHW3A7Z3.js} +2 -2
  31. package/dist/{chunk-TZORR6GZ.js → chunk-PFWTGEZJ.js} +2 -2
  32. package/dist/{chunk-HQWVGU3W.js → chunk-Q3GLKL4B.js} +5 -5
  33. package/dist/{chunk-2RTRY45B.js → chunk-QJRJCXX2.js} +30 -4
  34. package/dist/{chunk-E5XVSMBR.js → chunk-QXRD7N35.js} +2 -2
  35. package/dist/{chunk-M455QSCW.js → chunk-TPLV2YX2.js} +2 -2
  36. package/dist/{chunk-XELAZAIM.js → chunk-UD3BEEBQ.js} +54 -12
  37. package/dist/{chunk-EAWPJHJ7.js → chunk-UGODVKBJ.js} +2 -2
  38. package/dist/{chunk-IIBB37JE.js → chunk-UQNCBXXH.js} +14 -14
  39. package/dist/{chunk-F5LEGPGP.js → chunk-WJJ2KYE4.js} +2 -2
  40. package/dist/{chunk-TAOOPXBV.js → chunk-Y2MZ5RE3.js} +88 -56
  41. package/dist/{cli-ZN7ZVDEZ.js → cli-MUP2NSXT.js} +10 -9
  42. package/dist/{cli-MI4ZCAZ3.js → cli-T5LHBUY2.js} +8 -8
  43. package/dist/cli.js +3 -3
  44. package/dist/{completion-GYN7PX3T.js → completion-CCK3LWVR.js} +2 -2
  45. package/dist/{diagnostics-WACXQ33W.js → diagnostics-6WON3VMZ.js} +13 -12
  46. package/dist/{doctor-VSQ72A6X.js → doctor-UEXUOW5O.js} +19 -19
  47. package/dist/{entry-VFEZC2XB.js → entry-GMC6LRO2.js} +13 -12
  48. package/dist/{exec-mcp-TOQEJFK3.js → exec-mcp-FS7IPXNC.js} +14 -14
  49. package/dist/{harness-XCEWFGCG.js → harness-32PERNQY.js} +4 -4
  50. package/dist/harness-launch-gate.js +6 -5
  51. package/dist/harness-pane-runner.js +2 -1
  52. package/dist/harness-worker.js +8 -7
  53. package/dist/hook-body.js +446 -278
  54. package/dist/{hook-spec-C5fWTSCH.d.ts → hook-spec-0aGt29Pg.d.ts} +22 -2
  55. package/dist/{hooks-32AFBC3Z.js → hooks-VQCLHXRZ.js} +3 -3
  56. package/dist/{host-TE5PNDHJ.js → host-4WNPLAD5.js} +8 -7
  57. package/dist/{host-72OLHUX7.js → host-ED3XRUNM.js} +16 -16
  58. package/dist/{host-run-MXCH26ZD.js → host-run-PNY6NAYW.js} +28 -11
  59. package/dist/http.js +1 -1
  60. package/dist/{import-mcp-QWGZSIZR.js → import-mcp-WEUY6IVK.js} +12 -12
  61. package/dist/index.d.ts +6 -2
  62. package/dist/index.js +18 -18
  63. package/dist/{init-5M3XWOTJ.js → init-5ZDPHPWB.js} +2 -2
  64. package/dist/invoke-MB4SWBIE.js +24 -0
  65. package/dist/{list-FGDUU5DL.js → list-U4SUFIS7.js} +14 -14
  66. package/dist/{logout-KM5N5GOC.js → logout-M76LEHVP.js} +13 -13
  67. package/dist/{logs-TBUA4UWU.js → logs-H3RPKNTE.js} +3 -4
  68. package/dist/{mailbox-BMTZOSZ7.js → mailbox-O3MX6QPF.js} +3 -4
  69. package/dist/{mainline-KAD2ERLP.js → mainline-DG75NLBS.js} +306 -57
  70. package/dist/{mcp-FJ2UQ4RH.js → mcp-AXHV547W.js} +5 -5
  71. package/dist/{mcp-ND6ZQWJE.js → mcp-NSKAEV7J.js} +2 -2
  72. package/dist/{pause-7LILUVGL.js → pause-2HQ7CKMR.js} +3 -4
  73. package/dist/project/hook-adapter.d.ts +1 -1
  74. package/dist/{project-LZKQUV2W.js → project-FTXIKBML.js} +4 -4
  75. package/dist/{recovery-U6QB3PMT.js → recovery-54KHNJX4.js} +4 -3
  76. package/dist/{resume-26VFAAMH.js → resume-ETFTR5V3.js} +3 -4
  77. package/dist/{run-X4663F4M.js → run-UMHKF2GM.js} +4 -4
  78. package/dist/{run-YEVGHGTN.js → run-Y7NKULSP.js} +12 -12
  79. package/dist/{serve-S7MF42SS.js → serve-MRWTSSAU.js} +3 -3
  80. package/dist/setup-T6T2PFC4.js +20 -0
  81. package/dist/{start-login-GKFGTE2A.js → start-login-POISLJD2.js} +13 -13
  82. package/dist/{status-XG5GRWVU.js → status-GGDHOPSE.js} +21 -27
  83. package/dist/{status-RO55QPKV.js → status-GPSLH4VO.js} +3 -4
  84. package/dist/{status-FYG6XYQ6.js → status-XMATSURN.js} +13 -13
  85. package/dist/stdio.js +2 -2
  86. package/dist/{sweep-35LGQTTO.js → sweep-VY2TNOO5.js} +3 -4
  87. package/dist/{test-KFDO6ROC.js → test-ULKQY6FV.js} +51 -15
  88. package/dist/{tui-2MP7DRIX.js → tui-NGBCIBRW.js} +5 -5
  89. package/dist/{unbroadcast-5QNGAJR2.js → unbroadcast-RKTBP57G.js} +3 -4
  90. package/dist/{worker-3VS6RQEL.js → worker-Q7JWY6BR.js} +11 -10
  91. package/dist/{worktree-create-PZSRB7PH.js → worktree-create-NO4UOOEP.js} +2 -2
  92. package/dist/{worktree-list-JYB6VXLW.js → worktree-list-NEIDD66X.js} +4 -4
  93. package/dist/{worktree-sync-UF5CXPWV.js → worktree-sync-W4BDDLRO.js} +8 -9
  94. package/docs/commands.md +1 -1
  95. package/docs/git-workflow.md +58 -1
  96. package/docs/hooks.md +29 -0
  97. package/docs/project-configuration.md +15 -7
  98. package/docs/terminal-harness.md +14 -0
  99. package/gemini-extension.json +2 -2
  100. package/mcp.json +1 -1
  101. package/package.json +5 -5
  102. package/plugin.json +1 -1
  103. package/plugins/pmcp/.claude-plugin/plugin.json +1 -1
  104. package/plugins/pmcp/.mcp.json +1 -1
  105. package/plugins/pmcp/gemini-extension.json +2 -2
  106. package/plugins/pmcp/mcp.json +1 -1
  107. package/plugins/pmcp/plugin.json +1 -1
  108. package/dist/chunk-26WLNWDG.js +0 -93
  109. package/dist/chunk-AF2IBMWN.js +0 -7
  110. package/dist/invoke-SFSN4XT7.js +0 -23
  111. package/dist/setup-DTKZLZUT.js +0 -18
@@ -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
@@ -61,11 +61,11 @@ var completionSpec = {
61
61
  var COMMANDS = [
62
62
  {
63
63
  ...statusSpec,
64
- load: async () => (await import("./status-XG5GRWVU.js")).statusCommand
64
+ load: async () => (await import("./status-GGDHOPSE.js")).statusCommand
65
65
  },
66
- { ...initSpec, load: async () => (await import("./init-5M3XWOTJ.js")).initCommand },
67
- { ...hooksSpec, load: async () => (await import("./hooks-32AFBC3Z.js")).hooksCommand },
68
- { ...serveSpec, load: async () => (await import("./serve-S7MF42SS.js")).serveCommand },
66
+ { ...initSpec, load: async () => (await import("./init-5ZDPHPWB.js")).initCommand },
67
+ { ...hooksSpec, load: async () => (await import("./hooks-VQCLHXRZ.js")).hooksCommand },
68
+ { ...serveSpec, load: async () => (await import("./serve-MRWTSSAU.js")).serveCommand },
69
69
  { ...listSpec, load: async () => (await import("./list-FB6RNYYB.js")).listCommand },
70
70
  {
71
71
  ...indexSpec,
@@ -102,19 +102,19 @@ var COMMANDS = [
102
102
  { ...syncSpec, load: async () => (await import("./install-MQ7QSJQ7.js")).syncCommand },
103
103
  {
104
104
  ...projectSpec,
105
- load: async () => (await import("./project-LZKQUV2W.js")).projectCommand
105
+ load: async () => (await import("./project-FTXIKBML.js")).projectCommand
106
106
  },
107
107
  {
108
108
  ...doctorSpec,
109
- load: async () => (await import("./doctor-VSQ72A6X.js")).doctorCommand
109
+ load: async () => (await import("./doctor-UEXUOW5O.js")).doctorCommand
110
110
  },
111
111
  {
112
112
  ...sessionsSpec,
113
- load: async () => (await import("./cli-MI4ZCAZ3.js")).sessionsCommand
113
+ load: async () => (await import("./cli-T5LHBUY2.js")).sessionsCommand
114
114
  },
115
- { ...logsSpec, load: async () => (await import("./logs-TBUA4UWU.js")).logsCommand },
116
- { ...gitSpec, load: async () => (await import("./cli-ZN7ZVDEZ.js")).gitCommand },
117
- { ...mcpSpec, load: async () => (await import("./mcp-ND6ZQWJE.js")).mcpCommand },
115
+ { ...logsSpec, load: async () => (await import("./logs-H3RPKNTE.js")).logsCommand },
116
+ { ...gitSpec, load: async () => (await import("./cli-MUP2NSXT.js")).gitCommand },
117
+ { ...mcpSpec, load: async () => (await import("./mcp-NSKAEV7J.js")).mcpCommand },
118
118
  {
119
119
  ...validateSpec,
120
120
  load: async () => (await import("./validate-AVM2VHMM.js")).validateCommand
@@ -125,16 +125,16 @@ var COMMANDS = [
125
125
  },
126
126
  {
127
127
  ...harnessSpec,
128
- load: async () => (await import("./harness-XCEWFGCG.js")).harnessCommand
128
+ load: async () => (await import("./harness-32PERNQY.js")).harnessCommand
129
129
  },
130
- { ...tuiSpec, load: async () => (await import("./tui-2MP7DRIX.js")).tuiCommand },
130
+ { ...tuiSpec, load: async () => (await import("./tui-NGBCIBRW.js")).tuiCommand },
131
131
  {
132
132
  ...marketplaceSpec,
133
133
  load: async () => (await import("./marketplace-G4VQET5W.js")).marketplaceCommand
134
134
  },
135
135
  {
136
136
  ...completionSpec,
137
- load: async () => (await import("./completion-GYN7PX3T.js")).completionCommand
137
+ load: async () => (await import("./completion-CCK3LWVR.js")).completionCommand
138
138
  }
139
139
  ];
140
140
  var PLANNED = [];
@@ -148,4 +148,4 @@ export {
148
148
  PLANNED,
149
149
  commandNamed
150
150
  };
151
- //# sourceMappingURL=chunk-IIBB37JE.js.map
151
+ //# sourceMappingURL=chunk-UQNCBXXH.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-7DLZC73N.js";
4
4
  import {
5
5
  readSpec
6
- } from "./chunk-XJUNAVU2.js";
6
+ } from "./chunk-KHQQGBFJ.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-F5LEGPGP.js.map
31
+ //# sourceMappingURL=chunk-WJJ2KYE4.js.map
@@ -3,14 +3,77 @@ import {
3
3
  } from "./chunk-OEH47H6A.js";
4
4
  import {
5
5
  VERSION
6
- } from "./chunk-AF2IBMWN.js";
6
+ } from "./chunk-FGEBSQQJ.js";
7
7
  import {
8
8
  ConfigError
9
9
  } from "./chunk-QPL7E2HW.js";
10
+ import {
11
+ envNames
12
+ } from "./chunk-J6KL3COD.js";
13
+
14
+ // src/native/binary.ts
15
+ import { accessSync, constants, statSync } from "fs";
16
+ import { createRequire } from "module";
17
+ import { delimiter, dirname, join } from "path";
18
+ function executable(path) {
19
+ try {
20
+ accessSync(path, constants.X_OK);
21
+ return statSync(path).isFile();
22
+ } catch {
23
+ return false;
24
+ }
25
+ }
26
+ function packagedBinary(name, from = import.meta.url) {
27
+ const platform = `pmcp-${process.platform}-${process.arch}`;
28
+ let manifest;
29
+ try {
30
+ manifest = createRequire(from).resolve(
31
+ `@modootoday/${platform}/package.json`
32
+ );
33
+ } catch {
34
+ return { reason: `no @modootoday/${platform} package is installed` };
35
+ }
36
+ const path = join(dirname(manifest), "bin", name);
37
+ return executable(path) ? { path } : { reason: `@modootoday/${platform} has no ${name}` };
38
+ }
39
+ var BUILT = {
40
+ "linux-x64": ["pmcp-pty", "pmcp-tui", "pmcp-browser", "pmcp-desktop"],
41
+ "linux-arm64": ["pmcp-pty", "pmcp-tui", "pmcp-browser", "pmcp-desktop"],
42
+ "darwin-x64": ["pmcp-pty", "pmcp-tui"],
43
+ "darwin-arm64": ["pmcp-pty", "pmcp-tui"]
44
+ };
45
+ function missingBinary(name, variable, version, from = import.meta.url) {
46
+ const platform = `${process.platform}-${process.arch}`;
47
+ const pkg = `@modootoday/pmcp-${platform}@${version}`;
48
+ const own = `, or set ${variable} to a ${name} you built`;
49
+ if (!BUILT[platform]?.includes(name))
50
+ return `${name} is not built for ${platform}; set ${variable} to a ${name} you built`;
51
+ const found = packagedBinary(name, from);
52
+ if ("path" in found)
53
+ return `${name} at ${found.path} is not executable${own}`;
54
+ if (found.reason.startsWith("no "))
55
+ return `${name} not found: the platform package ${pkg} is not installed; reinstall @modootoday/pmcp (npm installs it as an optional dependency)${own}`;
56
+ return `${name} not found: ${found.reason}; reinstall @modootoday/pmcp${own}`;
57
+ }
58
+ function packaged(name) {
59
+ const found = packagedBinary(name);
60
+ return "path" in found ? found.path : null;
61
+ }
62
+ function nativeBinary(name, variable, env) {
63
+ const given = env[variable];
64
+ if (given) return executable(given) ? given : null;
65
+ const found = packaged(name);
66
+ if (found) return found;
67
+ for (const dir of (env["PATH"] ?? "").split(delimiter).filter(Boolean)) {
68
+ const candidate = join(dir, name);
69
+ if (executable(candidate)) return candidate;
70
+ }
71
+ return null;
72
+ }
10
73
 
11
74
  // src/project/projector.ts
12
75
  import { existsSync, mkdirSync, readFileSync, realpathSync } from "fs";
13
- import { join } from "path";
76
+ import { join as join2 } from "path";
14
77
 
15
78
  // src/project/write.ts
16
79
  import { randomUUID } from "crypto";
@@ -25,7 +88,7 @@ import {
25
88
  symlinkSync,
26
89
  writeFileSync
27
90
  } from "fs";
28
- import { dirname } from "path";
91
+ import { dirname as dirname2 } from "path";
29
92
  function fileMode(path) {
30
93
  try {
31
94
  const stat = lstatSync(path);
@@ -37,7 +100,7 @@ function fileMode(path) {
37
100
  }
38
101
  function syncDirectory(path) {
39
102
  if (process.platform === "win32") return;
40
- const descriptor = openSync(dirname(path), "r");
103
+ const descriptor = openSync(dirname2(path), "r");
41
104
  try {
42
105
  fsyncSync(descriptor);
43
106
  } finally {
@@ -77,7 +140,7 @@ function replaceLink(path, target) {
77
140
  var LOCK_VERSION_KEY = "pmcp_version";
78
141
  var PROJECTOR_FILE = "projector.json";
79
142
  function lockVersionProblem(root) {
80
- const path = join(root, "pmcp.lock");
143
+ const path = join2(root, "pmcp.lock");
81
144
  if (!existsSync(path)) return null;
82
145
  const lock = JSON.parse(readFileSync(path, "utf8"));
83
146
  const recorded = lock[LOCK_VERSION_KEY];
@@ -92,7 +155,7 @@ function recordProjector(spec, entry = process.argv[1]) {
92
155
  const cli = realpathSync(entry);
93
156
  if (!CLI_ENTRY.test(cli)) return;
94
157
  const dir = projectStateDir(spec.root, policy.stateDir);
95
- const file = join(dir, PROJECTOR_FILE);
158
+ const file = join2(dir, PROJECTOR_FILE);
96
159
  const known = existsSync(file) ? JSON.parse(readFileSync(file, "utf8")) : {};
97
160
  mkdirSync(dir, { recursive: true });
98
161
  replaceFile(
@@ -107,11 +170,11 @@ function recordProjector(spec, entry = process.argv[1]) {
107
170
  // src/project/apply/lock.ts
108
171
  import { createHash } from "crypto";
109
172
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
110
- import { join as join2 } from "path";
173
+ import { join as join3 } from "path";
111
174
  var LOCK_FILE = "pmcp.lock";
112
175
  var sha = (text2) => createHash("sha256").update(text2).digest("hex");
113
176
  function readLock(root) {
114
- const path = join2(root, LOCK_FILE);
177
+ const path = join3(root, LOCK_FILE);
115
178
  if (!existsSync2(path)) return [];
116
179
  const lock = JSON.parse(readFileSync2(path, "utf8"));
117
180
  return lock.outputs ?? [];
@@ -135,53 +198,12 @@ function lockEntry(output) {
135
198
  }
136
199
  function writeLock(root, outputs) {
137
200
  replaceFile(
138
- join2(root, LOCK_FILE),
201
+ join3(root, LOCK_FILE),
139
202
  `${JSON.stringify({ version: 1, [LOCK_VERSION_KEY]: VERSION, outputs: outputs.filter((output) => output.kind !== "json" || output.managed === void 0 || output.managed.length > 0).map(lockEntry) }, null, 2)}
140
203
  `
141
204
  );
142
205
  }
143
206
 
144
- // src/native/binary.ts
145
- import { accessSync, constants, statSync } from "fs";
146
- import { createRequire } from "module";
147
- import { delimiter, dirname as dirname2, join as join3 } from "path";
148
- function executable(path) {
149
- try {
150
- accessSync(path, constants.X_OK);
151
- return statSync(path).isFile();
152
- } catch {
153
- return false;
154
- }
155
- }
156
- function packagedBinary(name, from = import.meta.url) {
157
- const platform = `pmcp-${process.platform}-${process.arch}`;
158
- let manifest;
159
- try {
160
- manifest = createRequire(from).resolve(
161
- `@modootoday/${platform}/package.json`
162
- );
163
- } catch {
164
- return { reason: `no @modootoday/${platform} package is installed` };
165
- }
166
- const path = join3(dirname2(manifest), "bin", name);
167
- return executable(path) ? { path } : { reason: `@modootoday/${platform} has no ${name}` };
168
- }
169
- function packaged(name) {
170
- const found = packagedBinary(name);
171
- return "path" in found ? found.path : null;
172
- }
173
- function nativeBinary(name, variable, env) {
174
- const given = env[variable];
175
- if (given) return executable(given) ? given : null;
176
- const found = packaged(name);
177
- if (found) return found;
178
- for (const dir of (env["PATH"] ?? "").split(delimiter).filter(Boolean)) {
179
- const candidate = join3(dir, name);
180
- if (executable(candidate)) return candidate;
181
- }
182
- return null;
183
- }
184
-
185
207
  // src/project/host-spec.ts
186
208
  import { isAbsolute, normalize } from "path";
187
209
 
@@ -340,7 +362,8 @@ function session(path, i, value, roots) {
340
362
  "argv",
341
363
  "labels",
342
364
  "restart",
343
- "max_restarts"
365
+ "max_restarts",
366
+ "env"
344
367
  ]);
345
368
  const name = text(path, `${where} name`, t["name"]);
346
369
  if (!NAME2.test(name))
@@ -364,9 +387,17 @@ function session(path, i, value, roots) {
364
387
  argv,
365
388
  labels: labels(path, `${where} labels`, t["labels"]),
366
389
  restart,
367
- maxRestarts: max
390
+ maxRestarts: max,
391
+ env: names(path, `${where} env`, t["env"])
368
392
  };
369
393
  }
394
+ function names(path, where, value) {
395
+ try {
396
+ return envNames(value, where);
397
+ } catch (error) {
398
+ return fail2(path, error.message);
399
+ }
400
+ }
370
401
  function readHost(path, raw) {
371
402
  if (raw === void 0) return void 0;
372
403
  const root = table2(path, "[host]", raw);
@@ -392,11 +423,11 @@ function readHost(path, raw) {
392
423
  return value;
393
424
  };
394
425
  const sessions = list("sessions").map((s, i) => session(path, i, s, roots));
395
- const names = /* @__PURE__ */ new Set();
426
+ const names2 = /* @__PURE__ */ new Set();
396
427
  for (const s of sessions) {
397
- if (names.has(s.name))
428
+ if (names2.has(s.name))
398
429
  fail2(path, `[[host.sessions]] name ${s.name} is used twice`);
399
- names.add(s.name);
430
+ names2.add(s.name);
400
431
  }
401
432
  const answers = list("answers").map((a, i) => answer(path, i, a));
402
433
  const browser = readHostBrowser(path, root["browser"]);
@@ -406,6 +437,7 @@ function readHost(path, raw) {
406
437
 
407
438
  export {
408
439
  packagedBinary,
440
+ missingBinary,
409
441
  nativeBinary,
410
442
  replaceFile,
411
443
  replaceLink,
@@ -416,4 +448,4 @@ export {
416
448
  writeLock,
417
449
  readHost
418
450
  };
419
- //# sourceMappingURL=chunk-TAOOPXBV.js.map
451
+ //# sourceMappingURL=chunk-Y2MZ5RE3.js.map
@@ -11,23 +11,24 @@ import {
11
11
  async function action(positional) {
12
12
  const [verb, sub] = positional;
13
13
  if (verb === "deliver")
14
- return (await import("./mainline-KAD2ERLP.js")).mainlineDeliver;
15
- if (verb === "sync") return (await import("./mainline-KAD2ERLP.js")).mainlineSync;
14
+ return (await import("./mainline-DG75NLBS.js")).mainlineDeliver;
15
+ if (verb === "sync") return (await import("./mainline-DG75NLBS.js")).mainlineSync;
16
16
  if (verb !== "worktree")
17
17
  throw new ArgumentError("Use worktree, deliver or sync");
18
18
  if (sub === "create")
19
- return (await import("./worktree-create-PZSRB7PH.js")).worktreeCreate;
19
+ return (await import("./worktree-create-NO4UOOEP.js")).worktreeCreate;
20
20
  if (sub === "list")
21
- return (await import("./worktree-list-JYB6VXLW.js")).worktreeList;
21
+ return (await import("./worktree-list-NEIDD66X.js")).worktreeList;
22
22
  if (sub === "sync")
23
- return (await import("./worktree-sync-UF5CXPWV.js")).worktreeSync;
23
+ return (await import("./worktree-sync-W4BDDLRO.js")).worktreeSync;
24
24
  throw new ArgumentError("Use worktree create, list or sync");
25
25
  }
26
26
  async function run(context) {
27
- if (context.args.flags.has("json") && !(context.args.positional[0] === "worktree" && context.args.positional[1] === "list"))
28
- throw new ArgumentError("--json requires git worktree list");
27
+ const [verb, sub] = context.args.positional;
28
+ if (context.args.flags.has("json") && !(verb === "worktree" && sub === "list") && verb !== "deliver")
29
+ throw new ArgumentError("--json requires git worktree list or git deliver");
29
30
  const act = await action(context.args.positional);
30
- const { loadGit } = await import("./setup-DTKZLZUT.js");
31
+ const { loadGit } = await import("./setup-T6T2PFC4.js");
31
32
  const setup = loadGit(context.cwd, one(context.args, "config"), context.env);
32
33
  if (setup instanceof Error) {
33
34
  context.ui.error(setup.message);
@@ -43,4 +44,4 @@ var gitCommand = { ...gitSpec, run };
43
44
  export {
44
45
  gitCommand
45
46
  };
46
- //# sourceMappingURL=cli-ZN7ZVDEZ.js.map
47
+ //# sourceMappingURL=cli-MUP2NSXT.js.map
@@ -16,26 +16,26 @@ async function run(context) {
16
16
  `unknown verb ${verb}; use ${SESSION_VERBS.join(", ")}`
17
17
  );
18
18
  if (verb === "status")
19
- return (await import("./status-RO55QPKV.js")).status(context);
19
+ return (await import("./status-GPSLH4VO.js")).status(context);
20
20
  if (context.args.flags.has("json") && !JSON_VERBS.includes(verb))
21
21
  throw new ArgumentError(`--json works with ${JSON_VERBS.join(", ")}`);
22
22
  if (["send", "inbox", "ack", "reply"].includes(verb)) {
23
- const mailbox = await import("./mailbox-BMTZOSZ7.js");
23
+ const mailbox = await import("./mailbox-O3MX6QPF.js");
24
24
  if (verb === "send") return mailbox.send(context);
25
25
  if (verb === "inbox") return mailbox.inbox(context);
26
26
  if (verb === "ack") return mailbox.ack(context);
27
27
  return mailbox.reply(context);
28
28
  }
29
- if (verb === "pause") return (await import("./pause-7LILUVGL.js")).run(context);
30
- if (verb === "resume") return (await import("./resume-26VFAAMH.js")).run(context);
29
+ if (verb === "pause") return (await import("./pause-2HQ7CKMR.js")).run(context);
30
+ if (verb === "resume") return (await import("./resume-ETFTR5V3.js")).run(context);
31
31
  if (verb === "broadcast")
32
- return (await import("./broadcast-CBMVOV3G.js")).run(context);
32
+ return (await import("./broadcast-56NPEJWM.js")).run(context);
33
33
  if (verb === "unbroadcast")
34
- return (await import("./unbroadcast-5QNGAJR2.js")).run(context);
35
- return (await import("./sweep-35LGQTTO.js")).run(context);
34
+ return (await import("./unbroadcast-RKTBP57G.js")).run(context);
35
+ return (await import("./sweep-VY2TNOO5.js")).run(context);
36
36
  }
37
37
  var sessionsCommand = { ...sessionsSpec, run };
38
38
  export {
39
39
  sessionsCommand
40
40
  };
41
- //# sourceMappingURL=cli-MI4ZCAZ3.js.map
41
+ //# sourceMappingURL=cli-T5LHBUY2.js.map
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  COMMANDS,
4
4
  PLANNED,
5
5
  commandNamed
6
- } from "./chunk-IIBB37JE.js";
6
+ } from "./chunk-UQNCBXXH.js";
7
7
  import "./chunk-2P4Z2NUX.js";
8
8
  import "./chunk-3Y3HDMHA.js";
9
9
  import {
@@ -32,7 +32,7 @@ import {
32
32
  import "./chunk-V4NPDK6X.js";
33
33
  import {
34
34
  VERSION
35
- } from "./chunk-AF2IBMWN.js";
35
+ } from "./chunk-FGEBSQQJ.js";
36
36
 
37
37
  // src/cli/ui.ts
38
38
  var ESC = String.fromCharCode(27);
@@ -185,7 +185,7 @@ async function defaultEntry(options, context) {
185
185
  });
186
186
  if (mode === "server") return run(required("serve"), [], context);
187
187
  if (mode === "terminal") {
188
- const { terminalSupport } = await import("./host-TE5PNDHJ.js");
188
+ const { terminalSupport } = await import("./host-4WNPLAD5.js");
189
189
  const support = terminalSupport();
190
190
  if (support.supported) return run(required("tui"), [], context);
191
191
  context.ui.info(`Terminal workspace unavailable: ${support.reason}`);
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  COMMANDS,
3
3
  completionSpec
4
- } from "./chunk-IIBB37JE.js";
4
+ } from "./chunk-UQNCBXXH.js";
5
5
  import "./chunk-2P4Z2NUX.js";
6
6
  import "./chunk-3Y3HDMHA.js";
7
7
  import "./chunk-E3DQB5LS.js";
@@ -139,4 +139,4 @@ var completionCommand = {
139
139
  export {
140
140
  completionCommand
141
141
  };
142
- //# sourceMappingURL=completion-GYN7PX3T.js.map
142
+ //# sourceMappingURL=completion-CCK3LWVR.js.map
@@ -1,23 +1,28 @@
1
1
  import {
2
2
  dependencies
3
- } from "./chunk-WM2RF2MI.js";
3
+ } from "./chunk-NLKAEKSG.js";
4
4
  import {
5
5
  assertNativeHost
6
- } from "./chunk-HFE4QDJQ.js";
6
+ } from "./chunk-HEPSITZX.js";
7
7
  import {
8
8
  locateExecutable
9
9
  } from "./chunk-R2GPCZUX.js";
10
10
  import "./chunk-34DECPVC.js";
11
- import "./chunk-2RTRY45B.js";
12
- import "./chunk-TAOOPXBV.js";
11
+ import "./chunk-QJRJCXX2.js";
12
+ import {
13
+ missingBinary
14
+ } from "./chunk-Y2MZ5RE3.js";
13
15
  import "./chunk-OEH47H6A.js";
14
16
  import "./chunk-IJBSOWHK.js";
15
- import "./chunk-AF2IBMWN.js";
17
+ import {
18
+ VERSION
19
+ } from "./chunk-FGEBSQQJ.js";
16
20
  import "./chunk-QPL7E2HW.js";
17
21
  import "./chunk-PMJG2CXF.js";
18
22
  import {
19
23
  runtimeExecutables
20
24
  } from "./chunk-BU65MNVU.js";
25
+ import "./chunk-J6KL3COD.js";
21
26
 
22
27
  // src/tui/startup/diagnostics.ts
23
28
  function remediation(tools, userManagerAvailable) {
@@ -27,13 +32,9 @@ function remediation(tools, userManagerAvailable) {
27
32
  "Use Linux or macOS for the terminal workspace. Other PMCP CLI features do not require this host profile."
28
33
  );
29
34
  if (!tools.pmcpPty)
30
- steps.push(
31
- "Build or install pmcp-pty and set PMCP_PTY_BIN to it, or put it on PATH."
32
- );
35
+ steps.push(`${missingBinary("pmcp-pty", "PMCP_PTY_BIN", VERSION)}.`);
33
36
  if (!tools.pmcpTui)
34
- steps.push(
35
- "Build or install pmcp-tui and set PMCP_TUI_BIN to it, or put it on PATH."
36
- );
37
+ steps.push(`${missingBinary("pmcp-tui", "PMCP_TUI_BIN", VERSION)}.`);
37
38
  if (tools.platform === "linux" && !(tools.systemctl && tools.systemdRun))
38
39
  steps.push(
39
40
  "Install systemd's systemctl and systemd-run for your distribution and add them to PATH."
@@ -90,4 +91,4 @@ function inspectTerminalHost() {
90
91
  export {
91
92
  inspectTerminalHost
92
93
  };
93
- //# sourceMappingURL=diagnostics-WACXQ33W.js.map
94
+ //# sourceMappingURL=diagnostics-6WON3VMZ.js.map