@modootoday/pmcp 0.18.4 → 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 (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-JVLYYXAG.js} +16 -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-YSUINA5Q.js → chunk-3O3FS6KM.js} +8 -8
  9. package/dist/{chunk-6UXJ62XJ.js → chunk-3TG3KVHZ.js} +3 -3
  10. package/dist/{chunk-LGO2SZAS.js → chunk-47ZGCZQA.js} +2 -2
  11. package/dist/{chunk-TFRJ5QOS.js → chunk-4LV7KDTS.js} +3 -3
  12. package/dist/{chunk-DAR6RGRN.js → chunk-6MZTOC6H.js} +2 -2
  13. package/dist/{chunk-LFR245MZ.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-4JUSGIMX.js → chunk-HEPSITZX.js} +2 -2
  20. package/dist/{chunk-YRGDWUFY.js → chunk-IEK4U5RR.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-GZHHEHKY.js → chunk-JJBSYUSQ.js} +19 -7
  24. package/dist/{chunk-45Y3KZ3Q.js → chunk-KHQQGBFJ.js} +87 -20
  25. package/dist/{chunk-XMXBE5IQ.js → chunk-LCENQ6JR.js} +5 -5
  26. package/dist/{chunk-HE2C2S5A.js → chunk-NLKAEKSG.js} +3 -3
  27. package/dist/{chunk-ARA4VDHD.js → chunk-OHW3A7Z3.js} +2 -2
  28. package/dist/{chunk-ZWLUH3F2.js → chunk-PFWTGEZJ.js} +2 -2
  29. package/dist/{chunk-3CA3NNVH.js → chunk-Q3GLKL4B.js} +5 -5
  30. package/dist/{chunk-MSOZPOPX.js → chunk-QJRJCXX2.js} +7 -3
  31. package/dist/{chunk-R26RWSFW.js → chunk-QXRD7N35.js} +2 -2
  32. package/dist/{chunk-OB3P5RMN.js → chunk-TPLV2YX2.js} +2 -2
  33. package/dist/{chunk-XELAZAIM.js → chunk-UD3BEEBQ.js} +54 -12
  34. package/dist/{chunk-EAWPJHJ7.js → chunk-UGODVKBJ.js} +2 -2
  35. package/dist/{chunk-QBJC4DRP.js → chunk-UQNCBXXH.js} +14 -14
  36. package/dist/{chunk-VQ2HEGWH.js → chunk-WJJ2KYE4.js} +2 -2
  37. package/dist/{chunk-FBIDDE3N.js → chunk-Y2MZ5RE3.js} +71 -51
  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-CCK3LWVR.js} +2 -2
  42. package/dist/{diagnostics-ADIVFSBW.js → diagnostics-6WON3VMZ.js} +12 -12
  43. package/dist/{doctor-BBCS4DF5.js → doctor-UEXUOW5O.js} +18 -19
  44. package/dist/{entry-DMOTX4SS.js → entry-GMC6LRO2.js} +10 -10
  45. package/dist/{exec-mcp-OBUM3DVW.js → exec-mcp-FS7IPXNC.js} +13 -14
  46. package/dist/{harness-6AUE3I4Q.js → harness-32PERNQY.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-VQCLHXRZ.js} +3 -3
  52. package/dist/{host-LGSWU3PJ.js → host-4WNPLAD5.js} +7 -7
  53. package/dist/{host-5Q3X6OY7.js → host-ED3XRUNM.js} +15 -16
  54. package/dist/{host-run-4NMQQASQ.js → host-run-PNY6NAYW.js} +10 -6
  55. package/dist/http.js +1 -1
  56. package/dist/{import-mcp-WU7TO2RT.js → import-mcp-WEUY6IVK.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-5ZDPHPWB.js} +2 -2
  60. package/dist/{invoke-CYQZYU5T.js → invoke-MB4SWBIE.js} +8 -8
  61. package/dist/{list-FNGXY5D7.js → list-U4SUFIS7.js} +13 -14
  62. package/dist/{logout-N753FBZP.js → logout-M76LEHVP.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-NSKAEV7J.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-FTXIKBML.js} +4 -4
  70. package/dist/{resume-26VFAAMH.js → resume-ETFTR5V3.js} +3 -4
  71. package/dist/{run-7XNGPU2I.js → run-UMHKF2GM.js} +4 -4
  72. package/dist/{run-MDRUOEFL.js → run-Y7NKULSP.js} +11 -12
  73. package/dist/{serve-HXHNWKEK.js → serve-MRWTSSAU.js} +3 -3
  74. package/dist/setup-T6T2PFC4.js +20 -0
  75. package/dist/{start-login-PWCEKNED.js → start-login-POISLJD2.js} +12 -13
  76. package/dist/{status-QFOBQ42J.js → status-GGDHOPSE.js} +20 -27
  77. package/dist/{status-RO55QPKV.js → status-GPSLH4VO.js} +3 -4
  78. package/dist/{status-54IYX2FN.js → status-XMATSURN.js} +12 -13
  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-ULKQY6FV.js} +50 -15
  82. package/dist/{tui-CSRW4DN2.js → tui-NGBCIBRW.js} +4 -4
  83. package/dist/{unbroadcast-5QNGAJR2.js → unbroadcast-RKTBP57G.js} +3 -4
  84. package/dist/{worker-EODWT4KK.js → worker-Q7JWY6BR.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
@@ -3,16 +3,16 @@ import {
3
3
  } from "./chunk-HQOB7OQS.js";
4
4
  import {
5
5
  readGitConfig
6
- } from "./chunk-S3PIAMXV.js";
6
+ } from "./chunk-J5XQW2CM.js";
7
7
  import {
8
8
  detect
9
- } from "./chunk-JS5RTH4I.js";
9
+ } from "./chunk-2Q6MNGU5.js";
10
10
  import {
11
11
  syncWorktree
12
- } from "./chunk-DCU2EXQV.js";
12
+ } from "./chunk-D5D3V6RU.js";
13
13
  import {
14
14
  gitText
15
- } from "./chunk-OPYFEHKG.js";
15
+ } from "./chunk-G7JONWL4.js";
16
16
  import {
17
17
  localCli,
18
18
  pmcpCommand,
@@ -25,13 +25,11 @@ import {
25
25
  ptyFields,
26
26
  ptyRef
27
27
  } from "./chunk-3PW4FI7U.js";
28
- import {
29
- readStoreSettings
30
- } from "./chunk-26WLNWDG.js";
31
28
  import {
32
29
  inboxKey,
33
- noticeOf
34
- } from "./chunk-LTZH5E3G.js";
30
+ noticeOf,
31
+ readStoreSettings
32
+ } from "./chunk-DHAPQUEF.js";
35
33
  import {
36
34
  STATE_FILES,
37
35
  leaseFile,
@@ -47,7 +45,7 @@ import {
47
45
  packagedBinary,
48
46
  readHost,
49
47
  readLock
50
- } from "./chunk-FBIDDE3N.js";
48
+ } from "./chunk-Y2MZ5RE3.js";
51
49
  import {
52
50
  checkoutOf,
53
51
  hasLinkedWorktrees
@@ -2633,7 +2631,7 @@ var leases = {
2633
2631
  options(raw) {
2634
2632
  return Object.entries(raw).map(([name, value]) => {
2635
2633
  const table3 = value ?? {};
2636
- onlyKeys(table3, ["path", "blocks"]);
2634
+ onlyKeys(table3, ["path", "blocks", "file", "events"]);
2637
2635
  if (table3["path"] !== void 0 && typeof table3["path"] !== "string")
2638
2636
  throw new Error(`${name}.path must be a string`);
2639
2637
  return {
@@ -3825,6 +3823,7 @@ var POLICIES = {
3825
3823
 
3826
3824
  // src/hooks/compile/bindings.ts
3827
3825
  var BASE_TIMEOUT_SEC = 10;
3826
+ var STARTUP_MS = 3e3;
3828
3827
  function listening(policy, options2) {
3829
3828
  const events = policy.eventsFor ? policy.eventsFor(policy.options(options2)) : policy.events;
3830
3829
  return { events, tools: policy.tools };
@@ -3849,8 +3848,15 @@ function bindingsFor(policy, id) {
3849
3848
  want(event, listener.tools ?? ["other"]);
3850
3849
  }
3851
3850
  if (policy.emergencyOffFile) want("before_tool", ["shell", "edit"]);
3852
- const slowest = Math.max(0, ...policy.custom.map((entry) => entry.timeoutMs));
3853
- const timeoutSec = Math.max(BASE_TIMEOUT_SEC, Math.ceil(slowest / 1e3) + 2);
3851
+ const tries = policy.failure ? policy.failure.timeoutMs * (policy.failure.retry + 1) : 0;
3852
+ const slowest = Math.max(
3853
+ tries,
3854
+ ...policy.custom.map((entry) => entry.timeoutMs)
3855
+ );
3856
+ const timeoutSec = Math.max(
3857
+ BASE_TIMEOUT_SEC,
3858
+ Math.ceil((slowest + STARTUP_MS) / 1e3)
3859
+ );
3854
3860
  return [...wanted].flatMap(
3855
3861
  ([event, tools]) => adapter.bindings(event, [...tools], timeoutSec)
3856
3862
  );
@@ -4044,6 +4050,59 @@ function readChecks(raw) {
4044
4050
  });
4045
4051
  }
4046
4052
 
4053
+ // src/hooks/dispatch/failure.ts
4054
+ import { isAbsolute as isAbsolute11, relative as relative6, resolve as resolve13 } from "path";
4055
+ var PASS_KINDS = ["read", "edit-own-worktree"];
4056
+ function readFailure(value) {
4057
+ if (value === void 0) return void 0;
4058
+ if (value === null || typeof value !== "object" || Array.isArray(value))
4059
+ throw new Error("[hooks.failure] must be a table");
4060
+ const table3 = value;
4061
+ for (const key of Object.keys(table3))
4062
+ if (!["timeout_ms", "retry", "pass"].includes(key))
4063
+ throw new Error(`[hooks.failure] unknown key ${key}`);
4064
+ const integer = (key, fallback3, min, max) => {
4065
+ const v = table3[key] ?? fallback3;
4066
+ if (typeof v !== "number" || !Number.isInteger(v) || v < min || v > max)
4067
+ throw new Error(
4068
+ `[hooks.failure] ${key} must be an integer from ${min} to ${max}`
4069
+ );
4070
+ return v;
4071
+ };
4072
+ const pass2 = table3["pass"] ?? [];
4073
+ if (!Array.isArray(pass2) || !pass2.every((kind) => PASS_KINDS.includes(kind)))
4074
+ throw new Error(
4075
+ `[hooks.failure] pass must list ${PASS_KINDS.join(" or ")}`
4076
+ );
4077
+ return {
4078
+ timeoutMs: integer("timeout_ms", 2e3, 100, 6e4),
4079
+ retry: integer("retry", 1, 0, 3),
4080
+ pass: [...new Set(pass2)]
4081
+ };
4082
+ }
4083
+ function ownWorktree(input) {
4084
+ const checkout = checkoutOf(input.cwd);
4085
+ if (!checkout || checkout.main) return false;
4086
+ const paths = input.tool?.paths ?? [];
4087
+ return paths.length > 0 && paths.every((path) => {
4088
+ const rest = relative6(checkout.root, resolve13(input.cwd, path));
4089
+ return rest !== "" && !rest.startsWith("..") && !isAbsolute11(rest);
4090
+ });
4091
+ }
4092
+ function passes(input, pass2) {
4093
+ const kind = input.tool?.kind;
4094
+ if (kind === "read") return pass2.includes("read");
4095
+ if (kind === "edit")
4096
+ return pass2.includes("edit-own-worktree") && ownWorktree(input);
4097
+ return false;
4098
+ }
4099
+ function afterFailure(policy, cause, input, failure) {
4100
+ const head = `pmcp hooks: ${policy} failed (${cause})`;
4101
+ if (passes(input, failure.pass))
4102
+ return { context: [`${head}; passed with a warning`] };
4103
+ return { verdict: "deny", reason: `${head}; refused` };
4104
+ }
4105
+
4047
4106
  // src/hooks/compile/hooks-table.ts
4048
4107
  var KEYS2 = [
4049
4108
  "targets",
@@ -4053,7 +4112,8 @@ var KEYS2 = [
4053
4112
  "guards",
4054
4113
  "checks",
4055
4114
  "shell",
4056
- "edit"
4115
+ "edit",
4116
+ "failure"
4057
4117
  ];
4058
4118
  var LEGACY = /* @__PURE__ */ new Set(["shell", "edit"]);
4059
4119
  var FALLBACKS = ["deny", "warn", "refuse"];
@@ -4093,13 +4153,15 @@ function readHooksTable(table3, tools) {
4093
4153
  }
4094
4154
  const log = errorLog(table3["error_log"]);
4095
4155
  const emergencyOffFile = offFile(table3["emergency_off_file"]);
4156
+ const failure = readFailure(table3["failure"]);
4096
4157
  return {
4097
4158
  enabled,
4098
4159
  targets: [...new Set(targets)],
4099
4160
  askFallback,
4100
4161
  logEnabled: log.enabled,
4101
4162
  ...log.file ? { errorLog: log.file } : {},
4102
- ...emergencyOffFile ? { emergencyOffFile } : {}
4163
+ ...emergencyOffFile ? { emergencyOffFile } : {},
4164
+ ...failure ? { failure } : {}
4103
4165
  };
4104
4166
  }
4105
4167
 
@@ -4141,11 +4203,11 @@ function registryCheck(raw) {
4141
4203
  const unknown = Object.keys(rest).find((key) => key !== "stale_minutes");
4142
4204
  if (unknown) throw new Error(`[sessions.registry] unknown key ${unknown}`);
4143
4205
  }
4144
- function readSessions(raw) {
4206
+ function readSessions(raw, git) {
4145
4207
  const table3 = asTable(raw, "[sessions]");
4146
4208
  const unknown = Object.keys(table3).find((key) => !KEYS3.includes(key));
4147
4209
  if (unknown) throw new Error(`[sessions] unknown key ${unknown}`);
4148
- const settings = readStoreSettings(raw);
4210
+ const settings = readStoreSettings(raw, git);
4149
4211
  registryCheck(table3["registry"]);
4150
4212
  const guards = [];
4151
4213
  if (table3["registry"] !== void 0)
@@ -4295,7 +4357,7 @@ function compileHooks(tables, options2) {
4295
4357
  const table3 = readHooksTable(hooks, options2.tools);
4296
4358
  const guardsTable = asTable(hooks["guards"], "[hooks.guards]");
4297
4359
  const entries = readCustom(options2.root, hooks, guardsTable);
4298
- const sessions = readSessions(tables.sessions);
4360
+ const sessions = readSessions(tables.sessions, tables.git);
4299
4361
  const workspace = readWorkspace(tables.git, options2.root);
4300
4362
  const deskSync = readWorktreeSync(tables, options2.root);
4301
4363
  const directPush = readMainlineDeliver(tables, options2.root);
@@ -4327,6 +4389,7 @@ function compileHooks(tables, options2) {
4327
4389
  contract: 2,
4328
4390
  targets: table3.targets,
4329
4391
  ...table3.emergencyOffFile ? { emergencyOffFile: table3.emergencyOffFile } : {},
4392
+ ...table3.failure ? { failure: table3.failure } : {},
4330
4393
  ...sessions.stateDir ? { stateDir: sessions.stateDir } : {},
4331
4394
  ...table3.errorLog ? { logFile: table3.errorLog } : {},
4332
4395
  log: { ...readLoggingTable(tables.logging), enabled: table3.logEnabled },
@@ -4334,7 +4397,10 @@ function compileHooks(tables, options2) {
4334
4397
  staleMs: sessions.staleMs,
4335
4398
  keepBroadcasts: sessions.keepBroadcasts,
4336
4399
  // Only when on, so projects without a mailbox keep the same policy.json and hash.
4337
- ...sessions.mailbox?.enabled ? { mailbox: sessions.mailbox } : {}
4400
+ ...sessions.mailbox?.enabled ? { mailbox: sessions.mailbox } : {},
4401
+ // Only when declared, like the mailbox, so other projects keep the same policy.json.
4402
+ ...sessions.leaseFiles ? { leaseFiles: sessions.leaseFiles } : {},
4403
+ ...sessions.gate ? { gate: sessions.gate } : {}
4338
4404
  },
4339
4405
  guards,
4340
4406
  custom: pinnedEntries(options2.root, entries, table3.targets),
@@ -4976,6 +5042,7 @@ export {
4976
5042
  climbCommand,
4977
5043
  RUNTIMES,
4978
5044
  NATIVE_HOOK_FILES,
5045
+ afterFailure,
4979
5046
  uiClaudeOutputs,
4980
5047
  uiClaudeDoctor,
4981
5048
  linkOf,
@@ -5002,4 +5069,4 @@ export {
5002
5069
  permissionDoctor,
5003
5070
  readSpec
5004
5071
  };
5005
- //# sourceMappingURL=chunk-45Y3KZ3Q.js.map
5072
+ //# sourceMappingURL=chunk-KHQQGBFJ.js.map
@@ -7,20 +7,20 @@ import {
7
7
  observeSession,
8
8
  openGroup,
9
9
  runOperation
10
- } from "./chunk-TFRJ5QOS.js";
10
+ } from "./chunk-4LV7KDTS.js";
11
11
  import {
12
12
  nativeHostTools
13
- } from "./chunk-4JUSGIMX.js";
13
+ } from "./chunk-HEPSITZX.js";
14
14
  import {
15
15
  locateExecutable
16
16
  } from "./chunk-R2GPCZUX.js";
17
17
  import {
18
18
  artifact,
19
19
  stateDirectory
20
- } from "./chunk-LGO2SZAS.js";
20
+ } from "./chunk-47ZGCZQA.js";
21
21
  import {
22
22
  ptyBinary
23
- } from "./chunk-MSOZPOPX.js";
23
+ } from "./chunk-QJRJCXX2.js";
24
24
  import {
25
25
  GroupStore,
26
26
  privateJson
@@ -249,4 +249,4 @@ async function invoke(operation) {
249
249
  export {
250
250
  invoke
251
251
  };
252
- //# sourceMappingURL=chunk-XMXBE5IQ.js.map
252
+ //# sourceMappingURL=chunk-LCENQ6JR.js.map
@@ -6,10 +6,10 @@ import {
6
6
  } from "./chunk-34DECPVC.js";
7
7
  import {
8
8
  ptyBinary
9
- } from "./chunk-MSOZPOPX.js";
9
+ } from "./chunk-QJRJCXX2.js";
10
10
  import {
11
11
  nativeBinary
12
- } from "./chunk-FBIDDE3N.js";
12
+ } from "./chunk-Y2MZ5RE3.js";
13
13
 
14
14
  // src/tui/rust.ts
15
15
  import { spawn } from "child_process";
@@ -64,4 +64,4 @@ export {
64
64
  runTui,
65
65
  dependencies
66
66
  };
67
- //# sourceMappingURL=chunk-HE2C2S5A.js.map
67
+ //# sourceMappingURL=chunk-NLKAEKSG.js.map
@@ -1190,7 +1190,7 @@ function registerReadTool(server, tools) {
1190
1190
 
1191
1191
  // src/mcp.ts
1192
1192
  var SERVER_NAME = "pmcp";
1193
- var SERVER_VERSION = "0.18.4";
1193
+ var SERVER_VERSION = "0.19.0";
1194
1194
  function registerSkillTools(server, tools) {
1195
1195
  registerCatalogTool(server, tools);
1196
1196
  registerFindTool(server, tools);
@@ -1243,4 +1243,4 @@ export {
1243
1243
  registerSkillTools,
1244
1244
  createSkillServer
1245
1245
  };
1246
- //# sourceMappingURL=chunk-ARA4VDHD.js.map
1246
+ //# sourceMappingURL=chunk-OHW3A7Z3.js.map
@@ -5,7 +5,7 @@ import {
5
5
  POLICIES,
6
6
  RUNTIMES,
7
7
  customPolicy
8
- } from "./chunk-45Y3KZ3Q.js";
8
+ } from "./chunk-KHQQGBFJ.js";
9
9
 
10
10
  // src/hooks/inspection/list.ts
11
11
  function policyRows(compiled) {
@@ -39,4 +39,4 @@ function policyRows(compiled) {
39
39
  export {
40
40
  policyRows
41
41
  };
42
- //# sourceMappingURL=chunk-ZWLUH3F2.js.map
42
+ //# sourceMappingURL=chunk-PFWTGEZJ.js.map
@@ -8,10 +8,10 @@ import {
8
8
  prepare,
9
9
  present,
10
10
  writeNative
11
- } from "./chunk-LFR245MZ.js";
11
+ } from "./chunk-CYQIAEQT.js";
12
12
  import {
13
13
  ANTIGRAVITY_MCP_PLUGIN
14
- } from "./chunk-R26RWSFW.js";
14
+ } from "./chunk-QXRD7N35.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-KHQQGBFJ.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-Y2MZ5RE3.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-Q3GLKL4B.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-Y2MZ5RE3.js";
6
+ import {
7
+ VERSION
8
+ } from "./chunk-FGEBSQQJ.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-QJRJCXX2.js.map
@@ -2,7 +2,7 @@ import {
2
2
  MARK,
3
3
  blockOutput,
4
4
  jsonOutput
5
- } from "./chunk-45Y3KZ3Q.js";
5
+ } from "./chunk-KHQQGBFJ.js";
6
6
  import {
7
7
  ProjectError
8
8
  } from "./chunk-NRBQK6UX.js";
@@ -393,4 +393,4 @@ export {
393
393
  serversForTool,
394
394
  mcpOutputs
395
395
  };
396
- //# sourceMappingURL=chunk-R26RWSFW.js.map
396
+ //# sourceMappingURL=chunk-QXRD7N35.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createSkillServer
3
- } from "./chunk-ARA4VDHD.js";
3
+ } from "./chunk-OHW3A7Z3.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-TPLV2YX2.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
@@ -61,11 +61,11 @@ var completionSpec = {
61
61
  var COMMANDS = [
62
62
  {
63
63
  ...statusSpec,
64
- load: async () => (await import("./status-QFOBQ42J.js")).statusCommand
64
+ load: async () => (await import("./status-GGDHOPSE.js")).statusCommand
65
65
  },
66
- { ...initSpec, load: async () => (await import("./init-XA6XXLGA.js")).initCommand },
67
- { ...hooksSpec, load: async () => (await import("./hooks-HLPQPVRY.js")).hooksCommand },
68
- { ...serveSpec, load: async () => (await import("./serve-HXHNWKEK.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-OEBACWEX.js")).projectCommand
105
+ load: async () => (await import("./project-FTXIKBML.js")).projectCommand
106
106
  },
107
107
  {
108
108
  ...doctorSpec,
109
- load: async () => (await import("./doctor-BBCS4DF5.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-GR4VXKTG.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-6AUE3I4Q.js")).harnessCommand
128
+ load: async () => (await import("./harness-32PERNQY.js")).harnessCommand
129
129
  },
130
- { ...tuiSpec, load: async () => (await import("./tui-CSRW4DN2.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-WYJAKJE4.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-QBJC4DRP.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-45Y3KZ3Q.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-VQ2HEGWH.js.map
31
+ //# sourceMappingURL=chunk-WJJ2KYE4.js.map