@modootoday/pmcp 0.17.3 → 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 -16160
  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 -4911
  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 +6 -3
  160. package/dist/project/hook-adapter.js +66 -35
  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 +844 -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-PRSnYGLV.d.ts +0 -10
  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,660 @@
1
+ import {
2
+ containedPath,
3
+ readLocalMarketplace
4
+ } from "./chunk-YSAWTGNA.js";
5
+
6
+ // src/catalog/_shared.ts
7
+ var ASSET_KINDS = ["skill", "agent", "hook", "mcp"];
8
+ var kindOf = (entry) => entry.kind ?? "skill";
9
+ var SKIPPED_DIRS = /* @__PURE__ */ new Set([
10
+ "node_modules",
11
+ ".git",
12
+ ".cache",
13
+ ".turbo",
14
+ "coverage",
15
+ "__tests__",
16
+ "__fixtures__"
17
+ ]);
18
+ var MAX_SKILL_DEPTH = 3;
19
+
20
+ // src/frontmatter.ts
21
+ import { parse } from "yaml";
22
+ function frontmatterText(source) {
23
+ const text = source.replace(/^/u, "").replace(/\r\n/gu, "\n");
24
+ if (!text.startsWith("---\n") && text !== "---") return null;
25
+ const end = text.indexOf("\n---", 3);
26
+ if (end === -1) return null;
27
+ return text.slice(4, end + 1);
28
+ }
29
+ function bodyOf(source) {
30
+ const text = source.replace(/^/u, "").replace(/\r\n/gu, "\n");
31
+ if (!text.startsWith("---\n")) return text;
32
+ const end = text.indexOf("\n---", 3);
33
+ if (end === -1) return text;
34
+ return text.slice(end + 4).replace(/^\n+/u, "");
35
+ }
36
+ var asObject = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
37
+ function frontmatterObject(source) {
38
+ const text = frontmatterText(source);
39
+ if (text === null) return null;
40
+ try {
41
+ return asObject(parse(text));
42
+ } catch {
43
+ const quoted = text.split("\n").map((line) => {
44
+ const match = /^([A-Za-z][\w-]*):\s+(.*:\s.*)$/u.exec(line);
45
+ if (!match || /^["'|>[{]/u.test(match[2] ?? "")) return line;
46
+ return `${match[1]}: ${JSON.stringify(match[2])}`;
47
+ }).join("\n");
48
+ try {
49
+ return asObject(parse(quoted));
50
+ } catch {
51
+ return null;
52
+ }
53
+ }
54
+ }
55
+ function stringFields(front) {
56
+ const out = {};
57
+ for (const [key, value] of Object.entries(front ?? {})) {
58
+ if (typeof value === "string") out[key] = value.trim();
59
+ else if (typeof value === "number" || typeof value === "boolean")
60
+ out[key] = String(value);
61
+ }
62
+ return out;
63
+ }
64
+ function leafOf(value) {
65
+ if (typeof value === "string") return value;
66
+ if (typeof value === "number" || typeof value === "boolean")
67
+ return String(value);
68
+ if (Array.isArray(value))
69
+ return value.filter((v) => typeof v === "string");
70
+ return void 0;
71
+ }
72
+ function metadataOf(front) {
73
+ const out = {};
74
+ const meta = asObject(front?.["metadata"]);
75
+ for (const [key, value] of Object.entries(meta ?? {})) {
76
+ const leaf = leafOf(value);
77
+ if (leaf !== void 0) {
78
+ out[key] = leaf;
79
+ continue;
80
+ }
81
+ const nested = asObject(value);
82
+ if (nested === null) continue;
83
+ const map = {};
84
+ for (const [inner, innerValue] of Object.entries(nested)) {
85
+ const innerLeaf = leafOf(innerValue);
86
+ if (innerLeaf !== void 0) map[inner] = innerLeaf;
87
+ }
88
+ if (Object.keys(map).length > 0) out[key] = map;
89
+ }
90
+ return out;
91
+ }
92
+ var SKILL_NAME = /^[a-z0-9](?:[a-z0-9]|-(?!-))*[a-z0-9]$|^[a-z0-9]$/u;
93
+ var NAME_MAX = 64;
94
+ var DESCRIPTION_MAX = 1024;
95
+ var COMPATIBILITY_MAX = 500;
96
+ function specProblems(front, directory) {
97
+ if (front === null) return ["frontmatter is missing or is not YAML"];
98
+ const problems = [];
99
+ const name = front["name"];
100
+ if (typeof name !== "string" || name === "") {
101
+ problems.push("name is required");
102
+ } else {
103
+ if (name.length > NAME_MAX)
104
+ problems.push(`name is longer than ${NAME_MAX} characters`);
105
+ if (!SKILL_NAME.test(name))
106
+ problems.push(
107
+ "name must be lowercase letters, digits and single hyphens, not starting or ending with one"
108
+ );
109
+ if (name !== directory)
110
+ problems.push(`name ${name} does not match its directory ${directory}`);
111
+ }
112
+ const description = front["description"];
113
+ if (typeof description !== "string" || description.trim() === "") {
114
+ problems.push("description is required");
115
+ } else if (description.length > DESCRIPTION_MAX) {
116
+ problems.push(`description is longer than ${DESCRIPTION_MAX} characters`);
117
+ }
118
+ const compatibility = front["compatibility"];
119
+ if (compatibility !== void 0) {
120
+ if (typeof compatibility !== "string")
121
+ problems.push("compatibility must be a string");
122
+ else if (compatibility.length > COMPATIBILITY_MAX)
123
+ problems.push(
124
+ `compatibility is longer than ${COMPATIBILITY_MAX} characters`
125
+ );
126
+ }
127
+ const license = front["license"];
128
+ if (license !== void 0 && typeof license !== "string")
129
+ problems.push("license must be a string");
130
+ const allowed = front["allowed-tools"];
131
+ if (allowed !== void 0 && typeof allowed !== "string")
132
+ problems.push("allowed-tools must be a space-separated string");
133
+ const metadata = front["metadata"];
134
+ if (metadata !== void 0 && asObject(metadata) === null)
135
+ problems.push("metadata must be a map");
136
+ return problems;
137
+ }
138
+
139
+ // src/catalog/frontmatter.ts
140
+ function readFrontmatter(source) {
141
+ return stringFields(frontmatterObject(source));
142
+ }
143
+ function readBody(source) {
144
+ return bodyOf(source);
145
+ }
146
+
147
+ // src/marketplace/frontmatter.ts
148
+ function readMetadata(source) {
149
+ return metadataOf(frontmatterObject(source));
150
+ }
151
+ function readFrontmatterText(source) {
152
+ return frontmatterText(source) ?? "";
153
+ }
154
+
155
+ // src/marketplace/_shared.ts
156
+ import { readFileSync as readFileSync4 } from "fs";
157
+ import { dirname as dirname2 } from "path";
158
+
159
+ // src/catalog/globs.ts
160
+ import { existsSync, readdirSync } from "fs";
161
+ import { isAbsolute, join } from "path";
162
+ function expandBraces(pattern) {
163
+ const match = /\{([^{}]*)\}/u.exec(pattern);
164
+ if (!match) return [pattern];
165
+ const head = pattern.slice(0, match.index);
166
+ const tail = pattern.slice(match.index + match[0].length);
167
+ return match[1].split(",").flatMap((option) => expandBraces(`${head}${option}${tail}`));
168
+ }
169
+ function segmentMatcher(segment) {
170
+ const body = segment.split("*").map((part) => part.replace(/[.+?^${}()|[\]\\]/gu, "\\$&")).join("[^/]*");
171
+ return new RegExp(`^${body}$`, "u");
172
+ }
173
+ function globDirs(base, pattern) {
174
+ const segments = pattern.split("/").filter((s) => s !== "" && s !== ".");
175
+ const found = /* @__PURE__ */ new Set();
176
+ const walk = (dir, index) => {
177
+ if (index === segments.length) {
178
+ found.add(dir);
179
+ return;
180
+ }
181
+ const segment = segments[index];
182
+ if (!segment.includes("*")) {
183
+ const next = join(dir, segment);
184
+ if (existsSync(next)) walk(next, index + 1);
185
+ return;
186
+ }
187
+ let entries;
188
+ try {
189
+ entries = readdirSync(dir, { withFileTypes: true });
190
+ } catch {
191
+ return;
192
+ }
193
+ const children = entries.filter((e) => e.isDirectory() || e.isSymbolicLink()).filter((e) => !SKIPPED_DIRS.has(e.name));
194
+ if (segment === "**") {
195
+ walk(dir, index + 1);
196
+ for (const child of children) walk(join(dir, child.name), index);
197
+ return;
198
+ }
199
+ const matcher = segmentMatcher(segment);
200
+ for (const child of children) {
201
+ if (matcher.test(child.name)) walk(join(dir, child.name), index + 1);
202
+ }
203
+ };
204
+ walk(base, 0);
205
+ return [...found];
206
+ }
207
+ function expandRootGlob(dir) {
208
+ if (!dir.includes("*")) return [dir];
209
+ const absolute = isAbsolute(dir);
210
+ const base = absolute ? "/" : ".";
211
+ return globDirs(base, dir).filter((d) => existsSync(join(d, "package.json"))).sort();
212
+ }
213
+
214
+ // src/catalog/workspaces.ts
215
+ import { existsSync as existsSync3 } from "fs";
216
+ import { join as join3 } from "path";
217
+
218
+ // src/catalog/packages.ts
219
+ import { existsSync as existsSync2, readFileSync, readdirSync as readdirSync2 } from "fs";
220
+ import { basename, join as join2 } from "path";
221
+ function skillFiles(packageDir) {
222
+ const found = [];
223
+ const stack = [[packageDir, 0]];
224
+ while (stack.length > 0) {
225
+ const next = stack.pop();
226
+ if (next === void 0) break;
227
+ const [dir, depth] = next;
228
+ let entries;
229
+ try {
230
+ entries = readdirSync2(dir, { withFileTypes: true });
231
+ } catch {
232
+ continue;
233
+ }
234
+ for (const entry of entries) {
235
+ if (entry.isFile()) {
236
+ if (entry.name === "SKILL.md") found.push(join2(dir, entry.name));
237
+ continue;
238
+ }
239
+ if (!entry.isDirectory()) continue;
240
+ if (SKIPPED_DIRS.has(entry.name)) continue;
241
+ if (depth + 1 <= MAX_SKILL_DEPTH)
242
+ stack.push([join2(dir, entry.name), depth + 1]);
243
+ }
244
+ }
245
+ return found.sort();
246
+ }
247
+ function packageDirs(root) {
248
+ if (!existsSync2(root)) return [];
249
+ const found = [];
250
+ for (const entry of readdirSync2(root, { withFileTypes: true })) {
251
+ if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;
252
+ if (entry.name === ".bin" || entry.name === ".cache") continue;
253
+ const path = join2(root, entry.name);
254
+ if (entry.name.startsWith("@")) {
255
+ if (!existsSync2(path)) continue;
256
+ for (const scoped of readdirSync2(path, { withFileTypes: true })) {
257
+ if (scoped.isDirectory() || scoped.isSymbolicLink()) {
258
+ found.push(join2(path, scoped.name));
259
+ }
260
+ }
261
+ continue;
262
+ }
263
+ found.push(path);
264
+ }
265
+ return found;
266
+ }
267
+ function readManifest(dir) {
268
+ try {
269
+ const parsed = JSON.parse(
270
+ readFileSync(join2(dir, "package.json"), "utf8")
271
+ );
272
+ return parsed !== null && typeof parsed === "object" ? parsed : null;
273
+ } catch {
274
+ return null;
275
+ }
276
+ }
277
+ function nameOf(dir, named) {
278
+ const manifestName = readManifest(dir)?.["name"];
279
+ if (typeof manifestName === "string" && manifestName !== "") {
280
+ return manifestName;
281
+ }
282
+ if (named) return basename(dir);
283
+ return "";
284
+ }
285
+
286
+ // src/catalog/workspaces.ts
287
+ function workspacePatterns(manifest) {
288
+ const field = manifest["workspaces"];
289
+ const list = Array.isArray(field) ? field : field?.packages;
290
+ if (!Array.isArray(list)) return [];
291
+ return list.filter((p) => typeof p === "string");
292
+ }
293
+ function workspacePackageDirs(root) {
294
+ const ordered = [];
295
+ const visited = /* @__PURE__ */ new Set();
296
+ const expand = (dir) => {
297
+ if (visited.has(dir)) return;
298
+ visited.add(dir);
299
+ const manifest = readManifest(dir);
300
+ if (manifest === null) return;
301
+ const included = /* @__PURE__ */ new Set();
302
+ const excluded = /* @__PURE__ */ new Set();
303
+ for (const raw of workspacePatterns(manifest)) {
304
+ const negated = raw.startsWith("!");
305
+ const pattern = negated ? raw.slice(1) : raw;
306
+ for (const alternative of expandBraces(pattern)) {
307
+ for (const match of globDirs(dir, alternative)) {
308
+ (negated ? excluded : included).add(match);
309
+ }
310
+ }
311
+ }
312
+ const members = [...included].filter((m) => !excluded.has(m) && existsSync3(join3(m, "package.json"))).sort();
313
+ for (const member of members) expand(member);
314
+ ordered.push(dir);
315
+ };
316
+ expand(root);
317
+ return ordered;
318
+ }
319
+
320
+ // src/catalog/load.ts
321
+ import { readFileSync as readFileSync3 } from "fs";
322
+ import { basename as basename4, dirname } from "path";
323
+
324
+ // src/marketplace/skills.ts
325
+ import { existsSync as existsSync4, readdirSync as readdirSync3 } from "fs";
326
+ import { join as join4 } from "path";
327
+
328
+ // src/marketplace/markdown.ts
329
+ import { readFileSync as readFileSync2 } from "fs";
330
+ function markdownEntry(context, path, fallbackSlug, shape) {
331
+ let source;
332
+ try {
333
+ source = readFileSync2(containedPath(context.pluginDir, path), "utf8");
334
+ } catch {
335
+ context.onReject?.({
336
+ path,
337
+ reason: "Asset is unreadable or outside the plugin root"
338
+ });
339
+ return null;
340
+ }
341
+ const front = readFrontmatter(source);
342
+ const description = front["description"] ?? "";
343
+ if (description === "") {
344
+ context.onReject?.({ path, reason: "no description" });
345
+ return null;
346
+ }
347
+ const metadata = readMetadata(source);
348
+ const ownTier = asString(metadata["tier"]);
349
+ if (context.tier !== void 0 && ownTier !== void 0 && ownTier !== context.tier) {
350
+ context.onReject?.({
351
+ path,
352
+ reason: `metadata.tier ${ownTier} in a ${context.tier} marketplace`
353
+ });
354
+ return null;
355
+ }
356
+ const slug = front["name"] ?? fallbackSlug;
357
+ const prefix = `${context.marketplace}/${context.plugin}`;
358
+ return {
359
+ name: shape.namespace ? `${prefix}/${shape.namespace}/${slug}` : `${prefix}/${slug}`,
360
+ package: prefix,
361
+ slug,
362
+ description,
363
+ path,
364
+ tier: ownTier ?? context.tier,
365
+ metadata,
366
+ keywords: asList(metadata["keywords"]),
367
+ ...shape.kind ? { kind: shape.kind } : {},
368
+ ...shape.root ? { root: shape.root } : {}
369
+ };
370
+ }
371
+
372
+ // src/marketplace/skills.ts
373
+ function skillEntries(context) {
374
+ const dir = join4(context.pluginDir, "skills");
375
+ if (!existsSync4(dir)) return [];
376
+ const found = [];
377
+ for (const child of readdirSync3(dir, { withFileTypes: true })) {
378
+ if (!child.isDirectory()) continue;
379
+ const path = join4(dir, child.name, "SKILL.md");
380
+ if (!existsSync4(path)) continue;
381
+ const entry = markdownEntry(context, path, child.name, {});
382
+ if (entry) found.push(entry);
383
+ }
384
+ return found;
385
+ }
386
+
387
+ // src/marketplace/commands.ts
388
+ import { existsSync as existsSync5, readdirSync as readdirSync4 } from "fs";
389
+ import { basename as basename2, join as join5 } from "path";
390
+ function commandEntries(context) {
391
+ const dir = join5(context.pluginDir, "commands");
392
+ if (!existsSync5(dir)) return [];
393
+ const found = [];
394
+ for (const child of readdirSync4(dir, { withFileTypes: true })) {
395
+ if (!child.isFile() || !child.name.endsWith(".md")) continue;
396
+ const path = join5(dir, child.name);
397
+ const entry = markdownEntry(context, path, basename2(child.name, ".md"), {
398
+ root: path
399
+ });
400
+ if (entry) found.push(entry);
401
+ }
402
+ return found;
403
+ }
404
+
405
+ // src/marketplace/agents.ts
406
+ import { existsSync as existsSync6, readdirSync as readdirSync5 } from "fs";
407
+ import { basename as basename3, join as join6 } from "path";
408
+ function agentEntries(context) {
409
+ const dir = join6(context.pluginDir, "agents");
410
+ if (!existsSync6(dir)) return [];
411
+ const found = [];
412
+ for (const child of readdirSync5(dir, { withFileTypes: true })) {
413
+ let entry = null;
414
+ if (child.isFile() && child.name.endsWith(".md")) {
415
+ const path = join6(dir, child.name);
416
+ entry = markdownEntry(context, path, basename3(child.name, ".md"), {
417
+ kind: "agent",
418
+ root: path,
419
+ namespace: "agents"
420
+ });
421
+ } else if (child.isDirectory() && existsSync6(join6(dir, child.name, "agent.md"))) {
422
+ entry = markdownEntry(
423
+ context,
424
+ join6(dir, child.name, "agent.md"),
425
+ child.name,
426
+ {
427
+ kind: "agent",
428
+ namespace: "agents"
429
+ }
430
+ );
431
+ }
432
+ if (entry) found.push(entry);
433
+ }
434
+ return found;
435
+ }
436
+
437
+ // src/marketplace/hooks.ts
438
+ import { existsSync as existsSync7 } from "fs";
439
+ import { resolve } from "path";
440
+ function hookEntries(context, manifest) {
441
+ const declared = typeof manifest.hooks === "string" ? manifest.hooks : void 0;
442
+ const path = resolve(context.pluginDir, declared ?? "hooks/hooks.json");
443
+ if (!existsSync7(path)) return [];
444
+ const hooks = readJson(path, context.pluginDir);
445
+ if (hooks === null) {
446
+ context.onReject?.({ path, reason: "hooks.json is not a JSON object" });
447
+ return [];
448
+ }
449
+ const own = typeof hooks["description"] === "string" ? hooks["description"] : void 0;
450
+ const description = own ?? context.pluginDescription ?? "";
451
+ if (description === "") {
452
+ context.onReject?.({ path, reason: "no description" });
453
+ return [];
454
+ }
455
+ const prefix = `${context.marketplace}/${context.plugin}`;
456
+ return [
457
+ {
458
+ name: `${prefix}/hooks`,
459
+ package: prefix,
460
+ slug: "hooks",
461
+ description,
462
+ path,
463
+ tier: context.tier,
464
+ kind: "hook",
465
+ root: context.pluginDir
466
+ }
467
+ ];
468
+ }
469
+
470
+ // src/marketplace/mcp.ts
471
+ import { existsSync as existsSync8 } from "fs";
472
+ import { join as join7 } from "path";
473
+ function mcpEntries(context) {
474
+ const filename = [".mcp.json", "mcp.json", "mcp_config.json"].find(
475
+ (name) => existsSync8(join7(context.pluginDir, name))
476
+ );
477
+ if (!filename) return [];
478
+ const path = join7(context.pluginDir, filename);
479
+ const config = readJson(path, context.pluginDir);
480
+ const servers = config?.["mcpServers"];
481
+ if (servers === null || typeof servers !== "object" || Array.isArray(servers)) {
482
+ context.onReject?.({ path, reason: ".mcp.json has no mcpServers object" });
483
+ return [];
484
+ }
485
+ const prefix = `${context.marketplace}/${context.plugin}`;
486
+ return Object.keys(servers).map((server) => ({
487
+ name: `${prefix}/mcp/${server}`,
488
+ package: prefix,
489
+ slug: server,
490
+ description: context.pluginDescription ? `MCP server ${server}. ${context.pluginDescription}` : `MCP server ${server} from plugin ${context.plugin}.`,
491
+ path,
492
+ tier: context.tier,
493
+ kind: "mcp",
494
+ root: path
495
+ }));
496
+ }
497
+
498
+ // src/marketplace/read.ts
499
+ function readMarketplace(dir, onReject) {
500
+ const marketplace = readLocalMarketplace(dir, onReject);
501
+ if (!marketplace) return [];
502
+ const found = [];
503
+ for (const plugin of marketplace.plugins) {
504
+ const pluginManifest = plugin.manifest;
505
+ const context = {
506
+ marketplace: marketplace.name,
507
+ plugin: plugin.name,
508
+ pluginDir: plugin.directory,
509
+ pluginDescription: typeof pluginManifest.description === "string" ? pluginManifest.description : void 0,
510
+ tier: marketplace.tier,
511
+ onReject
512
+ };
513
+ found.push(
514
+ ...skillEntries(context),
515
+ ...commandEntries(context),
516
+ ...agentEntries(context),
517
+ ...hookEntries(context, pluginManifest),
518
+ ...mcpEntries(context)
519
+ );
520
+ }
521
+ return found;
522
+ }
523
+
524
+ // src/catalog/load.ts
525
+ function readCatalog(options) {
526
+ const scopes = options.scopes ?? [];
527
+ const found = [];
528
+ const seen = /* @__PURE__ */ new Set();
529
+ const seenPaths = /* @__PURE__ */ new Set();
530
+ const direct = new Set(options.packages ?? []);
531
+ const packageDirsToRead = [
532
+ ...options.roots.flatMap(packageDirs),
533
+ ...direct,
534
+ ...(options.workspaces ?? []).flatMap(expandRootGlob).flatMap(workspacePackageDirs)
535
+ ];
536
+ for (const packageDir of packageDirsToRead) {
537
+ const packageName = nameOf(packageDir, direct.has(packageDir));
538
+ if (packageName === "") continue;
539
+ if (scopes.length > 0 && !scopes.some((s) => packageName.startsWith(s))) {
540
+ continue;
541
+ }
542
+ for (const path of skillFiles(packageDir)) {
543
+ if (seenPaths.has(path)) continue;
544
+ seenPaths.add(path);
545
+ let source;
546
+ try {
547
+ source = readFileSync3(path, "utf8");
548
+ } catch {
549
+ continue;
550
+ }
551
+ const parsed = frontmatterObject(source);
552
+ const front = stringFields(parsed);
553
+ const description = front["description"] ?? "";
554
+ if (description === "") continue;
555
+ const dirName = basename4(dirname(path));
556
+ const slug = front["name"] ?? (dirName === basename4(packageDir) ? packageName : dirName);
557
+ const name = `${packageName}/${slug}`;
558
+ if (seen.has(name)) {
559
+ if (!path.includes("/node_modules/"))
560
+ options.onWarning?.({
561
+ path,
562
+ reason: `duplicate name ${name}; the first one found is served`
563
+ });
564
+ continue;
565
+ }
566
+ seen.add(name);
567
+ for (const problem of specProblems(parsed, dirName))
568
+ options.onWarning?.({ path, reason: problem });
569
+ const metadata = metadataOf(parsed);
570
+ found.push({
571
+ name,
572
+ package: packageName,
573
+ slug,
574
+ description,
575
+ path,
576
+ ...Object.keys(metadata).length > 0 ? { metadata } : {}
577
+ });
578
+ }
579
+ }
580
+ for (const dir of options.marketplaces ?? []) {
581
+ for (const entry of readMarketplace(dir, options.onReject)) {
582
+ if (seen.has(entry.name)) {
583
+ options.onReject?.({
584
+ path: entry.path,
585
+ reason: `duplicate name ${entry.name}`
586
+ });
587
+ continue;
588
+ }
589
+ seen.add(entry.name);
590
+ if (kindOf(entry) === "skill" && basename4(entry.path) === "SKILL.md") {
591
+ const parsed = frontmatterObject(readFileSync3(entry.path, "utf8"));
592
+ for (const problem of specProblems(
593
+ parsed,
594
+ basename4(dirname(entry.path))
595
+ ))
596
+ options.onWarning?.({ path: entry.path, reason: problem });
597
+ }
598
+ found.push(entry);
599
+ }
600
+ }
601
+ return found.sort((a, b) => a.name.localeCompare(b.name));
602
+ }
603
+
604
+ // src/catalog/display.ts
605
+ import { relative } from "path";
606
+ function withoutBody({
607
+ path,
608
+ ...rest
609
+ }) {
610
+ void path;
611
+ return rest;
612
+ }
613
+ function displayPath(root, entry) {
614
+ return relative(root, entry.path).replaceAll("\\", "/");
615
+ }
616
+
617
+ // src/marketplace/_shared.ts
618
+ var asString = (value) => typeof value === "string" ? value : void 0;
619
+ var asList = (value) => {
620
+ if (value === void 0) return [];
621
+ if (typeof value === "string") return [value];
622
+ return Array.isArray(value) ? value : [];
623
+ };
624
+ function readJson(path, root) {
625
+ try {
626
+ const parsed = JSON.parse(
627
+ readFileSync4(containedPath(root, path), "utf8")
628
+ );
629
+ return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
630
+ } catch {
631
+ return null;
632
+ }
633
+ }
634
+ var assetRoot = (entry) => entry.root ?? dirname2(entry.path);
635
+
636
+ export {
637
+ ASSET_KINDS,
638
+ kindOf,
639
+ SKIPPED_DIRS,
640
+ MAX_SKILL_DEPTH,
641
+ bodyOf,
642
+ frontmatterObject,
643
+ NAME_MAX,
644
+ DESCRIPTION_MAX,
645
+ COMPATIBILITY_MAX,
646
+ specProblems,
647
+ readFrontmatter,
648
+ readBody,
649
+ expandBraces,
650
+ globDirs,
651
+ workspacePackageDirs,
652
+ readMetadata,
653
+ readFrontmatterText,
654
+ assetRoot,
655
+ readMarketplace,
656
+ readCatalog,
657
+ withoutBody,
658
+ displayPath
659
+ };
660
+ //# sourceMappingURL=chunk-KMXRRSKT.js.map