@modootoday/pmcp 0.20.0 → 0.21.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 (118) 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-6FLMTJDV.js} +57 -23
  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-ICF2JZSN.js → chunk-2MAD4WNZ.js} +2 -2
  10. package/dist/{chunk-YDICIB2A.js → chunk-33KGCJB2.js} +2 -2
  11. package/dist/{chunk-FQAJSNNU.js → chunk-3X5JQYKN.js} +3 -3
  12. package/dist/{chunk-IQD4W53M.js → chunk-57Q75MS4.js} +18 -18
  13. package/dist/{chunk-EKPMVEIA.js → chunk-5FW7A6TG.js} +7 -4
  14. package/dist/chunk-5YCKFU5Q.js +1672 -0
  15. package/dist/{chunk-QYH2NR6G.js → chunk-7FV2LORT.js} +2 -2
  16. package/dist/{chunk-66F3HLW4.js → chunk-DEY23WTH.js} +122 -4
  17. package/dist/chunk-DJZPPCJP.js +274 -0
  18. package/dist/{chunk-MZEMLFFD.js → chunk-G6JXCUSK.js} +2 -2
  19. package/dist/{chunk-T6GOWHK6.js → chunk-GFOQDLPL.js} +6 -1
  20. package/dist/{chunk-OAIQ7A3R.js → chunk-GQP4GWU4.js} +5 -5
  21. package/dist/chunk-H4ZOKIER.js +7 -0
  22. package/dist/{chunk-RBNMNKNN.js → chunk-JQVSDPFL.js} +3 -3
  23. package/dist/{chunk-OG7QR2DP.js → chunk-KEHB4FZP.js} +17 -2
  24. package/dist/chunk-KUBHGVTD.js +126 -0
  25. package/dist/{chunk-IZABPDAO.js → chunk-KVNNVLJR.js} +2 -2
  26. package/dist/chunk-LFFIQBNY.js +115 -0
  27. package/dist/{chunk-PQTM27GU.js → chunk-MR5IBS6L.js} +6 -7
  28. package/dist/{chunk-M2RYXWX2.js → chunk-NHUMPEPV.js} +2 -2
  29. package/dist/{chunk-ONP6JRFZ.js → chunk-OFJIMBTL.js} +2 -2
  30. package/dist/{chunk-J6HNP6HA.js → chunk-OFPNCLG7.js} +2 -2
  31. package/dist/{chunk-FD6VGFYZ.js → chunk-OS5DF3LL.js} +207 -15
  32. package/dist/{chunk-L4MFGGSI.js → chunk-POTI2RJ6.js} +2 -2
  33. package/dist/{chunk-RMHZFWHF.js → chunk-R3MVL67T.js} +33 -33
  34. package/dist/{chunk-YN5GQCHN.js → chunk-RHJEGLYM.js} +6 -1
  35. package/dist/{chunk-4VK5G3SV.js → chunk-TBKVC2TA.js} +3 -5
  36. package/dist/{chunk-K2C3KFGB.js → chunk-UFWQTZDX.js} +29 -17
  37. package/dist/{chunk-JBHGJKSL.js → chunk-VBDDFO2V.js} +2 -2
  38. package/dist/{chunk-QOFSPFJ6.js → chunk-VUM6LO77.js} +3417 -3395
  39. package/dist/{chunk-CQZYQAAV.js → chunk-YLITJLTR.js} +3 -3
  40. package/dist/{chunk-O2JWF7ZM.js → chunk-Z4Q6RYJH.js} +2 -2
  41. package/dist/{chunk-QSIADSMQ.js → chunk-Z6WRFOFT.js} +3 -3
  42. package/dist/{chunk-5JPD6VIH.js → chunk-ZIJ5IUXH.js} +9 -3
  43. package/dist/{claude-GT2BPXEL.js → claude-XVLF4N4S.js} +3 -3
  44. package/dist/{cli-IV5DJCXU.js → cli-6FWRBCWM.js} +8 -8
  45. package/dist/{cli-6HTAJ54L.js → cli-RVPR3MH3.js} +7 -7
  46. package/dist/cli.js +11 -11
  47. package/dist/{completion-PPM7MEI2.js → completion-YTPHEVEW.js} +7 -7
  48. package/dist/{diagnostics-EWU2ROTG.js → diagnostics-IW54MLFK.js} +5 -6
  49. package/dist/{doctor-ZWZQMDKZ.js → doctor-EN4JPSKV.js} +35 -35
  50. package/dist/{entry-NDICBQ2F.js → entry-TQWSDTJ4.js} +14 -15
  51. package/dist/{exec-mcp-AG4G7SG7.js → exec-mcp-KKQ75N5O.js} +15 -13
  52. package/dist/{harness-JABSZCAA.js → harness-EB76F6BG.js} +6 -6
  53. package/dist/harness-launch-gate.js +3 -4
  54. package/dist/harness-worker.js +5 -6
  55. package/dist/hook-body.js +247 -86
  56. package/dist/{hook-spec-C7umArqw.d.ts → hook-spec-hZL4MSgi.d.ts} +8 -3
  57. package/dist/hooks-YWSHUNLM.js +24 -0
  58. package/dist/{host-2SZRMHZX.js → host-LSVITS6M.js} +6 -7
  59. package/dist/{host-BWZ5LA4Q.js → host-OGGADMBT.js} +17 -15
  60. package/dist/{host-run-SXLV4LHI.js → host-run-XO2TS4JC.js} +5 -7
  61. package/dist/http.js +1 -1
  62. package/dist/{import-mcp-2M7SZRVQ.js → import-mcp-BJDJTPVS.js} +14 -11
  63. package/dist/index.d.ts +11 -2
  64. package/dist/index.js +24 -24
  65. package/dist/{init-HOOIFBAD.js → init-773PTQM5.js} +3 -3
  66. package/dist/{install-HF6CROQP.js → install-7V6NIA7W.js} +4 -4
  67. package/dist/{invoke-JP4MILYY.js → invoke-Y7XH5S2L.js} +7 -8
  68. package/dist/{list-UBSBUZKS.js → list-5W65XVES.js} +20 -17
  69. package/dist/{logout-OO3DERRK.js → logout-XO6ALD45.js} +15 -12
  70. package/dist/{logs-K3QXKRD4.js → logs-74JGLQG6.js} +4 -4
  71. package/dist/{mailbox-DAJV6VAI.js → mailbox-VK5AVTHI.js} +7 -7
  72. package/dist/{mainline-6K5BA3WX.js → mainline-M2NSTAGC.js} +70 -24
  73. package/dist/{mcp-JXNTKRJG.js → mcp-R62ZNVGJ.js} +2 -2
  74. package/dist/{pause-GRVTSKOK.js → pause-CZ2OZYLC.js} +4 -4
  75. package/dist/project/hook-adapter.d.ts +1 -1
  76. package/dist/{project-M672MKQH.js → project-W5DQIZA6.js} +5 -5
  77. package/dist/{pty-LHKJKY2E.js → pty-CDLQ4NP2.js} +3 -3
  78. package/dist/report-Z3JV2PCT.js +105 -0
  79. package/dist/{resume-6DMPGG3N.js → resume-DFIHT2RO.js} +4 -4
  80. package/dist/{run-5W566T3V.js → run-OZLGSRHF.js} +14 -11
  81. package/dist/{run-ORBIERI3.js → run-WYJMTLX7.js} +4 -4
  82. package/dist/{serve-73SRPAV4.js → serve-DCQGAGB7.js} +3 -3
  83. package/dist/{session-XM2CR425.js → session-YZVX4NGN.js} +4 -4
  84. package/dist/{setup-ULKDPF5B.js → setup-D3KEJBGO.js} +4 -4
  85. package/dist/smoke-FQQJOQBD.js +16 -0
  86. package/dist/{start-login-BGFAMCZL.js → start-login-EKXM75XQ.js} +15 -12
  87. package/dist/{status-YCW6YJ3S.js → status-23UDIYYP.js} +39 -22
  88. package/dist/{status-YHXEAJ7U.js → status-3RTGDN2K.js} +10 -10
  89. package/dist/{status-73FEFQUQ.js → status-EDSEG32U.js} +15 -12
  90. package/dist/stdio.js +2 -2
  91. package/dist/{sweep-XF2HG3EO.js → sweep-EPJMEZR6.js} +4 -4
  92. package/dist/{test-IMNBXOYW.js → test-TM6PIZTV.js} +30 -20
  93. package/dist/{tui-5GDA22TB.js → tui-EQNJIDN5.js} +4 -4
  94. package/dist/{unbroadcast-XP3OCVN3.js → unbroadcast-NTOC3PY3.js} +4 -4
  95. package/dist/{worker-RV6NGSXT.js → worker-7X6WBPEI.js} +9 -10
  96. package/dist/{worktree-list-4PLE7K6L.js → worktree-list-EMKUMCTQ.js} +2 -2
  97. package/dist/{worktree-sync-GQVYAXGJ.js → worktree-sync-T6C5YEYS.js} +3 -3
  98. package/docs/commands.md +13 -6
  99. package/docs/git-workflow.md +28 -9
  100. package/docs/hooks.md +138 -10
  101. package/docs/project-configuration.md +27 -1
  102. package/docs/upgrading.md +42 -0
  103. package/gemini-extension.json +2 -2
  104. package/mcp.json +1 -1
  105. package/package.json +5 -5
  106. package/plugin.json +1 -1
  107. package/plugins/pmcp/.claude-plugin/plugin.json +1 -1
  108. package/plugins/pmcp/.mcp.json +1 -1
  109. package/plugins/pmcp/gemini-extension.json +2 -2
  110. package/plugins/pmcp/mcp.json +1 -1
  111. package/plugins/pmcp/mod/sessions/format.ts +2 -2
  112. package/plugins/pmcp/plugin.json +1 -1
  113. package/dist/chunk-7SDOSTW7.js +0 -130
  114. package/dist/chunk-AWZF72SH.js +0 -1025
  115. package/dist/chunk-FGYFA6JY.js +0 -7
  116. package/dist/chunk-ISNRDHSD.js +0 -74
  117. package/dist/chunk-QDY6BWE6.js +0 -396
  118. package/dist/hooks-YVQSDQV3.js +0 -21
@@ -1,7 +0,0 @@
1
- // src/commands/version.ts
2
- var VERSION = "0.20.0";
3
-
4
- export {
5
- VERSION
6
- };
7
- //# sourceMappingURL=chunk-FGYFA6JY.js.map
@@ -1,74 +0,0 @@
1
- import {
2
- git,
3
- gitText
4
- } from "./chunk-G7JONWL4.js";
5
-
6
- // src/git/landed.ts
7
- function cherry(cwd, upstream, head = "HEAD") {
8
- const listed = git(cwd, ["cherry", "-v", upstream, head]).stdout;
9
- const carried = [];
10
- const missing = [];
11
- for (const line of listed.split("\n")) {
12
- if (line.startsWith("- ")) carried.push(line.slice(2));
13
- if (line.startsWith("+ ")) missing.push(line.slice(2));
14
- }
15
- return { carried, missing };
16
- }
17
- function undelivered(cwd, upstream, named) {
18
- if (named.length === 0)
19
- return cherry(cwd, upstream).missing.map(
20
- (line) => line.split(" ")[0] ?? ""
21
- );
22
- const shas = [];
23
- for (const ref of named) {
24
- const sha = gitText(cwd, [
25
- "rev-parse",
26
- "--verify",
27
- "-q",
28
- `${ref}^{commit}`
29
- ]);
30
- if (!sha) throw new Error(`${ref} is not a commit`);
31
- const listed = git(cwd, ["cherry", upstream, sha, `${sha}^`]).stdout;
32
- if (listed.startsWith("+ ")) shas.push(sha);
33
- }
34
- return shas;
35
- }
36
- function touchedPaths(cwd, commits) {
37
- const paths = /* @__PURE__ */ new Set();
38
- for (const sha of commits) {
39
- const listed = gitText(cwd, [
40
- "diff-tree",
41
- "--no-commit-id",
42
- "--name-only",
43
- "-r",
44
- sha
45
- ]);
46
- for (const path of listed.split("\n")) {
47
- if (path) paths.add(path);
48
- }
49
- }
50
- return paths;
51
- }
52
- function isAncestor(cwd, ancestor, of) {
53
- return git(cwd, ["merge-base", "--is-ancestor", ancestor, of]).status === 0;
54
- }
55
- function distance(cwd, upstream) {
56
- const counted = gitText(cwd, [
57
- "rev-list",
58
- "--left-right",
59
- "--count",
60
- `${upstream}...HEAD`
61
- ]);
62
- if (!counted) return null;
63
- const [behind = 0, ahead = 0] = counted.split(/\s+/u).map(Number);
64
- return { behind, ahead };
65
- }
66
-
67
- export {
68
- cherry,
69
- undelivered,
70
- touchedPaths,
71
- isAncestor,
72
- distance
73
- };
74
- //# sourceMappingURL=chunk-ISNRDHSD.js.map
@@ -1,396 +0,0 @@
1
- import {
2
- MARK,
3
- blockOutput,
4
- jsonOutput
5
- } from "./chunk-QOFSPFJ6.js";
6
- import {
7
- ProjectError
8
- } from "./chunk-NRBQK6UX.js";
9
-
10
- // src/project/mcp/_shared.ts
11
- var ROOT_VAR = "${PROJECT_ROOT}";
12
- var ANTIGRAVITY_MCP_PLUGIN = ".agents/plugins/pmcp-mcp";
13
- var VARIABLE = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/gu;
14
-
15
- // src/project/mcp/launch.ts
16
- var quote = (text) => `'${text.replaceAll("'", "'\\''")}'`;
17
- function shellWord(text) {
18
- const pieces = [];
19
- let offset = 0;
20
- for (const match of text.matchAll(VARIABLE)) {
21
- const literal = text.slice(offset, match.index);
22
- if (literal !== "") {
23
- pieces.push(quote(literal));
24
- }
25
- const name = match[1];
26
- if (name === "PROJECT_ROOT") {
27
- pieces.push('"$d"');
28
- } else {
29
- pieces.push(`"\${${name}:?${name} is required}"`);
30
- }
31
- offset = match.index + match[0].length;
32
- }
33
- const tail = text.slice(offset);
34
- if (tail !== "") {
35
- pieces.push(quote(tail));
36
- }
37
- if (pieces.length === 0) {
38
- return "''";
39
- }
40
- return pieces.join("");
41
- }
42
- function forwardedVariables(server) {
43
- const names = new Set(server.envVars ?? []);
44
- const words = [
45
- server.command ?? "",
46
- ...server.args,
47
- ...Object.values(server.env),
48
- server.cwd ?? ""
49
- ];
50
- for (const word of words) {
51
- for (const match of word.matchAll(VARIABLE)) {
52
- if (match[1] !== "PROJECT_ROOT") {
53
- names.add(match[1]);
54
- }
55
- }
56
- }
57
- return [...names].sort();
58
- }
59
- function launch(spec) {
60
- if (spec.command === void 0) {
61
- throw new ProjectError("An HTTP server cannot be launched as stdio");
62
- }
63
- const words = [
64
- spec.command,
65
- ...spec.args,
66
- ...Object.values(spec.env),
67
- spec.cwd ?? ""
68
- ];
69
- const variables = forwardedVariables(spec);
70
- const needsRoot = words.some((word) => word.includes(ROOT_VAR));
71
- const needsExpansion = words.some(
72
- (word) => [...word.matchAll(VARIABLE)].length > 0
73
- );
74
- if (!needsExpansion && !spec.cwd && variables.length === 0) {
75
- return { command: spec.command, args: spec.args, env: spec.env };
76
- }
77
- const statements = [];
78
- if (needsRoot) {
79
- statements.push(
80
- [
81
- // The real directory: an inherited $PWD can name a directory the runtime has left.
82
- "d=$(pwd -P)",
83
- 'while [ ! -f "$d/pmcp.toml" ]',
84
- "do",
85
- ' [ "$d" = / ] && exit 1',
86
- ' d=$(dirname "$d")',
87
- "done"
88
- ].join("\n")
89
- );
90
- }
91
- for (const name of variables) {
92
- statements.push(`export ${name}="\${${name}:?${name} is required}"`);
93
- }
94
- for (const [key, value] of Object.entries(spec.env)) {
95
- statements.push(`export ${key}=${shellWord(value)}`);
96
- }
97
- if (spec.cwd) {
98
- statements.push(`cd ${shellWord(spec.cwd)} || exit 1`);
99
- }
100
- statements.push(
101
- `exec ${[spec.command, ...spec.args].map(shellWord).join(" ")}`
102
- );
103
- return { command: "sh", args: ["-c", statements.join("\n")], env: {} };
104
- }
105
-
106
- // src/project/adapters/opencode.ts
107
- import { existsSync } from "fs";
108
- import { join } from "path";
109
- var OPENCODE_CONFIG = "opencode.json";
110
- function checkOpenCodeConfig(root) {
111
- if (existsSync(join(root, "opencode.jsonc"))) {
112
- throw new ProjectError(
113
- "OpenCode JSONC projection is not supported; reconcile opencode.jsonc before projecting opencode.json"
114
- );
115
- }
116
- }
117
- function opencodeMcpEntry(server, started) {
118
- if (server.tools !== void 0) {
119
- throw new ProjectError(
120
- "OpenCode per-server tool filtering is not qualified; limit this server's targets"
121
- );
122
- }
123
- const timeout = server.native?.opencode;
124
- if (server.url !== void 0) {
125
- const headers = { ...server.headers };
126
- for (const [key, name] of Object.entries(server.headerEnv ?? {})) {
127
- headers[key] = `{env:${name}}`;
128
- }
129
- if (server.bearerTokenEnvVar) {
130
- headers["Authorization"] = `Bearer {env:${server.bearerTokenEnvVar}}`;
131
- }
132
- return {
133
- type: "remote",
134
- url: server.url,
135
- enabled: true,
136
- ...Object.keys(headers).length > 0 ? { headers } : {},
137
- ...timeout
138
- };
139
- }
140
- if (!started) {
141
- throw new ProjectError(
142
- "OpenCode local MCP projection requires a launch specification"
143
- );
144
- }
145
- return {
146
- type: "local",
147
- command: [started.command, ...started.args],
148
- enabled: true,
149
- ...Object.keys(started.env).length > 0 ? { environment: { ...started.env } } : {},
150
- ...timeout
151
- };
152
- }
153
-
154
- // src/project/mcp/native.ts
155
- import { relative as relative2, isAbsolute as isAbsolute2 } from "path";
156
-
157
- // src/project/mcp/http.ts
158
- function httpEntry(server, tool) {
159
- const result = {};
160
- if (tool === "gemini") {
161
- result["httpUrl"] = server.url;
162
- } else if (tool === "antigravity") {
163
- result["serverUrl"] = server.url;
164
- } else {
165
- result["url"] = server.url;
166
- }
167
- if (tool === "claude") {
168
- result["type"] = "http";
169
- }
170
- const headers = { ...server.headers };
171
- if (tool === "antigravity" && (Object.keys(headers).length > 0 || Object.keys(server.headerEnv ?? {}).length > 0 || server.bearerTokenEnvVar !== void 0)) {
172
- throw new ProjectError(
173
- "Antigravity HTTP header projection is not qualified; limit this server's targets"
174
- );
175
- }
176
- if (tool === "codex") {
177
- if (Object.keys(headers).length > 0) {
178
- result["http_headers"] = headers;
179
- }
180
- if (Object.keys(server.headerEnv ?? {}).length > 0) {
181
- result["env_http_headers"] = { ...server.headerEnv };
182
- }
183
- if (server.bearerTokenEnvVar) {
184
- result["bearer_token_env_var"] = server.bearerTokenEnvVar;
185
- }
186
- return result;
187
- }
188
- for (const [key, name] of Object.entries(server.headerEnv ?? {})) {
189
- headers[key] = `\${${name}}`;
190
- }
191
- if (server.bearerTokenEnvVar) {
192
- headers["Authorization"] = `Bearer \${${server.bearerTokenEnvVar}}`;
193
- }
194
- if (Object.keys(headers).length > 0) {
195
- result["headers"] = headers;
196
- }
197
- return result;
198
- }
199
-
200
- // src/project/mcp/driver.ts
201
- import { isAbsolute, relative } from "path";
202
- function proxyDriver(spec, alias) {
203
- const entry = relative(spec.root, process.argv[1] ?? "");
204
- if (!isAbsolute(entry) && !entry.startsWith("..")) {
205
- return launch({
206
- command: "node",
207
- args: [`${ROOT_VAR}/${entry}`, "project", "exec-mcp", alias],
208
- env: {}
209
- });
210
- }
211
- return launch({
212
- command: "pmcp",
213
- args: ["project", "exec-mcp", alias],
214
- env: {}
215
- });
216
- }
217
-
218
- // src/project/mcp/native.ts
219
- var runtimeByTool = {
220
- claude: "claude-code",
221
- codex: "codex-cli",
222
- gemini: "gemini-cli",
223
- grok: "grok-cli",
224
- antigravity: "antigravity"
225
- };
226
- function mailboxRuntime(tool) {
227
- const runtime = runtimeByTool[tool];
228
- if (!runtime) {
229
- throw new ProjectError(
230
- "OpenCode mailbox runtime binding is not qualified; limit this server's targets"
231
- );
232
- }
233
- return runtime;
234
- }
235
- var PMCP_AUTH_TOOLS = [
236
- "claude",
237
- "codex",
238
- "gemini",
239
- "antigravity",
240
- "grok",
241
- "opencode"
242
- ];
243
- function nativeEntry(spec, alias, server, tool) {
244
- let result;
245
- if (server.auth === "pmcp") {
246
- if (!PMCP_AUTH_TOOLS.includes(tool))
247
- throw new ProjectError(
248
- `pmcp MCP authentication currently supports ${PMCP_AUTH_TOOLS.join(", ")} targets`
249
- );
250
- const started = proxyDriver(spec, alias);
251
- if (tool === "opencode") {
252
- const { url: _remote, ...local } = server;
253
- return opencodeMcpEntry(local, started);
254
- }
255
- result = { command: started.command, args: [...started.args] };
256
- if (Object.keys(started.env).length) result["env"] = started.env;
257
- if (tool === "codex")
258
- result["env_vars"] = [
259
- "XDG_STATE_HOME",
260
- ...Object.values(server.headerEnv ?? {})
261
- ];
262
- } else if (server.url !== void 0) {
263
- if (tool === "opencode") return opencodeMcpEntry(server);
264
- result = httpEntry(server, tool);
265
- } else {
266
- const env = { ...server.env };
267
- if (server.mailbox) {
268
- env["PMCP_MAILBOX_RUNTIME"] = mailboxRuntime(tool);
269
- }
270
- let started;
271
- if (Object.keys(server.envFrom ?? {}).length > 0) {
272
- const entry = relative2(spec.root, process.argv[1] ?? "");
273
- const driverEnv = {};
274
- if (server.mailbox) {
275
- driverEnv["PMCP_MAILBOX_RUNTIME"] = mailboxRuntime(tool);
276
- }
277
- if (!isAbsolute2(entry) && !entry.startsWith("..")) {
278
- started = launch({
279
- command: "node",
280
- args: [`${ROOT_VAR}/${entry}`, "project", "exec-mcp", alias],
281
- env: driverEnv
282
- });
283
- } else {
284
- started = launch({
285
- command: "pmcp",
286
- args: ["project", "exec-mcp", alias],
287
- env: driverEnv
288
- });
289
- }
290
- } else {
291
- started = launch({ ...server, env });
292
- }
293
- if (tool === "opencode") return opencodeMcpEntry(server, started);
294
- result = { command: started.command, args: [...started.args] };
295
- if (Object.keys(started.env).length > 0) {
296
- result["env"] = { ...started.env };
297
- }
298
- const variables = forwardedVariables(server).filter(
299
- (key) => !Object.hasOwn(server.envFrom ?? {}, key)
300
- );
301
- if (tool === "codex" && variables.length > 0) {
302
- result["env_vars"] = variables;
303
- }
304
- }
305
- if (server.tools) {
306
- if (tool === "gemini") {
307
- result["includeTools"] = [...server.tools];
308
- }
309
- if (tool === "codex") {
310
- result["enabled_tools"] = [...server.tools];
311
- }
312
- }
313
- return { ...result, ...server.native?.[tool] };
314
- }
315
-
316
- // src/project/mcp/outputs.ts
317
- var tomlValue = (value) => {
318
- if (Array.isArray(value)) {
319
- return `[${value.map(tomlValue).join(", ")}]`;
320
- }
321
- if (value !== null && typeof value === "object") {
322
- const parts = Object.entries(value).map(
323
- ([key, item]) => `${JSON.stringify(key)} = ${tomlValue(item)}`
324
- );
325
- return `{ ${parts.join(", ")} }`;
326
- }
327
- return JSON.stringify(value);
328
- };
329
- function serversForTool(spec, tool) {
330
- return Object.entries(spec.mcp).filter(
331
- ([, server]) => server.targets === void 0 || server.targets.includes(tool)
332
- );
333
- }
334
- function tomlServers(spec, servers, tool) {
335
- const lines = [`# ${MARK} from pmcp.toml [mcp]`];
336
- for (const [alias, server] of servers) {
337
- lines.push("", `[mcp_servers.${alias}]`);
338
- for (const [key, value] of Object.entries(
339
- nativeEntry(spec, alias, server, tool)
340
- )) {
341
- lines.push(`${key} = ${tomlValue(value)}`);
342
- }
343
- }
344
- return `${lines.join("\n")}
345
- `;
346
- }
347
- function mcpOutputs(spec) {
348
- const outputs = [];
349
- const jsonFiles = {
350
- claude: ".mcp.json",
351
- gemini: ".gemini/settings.json",
352
- antigravity: `${ANTIGRAVITY_MCP_PLUGIN}/mcp_config.json`,
353
- opencode: OPENCODE_CONFIG
354
- };
355
- for (const tool of spec.tools) {
356
- if (tool === "opencode") checkOpenCodeConfig(spec.root);
357
- const servers = serversForTool(spec, tool);
358
- if (servers.length === 0) {
359
- continue;
360
- }
361
- if (tool === "antigravity") {
362
- outputs.push({
363
- kind: "file",
364
- path: `${ANTIGRAVITY_MCP_PLUGIN}/plugin.json`,
365
- content: `${JSON.stringify({ name: "pmcp-mcp" }, null, 2)}
366
- `
367
- });
368
- }
369
- const file = jsonFiles[tool];
370
- if (file) {
371
- for (const [alias, server] of servers) {
372
- outputs.push(
373
- jsonOutput(
374
- file,
375
- [tool === "opencode" ? "mcp" : "mcpServers", alias],
376
- nativeEntry(spec, alias, server, tool)
377
- )
378
- );
379
- }
380
- continue;
381
- }
382
- outputs.push(
383
- blockOutput(`.${tool}/config.toml`, tomlServers(spec, servers, tool))
384
- );
385
- }
386
- return outputs;
387
- }
388
-
389
- export {
390
- ANTIGRAVITY_MCP_PLUGIN,
391
- launch,
392
- OPENCODE_CONFIG,
393
- serversForTool,
394
- mcpOutputs
395
- };
396
- //# sourceMappingURL=chunk-QDY6BWE6.js.map
@@ -1,21 +0,0 @@
1
- import {
2
- hooksSpec
3
- } from "./chunk-OG7QR2DP.js";
4
- import "./chunk-XNML2KIC.js";
5
- import {
6
- ArgumentError
7
- } from "./chunk-A4PKLESO.js";
8
-
9
- // src/commands/hooks.ts
10
- async function run(context) {
11
- const [verb = "list", ...extra] = context.args.positional;
12
- if (extra.length) throw new ArgumentError("Use hooks list or hooks test");
13
- if (verb === "list") return (await import("./list-UBSBUZKS.js")).run(context);
14
- if (verb === "test") return (await import("./test-IMNBXOYW.js")).run(context);
15
- throw new ArgumentError("Use hooks list or hooks test");
16
- }
17
- var hooksCommand = { ...hooksSpec, run };
18
- export {
19
- hooksCommand
20
- };
21
- //# sourceMappingURL=hooks-YVQSDQV3.js.map