@modootoday/pmcp 0.19.8 → 0.20.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 (133) 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-6OEABVQT.js → apply-QJ6MGLBX.js} +17 -17
  6. package/dist/{attachment-D84OGI6n.d.ts → attachment-ms6s8Aow.d.ts} +1 -1
  7. package/dist/{available-GFMTJW4E.js → available-HYSDAFYH.js} +4 -4
  8. package/dist/{broadcast-56NPEJWM.js → broadcast-LYOA6BEW.js} +5 -5
  9. package/dist/{chunk-44YE6B63.js → chunk-4VK5G3SV.js} +3 -3
  10. package/dist/{chunk-7B2KRL2H.js → chunk-5JPD6VIH.js} +74 -7
  11. package/dist/{chunk-42RFOVU3.js → chunk-66F3HLW4.js} +17 -5
  12. package/dist/{chunk-CVZEVTTX.js → chunk-7SDOSTW7.js} +3 -3
  13. package/dist/{chunk-6U623E6Y.js → chunk-AWZF72SH.js} +6 -6
  14. package/dist/{chunk-J5ZS7GLA.js → chunk-C3G75JH7.js} +2 -2
  15. package/dist/{chunk-PTDMSVKS.js → chunk-CQZYQAAV.js} +3 -3
  16. package/dist/{chunk-SRX2ONSZ.js → chunk-EKPMVEIA.js} +2 -2
  17. package/dist/{chunk-GXACIGVS.js → chunk-FD6VGFYZ.js} +5 -5
  18. package/dist/chunk-FGYFA6JY.js +7 -0
  19. package/dist/{chunk-RXKX33WU.js → chunk-FQAJSNNU.js} +3 -3
  20. package/dist/{chunk-QPL7E2HW.js → chunk-GJXOFDJT.js} +9 -2
  21. package/dist/{chunk-JZK7ZO7K.js → chunk-I4U2A6HP.js} +2 -2
  22. package/dist/{chunk-UGODVKBJ.js → chunk-IQD4W53M.js} +2 -2
  23. package/dist/{chunk-TFZLX66B.js → chunk-IZABPDAO.js} +2 -2
  24. package/dist/{chunk-VHTRCE5G.js → chunk-J6HNP6HA.js} +3 -3
  25. package/dist/{chunk-QXDD75DY.js → chunk-JBHGJKSL.js} +3 -3
  26. package/dist/{chunk-NWOV2E26.js → chunk-JZKAJUVT.js} +2 -2
  27. package/dist/{chunk-VUSA7POL.js → chunk-K2C3KFGB.js} +9 -9
  28. package/dist/{chunk-TLIOBOZ2.js → chunk-L4MFGGSI.js} +2 -2
  29. package/dist/{chunk-XP2U3LO3.js → chunk-M2RYXWX2.js} +2 -2
  30. package/dist/{chunk-LJL4L73I.js → chunk-MZEMLFFD.js} +3 -3
  31. package/dist/{chunk-6QM5OWGZ.js → chunk-O2JWF7ZM.js} +2 -2
  32. package/dist/{chunk-SHZPE6FD.js → chunk-OAIQ7A3R.js} +5 -5
  33. package/dist/{chunk-3PW4FI7U.js → chunk-ONP6JRFZ.js} +2 -2
  34. package/dist/{chunk-HEBCQTOD.js → chunk-PEMMV5YQ.js} +2 -2
  35. package/dist/{chunk-DHAPQUEF.js → chunk-PQTM27GU.js} +32 -15
  36. package/dist/{chunk-7B6IC3F7.js → chunk-PUIWESU3.js} +3 -3
  37. package/dist/{chunk-P4424VLT.js → chunk-QDY6BWE6.js} +2 -2
  38. package/dist/{chunk-3CYQWRGM.js → chunk-QOFSPFJ6.js} +351 -86
  39. package/dist/{chunk-C4NHQGHL.js → chunk-QSIADSMQ.js} +13 -2
  40. package/dist/{chunk-E4FJOLPJ.js → chunk-QYH2NR6G.js} +3 -3
  41. package/dist/{chunk-XLXDXJY2.js → chunk-RBNMNKNN.js} +5 -5
  42. package/dist/{chunk-ZYSALKKW.js → chunk-RMHZFWHF.js} +21 -21
  43. package/dist/{chunk-7DLZC73N.js → chunk-RPCIROW7.js} +2 -2
  44. package/dist/{chunk-CTA7255D.js → chunk-YDICIB2A.js} +2 -2
  45. package/dist/{chunk-HEWZ6INU.js → chunk-YOWIYFIV.js} +27 -41
  46. package/dist/{claude-U2JC2DNQ.js → claude-GT2BPXEL.js} +3 -3
  47. package/dist/{cli-UFCFDIVI.js → cli-6HTAJ54L.js} +5 -5
  48. package/dist/{cli-BTPTJWCC.js → cli-IV5DJCXU.js} +8 -8
  49. package/dist/cli.js +3 -3
  50. package/dist/{completion-UI4IOYXY.js → completion-PPM7MEI2.js} +2 -2
  51. package/dist/{config-DnpLL2kT.d.ts → config-DzHB75Jz.d.ts} +2 -0
  52. package/dist/{diagnostics-QSQDE2KO.js → diagnostics-EWU2ROTG.js} +7 -7
  53. package/dist/{doctor-EOBNGAAB.js → doctor-ZWZQMDKZ.js} +20 -20
  54. package/dist/{entry-HBROO3YP.js → entry-NDICBQ2F.js} +12 -12
  55. package/dist/{exec-mcp-DZU2DEPD.js → exec-mcp-AG4G7SG7.js} +13 -13
  56. package/dist/{harness-H4OKGO6F.js → harness-JABSZCAA.js} +3 -3
  57. package/dist/harness-launch-gate.js +5 -5
  58. package/dist/harness-worker.js +7 -7
  59. package/dist/hook-body.js +361 -81
  60. package/dist/{hooks-T5JAK3VQ.js → hooks-YVQSDQV3.js} +3 -3
  61. package/dist/{host-5JOCZURV.js → host-2SZRMHZX.js} +8 -8
  62. package/dist/{host-IRPBT5AL.js → host-BWZ5LA4Q.js} +16 -16
  63. package/dist/{host-run-KPH5ZNYU.js → host-run-SXLV4LHI.js} +21 -13
  64. package/dist/http.d.ts +1 -1
  65. package/dist/http.js +1 -1
  66. package/dist/{import-mcp-24QRNZBJ.js → import-mcp-2M7SZRVQ.js} +11 -11
  67. package/dist/index.d.ts +6 -4
  68. package/dist/index.js +19 -19
  69. package/dist/{init-EPIJY23S.js → init-HOOIFBAD.js} +2 -2
  70. package/dist/{install-MQ7QSJQ7.js → install-HF6CROQP.js} +19 -9
  71. package/dist/{invoke-2SXY6G3P.js → invoke-JP4MILYY.js} +9 -9
  72. package/dist/{list-C3WEYY3N.js → list-UBSBUZKS.js} +13 -13
  73. package/dist/{list-FB6RNYYB.js → list-WK2IYUK7.js} +4 -4
  74. package/dist/{logout-J4SFSWMA.js → logout-OO3DERRK.js} +12 -12
  75. package/dist/{logs-H3RPKNTE.js → logs-K3QXKRD4.js} +6 -6
  76. package/dist/mailbox/index.d.ts +4 -4
  77. package/dist/mailbox/index.js +3 -3
  78. package/dist/{mailbox-UECKDZ3Q.js → mailbox-DAJV6VAI.js} +10 -10
  79. package/dist/{mailbox-5DWLH4W2.js → mailbox-YN6PG66A.js} +4 -4
  80. package/dist/{mainline-FPK4HWFF.js → mainline-6K5BA3WX.js} +55 -33
  81. package/dist/{mcp-W6OADCKB.js → mcp-JXNTKRJG.js} +2 -2
  82. package/dist/{pause-2HQ7CKMR.js → pause-GRVTSKOK.js} +5 -5
  83. package/dist/{project-TZAYGUHM.js → project-M672MKQH.js} +4 -4
  84. package/dist/{pty-XTJ4MIWK.js → pty-LHKJKY2E.js} +3 -3
  85. package/dist/{recovery-54KHNJX4.js → recovery-HB2YFQSQ.js} +3 -3
  86. package/dist/{reindex-ZULHSQWY.js → reindex-I7RYWCUR.js} +5 -5
  87. package/dist/{resume-ETFTR5V3.js → resume-6DMPGG3N.js} +5 -5
  88. package/dist/{run-QQB74HRI.js → run-5W566T3V.js} +14 -14
  89. package/dist/{run-XZ75CAFL.js → run-ORBIERI3.js} +4 -4
  90. package/dist/{serve-TILM4DH5.js → serve-73SRPAV4.js} +9 -9
  91. package/dist/{setup-63E3TVJK.js → setup-ULKDPF5B.js} +5 -6
  92. package/dist/{start-login-C2BWQNO5.js → start-login-BGFAMCZL.js} +12 -12
  93. package/dist/{status-3AU65SCN.js → status-73FEFQUQ.js} +12 -12
  94. package/dist/{status-JMXH6XG4.js → status-YCW6YJ3S.js} +23 -23
  95. package/dist/{status-CM753VKY.js → status-YHXEAJ7U.js} +8 -8
  96. package/dist/stdio.d.ts +2 -2
  97. package/dist/stdio.js +5 -5
  98. package/dist/{sweep-VY2TNOO5.js → sweep-XF2HG3EO.js} +5 -5
  99. package/dist/{test-MCM44GOL.js → test-IMNBXOYW.js} +15 -17
  100. package/dist/{tui-BL4OSDW4.js → tui-5GDA22TB.js} +6 -6
  101. package/dist/{unbroadcast-RKTBP57G.js → unbroadcast-XP3OCVN3.js} +5 -5
  102. package/dist/{validate-AVM2VHMM.js → validate-KFBCUFI4.js} +5 -5
  103. package/dist/{worker-GHQKC5XU.js → worker-RV6NGSXT.js} +10 -10
  104. package/dist/{worktree-list-NEIDD66X.js → worktree-list-4PLE7K6L.js} +4 -4
  105. package/docs/git-workflow.md +48 -12
  106. package/docs/hooks.md +23 -14
  107. package/docs/project-configuration.md +21 -12
  108. package/docs/upgrading.md +52 -0
  109. package/gemini-extension.json +2 -2
  110. package/mcp.json +1 -1
  111. package/package.json +5 -5
  112. package/plugin.json +1 -1
  113. package/plugins/pmcp/.claude-plugin/plugin.json +1 -1
  114. package/plugins/pmcp/.mcp.json +1 -1
  115. package/plugins/pmcp/gemini-extension.json +2 -2
  116. package/plugins/pmcp/mcp.json +1 -1
  117. package/plugins/pmcp/mod/draw.tsx +9 -2
  118. package/plugins/pmcp/mod/guard.ts +3 -3
  119. package/plugins/pmcp/mod/model.ts +15 -4
  120. package/plugins/pmcp/mod/reader/read.ts +33 -8
  121. package/plugins/pmcp/mod/reader/settings.ts +7 -0
  122. package/plugins/pmcp/mod/reader/types.ts +2 -0
  123. package/plugins/pmcp/mod/sessions/format.ts +25 -2
  124. package/plugins/pmcp/mod/sessions/types.ts +1 -1
  125. package/plugins/pmcp/plugin.json +1 -1
  126. package/schema/catalog-v1.json +4 -15
  127. package/schema/library.json +3 -8
  128. package/schema/marketplace-manifest.json +2 -6
  129. package/schema/skill-frontmatter.json +3 -8
  130. package/schema/skill-metadata-core.json +3 -8
  131. package/dist/chunk-DXJZ2ZCX.js +0 -56
  132. package/dist/chunk-QHH3TXOA.js +0 -7
  133. package/dist/{core-C1LPjxK6.d.ts → core-Sug_rZrx.d.ts} +1 -1
@@ -1,12 +1,6 @@
1
1
  import {
2
2
  readLoggingTable
3
3
  } from "./chunk-HQOB7OQS.js";
4
- import {
5
- readGitConfig
6
- } from "./chunk-7B2KRL2H.js";
7
- import {
8
- detect
9
- } from "./chunk-2Q6MNGU5.js";
10
4
  import {
11
5
  syncWorktree
12
6
  } from "./chunk-ICF2JZSN.js";
@@ -21,20 +15,26 @@ import {
21
15
  import {
22
16
  ptyFields,
23
17
  ptyRef
24
- } from "./chunk-3PW4FI7U.js";
18
+ } from "./chunk-ONP6JRFZ.js";
19
+ import {
20
+ withUmask
21
+ } from "./chunk-P6LNYYYH.js";
22
+ import {
23
+ leaseSpecs,
24
+ readGitConfig
25
+ } from "./chunk-5JPD6VIH.js";
26
+ import {
27
+ detect
28
+ } from "./chunk-2Q6MNGU5.js";
25
29
  import {
26
30
  inboxKey,
27
31
  noticeOf,
28
32
  readStoreSettings
29
- } from "./chunk-DHAPQUEF.js";
33
+ } from "./chunk-PQTM27GU.js";
30
34
  import {
31
35
  STATE_FILES,
32
- leaseFile,
33
36
  runtimePid
34
- } from "./chunk-C4NHQGHL.js";
35
- import {
36
- withUmask
37
- } from "./chunk-P6LNYYYH.js";
37
+ } from "./chunk-QSIADSMQ.js";
38
38
  import {
39
39
  gitText
40
40
  } from "./chunk-G7JONWL4.js";
@@ -48,7 +48,7 @@ import {
48
48
  packagedBinary,
49
49
  readHost,
50
50
  readLock
51
- } from "./chunk-42RFOVU3.js";
51
+ } from "./chunk-66F3HLW4.js";
52
52
  import {
53
53
  checkoutOf,
54
54
  hasLinkedWorktrees
@@ -56,7 +56,7 @@ import {
56
56
  import {
57
57
  ConfigError,
58
58
  readMarketplaces
59
- } from "./chunk-QPL7E2HW.js";
59
+ } from "./chunk-GJXOFDJT.js";
60
60
  import {
61
61
  envNames
62
62
  } from "./chunk-J6KL3COD.js";
@@ -129,14 +129,14 @@ function silent(event) {
129
129
  }
130
130
  function render(input, decision) {
131
131
  const blocking = decision.verdict === "deny" || decision.verdict === "ask";
132
- const reason = (decision.reason ?? "Refused by pmcp").slice(0, MAX_REASON);
132
+ const reason2 = (decision.reason ?? "Refused by pmcp").slice(0, MAX_REASON);
133
133
  if (input.event === "before_tool") {
134
- const out2 = blocking ? { decision: "deny", reason } : { decision: "allow" };
134
+ const out2 = blocking ? { decision: "deny", reason: reason2 } : { decision: "allow" };
135
135
  return { stdout: `${JSON.stringify(out2)}
136
136
  `, exitCode: 0 };
137
137
  }
138
138
  const notes = [...decision.context ?? []];
139
- if (blocking) notes.unshift(reason);
139
+ if (blocking) notes.unshift(reason2);
140
140
  if (decision.feedback) notes.push(decision.feedback);
141
141
  let out = {};
142
142
  if (notes.length > 0 && input.event !== "after_tool") {
@@ -330,19 +330,19 @@ var MAX_REASON2 = 2e3;
330
330
  function render2(input, decision) {
331
331
  const hookEventName = NATIVE_EVENTS2[input.event];
332
332
  const context = decision.context?.length ? decision.context.join("\n\n") : void 0;
333
- const reason = decision.reason?.slice(0, MAX_REASON2);
333
+ const reason2 = decision.reason?.slice(0, MAX_REASON2);
334
334
  const blocking = decision.verdict === "deny" || decision.verdict === "ask";
335
335
  const out = shape(input, decision, {
336
336
  hookEventName,
337
337
  context,
338
- reason,
338
+ reason: reason2,
339
339
  blocking
340
340
  });
341
341
  return { stdout: out ? `${JSON.stringify(out)}
342
342
  ` : "", exitCode: 0 };
343
343
  }
344
344
  function shape(input, decision, parts) {
345
- const { hookEventName, context, reason, blocking } = parts;
345
+ const { hookEventName, context, reason: reason2, blocking } = parts;
346
346
  const contextOnly = context ? { hookSpecificOutput: { hookEventName, additionalContext: context } } : {};
347
347
  if (input.event === "before_tool") {
348
348
  if (!blocking && !context) return null;
@@ -350,7 +350,7 @@ function shape(input, decision, parts) {
350
350
  if (blocking) {
351
351
  refusal = {
352
352
  permissionDecision: decision.verdict,
353
- ...reason ? { permissionDecisionReason: reason } : {}
353
+ ...reason2 ? { permissionDecisionReason: reason2 } : {}
354
354
  };
355
355
  }
356
356
  return {
@@ -362,7 +362,7 @@ function shape(input, decision, parts) {
362
362
  };
363
363
  }
364
364
  if (input.event === "prompt" || input.event === "after_tool" || input.event === "stop") {
365
- const feedback = blocking ? reason ?? "Refused" : decision.feedback;
365
+ const feedback = blocking ? reason2 ?? "Refused" : decision.feedback;
366
366
  if (!feedback && !context) return null;
367
367
  return {
368
368
  ...feedback ? { decision: "block", reason: feedback } : {},
@@ -580,12 +580,12 @@ var MAX_REASON3 = 2e3;
580
580
  function render3(input, decision) {
581
581
  const hookEventName = NATIVE_EVENTS3[input.event];
582
582
  const context = decision.context?.length ? decision.context.join("\n\n") : void 0;
583
- const reason = decision.reason?.slice(0, MAX_REASON3);
583
+ const reason2 = decision.reason?.slice(0, MAX_REASON3);
584
584
  const blocking = decision.verdict === "deny" || decision.verdict === "ask";
585
585
  const out = shape2(input, decision, {
586
586
  hookEventName,
587
587
  context,
588
- reason,
588
+ reason: reason2,
589
589
  blocking
590
590
  });
591
591
  if (!out && input.event === "stop") return { stdout: "{}\n", exitCode: 0 };
@@ -593,7 +593,7 @@ function render3(input, decision) {
593
593
  ` : "", exitCode: 0 };
594
594
  }
595
595
  function shape2(input, decision, parts) {
596
- const { hookEventName, context, reason, blocking } = parts;
596
+ const { hookEventName, context, reason: reason2, blocking } = parts;
597
597
  const contextOnly = context ? { hookSpecificOutput: { hookEventName, additionalContext: context } } : {};
598
598
  if (input.event === "before_tool") {
599
599
  if (!blocking && !context) return null;
@@ -601,7 +601,7 @@ function shape2(input, decision, parts) {
601
601
  if (blocking) {
602
602
  refusal = {
603
603
  permissionDecision: "deny",
604
- ...reason ? { permissionDecisionReason: reason } : {}
604
+ ...reason2 ? { permissionDecisionReason: reason2 } : {}
605
605
  };
606
606
  }
607
607
  return {
@@ -613,7 +613,7 @@ function shape2(input, decision, parts) {
613
613
  };
614
614
  }
615
615
  if (input.event === "prompt" || input.event === "after_tool" || input.event === "stop") {
616
- const feedback = blocking ? reason ?? "Refused" : decision.feedback;
616
+ const feedback = blocking ? reason2 ?? "Refused" : decision.feedback;
617
617
  if (!feedback && !context) return null;
618
618
  return {
619
619
  ...feedback ? { decision: "block", reason: feedback } : {},
@@ -818,12 +818,12 @@ var DELIVERS = [
818
818
  ];
819
819
  function render4(input, decision) {
820
820
  const blocking = decision.verdict === "deny" || decision.verdict === "ask";
821
- const reason = (decision.reason ?? "Refused by pmcp").slice(0, MAX_REASON4);
821
+ const reason2 = (decision.reason ?? "Refused by pmcp").slice(0, MAX_REASON4);
822
822
  const out = {};
823
823
  const notes = [...decision.context ?? []];
824
824
  if (blocking && input.event === "before_tool")
825
- Object.assign(out, { decision: "deny", reason });
826
- else if (blocking) notes.unshift(reason);
825
+ Object.assign(out, { decision: "deny", reason: reason2 });
826
+ else if (blocking) notes.unshift(reason2);
827
827
  if (decision.feedback) notes.push(decision.feedback);
828
828
  if (notes.length > 0 && DELIVERS.includes(input.event))
829
829
  out["hookSpecificOutput"] = {
@@ -1007,10 +1007,10 @@ var DELIVERS2 = [
1007
1007
  ];
1008
1008
  function render5(input, decision) {
1009
1009
  const blocking = decision.verdict === "deny" || decision.verdict === "ask";
1010
- const reason = (decision.reason ?? "Refused by pmcp").slice(0, MAX_REASON5);
1010
+ const reason2 = (decision.reason ?? "Refused by pmcp").slice(0, MAX_REASON5);
1011
1011
  const notes = [...decision.context ?? []];
1012
1012
  const refuse = blocking && input.event === "before_tool";
1013
- if (blocking && !refuse) notes.unshift(reason);
1013
+ if (blocking && !refuse) notes.unshift(reason2);
1014
1014
  if (decision.feedback) notes.push(decision.feedback);
1015
1015
  const quiet = input.event === "stop" && input.stop?.active === true;
1016
1016
  const context = notes.length > 0 && DELIVERS2.includes(input.event) && !quiet ? notes.join("\n\n") : void 0;
@@ -1018,7 +1018,7 @@ function render5(input, decision) {
1018
1018
  const out = {
1019
1019
  hookSpecificOutput: {
1020
1020
  hookEventName: NATIVE_EVENTS5[input.event],
1021
- ...refuse ? { permissionDecision: "deny", permissionDecisionReason: reason } : {},
1021
+ ...refuse ? { permissionDecision: "deny", permissionDecisionReason: reason2 } : {},
1022
1022
  ...context ? { additionalContext: context } : {}
1023
1023
  }
1024
1024
  };
@@ -1208,14 +1208,14 @@ var DELIVERS3 = [
1208
1208
  ];
1209
1209
  function render6(input, decision) {
1210
1210
  const blocking = decision.verdict === "deny" || decision.verdict === "ask";
1211
- const reason = (decision.reason ?? "Refused by pmcp").slice(0, MAX_REASON6);
1211
+ const reason2 = (decision.reason ?? "Refused by pmcp").slice(0, MAX_REASON6);
1212
1212
  if (input.event === "before_tool") {
1213
- const out2 = blocking ? { deny: reason } : {};
1213
+ const out2 = blocking ? { deny: reason2 } : {};
1214
1214
  return { stdout: `${JSON.stringify(out2)}
1215
1215
  `, exitCode: 0 };
1216
1216
  }
1217
1217
  const notes = [...decision.context ?? []];
1218
- if (blocking) notes.unshift(reason);
1218
+ if (blocking) notes.unshift(reason2);
1219
1219
  if (decision.feedback) notes.push(decision.feedback);
1220
1220
  const out = notes.length > 0 && DELIVERS3.includes(input.event) ? { context: notes.join("\n\n") } : {};
1221
1221
  return { stdout: `${JSON.stringify(out)}
@@ -2042,24 +2042,41 @@ function runsScript(words, scripts) {
2042
2042
  }
2043
2043
  function touchesLock(words, scripts) {
2044
2044
  if (words[0] === "bun" && BUN_INSTALLS.has(words[1] ?? "")) return true;
2045
- if (words[0] === "bun" && words[1] === "run" && /^git:(land|sync)$/u.test(words[2] ?? ""))
2046
- return true;
2047
2045
  return runsScript(words, scripts);
2048
2046
  }
2049
- function mutates(words, scripts = []) {
2047
+ var DEFAULT_MUTATING_COMMANDS = [
2048
+ ...[...DOCKER_MUTATING].map((verb) => ["docker", verb]),
2049
+ ...[...WRANGLER_MUTATING].map((verb) => ["wrangler", verb])
2050
+ ];
2051
+ var DEFAULT_MUTATING_SCRIPT_NAMES = [
2052
+ "^git:",
2053
+ "^docker:",
2054
+ "^deploy",
2055
+ "^release",
2056
+ "^publish"
2057
+ ];
2058
+ var DEFAULT_MUTATING_RULES = {
2059
+ scripts: [],
2060
+ commands: DEFAULT_MUTATING_COMMANDS,
2061
+ scriptNames: DEFAULT_MUTATING_SCRIPT_NAMES.map(
2062
+ (source) => new RegExp(source, "u")
2063
+ )
2064
+ };
2065
+ var RUNNERS = /* @__PURE__ */ new Set(["bun", "npm", "pnpm", "yarn"]);
2066
+ function mutates(words, rules2 = DEFAULT_MUTATING_RULES) {
2050
2067
  const [name = "", sub = ""] = words;
2051
2068
  if (name === "git") {
2052
2069
  const call = gitCall(words);
2053
2070
  if (GIT_MUTATING.has(call.sub)) return true;
2054
2071
  return call.sub === "worktree" && ["add", "remove", "move"].includes(call.next);
2055
2072
  }
2056
- if (touchesLock(words, scripts)) return true;
2057
- if (name === "bun" && sub === "run")
2058
- return /^(git:|docker:|deploy|release|publish)/u.test(words[2] ?? "");
2073
+ if (touchesLock(words, rules2.scripts)) return true;
2074
+ if (RUNNERS.has(name) && sub === "run")
2075
+ return rules2.scriptNames.some((pattern) => pattern.test(words[2] ?? ""));
2059
2076
  if (["npm", "pnpm", "yarn"].includes(name)) return PACKAGE_MUTATING.has(sub);
2060
- if (name === "docker") return DOCKER_MUTATING.has(sub);
2061
- if (name === "wrangler") return WRANGLER_MUTATING.has(sub);
2062
- return false;
2077
+ return rules2.commands.some(
2078
+ (prefix) => prefix.length > 0 && prefix.every((word, at) => words[at] === word)
2079
+ );
2063
2080
  }
2064
2081
 
2065
2082
  // src/hooks/policies/_shared.ts
@@ -2677,7 +2694,7 @@ function recipientOf(input, ctx) {
2677
2694
  session,
2678
2695
  ...record?.alias ? { alias: record.alias } : {},
2679
2696
  roles: roles2,
2680
- desk: record?.worktree || input.cwd,
2697
+ worktree: record?.worktree || input.cwd,
2681
2698
  // The registry records a session at its start, so earlier broadcasts are not its news.
2682
2699
  ...record?.startedAt ? { since: record.startedAt } : {}
2683
2700
  };
@@ -2740,18 +2757,41 @@ var mailbox = {
2740
2757
  };
2741
2758
 
2742
2759
  // src/hooks/policies/sessions/pause.ts
2743
- var MUTATING = /\b(git\s+(commit|push|merge|rebase|reset|checkout|switch|cherry-pick|revert|am|stash|tag|clean|restore|rm|mv|worktree\s+(add|remove|move))|bun\s+(install|i|add|remove|rm|update|link)\b|(npm|pnpm|yarn)\s+(install|i|add|remove|publish|ci)\b|docker\s+(compose|build|push|run|rm|stop|restart)|wrangler\s+(deploy|publish|secret))\b/u;
2760
+ var BUILT_IN = /\b(git\s+(commit|push|merge|rebase|reset|checkout|switch|cherry-pick|revert|am|stash|tag|clean|restore|rm|mv|worktree\s+(add|remove|move))|bun\s+(install|i|add|remove|rm|update|link)\b|(npm|pnpm|yarn)\s+(install|i|add|remove|publish|ci)\b)\b/u;
2761
+ var escape2 = (word) => word.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
2744
2762
  function changes(input, options2) {
2745
2763
  const tool = input.tool;
2746
2764
  if (tool?.kind === "edit") return true;
2747
2765
  if (tool?.kind !== "shell") return false;
2748
2766
  if (!tool.steps) {
2749
2767
  const command6 = tool.command ?? "";
2750
- return MUTATING.test(command6) || options2.scripts.some((s) => s.test(command6));
2768
+ return BUILT_IN.test(command6) || options2.commands.some(
2769
+ (prefix) => new RegExp(`\\b${prefix.map(escape2).join("\\s+")}\\b`, "u").test(
2770
+ command6
2771
+ )
2772
+ ) || options2.scripts.some((s) => s.test(command6));
2751
2773
  }
2752
- return realSteps(tool.steps).some(
2753
- (step) => mutates(step.argv, options2.scripts)
2754
- );
2774
+ return realSteps(tool.steps).some((step) => mutates(step.argv, options2));
2775
+ }
2776
+ function patterns(raw, key) {
2777
+ const list2 = stringList(raw, key);
2778
+ if (list2 === void 0) return null;
2779
+ return list2.map((source) => {
2780
+ try {
2781
+ return new RegExp(source, "u");
2782
+ } catch {
2783
+ throw new Error(`${key}: ${source} is not a regular expression`);
2784
+ }
2785
+ });
2786
+ }
2787
+ function prefixes(raw) {
2788
+ const value = raw["commands"];
2789
+ if (value === void 0) return null;
2790
+ if (!Array.isArray(value) || !value.every(
2791
+ (prefix) => Array.isArray(prefix) && prefix.length > 0 && prefix.every((word) => typeof word === "string" && word !== "")
2792
+ ))
2793
+ throw new Error("commands must be a list of argv prefixes");
2794
+ return value;
2755
2795
  }
2756
2796
  function foreign(pause2, input, ctx) {
2757
2797
  const session = input.session.id;
@@ -2766,17 +2806,14 @@ var pause = {
2766
2806
  fail: "closed",
2767
2807
  defaultMode: "deny",
2768
2808
  options(raw) {
2769
- onlyKeys(raw, ["refuses", "scripts"]);
2809
+ onlyKeys(raw, ["refuses", "scripts", "commands", "script_names"]);
2770
2810
  if (raw["refuses"] !== void 0 && raw["refuses"] !== "mutating")
2771
2811
  throw new Error("refuses must be mutating");
2772
- const scripts = (stringList(raw, "scripts") ?? []).map((source) => {
2773
- try {
2774
- return new RegExp(source, "u");
2775
- } catch {
2776
- throw new Error(`scripts: ${source} is not a regular expression`);
2777
- }
2778
- });
2779
- return { scripts };
2812
+ return {
2813
+ scripts: patterns(raw, "scripts") ?? [],
2814
+ commands: prefixes(raw) ?? DEFAULT_MUTATING_COMMANDS,
2815
+ scriptNames: patterns(raw, "script_names") ?? DEFAULT_MUTATING_SCRIPT_NAMES.map((source) => new RegExp(source, "u"))
2816
+ };
2780
2817
  },
2781
2818
  evaluate(input, ctx) {
2782
2819
  const current = ctx.store.pause.read();
@@ -2850,8 +2887,8 @@ function fields(input) {
2850
2887
  return { ...cwd, status: "working", waiting: "" };
2851
2888
  if (input.event === "after_tool") return { ...cwd, status: "working" };
2852
2889
  if (input.event === "notification") {
2853
- const reason = input.notification?.type || input.notification?.message;
2854
- return { status: "waiting", waiting: reason ?? "" };
2890
+ const reason2 = input.notification?.type || input.notification?.message;
2891
+ return { status: "waiting", waiting: reason2 ?? "" };
2855
2892
  }
2856
2893
  if (input.event === "stop") {
2857
2894
  return {
@@ -3020,8 +3057,8 @@ var composeTeardown = {
3020
3057
  };
3021
3058
  }
3022
3059
  for (const step of realSteps(call.steps)) {
3023
- const reason = teardownReason(step.argv);
3024
- if (reason) return { verdict: "deny", reason };
3060
+ const reason2 = teardownReason(step.argv);
3061
+ if (reason2) return { verdict: "deny", reason: reason2 };
3025
3062
  }
3026
3063
  return pass;
3027
3064
  }
@@ -3129,6 +3166,220 @@ var inPlaceEdit = {
3129
3166
  }
3130
3167
  };
3131
3168
 
3169
+ // src/hooks/policies/shell/regex-cost.ts
3170
+ var BASIC_INTERVAL = /^\\\{(\d*)(?:,(\d*))?\\\}/u;
3171
+ var INTERVAL = /^\{(\d*)(?:,(\d*))?\}/u;
3172
+ function repetitionCounts(pattern, flavor) {
3173
+ const counts = [];
3174
+ for (let at = 0; at < pattern.length; at += 1) {
3175
+ const char = pattern[at];
3176
+ if (char !== "\\" && char !== "{") continue;
3177
+ const shape3 = flavor === "basic" ? BASIC_INTERVAL : INTERVAL;
3178
+ const interval = char === "{" && flavor === "basic" ? null : shape3.exec(pattern.slice(at));
3179
+ if (!interval) {
3180
+ if (char === "\\") at += 1;
3181
+ continue;
3182
+ }
3183
+ for (const bound of [interval[1], interval[2]])
3184
+ if (bound) counts.push(Number(bound));
3185
+ at += interval[0].length - 1;
3186
+ }
3187
+ return counts;
3188
+ }
3189
+ function nestedQuantifier(pattern) {
3190
+ const groups = [];
3191
+ let quantified = false;
3192
+ for (let at = 0; at < pattern.length; at += 1) {
3193
+ const char = pattern[at];
3194
+ if (char === "\\") {
3195
+ at += 1;
3196
+ continue;
3197
+ }
3198
+ if (char === "[") {
3199
+ at = classEnd(pattern, at);
3200
+ continue;
3201
+ }
3202
+ if (char === "(") {
3203
+ groups.push(quantified);
3204
+ quantified = false;
3205
+ continue;
3206
+ }
3207
+ if (char === ")") {
3208
+ const inner = quantified;
3209
+ quantified = groups.pop() ?? false;
3210
+ if (inner && repeats(pattern, at + 1)) return true;
3211
+ quantified ||= inner;
3212
+ continue;
3213
+ }
3214
+ if (repeats(pattern, at)) quantified = true;
3215
+ }
3216
+ return false;
3217
+ }
3218
+ function repeats(pattern, at) {
3219
+ const char = pattern[at];
3220
+ if (char === "*" || char === "+") return true;
3221
+ return char === "{" && /^\{\d*,\}/u.test(pattern.slice(at));
3222
+ }
3223
+ function classEnd(pattern, start) {
3224
+ let at = start + 1;
3225
+ if (pattern[at] === "^") at += 1;
3226
+ if (pattern[at] === "]") at += 1;
3227
+ for (; at < pattern.length; at += 1) {
3228
+ if (pattern[at] === "\\") at += 1;
3229
+ else if (pattern[at] === "]") return at;
3230
+ }
3231
+ return pattern.length;
3232
+ }
3233
+ function patternCost(pattern, flavor, onlyMatching, limits) {
3234
+ const largest = Math.max(0, ...repetitionCounts(pattern, flavor));
3235
+ if (largest > limits.threshold)
3236
+ return `a repetition count of ${largest} (the limit is ${limits.threshold})`;
3237
+ if (flavor === "perl" && nestedQuantifier(pattern))
3238
+ return "a -P pattern with a quantified group inside a quantifier, such as (a+)+ or (.*)*";
3239
+ if (limits.onlyMatchingWildcards && onlyMatching && (pattern.match(/\.\*/gu) ?? []).length > 1)
3240
+ return "-o with more than one .*";
3241
+ return null;
3242
+ }
3243
+
3244
+ // src/hooks/policies/shell/runaway-regex.ts
3245
+ var GREPS = {
3246
+ grep: "basic",
3247
+ zgrep: "basic",
3248
+ egrep: "extended",
3249
+ fgrep: "fixed"
3250
+ };
3251
+ var VALUE_SHORT = /* @__PURE__ */ new Set(["e", "f", "m", "A", "B", "C", "d", "D", "O"]);
3252
+ var VALUE_LONG = /* @__PURE__ */ new Set([
3253
+ "regexp",
3254
+ "file",
3255
+ "max-count",
3256
+ "after-context",
3257
+ "before-context",
3258
+ "context",
3259
+ "include",
3260
+ "exclude",
3261
+ "exclude-dir",
3262
+ "exclude-from",
3263
+ "binary-files",
3264
+ "devices",
3265
+ "directories",
3266
+ "label",
3267
+ "max-depth",
3268
+ "threads"
3269
+ ]);
3270
+ var FLAVOR_SHORT = {
3271
+ E: "extended",
3272
+ P: "perl",
3273
+ F: "fixed",
3274
+ G: "basic"
3275
+ };
3276
+ var FLAVOR_LONG = {
3277
+ "extended-regexp": "extended",
3278
+ "perl-regexp": "perl",
3279
+ "fixed-strings": "fixed",
3280
+ "basic-regexp": "basic"
3281
+ };
3282
+ function readGrep(args, start) {
3283
+ const patterns2 = [];
3284
+ let flavor = start;
3285
+ let onlyMatching = false;
3286
+ let operand;
3287
+ let fromFile = false;
3288
+ for (let at = 0; at < args.length; at += 1) {
3289
+ const arg = args[at];
3290
+ if (arg === "--") {
3291
+ operand ??= args[at + 1];
3292
+ break;
3293
+ }
3294
+ if (arg.startsWith("--")) {
3295
+ const [name = "", inline] = arg.slice(2).split(/=(.*)/su);
3296
+ if (FLAVOR_LONG[name]) flavor = FLAVOR_LONG[name];
3297
+ if (name === "only-matching") onlyMatching = true;
3298
+ const value = VALUE_LONG.has(name) && inline === void 0 ? args[at += 1] : inline;
3299
+ if (name === "regexp" && value !== void 0) patterns2.push(value);
3300
+ if (name === "file") fromFile = true;
3301
+ continue;
3302
+ }
3303
+ if (arg.startsWith("-") && arg.length > 1) {
3304
+ for (let i = 1; i < arg.length; i += 1) {
3305
+ const flag2 = arg[i];
3306
+ if (FLAVOR_SHORT[flag2]) flavor = FLAVOR_SHORT[flag2];
3307
+ if (flag2 === "o") onlyMatching = true;
3308
+ if (!VALUE_SHORT.has(flag2)) continue;
3309
+ const value = i + 1 < arg.length ? arg.slice(i + 1) : args[at += 1];
3310
+ if (flag2 === "e" && value !== void 0) patterns2.push(value);
3311
+ if (flag2 === "f") fromFile = true;
3312
+ break;
3313
+ }
3314
+ continue;
3315
+ }
3316
+ operand ??= arg;
3317
+ }
3318
+ if (patterns2.length === 0 && !fromFile && operand !== void 0)
3319
+ patterns2.push(operand);
3320
+ return { patterns: patterns2, flavor, onlyMatching };
3321
+ }
3322
+ function grepOf(argv) {
3323
+ const name = program(argv[0]);
3324
+ if (GREPS[name]) return readGrep(argv.slice(1), GREPS[name]);
3325
+ if (name !== "git") return null;
3326
+ const call = gitCall(argv);
3327
+ return call.sub === "grep" ? readGrep(argv.slice(call.at + 1), "basic") : null;
3328
+ }
3329
+ function timed(step) {
3330
+ const at = step.raw.indexOf(step.argv[0]);
3331
+ return step.raw.slice(0, at < 0 ? 0 : at).some((word) => program(word) === "timeout");
3332
+ }
3333
+ function costOf(step, options2) {
3334
+ const grep = grepOf(step.argv);
3335
+ if (!grep || grep.flavor === "fixed") return null;
3336
+ if (options2.allowTimeout && timed(step)) return null;
3337
+ for (const pattern of grep.patterns) {
3338
+ const why = patternCost(pattern, grep.flavor, grep.onlyMatching, options2);
3339
+ if (why) return why;
3340
+ }
3341
+ return null;
3342
+ }
3343
+ var reason = (why, threshold) => `This grep can keep a CPU core busy for minutes: ${why}. Find the line with grep -n and no -o or large count, then print a window around it with sed -n 'N,+K p' FILE; or use rg, which matches in linear time; or bring the count to ${threshold} or below; or bound the run with timeout 20 grep \u2026.`;
3344
+ function integer(raw, key, fallback3) {
3345
+ const value = raw[key] ?? fallback3;
3346
+ if (typeof value !== "number" || !Number.isInteger(value) || value < 1 || value > 32767)
3347
+ throw new Error(`${key} must be an integer from 1 to 32767`);
3348
+ return value;
3349
+ }
3350
+ function bool(raw, key, fallback3) {
3351
+ const value = raw[key] ?? fallback3;
3352
+ if (typeof value !== "boolean")
3353
+ throw new Error(`${key} must be true or false`);
3354
+ return value;
3355
+ }
3356
+ var runawayRegex = {
3357
+ id: "shell.runaway_regex",
3358
+ events: ["before_tool"],
3359
+ tools: ["shell"],
3360
+ fail: "closed",
3361
+ defaultMode: "deny",
3362
+ options(raw) {
3363
+ onlyKeys(raw, ["threshold", "only_matching_wildcards", "allow_timeout"]);
3364
+ return {
3365
+ threshold: integer(raw, "threshold", 255),
3366
+ onlyMatchingWildcards: bool(raw, "only_matching_wildcards", false),
3367
+ allowTimeout: bool(raw, "allow_timeout", true)
3368
+ };
3369
+ },
3370
+ // Unreadable shell syntax passes: a wrong refusal here costs more than a slow grep.
3371
+ evaluate(input, ctx) {
3372
+ const call = shellCall(input);
3373
+ if (!call?.steps) return pass;
3374
+ for (const step of realSteps(call.steps)) {
3375
+ const why = costOf(step, ctx.options);
3376
+ if (why)
3377
+ return { verdict: "deny", reason: reason(why, ctx.options.threshold) };
3378
+ }
3379
+ return pass;
3380
+ }
3381
+ };
3382
+
3132
3383
  // src/hooks/policies/shell/operands.ts
3133
3384
  var SEARCH = {
3134
3385
  code: ["-e", "--regexp"],
@@ -3234,9 +3485,7 @@ function fileOperands(argv) {
3234
3485
  // src/hooks/policies/shell/secret-exfiltration.ts
3235
3486
  var SECRET_PATHS = [
3236
3487
  /(?:^|[^\w.-])\.env(?:\.(?!example\b|sample\b|template\b|dist\b)[\w.-]+)?(?![\w.-])/iu,
3237
- /(?:^|[^\w.-])\.env\.d(?:\/|\b)/iu,
3238
3488
  /\.dev\.vars(?:\.json)?\b/iu,
3239
- /\.bak\.\d{8,}/u,
3240
3489
  /\b(?:id_rsa|id_ed25519|id_ecdsa)\b(?!\.pub)/u,
3241
3490
  /\.(?:pem|p12|pfx)\b/iu,
3242
3491
  // Known credential files only: a name that merely contains "secret" (a test fixture, a
@@ -3264,7 +3513,7 @@ var ENV_DUMPS = [
3264
3513
  ["export", "-p"],
3265
3514
  ["declare", "-x"]
3266
3515
  ];
3267
- var FALLBACK_PATH = /(?:^|[^\w.-])\.env(?![.\w-])|(?:^|[^\w.-])\.env\.d(?:\/|\b)|\.dev\.vars(?:\.json)?\b|\.bak\.\d{8,}/u;
3516
+ var FALLBACK_PATH = /(?:^|[^\w.-])\.env(?![.\w-])|\.dev\.vars(?:\.json)?\b/u;
3268
3517
  var FALLBACK_USE = /(?:^|[;&|(]|&&)\s*(?:sudo\s+)?(?:cat|head|tail|less|grep|rg|jq|base64|cp|curl|wget|nc|scp|rsync)\b/u;
3269
3518
  var NO_VALUES = "Use metadata verbs instead (ls, stat, wc, find), or a command that names keys without resolving values.";
3270
3519
  function names(word, options2) {
@@ -3657,8 +3906,12 @@ function blocked2(input, ctx) {
3657
3906
  const pause2 = ctx.store.pause.read();
3658
3907
  if (pause2 && pause2.by !== input.session.id)
3659
3908
  return `the workspace is paused (${pause2.reason})`;
3660
- const lease = ctx.store.leases.read("lockfile");
3661
- return lease ? `a lockfile change is being delivered (${lease.subject})` : null;
3909
+ for (const name of ctx.options.leases ?? ["lockfile"]) {
3910
+ const lease = ctx.store.leases.read(name);
3911
+ if (lease)
3912
+ return `a change under lease ${name} is being delivered (${lease.subject})`;
3913
+ }
3914
+ return null;
3662
3915
  }
3663
3916
  function changed(root, from, paths, to = "HEAD") {
3664
3917
  if (paths.length === 0) return [];
@@ -3707,7 +3960,7 @@ function move(input, ctx, git) {
3707
3960
  });
3708
3961
  if (result === "current") return [];
3709
3962
  if (result === "held")
3710
- return lines.map((line) => `Desk ${git.root}: ${line}`);
3963
+ return lines.map((line) => `Worktree ${git.root}: ${line}`);
3711
3964
  if (opts.install && opts.installAfterMove === "background" && changed(git.root, before, opts.installWhen).length > 0) {
3712
3965
  backgroundInstall(git.root, opts.install, opts.umask);
3713
3966
  lines.push(`installing in the background: ${opts.install.join(" ")}`);
@@ -3717,7 +3970,7 @@ function move(input, ctx, git) {
3717
3970
  lines.push(
3718
3971
  `These rule files changed with the move; re-read them before going on: ${rules2.join(", ")}`
3719
3972
  );
3720
- return lines.map((line) => `Desk ${git.root}: ${line}`);
3973
+ return lines.map((line) => `Worktree ${git.root}: ${line}`);
3721
3974
  }
3722
3975
  var worktreeSync = {
3723
3976
  id: "git.worktrees.sync",
@@ -3732,9 +3985,9 @@ var worktreeSync = {
3732
3985
  if (input.event === "prompt" && opts.betweenPrompts === "off") return pass;
3733
3986
  const git = desk(input, opts);
3734
3987
  if (!git) return pass;
3735
- const reason = blocked2(input, ctx);
3736
- if (reason)
3737
- return input.event === "session_start" ? { context: [`Desk ${git.root} was not moved: ${reason}.`] } : pass;
3988
+ const reason2 = blocked2(input, ctx);
3989
+ if (reason2)
3990
+ return input.event === "session_start" ? { context: [`Worktree ${git.root} was not moved: ${reason2}.`] } : pass;
3738
3991
  const lines = move(input, ctx, git);
3739
3992
  return lines.length > 0 ? { context: lines } : pass;
3740
3993
  }
@@ -3806,15 +4059,15 @@ function run2(entry, input) {
3806
4059
  const extra = Object.keys(response).some(
3807
4060
  (key) => key !== "decision" && key !== "reason"
3808
4061
  );
3809
- const reason = response["reason"];
3810
- if (extra || reason !== void 0 && typeof reason !== "string")
4062
+ const reason2 = response["reason"];
4063
+ if (extra || reason2 !== void 0 && typeof reason2 !== "string")
3811
4064
  return { verdict: "deny", reason: FAILED };
3812
4065
  if (response["decision"] === "allow") return pass;
3813
4066
  if (response["decision"] !== "deny")
3814
4067
  return { verdict: "deny", reason: FAILED };
3815
4068
  return {
3816
4069
  verdict: "deny",
3817
- reason: typeof reason === "string" ? reason.slice(0, 2e3) : FAILED
4070
+ reason: typeof reason2 === "string" ? reason2.slice(0, 2e3) : FAILED
3818
4071
  };
3819
4072
  }
3820
4073
  function customPolicy(entry) {
@@ -3838,6 +4091,7 @@ var GUARDS = byId([
3838
4091
  composeTeardown,
3839
4092
  hostApproval,
3840
4093
  secretExfiltration,
4094
+ runawayRegex,
3841
4095
  pushWithoutVerify,
3842
4096
  forcedBranchMove,
3843
4097
  gateBypassEnv,
@@ -4107,7 +4361,7 @@ function readFailure(value) {
4107
4361
  for (const key of Object.keys(table3))
4108
4362
  if (!["timeout_ms", "retry", "pass"].includes(key))
4109
4363
  throw new Error(`[hooks.failure] unknown key ${key}`);
4110
- const integer = (key, fallback3, min, max) => {
4364
+ const integer2 = (key, fallback3, min, max) => {
4111
4365
  const v = table3[key] ?? fallback3;
4112
4366
  if (typeof v !== "number" || !Number.isInteger(v) || v < min || v > max)
4113
4367
  throw new Error(
@@ -4121,8 +4375,8 @@ function readFailure(value) {
4121
4375
  `[hooks.failure] pass must list ${PASS_KINDS.join(" or ")}`
4122
4376
  );
4123
4377
  return {
4124
- timeoutMs: integer("timeout_ms", 2e3, 100, 6e4),
4125
- retry: integer("retry", 1, 0, 3),
4378
+ timeoutMs: integer2("timeout_ms", 2e3, 100, 6e4),
4379
+ retry: integer2("retry", 1, 0, 3),
4126
4380
  pass: [...new Set(pass2)]
4127
4381
  };
4128
4382
  }
@@ -4311,6 +4565,11 @@ function readWorkspace(raw, root) {
4311
4565
  const git = asTable(raw, "[git]");
4312
4566
  const gitEnabled = enabledValue(git["enabled"], "[git]");
4313
4567
  const declared = git["shared_checkout"] !== void 0;
4568
+ if (!declared)
4569
+ return {
4570
+ declared,
4571
+ sharedCheckout: { guard: null, source: "default-off" }
4572
+ };
4314
4573
  const { enabled, ...options2 } = asTable(
4315
4574
  git["shared_checkout"],
4316
4575
  "[git.shared_checkout]"
@@ -4370,6 +4629,7 @@ function readWorktreeSync(tables, root) {
4370
4629
  installWhen: git.sync?.installWhenChanged ?? [],
4371
4630
  noticePaths: sync.noticePaths,
4372
4631
  followSubmodules: git.submodules?.follow === "clean_pins",
4632
+ leases: leaseSpecs(git).map((spec) => spec.name),
4373
4633
  ...git.umask !== void 0 ? { umask: git.umask } : {}
4374
4634
  };
4375
4635
  return {
@@ -4530,7 +4790,6 @@ import { join as join2 } from "path";
4530
4790
  var STATE_PATHS = {
4531
4791
  records: STATE_FILES.records,
4532
4792
  pause: STATE_FILES.pause,
4533
- lease: leaseFile("lockfile"),
4534
4793
  broadcast: STATE_FILES.broadcast
4535
4794
  };
4536
4795
 
@@ -4544,7 +4803,7 @@ var KEYS4 = {
4544
4803
  commands: "commands",
4545
4804
  hold_foreign_edits: "holdForeignEdits"
4546
4805
  };
4547
- function readUiClaude(path, raw, sessionHooks) {
4806
+ function readUiClaude(path, raw, sessionHooks, worktreeRoot) {
4548
4807
  if (raw === void 0) return void 0;
4549
4808
  if (raw === null || typeof raw !== "object" || Array.isArray(raw))
4550
4809
  throw new ConfigError(path, "[ui] must be a table");
@@ -4570,7 +4829,8 @@ function readUiClaude(path, raw, sessionHooks) {
4570
4829
  sessionsPane: switches["sessionsPane"] ?? true,
4571
4830
  statusBand: switches["statusBand"] ?? true,
4572
4831
  commands: switches["commands"] ?? true,
4573
- holdForeignEdits: switches["holdForeignEdits"] ?? true
4832
+ holdForeignEdits: switches["holdForeignEdits"] ?? true,
4833
+ worktreeRoot
4574
4834
  };
4575
4835
  }
4576
4836
  var settingsText = (ui) => `${JSON.stringify(ui, null, 2)}
@@ -5053,7 +5313,12 @@ function readSpec(config) {
5053
5313
  throw new ConfigError(path, m);
5054
5314
  }
5055
5315
  );
5056
- const uiClaude = readUiClaude(path, raw["ui"], sessionHooks);
5316
+ const uiClaude = readUiClaude(
5317
+ path,
5318
+ raw["ui"],
5319
+ sessionHooks,
5320
+ readGitConfig(config)?.worktrees?.root ?? ".claude/worktrees"
5321
+ );
5057
5322
  const permissions = readPermissions(path, raw["permissions"]);
5058
5323
  const host = readHost(path, raw["host"]);
5059
5324
  const harness = readHarness(path, raw["harness"]);
@@ -5116,4 +5381,4 @@ export {
5116
5381
  permissionDoctor,
5117
5382
  readSpec
5118
5383
  };
5119
- //# sourceMappingURL=chunk-3CYQWRGM.js.map
5384
+ //# sourceMappingURL=chunk-QOFSPFJ6.js.map