@modootoday/pmcp 0.17.4 → 0.18.2

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 (272) hide show
  1. package/.agents/plugins/marketplace.json +1 -1
  2. package/.claude-plugin/marketplace.json +1 -1
  3. package/.claude-plugin/plugin.json +2 -2
  4. package/.mcp.json +1 -1
  5. package/CHANGELOG.md +152 -0
  6. package/CONTRIBUTING.md +71 -0
  7. package/README.md +98 -201
  8. package/SECURITY.md +17 -1
  9. package/dist/apply-JUTGS5WZ.js +242 -0
  10. package/dist/{attachment-tU5FZrgZ.d.ts → attachment-D84OGI6n.d.ts} +1 -1
  11. package/dist/available-DBSIVVJ6.js +73 -0
  12. package/dist/broadcast-CBMVOV3G.js +18 -0
  13. package/dist/chunk-26WLNWDG.js +93 -0
  14. package/dist/chunk-2FIV63WC.js +252 -0
  15. package/dist/chunk-2P4Z2NUX.js +28 -0
  16. package/dist/chunk-34DECPVC.js +22 -0
  17. package/dist/chunk-3FCFAQDG.js +42 -0
  18. package/dist/chunk-3IDXEV5E.js +1934 -0
  19. package/dist/chunk-3PW4FI7U.js +32 -0
  20. package/dist/chunk-3Y3HDMHA.js +108 -0
  21. package/dist/chunk-47O3X4VS.js +113 -0
  22. package/dist/chunk-4NDEP7HU.js +26 -0
  23. package/dist/chunk-5OMOPUE6.js +39 -0
  24. package/dist/chunk-5QQWS4US.js +53 -0
  25. package/dist/chunk-5ZABTVSW.js +48 -0
  26. package/dist/chunk-65KAQSJP.js +7 -0
  27. package/dist/chunk-6STKGOCW.js +27 -0
  28. package/dist/chunk-6WXMJOMI.js +9 -0
  29. package/dist/chunk-73AKO4UL.js +24 -0
  30. package/dist/chunk-7DLZC73N.js +29 -0
  31. package/dist/chunk-7GBYECSK.js +72 -0
  32. package/dist/chunk-7HFIGCSL.js +419 -0
  33. package/dist/chunk-7TD53M7L.js +13 -0
  34. package/dist/chunk-7UCZAN4J.js +778 -0
  35. package/dist/chunk-A4PKLESO.js +112 -0
  36. package/dist/chunk-A7VF7A35.js +1025 -0
  37. package/dist/chunk-ABTJQ4QV.js +74 -0
  38. package/dist/chunk-AJ4VXM2U.js +349 -0
  39. package/dist/chunk-BBTBJCFA.js +380 -0
  40. package/dist/chunk-BU65MNVU.js +13 -0
  41. package/dist/chunk-C4NHQGHL.js +142 -0
  42. package/dist/chunk-CJTKR6K6.js +1213 -0
  43. package/dist/chunk-D77IRGHO.js +1246 -0
  44. package/dist/chunk-DCU2EXQV.js +78 -0
  45. package/dist/chunk-DMZHQZ7P.js +104 -0
  46. package/dist/chunk-DZ2MRTYT.js +135 -0
  47. package/dist/chunk-E2YOZ2FF.js +207 -0
  48. package/dist/chunk-E3DQB5LS.js +48 -0
  49. package/dist/chunk-EATCUWGG.js +66 -0
  50. package/dist/chunk-EAWPJHJ7.js +155 -0
  51. package/dist/chunk-EIDIVIAD.js +33 -0
  52. package/dist/chunk-F5QYZK7E.js +396 -0
  53. package/dist/chunk-F5XMGOOX.js +28 -0
  54. package/dist/chunk-FENOGX3U.js +31 -0
  55. package/dist/chunk-GZHHEHKY.js +44 -0
  56. package/dist/chunk-HDMBVLCZ.js +53 -0
  57. package/dist/chunk-HQOB7OQS.js +81 -0
  58. package/dist/chunk-I2ZP2PSA.js +211 -0
  59. package/dist/chunk-IG33DXLT.js +151 -0
  60. package/dist/chunk-IJBSOWHK.js +86 -0
  61. package/dist/chunk-INT7QLEU.js +114 -0
  62. package/dist/chunk-J7UYNJCR.js +9 -0
  63. package/dist/chunk-JEL35P7S.js +53 -0
  64. package/dist/chunk-JGJ4INEN.js +32 -0
  65. package/dist/chunk-JS5RTH4I.js +84 -0
  66. package/dist/chunk-JWRZDYB5.js +59 -0
  67. package/dist/chunk-KMXRRSKT.js +660 -0
  68. package/dist/chunk-LBXO4VPG.js +73 -0
  69. package/dist/chunk-LLBPVZXM.js +67 -0
  70. package/dist/chunk-LLT5FQBE.js +57 -0
  71. package/dist/chunk-LMT3PPXJ.js +17 -0
  72. package/dist/chunk-LMUBBIE2.js +83 -0
  73. package/dist/chunk-LTZH5E3G.js +479 -0
  74. package/dist/chunk-LW4TG7EL.js +39 -0
  75. package/dist/chunk-MPSQXSC6.js +346 -0
  76. package/dist/chunk-MVFH26QT.js +97 -0
  77. package/dist/chunk-NLEXKE7U.js +67 -0
  78. package/dist/chunk-NQPURJT5.js +44 -0
  79. package/dist/chunk-NRBQK6UX.js +105 -0
  80. package/dist/chunk-OEH47H6A.js +48 -0
  81. package/dist/chunk-OG7QR2DP.js +75 -0
  82. package/dist/chunk-OPYFEHKG.js +52 -0
  83. package/dist/chunk-P4N7DBD5.js +83 -0
  84. package/dist/chunk-PAX3QXX2.js +140 -0
  85. package/dist/chunk-PKODFR5F.js +102 -0
  86. package/dist/chunk-PMJG2CXF.js +122 -0
  87. package/dist/chunk-Q5H3L6Y4.js +23 -0
  88. package/dist/chunk-QEF7EK3T.js +28 -0
  89. package/dist/chunk-QEW4J3IZ.js +74 -0
  90. package/dist/chunk-QPL7E2HW.js +464 -0
  91. package/dist/chunk-R2GPCZUX.js +22 -0
  92. package/dist/chunk-R5MT42JS.js +284 -0
  93. package/dist/chunk-RMATE45Z.js +197 -0
  94. package/dist/chunk-RPQOBHVU.js +87 -0
  95. package/dist/chunk-S3PIAMXV.js +230 -0
  96. package/dist/chunk-T3LKX23M.js +168 -0
  97. package/dist/chunk-T6GOWHK6.js +30 -0
  98. package/dist/chunk-TIA4SPU2.js +10 -0
  99. package/dist/chunk-TNCZ6444.js +57 -0
  100. package/dist/chunk-TVL5RTE6.js +269 -0
  101. package/dist/chunk-TXQ7L33K.js +45 -0
  102. package/dist/chunk-UPQTAHUK.js +189 -0
  103. package/dist/chunk-V4NPDK6X.js +14 -0
  104. package/dist/chunk-VJFEN6DJ.js +38 -0
  105. package/dist/chunk-VMHUEOT5.js +643 -0
  106. package/dist/chunk-VRPMYPZU.js +4985 -0
  107. package/dist/chunk-WIW772I3.js +25 -0
  108. package/dist/chunk-XELAZAIM.js +136 -0
  109. package/dist/chunk-XNML2KIC.js +23 -0
  110. package/dist/chunk-XP2U3LO3.js +30 -0
  111. package/dist/chunk-YGOWIJPE.js +51 -0
  112. package/dist/chunk-YIXDHQYE.js +11 -0
  113. package/dist/chunk-YSAWTGNA.js +117 -0
  114. package/dist/claude-U2JC2DNQ.js +77 -0
  115. package/dist/cli-MI4ZCAZ3.js +41 -0
  116. package/dist/cli-ZN7ZVDEZ.js +46 -0
  117. package/dist/cli.js +144 -16197
  118. package/dist/completion-ILSRB3LW.js +142 -0
  119. package/dist/config-DnpLL2kT.d.ts +46 -0
  120. package/dist/{service-qpCsOXkQ.d.ts → core-C1LPjxK6.d.ts} +2 -6
  121. package/dist/diagnostics-XKXVVQWH.js +93 -0
  122. package/dist/doctor-O2E63YGO.js +538 -0
  123. package/dist/entry-X6CSYQRQ.js +305 -0
  124. package/dist/exec-mcp-2PMWBPD7.js +365 -0
  125. package/dist/harness-L2KSI2ZB.js +177 -0
  126. package/dist/harness-egress-bridge.js +4 -4
  127. package/dist/harness-launch-gate.js +47 -940
  128. package/dist/harness-pane-runner.js +13 -80
  129. package/dist/harness-worker.js +21 -2703
  130. package/dist/hook-body.js +5222 -0
  131. package/dist/hook-spec-C5fWTSCH.d.ts +100 -0
  132. package/dist/hook.js +26 -0
  133. package/dist/hooks-BHTA44X7.js +21 -0
  134. package/dist/host-UIZAXXQH.js +22 -0
  135. package/dist/host-UWK754BW.js +210 -0
  136. package/dist/host-run-BI2OTZDZ.js +307 -0
  137. package/dist/http.d.ts +5 -42
  138. package/dist/http.js +21 -2234
  139. package/dist/import-mcp-GPKJI7DI.js +400 -0
  140. package/dist/index.d.ts +146 -168
  141. package/dist/index.js +133 -4948
  142. package/dist/init-3C2Y7BNJ.js +14 -0
  143. package/dist/install-GG7HHZK2.js +796 -0
  144. package/dist/invoke-44CJRVMK.js +23 -0
  145. package/dist/list-MCP2FXUF.js +68 -0
  146. package/dist/list-WL6L4J5H.js +65 -0
  147. package/dist/load-BEUBABtB.d.ts +21 -0
  148. package/dist/logout-F5EJ5MOU.js +44 -0
  149. package/dist/logs-TBUA4UWU.js +107 -0
  150. package/dist/mailbox/index.d.ts +10 -5
  151. package/dist/mailbox/index.js +53 -1572
  152. package/dist/mailbox-BMTZOSZ7.js +285 -0
  153. package/dist/mailbox-GDJ7BWQN.js +189 -0
  154. package/dist/mainline-KAD2ERLP.js +639 -0
  155. package/dist/marketplace-G4VQET5W.js +191 -0
  156. package/dist/mcp-235QZN2A.js +15 -0
  157. package/dist/mcp-FJ2UQ4RH.js +193 -0
  158. package/dist/models-ISU4DCMA.js +32 -0
  159. package/dist/opencode-CN7JLQYO.js +60 -0
  160. package/dist/pause-7LILUVGL.js +18 -0
  161. package/dist/preview-DT7DWG5F.js +91 -0
  162. package/dist/project/hook-adapter.d.ts +5 -2
  163. package/dist/project/hook-adapter.js +41 -27
  164. package/dist/project-5YV5CUEG.js +70 -0
  165. package/dist/pty-XTJ4MIWK.js +94 -0
  166. package/dist/recovery-U6QB3PMT.js +100 -0
  167. package/dist/reindex-Y27QJFDB.js +22 -0
  168. package/dist/resume-26VFAAMH.js +18 -0
  169. package/dist/run-3AXTZSR7.js +126 -0
  170. package/dist/run-3SOVRQIA.js +19 -0
  171. package/dist/serve-DQMKTFIV.js +104 -0
  172. package/dist/session-XM2CR425.js +159 -0
  173. package/dist/setup-DTKZLZUT.js +18 -0
  174. package/dist/start-login-YTZV6KMF.js +416 -0
  175. package/dist/status-A2OUTNGK.js +9 -0
  176. package/dist/status-H2VAHIDV.js +10 -0
  177. package/dist/status-MROQ7WR7.js +43 -0
  178. package/dist/status-RO55QPKV.js +55 -0
  179. package/dist/status-UME2L33L.js +286 -0
  180. package/dist/stdio.d.ts +3 -13
  181. package/dist/stdio.js +16 -3186
  182. package/dist/sweep-35LGQTTO.js +18 -0
  183. package/dist/test-AGZOJLRZ.js +561 -0
  184. package/dist/tools-gpHNq9Dh.d.ts +328 -0
  185. package/dist/tui-G5LLWCSV.js +153 -0
  186. package/dist/unbroadcast-5QNGAJR2.js +18 -0
  187. package/dist/validate-IU52H2IC.js +46 -0
  188. package/dist/worker-QZ5T6LJD.js +80 -0
  189. package/dist/worktree-create-PZSRB7PH.js +89 -0
  190. package/dist/worktree-list-JYB6VXLW.js +51 -0
  191. package/dist/worktree-sync-UF5CXPWV.js +30 -0
  192. package/docs/authoring.md +82 -0
  193. package/docs/browser-and-desktop.md +46 -0
  194. package/docs/commands.md +325 -0
  195. package/docs/compare.md +35 -0
  196. package/docs/compatibility.md +55 -0
  197. package/docs/embeddings.md +1 -1
  198. package/docs/getting-started.md +105 -0
  199. package/docs/git-workflow.md +60 -0
  200. package/docs/glossary.md +31 -0
  201. package/docs/hooks/capabilities/antigravity.json +199 -0
  202. package/docs/hooks/capabilities/claude.json +179 -0
  203. package/docs/hooks/capabilities/codex.json +179 -0
  204. package/docs/hooks/capabilities/gemini.json +196 -0
  205. package/docs/hooks/capabilities/grok.json +192 -0
  206. package/docs/hooks/capabilities/opencode.json +184 -0
  207. package/docs/hooks.md +264 -0
  208. package/docs/install.md +72 -0
  209. package/docs/library-skills.md +132 -0
  210. package/docs/mailbox.md +16 -5
  211. package/docs/project-configuration.md +540 -58
  212. package/docs/sessions.md +64 -0
  213. package/docs/skills.md +4 -45
  214. package/docs/terminal-harness.md +92 -44
  215. package/docs/terminal-workspace.md +81 -169
  216. package/gemini-extension.json +2 -2
  217. package/mcp.json +1 -1
  218. package/package.json +16 -2
  219. package/plugin.json +2 -2
  220. package/plugins/pmcp/.claude-plugin/plugin.json +4 -2
  221. package/plugins/pmcp/.mcp.json +1 -1
  222. package/plugins/pmcp/gemini-extension.json +2 -2
  223. package/plugins/pmcp/mcp.json +1 -1
  224. package/plugins/pmcp/mod/commands.ts +72 -0
  225. package/plugins/pmcp/mod/contract.d.ts +39 -0
  226. package/plugins/pmcp/mod/draw.tsx +216 -0
  227. package/plugins/pmcp/mod/guard.ts +42 -0
  228. package/plugins/pmcp/mod/hooks.json +4 -0
  229. package/plugins/pmcp/mod/host.ts +46 -0
  230. package/plugins/pmcp/mod/model.ts +144 -0
  231. package/plugins/pmcp/mod/reader/index.ts +18 -0
  232. package/plugins/pmcp/mod/reader/read.ts +76 -0
  233. package/plugins/pmcp/mod/reader/settings.ts +54 -0
  234. package/plugins/pmcp/mod/reader/types.ts +38 -0
  235. package/plugins/pmcp/mod/register.tsx +73 -0
  236. package/plugins/pmcp/mod/sessions/format.ts +91 -0
  237. package/plugins/pmcp/mod/sessions/types.ts +162 -0
  238. package/plugins/pmcp/mod/snapshot.ts +75 -0
  239. package/plugins/pmcp/mod/spinner.tsx +30 -0
  240. package/plugins/pmcp/mod/state.ts +28 -0
  241. package/plugins/pmcp/plugin.json +2 -2
  242. package/plugins/pmcp/skills/agent-assets-migrate/SKILL.md +96 -0
  243. package/plugins/pmcp/skills/headless-agents-ci-scaffold/SKILL.md +101 -0
  244. package/plugins/pmcp/skills/marketplace-plugin-scaffold/SKILL.md +87 -0
  245. package/plugins/pmcp/skills/package-skill-catalog/SKILL.md +51 -15
  246. package/plugins/pmcp/skills/pmcp-browser/SKILL.md +27 -0
  247. package/plugins/pmcp/skills/pmcp-desktop/SKILL.md +25 -0
  248. package/plugins/pmcp/skills/pmcp-project-init/SKILL.md +153 -0
  249. package/plugins/pmcp/skills/pmcp-sessions-and-git/SKILL.md +96 -0
  250. package/plugins/pmcp/skills/skill-package-scaffold/SKILL.md +89 -0
  251. package/schema/catalog-v1.json +187 -0
  252. package/schema/library.json +196 -0
  253. package/schema/marketplace-manifest.json +144 -0
  254. package/schema/plugin-manifest.json +59 -0
  255. package/schema/skill-frontmatter.json +170 -0
  256. package/schema/skill-metadata-core.json +131 -0
  257. package/skills/agent-assets-migrate/SKILL.md +96 -0
  258. package/skills/headless-agents-ci-scaffold/SKILL.md +101 -0
  259. package/skills/marketplace-plugin-scaffold/SKILL.md +87 -0
  260. package/skills/package-skill-catalog/SKILL.md +51 -15
  261. package/skills/pmcp-browser/SKILL.md +27 -0
  262. package/skills/pmcp-desktop/SKILL.md +25 -0
  263. package/skills/pmcp-project-init/SKILL.md +153 -0
  264. package/skills/pmcp-sessions-and-git/SKILL.md +96 -0
  265. package/skills/skill-package-scaffold/SKILL.md +89 -0
  266. package/dist/config-BkSpjUG6.d.ts +0 -50
  267. package/dist/embed-DRROSD3F.d.ts +0 -53
  268. package/dist/hook-spec-CSJJySsH.d.ts +0 -11
  269. package/dist/server-VWSY3Shw.d.ts +0 -543
  270. package/dist/tui-worker.js +0 -6549
  271. package/docs/manual-library-skills.md +0 -74
  272. /package/dist/{tui-worker.d.ts → hook.d.ts} +0 -0
@@ -0,0 +1,53 @@
1
+ import {
2
+ HEARTBEAT_INTERVAL_MS,
3
+ MailboxService,
4
+ MailboxStore,
5
+ readCredential,
6
+ writeBindingFile
7
+ } from "./chunk-CJTKR6K6.js";
8
+
9
+ // src/mailbox/attachment.ts
10
+ async function attachMailbox(options) {
11
+ const store = await MailboxStore.open(options.config);
12
+ let binding;
13
+ try {
14
+ binding = await store.attach(
15
+ readCredential(options.actorFile),
16
+ options.runtime,
17
+ options.replaceSessionId,
18
+ options.nativeSessionId
19
+ );
20
+ if (options.bindingFile) writeBindingFile(options.bindingFile, binding);
21
+ } catch (error) {
22
+ if (binding) await store.detach(binding);
23
+ await store.close();
24
+ throw error;
25
+ }
26
+ const current = binding;
27
+ let shutdown;
28
+ const close = () => {
29
+ if (shutdown) return shutdown;
30
+ clearInterval(heartbeat);
31
+ shutdown = (async () => {
32
+ try {
33
+ await store.detach(current);
34
+ } finally {
35
+ await store.close();
36
+ }
37
+ })();
38
+ return shutdown;
39
+ };
40
+ const heartbeat = setInterval(() => {
41
+ void store.heartbeat(current).catch(() => {
42
+ options.onExpired?.();
43
+ void close().catch(() => void 0);
44
+ });
45
+ }, HEARTBEAT_INTERVAL_MS);
46
+ heartbeat.unref();
47
+ return { service: new MailboxService(store, current), close };
48
+ }
49
+
50
+ export {
51
+ attachMailbox
52
+ };
53
+ //# sourceMappingURL=chunk-HDMBVLCZ.js.map
@@ -0,0 +1,81 @@
1
+ // src/logging/levels.ts
2
+ var LEVEL_RANK = {
3
+ error: 0,
4
+ warn: 1,
5
+ info: 2,
6
+ debug: 3,
7
+ trace: 4
8
+ };
9
+ function isLogLevel(value) {
10
+ return typeof value === "string" && Object.hasOwn(LEVEL_RANK, value);
11
+ }
12
+
13
+ // src/logging/settings.ts
14
+ var REDACT_KINDS = [
15
+ "secret_values",
16
+ "prompt_text",
17
+ "env_values"
18
+ ];
19
+ var DEFAULT_LOG_SETTINGS = {
20
+ enabled: true,
21
+ level: "info",
22
+ components: {},
23
+ maxFileMb: 20,
24
+ keepDays: 14,
25
+ redact: REDACT_KINDS
26
+ };
27
+ var KEYS = [
28
+ "level",
29
+ "format",
30
+ "max_file_mb",
31
+ "keep_days",
32
+ "redact",
33
+ "components"
34
+ ];
35
+ function level(value, where) {
36
+ if (!isLogLevel(value))
37
+ throw new Error(`${where} must be error, warn, info, debug or trace`);
38
+ return value;
39
+ }
40
+ function positive(value, where, fallback) {
41
+ if (value === void 0) return fallback;
42
+ if (typeof value !== "number" || !(value > 0))
43
+ throw new Error(`${where} must be a positive number`);
44
+ return value;
45
+ }
46
+ function readLoggingTable(raw) {
47
+ if (raw === void 0) return DEFAULT_LOG_SETTINGS;
48
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw))
49
+ throw new Error("[logging] must be a table");
50
+ const table = raw;
51
+ const unknown = Object.keys(table).find((key) => !KEYS.includes(key));
52
+ if (unknown) throw new Error(`[logging] unknown key ${unknown}`);
53
+ if (table["format"] !== void 0 && table["format"] !== "jsonl")
54
+ throw new Error("[logging] format must be jsonl");
55
+ const redact = table["redact"] ?? REDACT_KINDS;
56
+ if (!Array.isArray(redact) || !redact.every((kind) => REDACT_KINDS.includes(kind))) {
57
+ throw new Error(`[logging] redact must list ${REDACT_KINDS.join(", ")}`);
58
+ }
59
+ const components = table["components"] ?? {};
60
+ return {
61
+ enabled: true,
62
+ level: table["level"] === void 0 ? "info" : level(table["level"], "[logging] level"),
63
+ components: Object.fromEntries(
64
+ Object.entries(components).map(([name, value]) => [
65
+ name,
66
+ level(value, `[logging.components] ${name}`)
67
+ ])
68
+ ),
69
+ maxFileMb: positive(table["max_file_mb"], "[logging] max_file_mb", 20),
70
+ keepDays: positive(table["keep_days"], "[logging] keep_days", 14),
71
+ redact
72
+ };
73
+ }
74
+
75
+ export {
76
+ LEVEL_RANK,
77
+ isLogLevel,
78
+ DEFAULT_LOG_SETTINGS,
79
+ readLoggingTable
80
+ };
81
+ //# sourceMappingURL=chunk-HQOB7OQS.js.map
@@ -0,0 +1,211 @@
1
+ import {
2
+ backupFiles
3
+ } from "./chunk-P4N7DBD5.js";
4
+ import {
5
+ BUNDLE_NATIVE_FILES,
6
+ HOOK_DIRECTORY,
7
+ checkProject,
8
+ prepare,
9
+ present,
10
+ writeNative
11
+ } from "./chunk-A7VF7A35.js";
12
+ import {
13
+ ANTIGRAVITY_MCP_PLUGIN
14
+ } from "./chunk-F5QYZK7E.js";
15
+ import {
16
+ changedSincePlan,
17
+ exists,
18
+ getKey,
19
+ linkOf,
20
+ permissionConflicts,
21
+ readJson,
22
+ same,
23
+ splitKeyed,
24
+ withoutBlock
25
+ } from "./chunk-VRPMYPZU.js";
26
+ import {
27
+ RULES_DIR,
28
+ legacyLinks
29
+ } from "./chunk-NRBQK6UX.js";
30
+ import {
31
+ LOCK_FILE,
32
+ replaceFile,
33
+ replaceLink,
34
+ writeLock
35
+ } from "./chunk-7HFIGCSL.js";
36
+
37
+ // src/project/apply/files.ts
38
+ import { mkdirSync } from "fs";
39
+ import { dirname, join } from "path";
40
+ function writeFiles(root, outputs) {
41
+ for (const output of outputs) {
42
+ if (output.kind !== "link" && output.kind !== "file") continue;
43
+ if (present(root, output)) continue;
44
+ const abs = join(root, output.path);
45
+ mkdirSync(dirname(abs), { recursive: true });
46
+ if (output.kind === "link") {
47
+ replaceLink(abs, output.target);
48
+ continue;
49
+ }
50
+ replaceFile(abs, output.content);
51
+ }
52
+ }
53
+
54
+ // src/project/apply/legacy-rules.ts
55
+ import { existsSync, rmSync } from "fs";
56
+ import { join as join2, posix } from "path";
57
+ function pruneLegacyRules(spec, outputs) {
58
+ if (!spec.packageRules) return 0;
59
+ const linkedDirs = new Set(
60
+ outputs.filter(
61
+ (o) => o.kind === "link" && o.path.startsWith(`${RULES_DIR}/${spec.packageRules?.dir}/`)
62
+ ).map(
63
+ (o) => o.kind === "link" ? posix.dirname(o.target.replace(/^(\.\.\/)+/u, "")) : ""
64
+ )
65
+ );
66
+ let pruned = 0;
67
+ for (const [name, target] of legacyLinks(spec.root)) {
68
+ const abs = join2(spec.root, RULES_DIR, `${name}.md`);
69
+ const broken = !existsSync(abs);
70
+ if (!broken && !linkedDirs.has(posix.dirname(target))) continue;
71
+ rmSync(abs, { force: true });
72
+ pruned += 1;
73
+ }
74
+ return pruned;
75
+ }
76
+
77
+ // src/project/apply/replaceable.ts
78
+ import { existsSync as existsSync2, lstatSync, readFileSync } from "fs";
79
+ import { join as join3 } from "path";
80
+ import { parse } from "smol-toml";
81
+ var PREDECESSORS = [
82
+ "by sync-claude-projection.sh",
83
+ "AUTO-GENERATED by scripts/agent/project.mjs"
84
+ ];
85
+ function objectKeys(value) {
86
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
87
+ return [];
88
+ }
89
+ return Object.keys(value);
90
+ }
91
+ function replaceable(root, output, owned) {
92
+ if (output.kind === "json") {
93
+ if (output.file === "opencode.json") {
94
+ let parent = readJson(join3(root, output.file));
95
+ for (const part of output.key.slice(0, -1)) {
96
+ if (parent === void 0) break;
97
+ if (parent === null || typeof parent !== "object" || Array.isArray(parent))
98
+ return false;
99
+ parent = parent[part];
100
+ }
101
+ if (parent !== void 0 && (parent === null || typeof parent !== "object" || Array.isArray(parent)))
102
+ return false;
103
+ }
104
+ const guarded = output.key[0] === "mcpServers" || output.file === "opencode.json";
105
+ if (!guarded || owned.has(output.path)) {
106
+ return true;
107
+ }
108
+ const existing = getKey(readJson(join3(root, output.file)), output.key);
109
+ return existing === void 0 || same(existing, output.value);
110
+ }
111
+ if (output.kind === "block") {
112
+ const absolute = join3(root, output.file);
113
+ const text2 = existsSync2(absolute) ? readFileSync(absolute, "utf8") : "";
114
+ const outside = parse(withoutBlock(text2));
115
+ const proposed = parse(output.content);
116
+ return !["mcp_servers", "marketplaces", "plugins"].some((table) => {
117
+ const existing = objectKeys(outside[table]);
118
+ return objectKeys(proposed[table]).some(
119
+ (name) => existing.includes(name)
120
+ );
121
+ });
122
+ }
123
+ if (owned.has(output.path)) return true;
124
+ const abs = join3(root, output.path);
125
+ if (!exists(abs)) return true;
126
+ const target = linkOf(abs);
127
+ if (target !== null) {
128
+ return output.kind === "link" && target === output.target;
129
+ }
130
+ if (lstatSync(abs).isDirectory()) return false;
131
+ const text = readFileSync(abs, "utf8");
132
+ if (output.kind === "file" && text === output.content) return true;
133
+ return PREDECESSORS.some((mark) => text.includes(mark));
134
+ }
135
+
136
+ // src/project/apply/safeguard.ts
137
+ var MCP_PATHS = [
138
+ "opencode.json",
139
+ ".mcp.json",
140
+ ".gemini/settings.json",
141
+ ".agents/mcp_config.json",
142
+ `${ANTIGRAVITY_MCP_PLUGIN}/plugin.json`,
143
+ `${ANTIGRAVITY_MCP_PLUGIN}/mcp_config.json`,
144
+ ".codex/config.toml",
145
+ ".grok/config.toml"
146
+ ];
147
+ function backupBeforeWrite(spec, outputs, stale) {
148
+ const changedMcp = outputs.some((output) => {
149
+ if (output.kind !== "json" && output.kind !== "block" && output.kind !== "file") {
150
+ return false;
151
+ }
152
+ const path = output.kind === "file" ? output.path : output.file;
153
+ return MCP_PATHS.includes(path) && !present(spec.root, output);
154
+ });
155
+ const staleMcp = stale.some(
156
+ (entry) => MCP_PATHS.includes(splitKeyed(entry.path)?.file ?? "")
157
+ );
158
+ const hookPaths = [
159
+ .../* @__PURE__ */ new Set([
160
+ ...BUNDLE_NATIVE_FILES,
161
+ ".gemini/settings.json",
162
+ ".agents/hooks.json"
163
+ ]),
164
+ ...outputs.filter(
165
+ (output) => output.kind === "file" && output.path.startsWith(`${HOOK_DIRECTORY}/`)
166
+ ).map((output) => output.path),
167
+ ...stale.filter((entry) => entry.path.startsWith(`${HOOK_DIRECTORY}/`)).map((entry) => entry.path)
168
+ ];
169
+ const changedHooks = outputs.some(
170
+ (output) => (output.kind === "json" && output.managed !== void 0 || output.kind === "file" && output.path.startsWith(`${HOOK_DIRECTORY}/`)) && !present(spec.root, output)
171
+ ) || stale.some((entry) => entry.path.startsWith(`${HOOK_DIRECTORY}/`));
172
+ if (!changedMcp && !staleMcp && !changedHooks) return void 0;
173
+ return backupFiles(spec.root, [
174
+ ...MCP_PATHS,
175
+ ...changedHooks ? hookPaths : [],
176
+ LOCK_FILE
177
+ ]);
178
+ }
179
+
180
+ // src/project/apply.ts
181
+ function project(spec, options) {
182
+ if (options.check) return checkProject(spec);
183
+ const { outputs, owned, stale, basis } = prepare(spec);
184
+ const refused = outputs.filter((o) => !replaceable(spec.root, o, owned)).map((o) => `refusing to overwrite a file it did not write: ${o.path}`);
185
+ if (refused.length > 0) {
186
+ return { code: 3, problems: refused, outputs: outputs.length, pruned: 0 };
187
+ }
188
+ const conflicts = [
189
+ ...permissionConflicts(spec),
190
+ ...changedSincePlan(spec.root, basis)
191
+ ];
192
+ if (conflicts.length > 0) {
193
+ return { code: 3, problems: conflicts, outputs: outputs.length, pruned: 0 };
194
+ }
195
+ const backup = backupBeforeWrite(spec, outputs, stale);
196
+ writeFiles(spec.root, outputs);
197
+ const pruned = writeNative(spec.root, outputs, stale, basis) + pruneLegacyRules(spec, outputs);
198
+ writeLock(spec.root, outputs);
199
+ return {
200
+ code: 0,
201
+ problems: [],
202
+ outputs: outputs.length,
203
+ pruned,
204
+ ...backup ? { backup } : {}
205
+ };
206
+ }
207
+
208
+ export {
209
+ project
210
+ };
211
+ //# sourceMappingURL=chunk-I2ZP2PSA.js.map
@@ -0,0 +1,151 @@
1
+ import {
2
+ marketplaceSpec
3
+ } from "./chunk-2P4Z2NUX.js";
4
+ import {
5
+ harnessSpec,
6
+ tuiSpec
7
+ } from "./chunk-3Y3HDMHA.js";
8
+ import {
9
+ mcpSpec
10
+ } from "./chunk-E3DQB5LS.js";
11
+ import {
12
+ mailboxSpec
13
+ } from "./chunk-JWRZDYB5.js";
14
+ import {
15
+ logsSpec
16
+ } from "./chunk-YGOWIJPE.js";
17
+ import {
18
+ gitSpec
19
+ } from "./chunk-T6GOWHK6.js";
20
+ import {
21
+ sessionsSpec
22
+ } from "./chunk-LMUBBIE2.js";
23
+ import {
24
+ doctorSpec,
25
+ projectSpec
26
+ } from "./chunk-LLBPVZXM.js";
27
+ import {
28
+ serveSpec
29
+ } from "./chunk-LLT5FQBE.js";
30
+ import {
31
+ loginSpec,
32
+ logoutSpec,
33
+ whoamiSpec
34
+ } from "./chunk-EIDIVIAD.js";
35
+ import {
36
+ availableSpec,
37
+ installSpec,
38
+ previewSpec,
39
+ syncSpec
40
+ } from "./chunk-ABTJQ4QV.js";
41
+ import {
42
+ hooksSpec,
43
+ initSpec,
44
+ statusSpec
45
+ } from "./chunk-OG7QR2DP.js";
46
+ import {
47
+ indexSpec,
48
+ listSpec,
49
+ modelsSpec,
50
+ validateSpec
51
+ } from "./chunk-INT7QLEU.js";
52
+
53
+ // src/commands/specs/completion.ts
54
+ var completionSpec = {
55
+ name: "completion",
56
+ describe: "Print a shell completion script for bash, zsh or fish",
57
+ usage: "pmcp completion bash | zsh | fish"
58
+ };
59
+
60
+ // src/commands/registry.ts
61
+ var COMMANDS = [
62
+ {
63
+ ...statusSpec,
64
+ load: async () => (await import("./status-UME2L33L.js")).statusCommand
65
+ },
66
+ { ...initSpec, load: async () => (await import("./init-3C2Y7BNJ.js")).initCommand },
67
+ { ...hooksSpec, load: async () => (await import("./hooks-BHTA44X7.js")).hooksCommand },
68
+ { ...serveSpec, load: async () => (await import("./serve-DQMKTFIV.js")).serveCommand },
69
+ { ...listSpec, load: async () => (await import("./list-MCP2FXUF.js")).listCommand },
70
+ {
71
+ ...indexSpec,
72
+ load: async () => (await import("./reindex-Y27QJFDB.js")).indexCommand
73
+ },
74
+ {
75
+ ...modelsSpec,
76
+ load: async () => (await import("./models-ISU4DCMA.js")).modelsCommand
77
+ },
78
+ {
79
+ ...loginSpec,
80
+ load: async () => (await import("./session-XM2CR425.js")).loginCommand
81
+ },
82
+ {
83
+ ...logoutSpec,
84
+ load: async () => (await import("./session-XM2CR425.js")).logoutCommand
85
+ },
86
+ {
87
+ ...whoamiSpec,
88
+ load: async () => (await import("./session-XM2CR425.js")).whoamiCommand
89
+ },
90
+ {
91
+ ...availableSpec,
92
+ load: async () => (await import("./available-DBSIVVJ6.js")).availableCommand
93
+ },
94
+ {
95
+ ...previewSpec,
96
+ load: async () => (await import("./preview-DT7DWG5F.js")).previewCommand
97
+ },
98
+ {
99
+ ...installSpec,
100
+ load: async () => (await import("./install-GG7HHZK2.js")).installCommand
101
+ },
102
+ { ...syncSpec, load: async () => (await import("./install-GG7HHZK2.js")).syncCommand },
103
+ {
104
+ ...projectSpec,
105
+ load: async () => (await import("./project-5YV5CUEG.js")).projectCommand
106
+ },
107
+ {
108
+ ...doctorSpec,
109
+ load: async () => (await import("./doctor-O2E63YGO.js")).doctorCommand
110
+ },
111
+ {
112
+ ...sessionsSpec,
113
+ load: async () => (await import("./cli-MI4ZCAZ3.js")).sessionsCommand
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-235QZN2A.js")).mcpCommand },
118
+ {
119
+ ...validateSpec,
120
+ load: async () => (await import("./validate-IU52H2IC.js")).validateCommand
121
+ },
122
+ {
123
+ ...mailboxSpec,
124
+ load: async () => (await import("./mailbox-GDJ7BWQN.js")).mailboxCommand
125
+ },
126
+ {
127
+ ...harnessSpec,
128
+ load: async () => (await import("./harness-L2KSI2ZB.js")).harnessCommand
129
+ },
130
+ { ...tuiSpec, load: async () => (await import("./tui-G5LLWCSV.js")).tuiCommand },
131
+ {
132
+ ...marketplaceSpec,
133
+ load: async () => (await import("./marketplace-G4VQET5W.js")).marketplaceCommand
134
+ },
135
+ {
136
+ ...completionSpec,
137
+ load: async () => (await import("./completion-ILSRB3LW.js")).completionCommand
138
+ }
139
+ ];
140
+ var PLANNED = [];
141
+ function commandNamed(name) {
142
+ return COMMANDS.find((command) => command.name === name);
143
+ }
144
+
145
+ export {
146
+ completionSpec,
147
+ COMMANDS,
148
+ PLANNED,
149
+ commandNamed
150
+ };
151
+ //# sourceMappingURL=chunk-IG33DXLT.js.map
@@ -0,0 +1,86 @@
1
+ // src/sessions/checkout.ts
2
+ import {
3
+ existsSync,
4
+ readdirSync,
5
+ readFileSync,
6
+ realpathSync,
7
+ statSync
8
+ } from "fs";
9
+ import { dirname, join, resolve } from "path";
10
+ function gitDirOf(root) {
11
+ const dotGit = join(root, ".git");
12
+ if (statSync(dotGit).isDirectory()) return realpathSync(dotGit);
13
+ const pointer = /^gitdir:\s*(.+)$/mu.exec(readFileSync(dotGit, "utf8"))?.[1]?.trim();
14
+ return pointer ? realpathSync(resolve(root, pointer)) : null;
15
+ }
16
+ function commonDirOf(gitDir) {
17
+ const file = join(gitDir, "commondir");
18
+ if (!existsSync(file)) return gitDir;
19
+ return realpathSync(resolve(gitDir, readFileSync(file, "utf8").trim()));
20
+ }
21
+ function branchOf(gitDir) {
22
+ const head = readFileSync(join(gitDir, "HEAD"), "utf8").trim();
23
+ return head.startsWith("ref: refs/heads/") ? head.slice("ref: refs/heads/".length) : "";
24
+ }
25
+ function checkoutOf(path) {
26
+ let dir = resolve(path);
27
+ for (; ; ) {
28
+ try {
29
+ if (existsSync(join(dir, ".git"))) {
30
+ const gitDir = gitDirOf(dir);
31
+ if (!gitDir) return null;
32
+ const commonDir = commonDirOf(gitDir);
33
+ return {
34
+ root: dir,
35
+ gitDir,
36
+ commonDir,
37
+ branch: branchOf(gitDir),
38
+ main: gitDir === commonDir
39
+ };
40
+ }
41
+ } catch {
42
+ return null;
43
+ }
44
+ const parent = dirname(dir);
45
+ if (parent === dir) return null;
46
+ dir = parent;
47
+ }
48
+ }
49
+ function gitCommonDir(root) {
50
+ return checkoutOf(root)?.commonDir ?? null;
51
+ }
52
+ function worktreesOf(checkout) {
53
+ const found = [
54
+ { path: dirname(checkout.commonDir), branch: branchOf(checkout.commonDir) }
55
+ ];
56
+ let names = [];
57
+ try {
58
+ names = readdirSync(join(checkout.commonDir, "worktrees"));
59
+ } catch {
60
+ return found;
61
+ }
62
+ for (const name of names) {
63
+ const admin = join(checkout.commonDir, "worktrees", name);
64
+ try {
65
+ const dotGit = readFileSync(join(admin, "gitdir"), "utf8").trim();
66
+ found.push({ path: dirname(dotGit), branch: branchOf(admin) });
67
+ } catch {
68
+ }
69
+ }
70
+ return found;
71
+ }
72
+ function hasLinkedWorktrees(checkout) {
73
+ try {
74
+ return readdirSync(join(checkout.commonDir, "worktrees")).length > 0;
75
+ } catch {
76
+ return false;
77
+ }
78
+ }
79
+
80
+ export {
81
+ checkoutOf,
82
+ gitCommonDir,
83
+ worktreesOf,
84
+ hasLinkedWorktrees
85
+ };
86
+ //# sourceMappingURL=chunk-IJBSOWHK.js.map
@@ -0,0 +1,114 @@
1
+ import {
2
+ CATALOG_OPTIONS
3
+ } from "./chunk-JEL35P7S.js";
4
+
5
+ // src/commands/options/embedding.ts
6
+ var EMBEDDING_OPTIONS = [
7
+ {
8
+ name: "model",
9
+ describe: "Embedding preset or model ID; list presets with pmcp models",
10
+ placeholder: "<name>"
11
+ },
12
+ {
13
+ name: "dtype",
14
+ describe: "Weight precision; uses the selected model default when omitted",
15
+ placeholder: "<q4|q8|fp32>"
16
+ },
17
+ {
18
+ name: "dimensions",
19
+ describe: "Supported output width; uses the model's full output when omitted",
20
+ placeholder: "<number>"
21
+ },
22
+ {
23
+ name: "model-revision",
24
+ describe: "Model revision used for loading and index identity",
25
+ placeholder: "<revision>"
26
+ },
27
+ {
28
+ name: "model-path",
29
+ describe: "Local model artifact directory",
30
+ placeholder: "<dir>"
31
+ },
32
+ {
33
+ name: "model-cache",
34
+ describe: "Model cache directory",
35
+ placeholder: "<dir>"
36
+ },
37
+ {
38
+ name: "query-prefix",
39
+ describe: "Custom model's query instruction prefix",
40
+ placeholder: "<text>"
41
+ },
42
+ {
43
+ name: "passage-prefix",
44
+ describe: "Custom model's document instruction prefix",
45
+ placeholder: "<text>"
46
+ },
47
+ {
48
+ name: "pooling",
49
+ describe: "Custom model's pooling method",
50
+ placeholder: "<mean|cls>"
51
+ }
52
+ ];
53
+
54
+ // src/commands/specs/catalog.ts
55
+ var listSpec = {
56
+ name: "list",
57
+ describe: "List the skills discovered in node_modules and marketplaces",
58
+ usage: "pmcp list [--root <dir>] [--scope <prefix>] [--marketplace <dir>] [--package <dir>] [--workspace <dir|glob>] [--config <file> | --no-config] [--json]",
59
+ options: [
60
+ ...CATALOG_OPTIONS,
61
+ { name: "json", describe: "Emit JSON rather than a table.", boolean: true }
62
+ ]
63
+ };
64
+ var indexSpec = {
65
+ name: "index",
66
+ describe: "Encode the catalog so ranking can be semantic",
67
+ usage: "pmcp index [--root <dir>] [--model <id>]",
68
+ options: [
69
+ ...CATALOG_OPTIONS,
70
+ ...EMBEDDING_OPTIONS,
71
+ { name: "local-only", describe: "Refuse model downloads", boolean: true },
72
+ {
73
+ name: "force",
74
+ describe: "Re-encode the selected model even when descriptions match",
75
+ boolean: true
76
+ },
77
+ {
78
+ name: "json",
79
+ describe: "Emit JSON rather than a summary.",
80
+ boolean: true
81
+ },
82
+ {
83
+ name: "dry-run",
84
+ describe: "Report what would be encoded and write nothing.",
85
+ boolean: true
86
+ }
87
+ ]
88
+ };
89
+ var modelsSpec = {
90
+ name: "models",
91
+ describe: "List embedding presets without loading or downloading models",
92
+ usage: "pmcp models [--json]",
93
+ options: [
94
+ { name: "json", describe: "Emit preset metadata as JSON", boolean: true }
95
+ ]
96
+ };
97
+ var validateSpec = {
98
+ name: "validate",
99
+ describe: "Check skills against the Agent Skills specification: given directories, or every skill the catalog reaches",
100
+ usage: "pmcp validate [<skill-dir>...] [--root <dir>] [--marketplace <dir>] [--package <dir>] [--workspace <dir>] [--config <file> | --no-config] [--json]",
101
+ options: [
102
+ ...CATALOG_OPTIONS,
103
+ { name: "json", describe: "Emit JSON rather than a table.", boolean: true }
104
+ ]
105
+ };
106
+
107
+ export {
108
+ EMBEDDING_OPTIONS,
109
+ listSpec,
110
+ indexSpec,
111
+ modelsSpec,
112
+ validateSpec
113
+ };
114
+ //# sourceMappingURL=chunk-INT7QLEU.js.map
@@ -0,0 +1,9 @@
1
+ // src/cli/invocation.ts
2
+ function invocation(env = process.env) {
3
+ return env["npm_command"] === "exec" ? "npx -y @modootoday/pmcp" : "pmcp";
4
+ }
5
+
6
+ export {
7
+ invocation
8
+ };
9
+ //# sourceMappingURL=chunk-J7UYNJCR.js.map