@modootoday/pmcp 0.20.0 → 0.22.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 (124) 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-QJ6MGLBX.js → apply-3PR4UOES.js} +58 -24
  6. package/dist/{available-HYSDAFYH.js → available-BFXLII4A.js} +7 -7
  7. package/dist/{broadcast-LYOA6BEW.js → broadcast-ZALGUJVR.js} +4 -4
  8. package/dist/chunk-2GI5RM3M.js +53 -0
  9. package/dist/chunk-2QJGUR23.js +274 -0
  10. package/dist/{chunk-FD6VGFYZ.js → chunk-3LADLKAI.js} +207 -15
  11. package/dist/{chunk-MZEMLFFD.js → chunk-3OBJVG5R.js} +2 -2
  12. package/dist/{chunk-IQD4W53M.js → chunk-57Q75MS4.js} +18 -18
  13. package/dist/chunk-5YCKFU5Q.js +1672 -0
  14. package/dist/{chunk-IZABPDAO.js → chunk-5ZUDBC3P.js} +2 -2
  15. package/dist/{chunk-EKPMVEIA.js → chunk-73IDLWRI.js} +7 -4
  16. package/dist/{chunk-QYH2NR6G.js → chunk-7FV2LORT.js} +2 -2
  17. package/dist/{chunk-4VK5G3SV.js → chunk-E6YP2PMO.js} +3 -5
  18. package/dist/{chunk-RMHZFWHF.js → chunk-EPNTYTDZ.js} +33 -33
  19. package/dist/{chunk-5JPD6VIH.js → chunk-GBKRDRMZ.js} +22 -7
  20. package/dist/{chunk-T6GOWHK6.js → chunk-GFOQDLPL.js} +6 -1
  21. package/dist/{chunk-RBNMNKNN.js → chunk-JQVSDPFL.js} +3 -3
  22. package/dist/{chunk-OG7QR2DP.js → chunk-KEHB4FZP.js} +17 -2
  23. package/dist/chunk-KUBHGVTD.js +126 -0
  24. package/dist/chunk-L42U5XKC.js +7 -0
  25. package/dist/chunk-LFFIQBNY.js +115 -0
  26. package/dist/{chunk-O2JWF7ZM.js → chunk-LVNGMGOM.js} +2 -2
  27. package/dist/{chunk-PQTM27GU.js → chunk-MR5IBS6L.js} +6 -7
  28. package/dist/{chunk-OAIQ7A3R.js → chunk-NDED2O5B.js} +5 -5
  29. package/dist/{chunk-M2RYXWX2.js → chunk-NHUMPEPV.js} +2 -2
  30. package/dist/{chunk-ONP6JRFZ.js → chunk-OFJIMBTL.js} +2 -2
  31. package/dist/{chunk-YN5GQCHN.js → chunk-RHJEGLYM.js} +6 -1
  32. package/dist/{chunk-JBHGJKSL.js → chunk-RNC7PGW2.js} +2 -2
  33. package/dist/{chunk-J6HNP6HA.js → chunk-RNE4WPBS.js} +2 -2
  34. package/dist/{chunk-YDICIB2A.js → chunk-S4Y44CCC.js} +2 -2
  35. package/dist/{chunk-K2C3KFGB.js → chunk-SEM6WD7J.js} +29 -17
  36. package/dist/{chunk-CQZYQAAV.js → chunk-SLCNCAWY.js} +3 -3
  37. package/dist/{chunk-L4MFGGSI.js → chunk-SPZ42EWE.js} +2 -2
  38. package/dist/{chunk-QOFSPFJ6.js → chunk-TCW2H47H.js} +3405 -3395
  39. package/dist/{chunk-FQAJSNNU.js → chunk-TPGJXENR.js} +3 -3
  40. package/dist/chunk-UKR64U7J.js +20 -0
  41. package/dist/{chunk-66F3HLW4.js → chunk-XB363ZXT.js} +122 -4
  42. package/dist/{chunk-UD3BEEBQ.js → chunk-XZ2TDH3J.js} +80 -3
  43. package/dist/{chunk-QSIADSMQ.js → chunk-Z6WRFOFT.js} +3 -3
  44. package/dist/{claude-GT2BPXEL.js → claude-XVLF4N4S.js} +3 -3
  45. package/dist/{cli-IV5DJCXU.js → cli-6FWRBCWM.js} +8 -8
  46. package/dist/{cli-6HTAJ54L.js → cli-BEEDAD4E.js} +7 -7
  47. package/dist/cli.js +11 -11
  48. package/dist/{completion-PPM7MEI2.js → completion-LHYNCQ3N.js} +7 -7
  49. package/dist/{diagnostics-EWU2ROTG.js → diagnostics-ABTJUYZQ.js} +5 -6
  50. package/dist/{doctor-ZWZQMDKZ.js → doctor-GPPO5L4F.js} +36 -36
  51. package/dist/{entry-NDICBQ2F.js → entry-ARGY5CKA.js} +14 -15
  52. package/dist/{exec-mcp-AG4G7SG7.js → exec-mcp-JEF74XVP.js} +16 -14
  53. package/dist/{harness-JABSZCAA.js → harness-OCXW6YE4.js} +6 -6
  54. package/dist/harness-launch-gate.js +3 -4
  55. package/dist/harness-worker.js +5 -6
  56. package/dist/hook-body.js +247 -86
  57. package/dist/{hook-spec-C7umArqw.d.ts → hook-spec-hZL4MSgi.d.ts} +8 -3
  58. package/dist/hooks-JHXUN5MD.js +24 -0
  59. package/dist/{host-2SZRMHZX.js → host-OBRHBDRE.js} +6 -7
  60. package/dist/{host-BWZ5LA4Q.js → host-VI4ZFCZP.js} +18 -16
  61. package/dist/{host-run-SXLV4LHI.js → host-run-H7AITG7C.js} +5 -7
  62. package/dist/http.js +1 -1
  63. package/dist/{import-mcp-2M7SZRVQ.js → import-mcp-3Y33CUHF.js} +15 -12
  64. package/dist/index.d.ts +11 -2
  65. package/dist/index.js +25 -25
  66. package/dist/{init-HOOIFBAD.js → init-WZJHMWNJ.js} +3 -3
  67. package/dist/{install-HF6CROQP.js → install-7V6NIA7W.js} +4 -4
  68. package/dist/{invoke-JP4MILYY.js → invoke-GWWTXQLO.js} +7 -8
  69. package/dist/{list-UBSBUZKS.js → list-Y6UPLGNF.js} +21 -18
  70. package/dist/{logout-OO3DERRK.js → logout-KAUW4JZZ.js} +16 -13
  71. package/dist/{logs-K3QXKRD4.js → logs-74JGLQG6.js} +4 -4
  72. package/dist/{mailbox-DAJV6VAI.js → mailbox-VK5AVTHI.js} +7 -7
  73. package/dist/{mainline-6K5BA3WX.js → mainline-Q42M2GJ2.js} +173 -34
  74. package/dist/{mcp-JXNTKRJG.js → mcp-IDEUIY2F.js} +2 -2
  75. package/dist/{pause-GRVTSKOK.js → pause-CZ2OZYLC.js} +4 -4
  76. package/dist/project/hook-adapter.d.ts +1 -1
  77. package/dist/{project-M672MKQH.js → project-GVVWLDOJ.js} +5 -5
  78. package/dist/{pty-LHKJKY2E.js → pty-CDLQ4NP2.js} +3 -3
  79. package/dist/report-Z3JV2PCT.js +105 -0
  80. package/dist/{resume-6DMPGG3N.js → resume-DFIHT2RO.js} +4 -4
  81. package/dist/{run-ORBIERI3.js → run-HVNKQHVU.js} +4 -4
  82. package/dist/{run-5W566T3V.js → run-RRWB7U2Q.js} +15 -12
  83. package/dist/{serve-73SRPAV4.js → serve-KJSOU3BR.js} +3 -3
  84. package/dist/{session-XM2CR425.js → session-YZVX4NGN.js} +4 -4
  85. package/dist/{setup-ULKDPF5B.js → setup-3GET6K3J.js} +4 -4
  86. package/dist/smoke-FQQJOQBD.js +16 -0
  87. package/dist/{start-login-BGFAMCZL.js → start-login-RNHSEX5P.js} +16 -13
  88. package/dist/{status-YHXEAJ7U.js → status-3RTGDN2K.js} +10 -10
  89. package/dist/{status-YCW6YJ3S.js → status-RR4VZARJ.js} +40 -23
  90. package/dist/{status-73FEFQUQ.js → status-Y25ONHA5.js} +16 -13
  91. package/dist/stdio.js +2 -2
  92. package/dist/{sweep-XF2HG3EO.js → sweep-EPJMEZR6.js} +4 -4
  93. package/dist/{test-IMNBXOYW.js → test-7NYPQ6YU.js} +30 -20
  94. package/dist/{tui-5GDA22TB.js → tui-H5RPSF4B.js} +4 -4
  95. package/dist/{unbroadcast-XP3OCVN3.js → unbroadcast-NTOC3PY3.js} +4 -4
  96. package/dist/{worker-RV6NGSXT.js → worker-YWFTWIBP.js} +9 -10
  97. package/dist/{worktree-list-4PLE7K6L.js → worktree-list-EMKUMCTQ.js} +2 -2
  98. package/dist/{worktree-sync-GQVYAXGJ.js → worktree-sync-A277AF4M.js} +4 -6
  99. package/docs/commands.md +14 -7
  100. package/docs/git-workflow.md +53 -13
  101. package/docs/hooks.md +138 -10
  102. package/docs/project-configuration.md +31 -1
  103. package/docs/upgrading.md +58 -0
  104. package/gemini-extension.json +2 -2
  105. package/mcp.json +1 -1
  106. package/package.json +5 -5
  107. package/plugin.json +1 -1
  108. package/plugins/pmcp/.claude-plugin/plugin.json +1 -1
  109. package/plugins/pmcp/.mcp.json +1 -1
  110. package/plugins/pmcp/gemini-extension.json +2 -2
  111. package/plugins/pmcp/mcp.json +1 -1
  112. package/plugins/pmcp/mod/sessions/format.ts +2 -2
  113. package/plugins/pmcp/plugin.json +1 -1
  114. package/plugins/pmcp/skills/agent-assets-migrate/SKILL.md +11 -8
  115. package/plugins/pmcp/skills/pmcp-project-init/SKILL.md +11 -7
  116. package/skills/agent-assets-migrate/SKILL.md +11 -8
  117. package/skills/pmcp-project-init/SKILL.md +11 -7
  118. package/dist/chunk-7SDOSTW7.js +0 -130
  119. package/dist/chunk-AWZF72SH.js +0 -1025
  120. package/dist/chunk-FGYFA6JY.js +0 -7
  121. package/dist/chunk-ICF2JZSN.js +0 -92
  122. package/dist/chunk-ISNRDHSD.js +0 -74
  123. package/dist/chunk-QDY6BWE6.js +0 -396
  124. package/dist/hooks-YVQSDQV3.js +0 -21
@@ -5,19 +5,23 @@ import {
5
5
  flockAvailable,
6
6
  lockFile
7
7
  } from "./chunk-DZ2MRTYT.js";
8
+ import {
9
+ globPattern
10
+ } from "./chunk-UKR64U7J.js";
8
11
  import {
9
12
  followPins,
10
13
  installIfStale,
11
14
  installSpec,
12
15
  installState,
13
- lockHash
14
- } from "./chunk-UD3BEEBQ.js";
16
+ lockHash,
17
+ syncWorktree
18
+ } from "./chunk-XZ2TDH3J.js";
15
19
  import {
16
20
  cherry,
17
21
  isAncestor,
18
22
  touchedPaths,
19
23
  undelivered
20
- } from "./chunk-ISNRDHSD.js";
24
+ } from "./chunk-KUBHGVTD.js";
21
25
  import {
22
26
  reportModes,
23
27
  restoreModes,
@@ -27,12 +31,14 @@ import {
27
31
  import {
28
32
  gateTreePath,
29
33
  leaseSpecs
30
- } from "./chunk-5JPD6VIH.js";
31
- import "./chunk-2Q6MNGU5.js";
34
+ } from "./chunk-GBKRDRMZ.js";
35
+ import {
36
+ detect
37
+ } from "./chunk-2Q6MNGU5.js";
32
38
  import {
33
39
  createFilesStore
34
- } from "./chunk-PQTM27GU.js";
35
- import "./chunk-QSIADSMQ.js";
40
+ } from "./chunk-MR5IBS6L.js";
41
+ import "./chunk-Z6WRFOFT.js";
36
42
  import {
37
43
  git,
38
44
  gitOk,
@@ -46,7 +52,7 @@ import "./chunk-GJXOFDJT.js";
46
52
  import "./chunk-PMJG2CXF.js";
47
53
 
48
54
  // src/git/mainline/deliver.ts
49
- import { readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
55
+ import { readFileSync as readFileSync2 } from "fs";
50
56
  import { dirname as dirname3, join as join5 } from "path";
51
57
  import { loadavg } from "os";
52
58
 
@@ -393,13 +399,9 @@ function push(options, tip, preHook) {
393
399
  const dir = options.gate?.logDir ?? join5(dirname3(gateTree(options.tree).tree), "logs");
394
400
  const log = gateLog(dir, tip);
395
401
  report.info(`the pre-push hook gates ${tip.slice(0, 10)}; gate log: ${log}`);
396
- const pushed = git(ctx.root, args, env);
397
- const output = `${pushed.stdout}${pushed.stderr}`;
398
- writeFileSync2(log, output);
399
- process.stderr.write(output);
400
- if (options.track)
401
- options.track.gate = { exit: pushed.status, log, by: "pre-push" };
402
- return pushed;
402
+ const status = runCommandLogged(["git", ...args], ctx.root, log, env);
403
+ if (options.track) options.track.gate = { exit: status, log, by: "pre-push" };
404
+ return { status, stdout: "", stderr: "" };
403
405
  }
404
406
  function attempts(options) {
405
407
  const { ctx, report } = options;
@@ -429,6 +431,7 @@ function attempts(options) {
429
431
  report.warn(replayed.error);
430
432
  return 1;
431
433
  }
434
+ if (options.track) options.track.replayed = replayed.tip;
432
435
  const preHook = options.deliver.gate === "pre-push";
433
436
  const command = preHook ? void 0 : options.gate?.command;
434
437
  if (command !== void 0) {
@@ -450,6 +453,12 @@ function attempts(options) {
450
453
  return 1;
451
454
  }
452
455
  }
456
+ if (options.noPush) {
457
+ report.info(
458
+ `replayed ${replayed.tip.slice(0, 10)}; --no-push, so nothing was pushed`
459
+ );
460
+ return 0;
461
+ }
453
462
  const pushed = push(options, replayed.tip, preHook);
454
463
  if (pushed.status === 0) {
455
464
  if (options.track) options.track.delivered = replayed.tip;
@@ -537,7 +546,7 @@ function underLock(options) {
537
546
  });
538
547
  try {
539
548
  if (!loadAllows(options)) return 1;
540
- if (options.pushPins && !pinsPushed(options)) return 1;
549
+ if (options.pushPins && !options.noPush && !pinsPushed(options)) return 1;
541
550
  return attempts(options);
542
551
  } finally {
543
552
  removeHolder(lock);
@@ -558,7 +567,15 @@ function blocked(options) {
558
567
  );
559
568
  }
560
569
  function deliver(options) {
561
- const track = { attempts: 0, gate: null, delivered: null, leases: [] };
570
+ const track = {
571
+ attempts: 0,
572
+ gate: null,
573
+ replayed: null,
574
+ delivered: null,
575
+ leases: [],
576
+ sync: null,
577
+ deskSync: null
578
+ };
562
579
  let reason;
563
580
  const report = {
564
581
  info: (line) => options.report.info(line),
@@ -577,14 +594,23 @@ function deliver(options) {
577
594
  delivered: track.delivered,
578
595
  upstream: options.ctx.upstream,
579
596
  attempts: track.attempts,
597
+ replayed: track.replayed,
580
598
  gate: track.gate,
581
599
  leases: track.leases,
600
+ sync: track.sync,
601
+ desk_sync: track.deskSync,
582
602
  ...code !== 0 && reason ? { reason } : {}
583
603
  });
584
604
  return code;
585
605
  }
586
606
  function deliverOnce(options) {
587
607
  const { ctx, report } = options;
608
+ if (options.noPush && options.deliver.gate === "pre-push") {
609
+ report.warn(
610
+ '--no-push cannot gate with gate = "pre-push": the push is the gate; nothing ran'
611
+ );
612
+ return 2;
613
+ }
588
614
  const refusal2 = blocked(options);
589
615
  if (refusal2 !== null) {
590
616
  report.warn(refusal2);
@@ -596,7 +622,7 @@ function deliverOnce(options) {
596
622
  }
597
623
  const commits = undelivered(ctx.root, ctx.upstream, options.named);
598
624
  const touched = touchedPaths(ctx.root, commits);
599
- const leased = options.leases.filter(
625
+ const leased = options.noPush ? [] : options.leases.filter(
600
626
  (spec) => spec.paths.some((path) => touched.has(path))
601
627
  );
602
628
  const last = commits.at(-1) ?? "HEAD";
@@ -618,8 +644,11 @@ function deliverOnce(options) {
618
644
  report.info(`took lease ${spec.name}`);
619
645
  }
620
646
  const code = underLock(options);
621
- if (code !== 0) return code;
622
- options.afterDeliver?.();
647
+ if (code !== 0 || options.noPush) return code;
648
+ const synced = options.afterDeliver?.() ?? null;
649
+ if (options.track) options.track.sync = synced;
650
+ const deskSynced = options.afterDeliverDesk?.() ?? null;
651
+ if (options.track) options.track.deskSync = deskSynced;
623
652
  if (taken.length > 0)
624
653
  options.recordDelivery?.({
625
654
  leases: taken,
@@ -801,17 +830,20 @@ var IN_PROGRESS = [
801
830
  "REVERT_HEAD",
802
831
  "BISECT_LOG"
803
832
  ];
833
+ function inProgress(ctx) {
834
+ for (const marker of IN_PROGRESS) {
835
+ if (existsSync4(join7(ctx.gitDir, marker)))
836
+ return `${marker} is present; another git command is running or unfinished`;
837
+ }
838
+ return null;
839
+ }
804
840
  function refusal(ctx) {
805
841
  if (ctx.linked)
806
842
  return "this is a linked worktree; sync moves only the main checkout";
807
843
  const branch = gitText(ctx.root, ["symbolic-ref", "--short", "-q", "HEAD"]);
808
844
  if (branch !== ctx.mainline)
809
845
  return `the main checkout is on ${branch || "a detached HEAD"}, not ${ctx.mainline}`;
810
- for (const marker of IN_PROGRESS) {
811
- if (existsSync4(join7(ctx.gitDir, marker)))
812
- return `${marker} is present; another git command is running or unfinished`;
813
- }
814
- return null;
846
+ return inProgress(ctx);
815
847
  }
816
848
  function install(options) {
817
849
  const { ctx, sync, report } = options;
@@ -824,11 +856,25 @@ function install(options) {
824
856
  function syncMainline(options) {
825
857
  return withUmask(options.umask, () => syncOnce(options));
826
858
  }
859
+ function syncMainlineResult(options) {
860
+ let reason;
861
+ const report = {
862
+ info: (line) => options.report.info(line),
863
+ warn: (line) => {
864
+ reason = line;
865
+ options.report.warn(line);
866
+ }
867
+ };
868
+ const head = () => gitText(options.ctx.root, ["rev-parse", "HEAD"]);
869
+ const from = head();
870
+ const code = syncMainline({ ...options, report });
871
+ return { from, to: head(), code, ...reason ? { reason } : {} };
872
+ }
827
873
  function syncOnce(options) {
828
874
  const { ctx, sync, report } = options;
829
- const blocked2 = refusal(ctx);
830
- if (blocked2 !== null) {
831
- report.warn(blocked2);
875
+ const blocked3 = refusal(ctx);
876
+ if (blocked3 !== null) {
877
+ report.warn(blocked3);
832
878
  return 2;
833
879
  }
834
880
  if (git(ctx.root, ["fetch", "-q", ctx.remote, ctx.mainline]).status !== 0) {
@@ -878,9 +924,80 @@ ${moved.stderr.trim()}`
878
924
  return install(options);
879
925
  }
880
926
 
927
+ // src/git/worktrees/desk.ts
928
+ import { relative } from "path";
929
+ function checkoutKind(ctx, worktrees) {
930
+ if (!ctx.linked) return "shared";
931
+ if (worktrees === void 0) return "scratch";
932
+ const path = relative(ctx.mainRoot, ctx.root).split("\\").join("/");
933
+ return globPattern(worktrees.desks, false).test(path) ? "desk" : "scratch";
934
+ }
935
+ function blocked2(options) {
936
+ const pause = options.store.pause.read();
937
+ if (pause !== null)
938
+ return `the sessions are paused (${pause.reason}, since ${pause.since})`;
939
+ for (const spec of options.leases) {
940
+ const lease = options.store.leases.read(spec.name);
941
+ if (lease !== null && lease.pid !== process.pid)
942
+ return `lease ${spec.name} is held by ${lease.subject} (pid ${lease.pid})`;
943
+ }
944
+ return inProgress(options.ctx);
945
+ }
946
+ function syncDesk(options) {
947
+ let reason;
948
+ const report = {
949
+ info: (line) => options.report.info(line),
950
+ warn: (line) => {
951
+ reason = line;
952
+ options.report.warn(line);
953
+ }
954
+ };
955
+ const head = () => gitText(options.ctx.root, ["rev-parse", "HEAD"]);
956
+ const from = head();
957
+ const refused = blocked2(options);
958
+ if (refused !== null) {
959
+ report.warn(`${refused}; the desk stays where it is`);
960
+ return { from, to: from, code: 1, ...reason ? { reason } : {} };
961
+ }
962
+ const moved = syncWorktree({
963
+ ctx: options.ctx,
964
+ followSubmodules: options.followSubmodules,
965
+ report,
966
+ ...options.install === void 0 ? {} : { install: options.install },
967
+ ...options.umask === void 0 ? {} : { umask: options.umask }
968
+ });
969
+ return {
970
+ from,
971
+ to: head(),
972
+ code: moved === "held" ? 1 : 0,
973
+ ...reason ? { reason } : {}
974
+ };
975
+ }
976
+
881
977
  // src/git/cli/mainline.ts
978
+ function deskSync(setup, report) {
979
+ const { config } = setup;
980
+ const install2 = installSpec(config.sync, setup.stateDir);
981
+ return syncDesk({
982
+ ctx: setup.ctx,
983
+ followSubmodules: config.submodules?.follow === "clean_pins",
984
+ store: filesSessionGate(setup.stateDir, setup.leaseFiles),
985
+ leases: leaseSpecs(config),
986
+ report,
987
+ ...install2 === void 0 ? {} : { install: install2 },
988
+ ...config.umask !== void 0 ? { umask: config.umask } : {}
989
+ });
990
+ }
882
991
  var mainlineSync = (setup, _context, report) => {
883
992
  const sync = setup.config.sync ?? off("git.mainline.sync");
993
+ const kind = checkoutKind(setup.ctx, setup.config.worktrees);
994
+ if (kind === "desk") return deskSync(setup, report).code;
995
+ if (kind === "scratch") {
996
+ report.warn(
997
+ `${setup.ctx.root} is a linked worktree but not a desk ([git.worktrees] desks); pmcp git sync moves the main checkout and desks only`
998
+ );
999
+ return 2;
1000
+ }
884
1001
  const followSubmodules = setup.config.submodules?.follow === "clean_pins";
885
1002
  const { ctx, stateDir } = setup;
886
1003
  const sharedSubmodules = setup.config.submodules?.shared ?? [];
@@ -898,22 +1015,42 @@ var mainlineDeliver = (setup, context, report) => {
898
1015
  const { config, ctx, stateDir } = setup;
899
1016
  const settings = config.deliver ?? off("git.mainline.deliver");
900
1017
  const sync = config.sync;
1018
+ const mainCheckout = () => {
1019
+ const when = sync?.afterDeliver ?? "from_main";
1020
+ if (sync === void 0 || when === "off") return null;
1021
+ if (!ctx.linked) return ctx;
1022
+ if (when !== "always") return null;
1023
+ return detect(ctx.mainRoot, { remote: ctx.remote, mainline: ctx.mainline });
1024
+ };
901
1025
  const afterDeliver = () => {
902
- if (sync === void 0 || ctx.linked) return;
1026
+ const main = mainCheckout();
1027
+ if (sync === void 0 || main === null) return null;
903
1028
  const followSubmodules = config.submodules?.follow === "clean_pins";
904
1029
  const sharedSubmodules = config.submodules?.shared ?? [];
905
- if (syncMainline({
906
- ctx,
1030
+ const synced = syncMainlineResult({
1031
+ ctx: main,
907
1032
  sync,
908
1033
  followSubmodules,
909
1034
  sharedSubmodules,
910
1035
  stateDir,
911
1036
  report,
912
1037
  ...config.umask !== void 0 ? { umask: config.umask } : {}
913
- }) !== 0)
1038
+ });
1039
+ if (synced.code !== 0)
1040
+ report.warn(
1041
+ "delivered; only the main checkout did not catch up, run pmcp git sync there after the refusal above is cleared"
1042
+ );
1043
+ return synced;
1044
+ };
1045
+ const afterDeliverDesk = () => {
1046
+ if (config.worktreeSync?.afterDeliver !== "desk") return null;
1047
+ if (checkoutKind(ctx, config.worktrees) !== "desk") return null;
1048
+ const synced = deskSync(setup, report);
1049
+ if (synced.code !== 0)
914
1050
  report.warn(
915
- "delivered; only the main checkout did not catch up, run pmcp git sync after the refusal above is cleared"
1051
+ "delivered; only this desk did not catch up, run pmcp git sync here after the hold above is cleared"
916
1052
  );
1053
+ return synced;
917
1054
  };
918
1055
  return deliver({
919
1056
  ctx,
@@ -925,7 +1062,9 @@ var mainlineDeliver = (setup, context, report) => {
925
1062
  leases: leaseSpecs(config),
926
1063
  store: filesSessionGate(setup.stateDir, setup.leaseFiles),
927
1064
  duringPause: context.args.flags.has("during-pause"),
1065
+ noPush: context.args.flags.has("no-push"),
928
1066
  afterDeliver,
1067
+ afterDeliverDesk,
929
1068
  recordDelivery: deliveryEvents(setup),
930
1069
  pushPins: config.submodules?.push === "pins",
931
1070
  ...config.umask !== void 0 ? { umask: config.umask } : {},
@@ -940,4 +1079,4 @@ export {
940
1079
  mainlineDeliver,
941
1080
  mainlineSync
942
1081
  };
943
- //# sourceMappingURL=mainline-6K5BA3WX.js.map
1082
+ //# sourceMappingURL=mainline-Q42M2GJ2.js.map
@@ -5,11 +5,11 @@ import "./chunk-XNML2KIC.js";
5
5
 
6
6
  // src/commands/mcp.ts
7
7
  async function run(context) {
8
- const { executeMcpCommand } = await import("./run-ORBIERI3.js");
8
+ const { executeMcpCommand } = await import("./run-HVNKQHVU.js");
9
9
  return executeMcpCommand(context);
10
10
  }
11
11
  var mcpCommand = { ...mcpSpec, run };
12
12
  export {
13
13
  mcpCommand
14
14
  };
15
- //# sourceMappingURL=mcp-JXNTKRJG.js.map
15
+ //# sourceMappingURL=mcp-IDEUIY2F.js.map
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  change
3
- } from "./chunk-QYH2NR6G.js";
4
- import "./chunk-PQTM27GU.js";
5
- import "./chunk-QSIADSMQ.js";
3
+ } from "./chunk-7FV2LORT.js";
4
+ import "./chunk-MR5IBS6L.js";
5
+ import "./chunk-Z6WRFOFT.js";
6
6
  import "./chunk-A4PKLESO.js";
7
7
  import "./chunk-OEH47H6A.js";
8
8
  import "./chunk-IJBSOWHK.js";
@@ -14,4 +14,4 @@ var run = (context) => change(context, "pause");
14
14
  export {
15
15
  run
16
16
  };
17
- //# sourceMappingURL=pause-GRVTSKOK.js.map
17
+ //# sourceMappingURL=pause-CZ2OZYLC.js.map
@@ -1,4 +1,4 @@
1
- import { S as ShellHookSpec, H as HookTool } from '../hook-spec-C7umArqw.js';
1
+ import { S as ShellHookSpec, H as HookTool } from '../hook-spec-hZL4MSgi.js';
2
2
 
3
3
  declare function guardPath(root: string, command: readonly string[]): string;
4
4
 
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-NRBQK6UX.js";
4
4
  import {
5
5
  projectSpec
6
- } from "./chunk-YN5GQCHN.js";
6
+ } from "./chunk-RHJEGLYM.js";
7
7
  import "./chunk-JEL35P7S.js";
8
8
  import "./chunk-XNML2KIC.js";
9
9
  import {
@@ -19,7 +19,7 @@ async function route(context, verb, name) {
19
19
  if (name === void 0 || context.args.flags.has("check") || context.args.flags.has("write") || many(context.args, "source").length > 0 || many(context.args, "name").length > 0) {
20
20
  throw new ArgumentError("exec-mcp takes only a declared MCP alias");
21
21
  }
22
- const { runExecMcp } = await import("./exec-mcp-AG4G7SG7.js");
22
+ const { runExecMcp } = await import("./exec-mcp-JEF74XVP.js");
23
23
  return await runExecMcp(context, name);
24
24
  }
25
25
  if (verb === "import-mcp") {
@@ -28,13 +28,13 @@ async function route(context, verb, name) {
28
28
  "import-mcp takes --source, --name and --write; no positional name or --check"
29
29
  );
30
30
  }
31
- const { importMcp } = await import("./import-mcp-2M7SZRVQ.js");
31
+ const { importMcp } = await import("./import-mcp-3Y33CUHF.js");
32
32
  return importMcp(context);
33
33
  }
34
34
  if (many(context.args, "source").length > 0 || one(context.args, "name") !== void 0 || context.args.flags.has("write")) {
35
35
  throw new ArgumentError("--source, --name and --write require import-mcp");
36
36
  }
37
- const apply = await import("./apply-QJ6MGLBX.js");
37
+ const apply = await import("./apply-3PR4UOES.js");
38
38
  if (verb === void 0) return apply.projectOrCheck(context);
39
39
  if (context.args.flags.has("check")) {
40
40
  throw new ArgumentError("--check takes no subcommand");
@@ -67,4 +67,4 @@ var projectCommand = {
67
67
  export {
68
68
  projectCommand
69
69
  };
70
- //# sourceMappingURL=project-M672MKQH.js.map
70
+ //# sourceMappingURL=project-GVVWLDOJ.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ptyRef
3
- } from "./chunk-ONP6JRFZ.js";
4
- import "./chunk-QSIADSMQ.js";
3
+ } from "./chunk-OFJIMBTL.js";
4
+ import "./chunk-Z6WRFOFT.js";
5
5
 
6
6
  // src/sessions/wake/pty.ts
7
7
  import { createConnection } from "net";
@@ -91,4 +91,4 @@ async function ptyTurn(record, text, _context) {
91
91
  export {
92
92
  ptyTurn
93
93
  };
94
- //# sourceMappingURL=pty-LHKJKY2E.js.map
94
+ //# sourceMappingURL=pty-CDLQ4NP2.js.map
@@ -0,0 +1,105 @@
1
+ import {
2
+ logLocation,
3
+ parseSince,
4
+ readLogs
5
+ } from "./chunk-57Q75MS4.js";
6
+ import {
7
+ configFrom
8
+ } from "./chunk-RPCIROW7.js";
9
+ import {
10
+ guardLines,
11
+ readReportTable,
12
+ report,
13
+ wouldRefuse
14
+ } from "./chunk-LFFIQBNY.js";
15
+ import "./chunk-HQOB7OQS.js";
16
+ import "./chunk-MR5IBS6L.js";
17
+ import "./chunk-Z6WRFOFT.js";
18
+ import {
19
+ ArgumentError,
20
+ one
21
+ } from "./chunk-A4PKLESO.js";
22
+ import "./chunk-OEH47H6A.js";
23
+ import "./chunk-IJBSOWHK.js";
24
+ import "./chunk-GJXOFDJT.js";
25
+ import "./chunk-PMJG2CXF.js";
26
+
27
+ // src/commands/hooks/report.ts
28
+ async function run(context) {
29
+ const config = configFrom(context);
30
+ if (!config)
31
+ throw new ArgumentError("no pmcp.toml here or above; pass --config");
32
+ const hooks = config.raw.hooks ?? {};
33
+ let settings;
34
+ let since;
35
+ try {
36
+ settings = readReportTable(hooks["report"]);
37
+ const value = one(context.args, "since");
38
+ if (value !== void 0) since = parseSince(value);
39
+ } catch (error) {
40
+ throw new ArgumentError(
41
+ error instanceof Error ? error.message : String(error)
42
+ );
43
+ }
44
+ const location = logLocation(config, context.env);
45
+ const logged = readLogs(
46
+ location.dir,
47
+ { component: "hooks.entry", ...since ? { since } : {} },
48
+ location.file
49
+ );
50
+ const { kept, excluded } = guardLines(logged, settings);
51
+ const guard = one(context.args, "switch-check");
52
+ const json = context.args.flags.has("json");
53
+ if (guard !== void 0) {
54
+ const found = wouldRefuse(kept, guard);
55
+ if (json)
56
+ context.ui.data(
57
+ JSON.stringify({ version: 1, guard, refused: found }) + "\n"
58
+ );
59
+ else {
60
+ for (const line of found)
61
+ context.ui.line(
62
+ [
63
+ line.ts,
64
+ line.runtime,
65
+ line.session.slice(0, 8),
66
+ `${line.mode}: ${line.raw} -> ${line.verdict}`,
67
+ line.tool ?? ""
68
+ ].filter(Boolean).join(" ")
69
+ );
70
+ context.ui.line(
71
+ `${guard} would have refused ${found.length} call(s) it let through`
72
+ );
73
+ }
74
+ return 0;
75
+ }
76
+ const summary = report(kept, excluded);
77
+ if (json) {
78
+ context.ui.data(
79
+ JSON.stringify({
80
+ version: 1,
81
+ ...since ? { since: since.toISOString() } : {},
82
+ ...summary
83
+ }) + "\n"
84
+ );
85
+ return 0;
86
+ }
87
+ if (summary.lines === 0)
88
+ context.ui.line(
89
+ "no guard log lines; guards log at debug level ([logging] level or PMCP_LOG=debug)"
90
+ );
91
+ for (const row of summary.guards) {
92
+ const counts = (values) => Object.entries(values).sort(([a], [b]) => a.localeCompare(b)).map(([name, value]) => `${name} ${value}`).join(", ");
93
+ context.ui.line(
94
+ `${row.policy} ${row.runtime} [${row.modes.join(",")}]: ${row.calls} call(s), ${row.sessions} session(s); found ${counts(row.raw)}; gave ${counts(row.verdict)}; p50 ${row.durationMs.p50}ms p95 ${row.durationMs.p95}ms max ${row.durationMs.max}ms`
95
+ );
96
+ }
97
+ context.ui.line(
98
+ `${summary.lines} guard run(s) in ${summary.sessions} session(s)${summary.excluded ? `; ${summary.excluded} excluded by [hooks.report] exclude_sessions` : ""}`
99
+ );
100
+ return 0;
101
+ }
102
+ export {
103
+ run
104
+ };
105
+ //# sourceMappingURL=report-Z3JV2PCT.js.map
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  change
3
- } from "./chunk-QYH2NR6G.js";
4
- import "./chunk-PQTM27GU.js";
5
- import "./chunk-QSIADSMQ.js";
3
+ } from "./chunk-7FV2LORT.js";
4
+ import "./chunk-MR5IBS6L.js";
5
+ import "./chunk-Z6WRFOFT.js";
6
6
  import "./chunk-A4PKLESO.js";
7
7
  import "./chunk-OEH47H6A.js";
8
8
  import "./chunk-IJBSOWHK.js";
@@ -14,4 +14,4 @@ var run = (context) => change(context, "resume");
14
14
  export {
15
15
  run
16
16
  };
17
- //# sourceMappingURL=resume-6DMPGG3N.js.map
17
+ //# sourceMappingURL=resume-DFIHT2RO.js.map
@@ -9,11 +9,11 @@ async function executeMcpCommand(context) {
9
9
  throw new ArgumentError("Use pmcp mcp <login|logout|status> <name>");
10
10
  if (context.args.flags.has("json") && verb !== "status")
11
11
  throw new ArgumentError("--json requires mcp status");
12
- if (verb === "status") return (await import("./status-73FEFQUQ.js")).run(context);
13
- if (verb === "logout") return (await import("./logout-OO3DERRK.js")).run(context);
14
- return (await import("./start-login-BGFAMCZL.js")).run(context);
12
+ if (verb === "status") return (await import("./status-Y25ONHA5.js")).run(context);
13
+ if (verb === "logout") return (await import("./logout-KAUW4JZZ.js")).run(context);
14
+ return (await import("./start-login-RNHSEX5P.js")).run(context);
15
15
  }
16
16
  export {
17
17
  executeMcpCommand
18
18
  };
19
- //# sourceMappingURL=run-ORBIERI3.js.map
19
+ //# sourceMappingURL=run-HVNKQHVU.js.map
@@ -1,33 +1,36 @@
1
1
  import {
2
2
  readSpec
3
- } from "./chunk-QOFSPFJ6.js";
4
- import "./chunk-HQOB7OQS.js";
5
- import "./chunk-ICF2JZSN.js";
6
- import "./chunk-UD3BEEBQ.js";
7
- import "./chunk-ISNRDHSD.js";
3
+ } from "./chunk-TCW2H47H.js";
4
+ import "./chunk-UKR64U7J.js";
5
+ import "./chunk-XZ2TDH3J.js";
6
+ import "./chunk-KUBHGVTD.js";
8
7
  import "./chunk-EATCUWGG.js";
8
+ import "./chunk-OFJIMBTL.js";
9
9
  import "./chunk-NRBQK6UX.js";
10
- import "./chunk-ONP6JRFZ.js";
10
+ import "./chunk-LFFIQBNY.js";
11
+ import "./chunk-HQOB7OQS.js";
12
+ import "./chunk-73AKO4UL.js";
11
13
  import "./chunk-P6LNYYYH.js";
12
14
  import {
13
15
  readGitConfig
14
- } from "./chunk-5JPD6VIH.js";
16
+ } from "./chunk-GBKRDRMZ.js";
15
17
  import {
16
18
  detect
17
19
  } from "./chunk-2Q6MNGU5.js";
18
- import "./chunk-PQTM27GU.js";
19
- import "./chunk-QSIADSMQ.js";
20
+ import "./chunk-MR5IBS6L.js";
21
+ import "./chunk-Z6WRFOFT.js";
20
22
  import "./chunk-G7JONWL4.js";
21
23
  import "./chunk-Q5H3L6Y4.js";
24
+ import "./chunk-5YCKFU5Q.js";
22
25
  import {
23
26
  ArgumentError,
24
27
  one
25
28
  } from "./chunk-A4PKLESO.js";
26
29
  import "./chunk-V4NPDK6X.js";
27
- import "./chunk-66F3HLW4.js";
30
+ import "./chunk-XB363ZXT.js";
28
31
  import "./chunk-OEH47H6A.js";
29
32
  import "./chunk-IJBSOWHK.js";
30
- import "./chunk-FGYFA6JY.js";
33
+ import "./chunk-L42U5XKC.js";
31
34
  import {
32
35
  readConfig
33
36
  } from "./chunk-GJXOFDJT.js";
@@ -124,4 +127,4 @@ function run(context) {
124
127
  export {
125
128
  run
126
129
  };
127
- //# sourceMappingURL=run-5W566T3V.js.map
130
+ //# sourceMappingURL=run-RRWB7U2Q.js.map
@@ -19,7 +19,7 @@ import "./chunk-73AKO4UL.js";
19
19
  import {
20
20
  serve,
21
21
  serveWithMailbox
22
- } from "./chunk-MZEMLFFD.js";
22
+ } from "./chunk-3OBJVG5R.js";
23
23
  import {
24
24
  serveSpec
25
25
  } from "./chunk-LLT5FQBE.js";
@@ -30,7 +30,7 @@ import {
30
30
  one
31
31
  } from "./chunk-A4PKLESO.js";
32
32
  import "./chunk-ISZOLR3D.js";
33
- import "./chunk-O2JWF7ZM.js";
33
+ import "./chunk-LVNGMGOM.js";
34
34
  import "./chunk-6WXMJOMI.js";
35
35
  import "./chunk-4CRRLDDS.js";
36
36
  import "./chunk-YSAWTGNA.js";
@@ -101,4 +101,4 @@ var serveCommand = {
101
101
  export {
102
102
  serveCommand
103
103
  };
104
- //# sourceMappingURL=serve-73SRPAV4.js.map
104
+ //# sourceMappingURL=serve-KJSOU3BR.js.map