@modootoday/pmcp 0.17.4 → 0.18.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 (246) 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/CHANGELOG.md +60 -0
  5. package/README.md +29 -24
  6. package/dist/apply-4IGTXOCQ.js +242 -0
  7. package/dist/{attachment-tU5FZrgZ.d.ts → attachment-D84OGI6n.d.ts} +1 -1
  8. package/dist/available-DBSIVVJ6.js +73 -0
  9. package/dist/broadcast-3RY3OZGY.js +18 -0
  10. package/dist/chunk-25GHX674.js +1246 -0
  11. package/dist/chunk-2P4Z2NUX.js +28 -0
  12. package/dist/chunk-34DECPVC.js +22 -0
  13. package/dist/chunk-3NYG4SGU.js +45 -0
  14. package/dist/chunk-3PW4FI7U.js +32 -0
  15. package/dist/chunk-3Y3HDMHA.js +108 -0
  16. package/dist/chunk-47O3X4VS.js +113 -0
  17. package/dist/chunk-4NDEP7HU.js +26 -0
  18. package/dist/chunk-4VCC2NXE.js +104 -0
  19. package/dist/chunk-5OMOPUE6.js +39 -0
  20. package/dist/chunk-5QQWS4US.js +53 -0
  21. package/dist/chunk-5ZABTVSW.js +48 -0
  22. package/dist/chunk-65ZHM5RH.js +4985 -0
  23. package/dist/chunk-665TA55Z.js +419 -0
  24. package/dist/chunk-6STKGOCW.js +27 -0
  25. package/dist/chunk-6WXMJOMI.js +9 -0
  26. package/dist/chunk-73AKO4UL.js +24 -0
  27. package/dist/chunk-7BLPN3W6.js +31 -0
  28. package/dist/chunk-7DLZC73N.js +29 -0
  29. package/dist/chunk-7GBYECSK.js +72 -0
  30. package/dist/chunk-7TD53M7L.js +13 -0
  31. package/dist/chunk-A4PKLESO.js +112 -0
  32. package/dist/chunk-ABTJQ4QV.js +74 -0
  33. package/dist/chunk-BBTBJCFA.js +380 -0
  34. package/dist/chunk-BU65MNVU.js +13 -0
  35. package/dist/chunk-BVCTKPT3.js +83 -0
  36. package/dist/chunk-C4NHQGHL.js +142 -0
  37. package/dist/chunk-CJTKR6K6.js +1213 -0
  38. package/dist/chunk-DCU2EXQV.js +78 -0
  39. package/dist/chunk-DZ2MRTYT.js +135 -0
  40. package/dist/chunk-E2YOZ2FF.js +207 -0
  41. package/dist/chunk-E3DQB5LS.js +48 -0
  42. package/dist/chunk-E7OOHLQR.js +7 -0
  43. package/dist/chunk-EATCUWGG.js +66 -0
  44. package/dist/chunk-EIDIVIAD.js +33 -0
  45. package/dist/chunk-EJBZGIDK.js +1934 -0
  46. package/dist/chunk-ELAGZ635.js +252 -0
  47. package/dist/chunk-GZHHEHKY.js +44 -0
  48. package/dist/chunk-HDMBVLCZ.js +53 -0
  49. package/dist/chunk-HQOB7OQS.js +81 -0
  50. package/dist/chunk-IGYRMM62.js +28 -0
  51. package/dist/chunk-IJBSOWHK.js +86 -0
  52. package/dist/chunk-INT7QLEU.js +114 -0
  53. package/dist/chunk-J6QLLQVL.js +1025 -0
  54. package/dist/chunk-J7UYNJCR.js +9 -0
  55. package/dist/chunk-JEL35P7S.js +53 -0
  56. package/dist/chunk-JGJ4INEN.js +32 -0
  57. package/dist/chunk-JS5RTH4I.js +84 -0
  58. package/dist/chunk-JUXNIXN4.js +42 -0
  59. package/dist/chunk-JWRZDYB5.js +59 -0
  60. package/dist/chunk-KMXRRSKT.js +660 -0
  61. package/dist/chunk-LAZQBMAU.js +67 -0
  62. package/dist/chunk-LLBPVZXM.js +67 -0
  63. package/dist/chunk-LLT5FQBE.js +57 -0
  64. package/dist/chunk-LMT3PPXJ.js +17 -0
  65. package/dist/chunk-MM2Y43LC.js +87 -0
  66. package/dist/chunk-MPSQXSC6.js +346 -0
  67. package/dist/chunk-MVFH26QT.js +97 -0
  68. package/dist/chunk-MWFOUBFC.js +39 -0
  69. package/dist/chunk-N5AQ3PP7.js +211 -0
  70. package/dist/chunk-NQPURJT5.js +44 -0
  71. package/dist/chunk-NRBQK6UX.js +105 -0
  72. package/dist/chunk-NZS5CD72.js +333 -0
  73. package/dist/chunk-OEH47H6A.js +48 -0
  74. package/dist/chunk-OG7QR2DP.js +75 -0
  75. package/dist/chunk-OPYFEHKG.js +52 -0
  76. package/dist/chunk-P4N7DBD5.js +83 -0
  77. package/dist/chunk-PAX3QXX2.js +140 -0
  78. package/dist/chunk-PLX3BOOS.js +396 -0
  79. package/dist/chunk-PMJG2CXF.js +122 -0
  80. package/dist/chunk-PWSJJXLQ.js +643 -0
  81. package/dist/chunk-Q5H3L6Y4.js +23 -0
  82. package/dist/chunk-Q65R3XKX.js +155 -0
  83. package/dist/chunk-QEW4J3IZ.js +74 -0
  84. package/dist/chunk-QPL7E2HW.js +464 -0
  85. package/dist/chunk-R2GPCZUX.js +22 -0
  86. package/dist/chunk-R4L6LJJ2.js +778 -0
  87. package/dist/chunk-R5MT42JS.js +284 -0
  88. package/dist/chunk-RK4PYD7L.js +73 -0
  89. package/dist/chunk-RMATE45Z.js +197 -0
  90. package/dist/chunk-S3PIAMXV.js +230 -0
  91. package/dist/chunk-SG5TPMKH.js +93 -0
  92. package/dist/chunk-T3LKX23M.js +168 -0
  93. package/dist/chunk-T6GOWHK6.js +30 -0
  94. package/dist/chunk-TIA4SPU2.js +10 -0
  95. package/dist/chunk-TNCZ6444.js +57 -0
  96. package/dist/chunk-TVL5RTE6.js +269 -0
  97. package/dist/chunk-UOCLRM7P.js +151 -0
  98. package/dist/chunk-UPQTAHUK.js +189 -0
  99. package/dist/chunk-V4NPDK6X.js +14 -0
  100. package/dist/chunk-VJFEN6DJ.js +38 -0
  101. package/dist/chunk-WIW772I3.js +25 -0
  102. package/dist/chunk-XELAZAIM.js +136 -0
  103. package/dist/chunk-XNML2KIC.js +23 -0
  104. package/dist/chunk-XP2U3LO3.js +30 -0
  105. package/dist/chunk-YGOWIJPE.js +51 -0
  106. package/dist/chunk-YIXDHQYE.js +11 -0
  107. package/dist/chunk-YMHUM7AV.js +22 -0
  108. package/dist/chunk-YSAWTGNA.js +117 -0
  109. package/dist/chunk-Z4HRRXRF.js +478 -0
  110. package/dist/chunk-ZH6R642Z.js +102 -0
  111. package/dist/claude-U2JC2DNQ.js +77 -0
  112. package/dist/cli-VYCQJZ5X.js +41 -0
  113. package/dist/cli-ZTCBSDW4.js +46 -0
  114. package/dist/cli.js +144 -16197
  115. package/dist/completion-E7RRG3ZT.js +142 -0
  116. package/dist/config-DnpLL2kT.d.ts +46 -0
  117. package/dist/{service-qpCsOXkQ.d.ts → core-C1LPjxK6.d.ts} +2 -6
  118. package/dist/diagnostics-XXH4FLUG.js +93 -0
  119. package/dist/doctor-ZIOESU3N.js +538 -0
  120. package/dist/entry-ZNFCTDVE.js +305 -0
  121. package/dist/exec-mcp-X6372BLE.js +365 -0
  122. package/dist/harness-F2XFDYXF.js +177 -0
  123. package/dist/harness-egress-bridge.js +4 -4
  124. package/dist/harness-launch-gate.js +47 -940
  125. package/dist/harness-pane-runner.js +13 -80
  126. package/dist/harness-worker.js +21 -2703
  127. package/dist/hook-body.js +5221 -0
  128. package/dist/hook-spec-C5fWTSCH.d.ts +100 -0
  129. package/dist/hook.js +26 -0
  130. package/dist/hooks-FYE2L5RW.js +21 -0
  131. package/dist/host-GRY3VAHH.js +22 -0
  132. package/dist/host-X6BR6X4O.js +200 -0
  133. package/dist/host-run-GCA6H6SR.js +307 -0
  134. package/dist/http.d.ts +5 -42
  135. package/dist/http.js +21 -2234
  136. package/dist/import-mcp-2TTBPVLY.js +400 -0
  137. package/dist/index.d.ts +146 -168
  138. package/dist/index.js +133 -4948
  139. package/dist/init-627KFXTG.js +14 -0
  140. package/dist/install-GG7HHZK2.js +796 -0
  141. package/dist/invoke-LW22Z6ET.js +23 -0
  142. package/dist/list-MCP2FXUF.js +68 -0
  143. package/dist/list-NGMSQ5SH.js +65 -0
  144. package/dist/load-BEUBABtB.d.ts +21 -0
  145. package/dist/logout-6CSHUWWE.js +44 -0
  146. package/dist/logs-SPB6AANY.js +107 -0
  147. package/dist/mailbox/index.d.ts +10 -5
  148. package/dist/mailbox/index.js +53 -1572
  149. package/dist/mailbox-7BV54Q4R.js +285 -0
  150. package/dist/mailbox-GDJ7BWQN.js +189 -0
  151. package/dist/mainline-JQTTYJMI.js +639 -0
  152. package/dist/marketplace-G4VQET5W.js +191 -0
  153. package/dist/mcp-2DKVU3SW.js +15 -0
  154. package/dist/mcp-V23HC3LB.js +193 -0
  155. package/dist/models-ISU4DCMA.js +32 -0
  156. package/dist/opencode-CN7JLQYO.js +60 -0
  157. package/dist/pause-FFAYRBWI.js +18 -0
  158. package/dist/preview-DT7DWG5F.js +91 -0
  159. package/dist/project/hook-adapter.d.ts +5 -2
  160. package/dist/project/hook-adapter.js +41 -27
  161. package/dist/project-FY62G55N.js +70 -0
  162. package/dist/pty-XTJ4MIWK.js +94 -0
  163. package/dist/recovery-U6QB3PMT.js +100 -0
  164. package/dist/reindex-Y27QJFDB.js +22 -0
  165. package/dist/resume-UU4HZIUP.js +18 -0
  166. package/dist/run-HALGEJNJ.js +19 -0
  167. package/dist/run-OGA3P7FC.js +126 -0
  168. package/dist/serve-NBKT5BKY.js +104 -0
  169. package/dist/session-XM2CR425.js +159 -0
  170. package/dist/setup-DTKZLZUT.js +18 -0
  171. package/dist/start-login-UIQYQBMC.js +416 -0
  172. package/dist/status-A2OUTNGK.js +9 -0
  173. package/dist/status-H2VAHIDV.js +10 -0
  174. package/dist/status-NOOHW5WA.js +43 -0
  175. package/dist/status-VHODZPXB.js +55 -0
  176. package/dist/status-XQANBVXW.js +286 -0
  177. package/dist/stdio.d.ts +3 -13
  178. package/dist/stdio.js +16 -3186
  179. package/dist/sweep-64JDCGK6.js +18 -0
  180. package/dist/test-MKAXFJOL.js +561 -0
  181. package/dist/tools-gpHNq9Dh.d.ts +328 -0
  182. package/dist/tui-MWKAXE4K.js +153 -0
  183. package/dist/unbroadcast-KPUEFLZD.js +18 -0
  184. package/dist/validate-5GZ5YWNA.js +46 -0
  185. package/dist/worker-RQ575EJL.js +80 -0
  186. package/dist/worktree-create-PZSRB7PH.js +89 -0
  187. package/dist/worktree-list-JYB6VXLW.js +51 -0
  188. package/dist/worktree-sync-UF5CXPWV.js +30 -0
  189. package/docs/hooks/capabilities/antigravity.json +199 -0
  190. package/docs/hooks/capabilities/claude.json +179 -0
  191. package/docs/hooks/capabilities/codex.json +179 -0
  192. package/docs/hooks/capabilities/gemini.json +196 -0
  193. package/docs/hooks/capabilities/grok.json +192 -0
  194. package/docs/hooks/capabilities/opencode.json +184 -0
  195. package/docs/project-configuration.md +821 -4
  196. package/docs/terminal-harness.md +71 -28
  197. package/docs/terminal-workspace.md +91 -170
  198. package/gemini-extension.json +1 -1
  199. package/package.json +13 -1
  200. package/plugin.json +1 -1
  201. package/plugins/pmcp/.claude-plugin/plugin.json +4 -2
  202. package/plugins/pmcp/gemini-extension.json +1 -1
  203. package/plugins/pmcp/mod/commands.ts +72 -0
  204. package/plugins/pmcp/mod/contract.d.ts +39 -0
  205. package/plugins/pmcp/mod/draw.tsx +216 -0
  206. package/plugins/pmcp/mod/guard.ts +42 -0
  207. package/plugins/pmcp/mod/hooks.json +4 -0
  208. package/plugins/pmcp/mod/host.ts +46 -0
  209. package/plugins/pmcp/mod/model.ts +144 -0
  210. package/plugins/pmcp/mod/reader/index.ts +18 -0
  211. package/plugins/pmcp/mod/reader/read.ts +76 -0
  212. package/plugins/pmcp/mod/reader/settings.ts +54 -0
  213. package/plugins/pmcp/mod/reader/types.ts +38 -0
  214. package/plugins/pmcp/mod/register.tsx +73 -0
  215. package/plugins/pmcp/mod/sessions/format.ts +91 -0
  216. package/plugins/pmcp/mod/sessions/types.ts +162 -0
  217. package/plugins/pmcp/mod/snapshot.ts +75 -0
  218. package/plugins/pmcp/mod/spinner.tsx +30 -0
  219. package/plugins/pmcp/mod/state.ts +28 -0
  220. package/plugins/pmcp/plugin.json +1 -1
  221. package/plugins/pmcp/skills/agent-assets-migrate/SKILL.md +96 -0
  222. package/plugins/pmcp/skills/headless-agents-ci-scaffold/SKILL.md +100 -0
  223. package/plugins/pmcp/skills/marketplace-plugin-scaffold/SKILL.md +87 -0
  224. package/plugins/pmcp/skills/package-skill-catalog/SKILL.md +51 -11
  225. package/plugins/pmcp/skills/pmcp-project-init/SKILL.md +145 -0
  226. package/plugins/pmcp/skills/pmcp-sessions-and-git/SKILL.md +104 -0
  227. package/plugins/pmcp/skills/skill-package-scaffold/SKILL.md +88 -0
  228. package/schema/catalog-v1.json +158 -0
  229. package/schema/library.json +164 -0
  230. package/schema/marketplace-manifest.json +130 -0
  231. package/schema/plugin-manifest.json +55 -0
  232. package/schema/skill-frontmatter.json +144 -0
  233. package/schema/skill-metadata-core.json +110 -0
  234. package/skills/agent-assets-migrate/SKILL.md +96 -0
  235. package/skills/headless-agents-ci-scaffold/SKILL.md +100 -0
  236. package/skills/marketplace-plugin-scaffold/SKILL.md +87 -0
  237. package/skills/package-skill-catalog/SKILL.md +51 -11
  238. package/skills/pmcp-project-init/SKILL.md +145 -0
  239. package/skills/pmcp-sessions-and-git/SKILL.md +104 -0
  240. package/skills/skill-package-scaffold/SKILL.md +88 -0
  241. package/dist/config-BkSpjUG6.d.ts +0 -50
  242. package/dist/embed-DRROSD3F.d.ts +0 -53
  243. package/dist/hook-spec-CSJJySsH.d.ts +0 -11
  244. package/dist/server-VWSY3Shw.d.ts +0 -543
  245. package/dist/tui-worker.js +0 -6549
  246. /package/dist/{tui-worker.d.ts → hook.d.ts} +0 -0
@@ -0,0 +1,643 @@
1
+ import {
2
+ hostApprovalDoctor
3
+ } from "./chunk-ZH6R642Z.js";
4
+ import {
5
+ project
6
+ } from "./chunk-N5AQ3PP7.js";
7
+ import {
8
+ wakeableBy
9
+ } from "./chunk-WIW772I3.js";
10
+ import {
11
+ currentHooks,
12
+ restartNotes
13
+ } from "./chunk-VJFEN6DJ.js";
14
+ import {
15
+ agentNames,
16
+ marketplaceDoctor,
17
+ skillNames,
18
+ splitFrontmatter
19
+ } from "./chunk-J6QLLQVL.js";
20
+ import {
21
+ ANTIGRAVITY_MCP_PLUGIN,
22
+ serversForTool
23
+ } from "./chunk-PLX3BOOS.js";
24
+ import {
25
+ permissionDoctor,
26
+ pluginBinaryDoctor,
27
+ uiClaudeDoctor
28
+ } from "./chunk-65ZHM5RH.js";
29
+ import {
30
+ pathPmcp,
31
+ pmcpCommand
32
+ } from "./chunk-EATCUWGG.js";
33
+ import {
34
+ createFilesStore,
35
+ inboxKey
36
+ } from "./chunk-Z4HRRXRF.js";
37
+ import {
38
+ hostDoctor,
39
+ ptyBinaryDoctor
40
+ } from "./chunk-4VCC2NXE.js";
41
+ import {
42
+ projectStateDir
43
+ } from "./chunk-OEH47H6A.js";
44
+
45
+ // src/project/doctor/runner.ts
46
+ import { spawnSync as spawnSync2 } from "child_process";
47
+
48
+ // src/project/adapters/opencode-doctor.ts
49
+ import { realpathSync } from "fs";
50
+ import { join } from "path";
51
+ function isOpenCodeInventory(command, args) {
52
+ return command === "opencode" && args.length === 2 && args[0] === "debug" && args[1] === "skill";
53
+ }
54
+ function connected(out, alias) {
55
+ const ansi = new RegExp(
56
+ `${String.fromCharCode(27)}\\[[0-?]*[ -/]*[@-~]`,
57
+ "gu"
58
+ );
59
+ const pattern = new RegExp(
60
+ `^[^a-zA-Z0-9]*${alias}\\s+connected(?:\\s|$)`,
61
+ "u"
62
+ );
63
+ return out.replace(ansi, "").split("\n").some((line) => pattern.test(line.trim()));
64
+ }
65
+ function projectSkill(out, root, name) {
66
+ try {
67
+ const entries = JSON.parse(out);
68
+ if (!Array.isArray(entries)) return false;
69
+ const expected = realpathSync(
70
+ join(root, ".agents/skills", name, "SKILL.md")
71
+ );
72
+ return entries.some(
73
+ (entry) => entry?.name === name && typeof entry.location === "string" && realpathSync(entry.location) === expected
74
+ );
75
+ } catch {
76
+ return false;
77
+ }
78
+ }
79
+ function opencodeDoctor(spec, options, listed2) {
80
+ const findings = [];
81
+ const names = skillNames(spec.root);
82
+ if (names.length > 0) {
83
+ findings.push(
84
+ listed2(
85
+ "opencode",
86
+ "project skills discovered",
87
+ options.run("opencode", ["debug", "skill"], spec.root, options.env),
88
+ names,
89
+ (out, name) => projectSkill(out, spec.root, name)
90
+ )
91
+ );
92
+ }
93
+ const aliases = serversForTool(spec, "opencode").map(([alias]) => alias);
94
+ if (aliases.length > 0) {
95
+ findings.push(
96
+ listed2(
97
+ "opencode",
98
+ "mcp servers connected",
99
+ options.run("opencode", ["mcp", "list"], spec.root, options.env),
100
+ aliases,
101
+ connected
102
+ )
103
+ );
104
+ }
105
+ return findings;
106
+ }
107
+
108
+ // src/project/diagnostics/native-json.ts
109
+ import { spawnSync } from "child_process";
110
+ import {
111
+ closeSync,
112
+ mkdtempSync,
113
+ openSync,
114
+ readFileSync,
115
+ rmSync,
116
+ statSync
117
+ } from "fs";
118
+ import { tmpdir } from "os";
119
+ import { join as join2 } from "path";
120
+ var MAX_OUTPUT = 1 << 26;
121
+ var nativeJsonRunner = (command, args, cwd, env) => {
122
+ const directory = mkdtempSync(join2(tmpdir(), "pmcp-native-json-"));
123
+ let descriptor;
124
+ try {
125
+ const file = join2(directory, "stdout.json");
126
+ descriptor = openSync(file, "wx", 384);
127
+ const result = spawnSync(command, [...args], {
128
+ cwd,
129
+ ...env ? { env: { ...process.env, ...env } } : {},
130
+ encoding: "utf8",
131
+ timeout: 18e4,
132
+ maxBuffer: MAX_OUTPUT,
133
+ stdio: ["ignore", descriptor, "pipe"]
134
+ });
135
+ const code = result.error?.code;
136
+ if (result.status !== 0 || result.error) {
137
+ return {
138
+ missing: code === "ENOENT",
139
+ status: result.status,
140
+ stdout: result.stderr || result.error?.message || "Native inventory failed"
141
+ };
142
+ }
143
+ if (statSync(file).size > MAX_OUTPUT) {
144
+ return {
145
+ missing: false,
146
+ status: null,
147
+ stdout: "Native JSON output exceeds 64 MiB"
148
+ };
149
+ }
150
+ return { missing: false, status: 0, stdout: readFileSync(file, "utf8") };
151
+ } finally {
152
+ if (descriptor !== void 0) closeSync(descriptor);
153
+ rmSync(directory, { recursive: true, force: true });
154
+ }
155
+ };
156
+
157
+ // src/project/doctor/runner.ts
158
+ var spawnRunner = (command, args, cwd, env) => {
159
+ if (isOpenCodeInventory(command, args))
160
+ return nativeJsonRunner(command, args, cwd, env);
161
+ const result = spawnSync2(command, [...args], {
162
+ cwd,
163
+ ...env ? { env: { ...process.env, ...env } } : {},
164
+ encoding: "utf8",
165
+ timeout: 18e4,
166
+ maxBuffer: 1 << 26
167
+ });
168
+ const code = result.error?.code;
169
+ return {
170
+ missing: code === "ENOENT",
171
+ status: result.status,
172
+ stdout: `${result.stdout ?? ""}${result.stderr ?? ""}`
173
+ };
174
+ };
175
+
176
+ // src/project/doctor/inspect.ts
177
+ import "path";
178
+
179
+ // src/project/doctor/_shared.ts
180
+ import "path";
181
+ var missingFrom = (names, present) => names.filter((name) => !present(name));
182
+ function verdict(tool, check, missing) {
183
+ if (missing.length === 0) return { tool, check, status: "ok" };
184
+ return {
185
+ tool,
186
+ check,
187
+ status: "fail",
188
+ detail: `missing: ${missing.join(", ")}`
189
+ };
190
+ }
191
+ function listed(tool, check, result, names, present) {
192
+ if (result.missing)
193
+ return { tool, check, status: "skip", detail: "not installed" };
194
+ if (result.status !== 0) {
195
+ return {
196
+ tool,
197
+ check,
198
+ status: "fail",
199
+ detail: `exit ${result.status}: ${result.stdout.trim().split("\n").pop() ?? ""}`
200
+ };
201
+ }
202
+ return verdict(
203
+ tool,
204
+ check,
205
+ missingFrom(names, (name) => present(result.stdout, name))
206
+ );
207
+ }
208
+ var lines = (out) => out.split("\n").map((l) => l.trim());
209
+
210
+ // src/project/doctor/claude.ts
211
+ function claude(spec, o) {
212
+ const aliases = serversForTool(spec, "claude").map(([alias]) => alias);
213
+ if (aliases.length === 0) return [];
214
+ const result = o.run("claude", ["mcp", "list"], spec.root);
215
+ return [
216
+ listed(
217
+ "claude",
218
+ "mcp servers connected",
219
+ result,
220
+ aliases,
221
+ (out, alias) => lines(out).some(
222
+ (l) => l.startsWith(`${alias}:`) && /connected/iu.test(l) && !/failed/iu.test(l)
223
+ )
224
+ )
225
+ ];
226
+ }
227
+
228
+ // src/project/doctor/codex.ts
229
+ import { existsSync, readFileSync as readFileSync2 } from "fs";
230
+ import { join as join4 } from "path";
231
+ import { parse } from "smol-toml";
232
+ function codex(spec, o) {
233
+ const findings = [];
234
+ const config = join4(o.home, ".codex/config.toml");
235
+ let trusted = false;
236
+ if (existsSync(config)) {
237
+ const projects = parse(readFileSync2(config, "utf8")).projects ?? {};
238
+ const root = spec.root.replace(/\/$/u, "");
239
+ trusted = projects[root]?.trust_level === "trusted" || projects[`${root}/`]?.trust_level === "trusted";
240
+ }
241
+ findings.push(
242
+ trusted ? { tool: "codex", check: "project trusted", status: "ok" } : {
243
+ tool: "codex",
244
+ check: "project trusted",
245
+ status: "fail",
246
+ detail: "untrusted projects skip .codex/ and .agents/"
247
+ }
248
+ );
249
+ const aliases = serversForTool(spec, "codex").map(([alias]) => alias);
250
+ if (aliases.length > 0) {
251
+ const result = o.run("codex", ["mcp", "list"], spec.root);
252
+ findings.push(
253
+ listed(
254
+ "codex",
255
+ "mcp servers listed",
256
+ result,
257
+ aliases,
258
+ (out, alias) => lines(out).some((l) => l.split(/\s+/u)[0] === alias)
259
+ )
260
+ );
261
+ }
262
+ return findings;
263
+ }
264
+
265
+ // src/project/features/gemini-trust.ts
266
+ import { existsSync as existsSync2, readFileSync as readFileSync3 } from "fs";
267
+ import { dirname, join as join5, resolve, sep } from "path";
268
+ function readJson(file) {
269
+ if (!existsSync2(file)) return null;
270
+ try {
271
+ return JSON.parse(readFileSync3(file, "utf8"));
272
+ } catch {
273
+ return null;
274
+ }
275
+ }
276
+ var within = (path, base) => path === base || path.startsWith(base.endsWith(sep) ? base : `${base}${sep}`);
277
+ function folderTrust(root, home) {
278
+ const folders = readJson(join5(home, ".gemini/trustedFolders.json"));
279
+ if (!folders) return "unknown";
280
+ let best = null;
281
+ for (const [path, value] of Object.entries(folders)) {
282
+ const base = value === "TRUST_PARENT" ? dirname(resolve(path)) : resolve(path);
283
+ if (!within(root, base)) continue;
284
+ if (best && best.length > base.length) continue;
285
+ best = { length: base.length, trusted: value !== "DO_NOT_TRUST" };
286
+ }
287
+ return best?.trusted ? "trusted" : "untrusted";
288
+ }
289
+ function projectedIdentities(root) {
290
+ const settings = readJson(join5(root, ".gemini/settings.json"));
291
+ const hooks = settings?.["hooks"] ?? {};
292
+ return Object.values(hooks).flatMap(
293
+ (groups) => (Array.isArray(groups) ? groups : []).flatMap(
294
+ (group) => (group.hooks ?? []).filter((hook) => hook.name?.startsWith("pmcp-")).map((hook) => `${hook.name}:${hook.command}`)
295
+ )
296
+ );
297
+ }
298
+ function geminiTrust(root, home) {
299
+ const identities = projectedIdentities(root);
300
+ const known = readJson(join5(home, ".gemini/trusted_hooks.json"));
301
+ const seen = new Set(
302
+ Array.isArray(known?.[root]) ? known[root] : []
303
+ );
304
+ const folder = folderTrust(root, home);
305
+ if (identities.length === 0) return { folder, hooks: "none" };
306
+ const reviewed = identities.every((identity) => seen.has(identity));
307
+ return { folder, hooks: reviewed ? "reviewed" : "new" };
308
+ }
309
+
310
+ // src/project/doctor/gemini.ts
311
+ function geminiConnected(out, alias) {
312
+ const sections = out.split(
313
+ /(?=^[^\p{L}\p{N}\r\n]*[A-Za-z0-9][A-Za-z0-9_-]*:\s)/gmu
314
+ );
315
+ const header = new RegExp(`^[^\\p{L}\\p{N}\\r\\n]*${alias}:\\s`, "mu");
316
+ const section = sections.find((entry) => header.test(entry));
317
+ if (section === void 0) {
318
+ return false;
319
+ }
320
+ const statuses = [
321
+ ...section.matchAll(/\s-\s+(Connected|Disconnected)\s*$/gimu)
322
+ ];
323
+ return statuses.at(-1)?.[1]?.toLowerCase() === "connected";
324
+ }
325
+ function gemini(spec, o) {
326
+ const findings = [];
327
+ const skills = skillNames(spec.root);
328
+ if (skills.length > 0) {
329
+ const result = o.run("gemini", ["skills", "list"], spec.root);
330
+ findings.push(
331
+ listed(
332
+ "gemini",
333
+ "project skills listed",
334
+ result,
335
+ skills,
336
+ (out, name) => lines(out).some((l) => l.startsWith(`${name} [`))
337
+ )
338
+ );
339
+ }
340
+ const aliases = serversForTool(spec, "gemini").map(([alias]) => alias);
341
+ if (aliases.length > 0) {
342
+ const result = o.run("gemini", ["mcp", "list"], spec.root);
343
+ findings.push(
344
+ listed(
345
+ "gemini",
346
+ "mcp servers connected",
347
+ result,
348
+ aliases,
349
+ geminiConnected
350
+ )
351
+ );
352
+ }
353
+ if (spec.hookBundle?.policy?.targets.includes("gemini"))
354
+ findings.push(hookTrust(spec.root, o.home));
355
+ return findings;
356
+ }
357
+ function hookTrust(root, home) {
358
+ const check = "hooks: folder trust";
359
+ const trust = geminiTrust(root, home);
360
+ const detail = `folder ${trust.folder}, hooks ${trust.hooks}`;
361
+ if (trust.folder === "trusted")
362
+ return { tool: "gemini", check, status: "ok", detail };
363
+ const hint = "the user trusts this folder in an interactive gemini session";
364
+ return {
365
+ tool: "gemini",
366
+ check,
367
+ status: "warn",
368
+ detail: `${detail}; ${hint}`
369
+ };
370
+ }
371
+
372
+ // src/project/doctor/grok.ts
373
+ import "smol-toml";
374
+
375
+ // src/project/features/grok-trust.ts
376
+ import { existsSync as existsSync3, readFileSync as readFileSync4 } from "fs";
377
+ import { join as join6, resolve as resolve2, sep as sep2 } from "path";
378
+ import { parse as parse2 } from "smol-toml";
379
+ var within2 = (path, base) => path === base || path.startsWith(base.endsWith(sep2) ? base : `${base}${sep2}`);
380
+ function grokTrust(root, home) {
381
+ const file = join6(home, ".grok/trusted_folders.toml");
382
+ if (!existsSync3(file)) return "unknown";
383
+ let folders;
384
+ try {
385
+ const config = parse2(readFileSync4(file, "utf8"));
386
+ folders = config.folders ?? {};
387
+ } catch {
388
+ return "unknown";
389
+ }
390
+ let best = null;
391
+ for (const [path, entry] of Object.entries(folders)) {
392
+ const base = resolve2(path);
393
+ if (!within2(root, base)) continue;
394
+ if (best && best.length > base.length) continue;
395
+ best = { length: base.length, trusted: entry.trusted === true };
396
+ }
397
+ return best?.trusted ? "trusted" : "untrusted";
398
+ }
399
+
400
+ // src/project/doctor/grok.ts
401
+ function grok(spec, o) {
402
+ const findings = inspect(spec, o);
403
+ if (spec.hookBundle?.policy?.targets.includes("grok"))
404
+ findings.push(hookTrust2(spec.root, o.home));
405
+ return findings;
406
+ }
407
+ function hookTrust2(root, home) {
408
+ const check = "hooks: folder trust";
409
+ const trust = grokTrust(root, home);
410
+ if (trust === "trusted")
411
+ return { tool: "grok", check, status: "ok", detail: "folder trusted" };
412
+ return {
413
+ tool: "grok",
414
+ check,
415
+ status: "warn",
416
+ detail: `folder ${trust}; the user runs /hooks-trust in an interactive grok session`
417
+ };
418
+ }
419
+ function inspect(spec, o) {
420
+ const result = o.run("grok", ["inspect", "--json"], spec.root);
421
+ if (result.missing)
422
+ return [
423
+ {
424
+ tool: "grok",
425
+ check: "inspect",
426
+ status: "skip",
427
+ detail: "not installed"
428
+ }
429
+ ];
430
+ let report;
431
+ try {
432
+ report = JSON.parse(
433
+ result.stdout.slice(result.stdout.indexOf("{"))
434
+ );
435
+ } catch {
436
+ return [
437
+ {
438
+ tool: "grok",
439
+ check: "inspect",
440
+ status: "fail",
441
+ detail: "grok inspect --json did not return JSON"
442
+ }
443
+ ];
444
+ }
445
+ const findings = [];
446
+ findings.push(
447
+ report.projectTrusted ? { tool: "grok", check: "project trusted", status: "ok" } : {
448
+ tool: "grok",
449
+ check: "project trusted",
450
+ status: "fail",
451
+ detail: "untrusted projects skip .grok/ MCP and hooks"
452
+ }
453
+ );
454
+ const skills = new Set((report.skills ?? []).map((s) => s.name));
455
+ findings.push(
456
+ verdict(
457
+ "grok",
458
+ "project skills listed",
459
+ missingFrom(skillNames(spec.root), (n) => skills.has(n))
460
+ )
461
+ );
462
+ const leaked = (report.projectInstructions ?? []).filter(
463
+ (i) => i.path.includes("/.claude/rules/")
464
+ );
465
+ findings.push(
466
+ leaked.length === 0 ? { tool: "grok", check: "no .claude/rules loaded", status: "ok" } : {
467
+ tool: "grok",
468
+ check: "no .claude/rules loaded",
469
+ status: "fail",
470
+ detail: `${leaked.length} rule files load unscoped`
471
+ }
472
+ );
473
+ const servers = new Set((report.mcpServers ?? []).map((s) => s.name));
474
+ const aliases = serversForTool(spec, "grok").map(([alias]) => alias);
475
+ if (aliases.length > 0) {
476
+ findings.push(
477
+ verdict(
478
+ "grok",
479
+ "mcp servers listed",
480
+ missingFrom(aliases, (n) => servers.has(n))
481
+ )
482
+ );
483
+ }
484
+ return findings;
485
+ }
486
+
487
+ // src/project/doctor/antigravity.ts
488
+ import { readFileSync as readFileSync5 } from "fs";
489
+ import { join as join7 } from "path";
490
+ function antigravity(spec, options) {
491
+ const foreign = agentNames(spec.root).filter((name) => {
492
+ const text = readFileSync5(
493
+ join7(spec.root, ".agents/agents", name, "agent.md"),
494
+ "utf8"
495
+ );
496
+ return splitFrontmatter(text).meta["tools"] !== void 0;
497
+ });
498
+ const findings = [
499
+ foreign.length === 0 ? {
500
+ tool: "antigravity",
501
+ check: "agents carry no tool lists",
502
+ status: "ok"
503
+ } : {
504
+ tool: "antigravity",
505
+ check: "agents carry no tool lists",
506
+ status: "fail",
507
+ detail: `move tools to pmcp.toml [agents.<name>.<tool>]: ${foreign.join(", ")}`
508
+ }
509
+ ];
510
+ if (serversForTool(spec, "antigravity").length > 0) {
511
+ const result = options.run(
512
+ "agy",
513
+ ["plugin", "validate", join7(spec.root, ANTIGRAVITY_MCP_PLUGIN)],
514
+ spec.root
515
+ );
516
+ findings.push(
517
+ listed("antigravity", "project MCP plugin valid", result, [], () => true)
518
+ );
519
+ }
520
+ return findings;
521
+ }
522
+
523
+ // src/sessions/wake/last.ts
524
+ import { closeSync as closeSync2, existsSync as existsSync4, openSync as openSync2, readSync, statSync as statSync2 } from "fs";
525
+ import { join as join8 } from "path";
526
+ var TAIL_BYTES = 256 * 1024;
527
+ function tail(path) {
528
+ const size = statSync2(path).size;
529
+ const length = Math.min(size, TAIL_BYTES);
530
+ const buffer = Buffer.alloc(length);
531
+ const fd = openSync2(path, "r");
532
+ try {
533
+ readSync(fd, buffer, 0, length, size - length);
534
+ } finally {
535
+ closeSync2(fd);
536
+ }
537
+ return buffer.toString("utf8");
538
+ }
539
+ function lastWakes(stateDir) {
540
+ const path = join8(stateDir, "messages.jsonl");
541
+ const found = /* @__PURE__ */ new Map();
542
+ if (!existsSync4(path)) return found;
543
+ for (const line of tail(path).split("\n")) {
544
+ if (!line.includes('"woken"')) continue;
545
+ try {
546
+ const entry = JSON.parse(line);
547
+ if (entry["event"] !== "woken" || typeof entry["to"] !== "string")
548
+ continue;
549
+ const via = entry["channel"] ?? entry["transport"] ?? "none";
550
+ found.set(entry["to"], {
551
+ at: String(entry["at"]),
552
+ outcome: String(entry["outcome"]),
553
+ via: String(via)
554
+ });
555
+ } catch {
556
+ continue;
557
+ }
558
+ }
559
+ return found;
560
+ }
561
+
562
+ // src/project/doctor/sessions.ts
563
+ function sessionsDoctor(spec, options) {
564
+ const policy = spec.hookBundle?.policy;
565
+ if (!policy) return [];
566
+ const store = createFilesStore(
567
+ projectStateDir(spec.root, policy.stateDir),
568
+ policy.sessions
569
+ );
570
+ const records = store.registry.list();
571
+ const notes = restartNotes(records, currentHooks(spec.root));
572
+ const check = "live sessions run the current hooks";
573
+ const findings = [
574
+ notes.length === 0 ? { tool: "project", check, status: "ok" } : { tool: "project", check, status: "warn", detail: notes.join("; ") }
575
+ ];
576
+ if (!store.mailbox.settings.enabled) return findings;
577
+ const live = records.filter((record) => record.live);
578
+ const last = lastWakes(store.dir);
579
+ const rows = live.map((record) => {
580
+ const name = record.alias || record.session.slice(0, 8);
581
+ const transport = wakeableBy(record, {
582
+ home: options.home,
583
+ env: options.env ?? {}
584
+ });
585
+ const wake = last.get(inboxKey({ session: record.session }));
586
+ const tried = wake ? `; last wake ${wake.outcome} via ${wake.via} at ${wake.at}` : "";
587
+ return `${name} (${record.runtime ?? "unknown"}): ${transport ?? "next event only"}${tried}`;
588
+ });
589
+ findings.push({
590
+ tool: "project",
591
+ check: "mailbox wake",
592
+ status: "ok",
593
+ ...rows.length > 0 ? { detail: rows.join("; ") } : {}
594
+ });
595
+ findings.push(pathFinding(spec.root, store.dir, options));
596
+ return findings;
597
+ }
598
+ function pathFinding(root, stateDir, options) {
599
+ const check = "pmcp on PATH is the projecting CLI";
600
+ const command = pmcpCommand(root, stateDir, options.env?.["PATH"]);
601
+ if (command === "pmcp") return { tool: "project", check, status: "ok" };
602
+ const found = pathPmcp(options.env?.["PATH"]);
603
+ const detail = found ? `PATH runs ${found}, not this project's pmcp; mailbox notices say ${command}` : `no pmcp on PATH; mailbox notices say ${command}`;
604
+ return { tool: "project", check, status: "warn", detail };
605
+ }
606
+
607
+ // src/project/doctor/inspect.ts
608
+ function doctor(spec, options) {
609
+ const check = project(spec, { check: true });
610
+ const findings = [
611
+ check.code === 0 ? { tool: "project", check: "outputs match sources", status: "ok" } : {
612
+ tool: "project",
613
+ check: "outputs match sources",
614
+ status: "fail",
615
+ detail: check.problems.slice(0, 5).join("; ")
616
+ }
617
+ ];
618
+ findings.push(...sessionsDoctor(spec, options));
619
+ findings.push(...hostDoctor(spec));
620
+ if (spec.host) findings.push(hostApprovalDoctor(spec.root));
621
+ if (spec.host) findings.push(ptyBinaryDoctor(process.env));
622
+ findings.push(...pluginBinaryDoctor(spec.mcp));
623
+ const wanted = (tool) => spec.tools.has(tool) && (options.only === void 0 || options.only.has(tool));
624
+ if (wanted("claude")) findings.push(...claude(spec, options));
625
+ if (wanted("claude")) findings.push(...permissionDoctor(spec));
626
+ if (wanted("claude")) findings.push(...uiClaudeDoctor(spec));
627
+ if (wanted("codex")) findings.push(...codex(spec, options));
628
+ if (wanted("codex")) findings.push(...marketplaceDoctor(spec, options.run));
629
+ if (wanted("gemini")) findings.push(...gemini(spec, options));
630
+ if (wanted("grok")) findings.push(...grok(spec, options));
631
+ if (wanted("opencode"))
632
+ findings.push(...opencodeDoctor(spec, options, listed));
633
+ if (wanted("antigravity")) {
634
+ findings.push(...antigravity(spec, options));
635
+ }
636
+ return findings;
637
+ }
638
+
639
+ export {
640
+ spawnRunner,
641
+ doctor
642
+ };
643
+ //# sourceMappingURL=chunk-PWSJJXLQ.js.map
@@ -0,0 +1,23 @@
1
+ // src/mcp-auth/endpoint.ts
2
+ var McpAuthError = class extends Error {
3
+ constructor(message) {
4
+ super(message);
5
+ this.name = "McpAuthError";
6
+ }
7
+ };
8
+ function safeEndpoint(value) {
9
+ const url = new URL(value);
10
+ const loopback = ["127.0.0.1", "localhost", "[::1]"].includes(url.hostname);
11
+ if (url.protocol !== "https:" && !(url.protocol === "http:" && loopback) || url.username || url.password || url.hash) {
12
+ throw new McpAuthError(
13
+ "MCP authentication requires HTTPS or loopback HTTP without embedded credentials"
14
+ );
15
+ }
16
+ return url;
17
+ }
18
+
19
+ export {
20
+ McpAuthError,
21
+ safeEndpoint
22
+ };
23
+ //# sourceMappingURL=chunk-Q5H3L6Y4.js.map