@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,333 @@
1
+ import {
2
+ bodyOf,
3
+ frontmatterObject,
4
+ readCatalog,
5
+ specProblems
6
+ } from "./chunk-KMXRRSKT.js";
7
+
8
+ // src/validate.ts
9
+ import { existsSync as existsSync3, readFileSync as readFileSync3, statSync as statSync2 } from "fs";
10
+ import { basename as basename2, join as join3, resolve } from "path";
11
+
12
+ // src/validate/deny-list.ts
13
+ import { existsSync, readdirSync, readFileSync, statSync } from "fs";
14
+ import { dirname, join } from "path";
15
+ var MAX_BYTES = 1024 * 1024;
16
+ function readDenyList(path) {
17
+ return readFileSync(path, "utf8").split("\n").map((line) => line.trim().toLowerCase()).filter((line) => line !== "" && !line.startsWith("#"));
18
+ }
19
+ function filesUnder(dir) {
20
+ return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
21
+ const path = join(dir, entry.name);
22
+ if (entry.isDirectory()) return filesUnder(path);
23
+ return entry.isFile() ? [path] : [];
24
+ });
25
+ }
26
+ function denyListFindings(skillMd, denyList) {
27
+ if (denyList === void 0) return [];
28
+ if (!existsSync(denyList))
29
+ return [
30
+ { path: denyList, reason: "deny_list file not found", level: "error" }
31
+ ];
32
+ const terms = readDenyList(denyList);
33
+ const findings = [];
34
+ for (const file of filesUnder(dirname(skillMd))) {
35
+ if (statSync(file).size > MAX_BYTES) continue;
36
+ const text = readFileSync(file, "utf8").toLowerCase();
37
+ terms.forEach((term, index) => {
38
+ if (!text.includes(term)) return;
39
+ findings.push({
40
+ path: file,
41
+ reason: `contains deny-list entry ${index + 1}`,
42
+ level: "error"
43
+ });
44
+ });
45
+ }
46
+ return findings;
47
+ }
48
+
49
+ // src/validate/profile.ts
50
+ import { existsSync as existsSync2, readdirSync as readdirSync2, readFileSync as readFileSync2 } from "fs";
51
+ import { basename, dirname as dirname2, join as join2 } from "path";
52
+
53
+ // src/metadata/profiles/catalog-v1/schema.ts
54
+ import { z as z2 } from "zod";
55
+
56
+ // src/metadata/schema.ts
57
+ import { z } from "zod";
58
+ var TIERS = ["open", "free", "paid", "internal"];
59
+ var RUNTIMES = [
60
+ "claude-code",
61
+ "codex-cli",
62
+ "gemini-cli",
63
+ "grok-cli",
64
+ "antigravity"
65
+ ];
66
+ var tier = z.enum(TIERS);
67
+ var runtime = z.enum(RUNTIMES);
68
+ var version = z.string().regex(/^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/);
69
+ var kebab = z.string().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/);
70
+ var strings = z.array(z.string());
71
+ var requires = z.looseObject({
72
+ mcp: strings.optional(),
73
+ bin: strings.optional(),
74
+ env: strings.optional(),
75
+ "gpu-gb": z.string().optional(),
76
+ capabilities: strings.optional()
77
+ });
78
+ var skillMetadataCore = z.looseObject({
79
+ version: version.optional(),
80
+ keywords: strings.optional(),
81
+ locales: z.array(z.string().regex(/^[a-z]{2}$/)).optional(),
82
+ level: z.enum(["L1", "L2", "L3", "L4", "L5"]).optional(),
83
+ domain: kebab.optional(),
84
+ install: z.enum(["default", "optional", "catalog-only"]).optional(),
85
+ requires: requires.optional(),
86
+ provides: strings.optional(),
87
+ approval: z.enum(["none", "scripts", "hooks"]).optional(),
88
+ "output-license": z.string().optional(),
89
+ pair: strings.optional(),
90
+ "verified-runtimes": z.array(runtime).refine((v) => new Set(v).size === v.length, "Runtime listed twice").meta({
91
+ description: "Generated from recorded runtime evaluations; do not author by hand.",
92
+ readOnly: true,
93
+ uniqueItems: true
94
+ }).optional(),
95
+ tier: tier.meta({
96
+ deprecated: true,
97
+ description: "Inherited from marketplace metadata.tier; repeated skill tiers warn."
98
+ }).optional()
99
+ });
100
+ var skillFrontmatter = z.looseObject({
101
+ name: z.string().min(1),
102
+ description: z.string().min(1),
103
+ license: z.string().optional(),
104
+ compatibility: z.string().optional(),
105
+ "allowed-tools": z.union([z.string(), strings]).optional(),
106
+ metadata: skillMetadataCore.optional()
107
+ });
108
+ var manifestFields = {
109
+ tier: z.never().optional(),
110
+ name: z.string().min(1),
111
+ description: z.string().min(1).optional(),
112
+ version: version.optional(),
113
+ displayName: z.string().min(1).optional(),
114
+ renames: z.record(z.string().min(1), z.string().min(1).nullable()).optional(),
115
+ interface: z.looseObject({ displayName: z.string().min(1).optional() }).optional()
116
+ };
117
+ var pluginManifest = z.looseObject(manifestFields);
118
+ var marketplaceManifest = z.looseObject({
119
+ ...manifestFields,
120
+ metadata: z.looseObject({
121
+ tier: tier.optional(),
122
+ description: z.string().min(1).optional(),
123
+ version: version.optional()
124
+ }).optional(),
125
+ plugins: z.array(pluginManifest)
126
+ });
127
+ function skillDuplicationWarnings(metadata, pluginVersion) {
128
+ const warnings = [];
129
+ if (metadata.tier !== void 0)
130
+ warnings.push(
131
+ "metadata.tier is inherited from the marketplace; remove the repeated field"
132
+ );
133
+ if (metadata.version !== void 0 && metadata.version === pluginVersion)
134
+ warnings.push(
135
+ "metadata.version equals the plugin version; inherit it instead"
136
+ );
137
+ return warnings;
138
+ }
139
+
140
+ // src/metadata/profiles/catalog-v1/schema.ts
141
+ var SERVER_TOOLS = [
142
+ "job_estimate",
143
+ "job_submit",
144
+ "job_status",
145
+ "job_result",
146
+ "job_cancel"
147
+ ];
148
+ var catalogMetadata = z2.strictObject({
149
+ ...skillMetadataCore.shape,
150
+ level: skillMetadataCore.shape.level.unwrap(),
151
+ domain: kebab,
152
+ install: skillMetadataCore.shape.install.unwrap(),
153
+ requires: requires.strict().optional(),
154
+ "server-tools": z2.array(z2.enum(SERVER_TOOLS)).optional()
155
+ });
156
+ var catalogV1 = skillFrontmatter.extend({
157
+ name: kebab,
158
+ description: z2.string().min(40),
159
+ metadata: catalogMetadata
160
+ });
161
+
162
+ // src/metadata/profiles/catalog-v1/frontmatter.ts
163
+ import { parse } from "yaml";
164
+
165
+ // src/metadata/profiles/catalog-v1/skills.ts
166
+ function skillFindings(skill) {
167
+ const out = [];
168
+ const add = (rule, message) => out.push({ rule, message, severity: "error" });
169
+ const result = catalogV1.safeParse(skill.front);
170
+ if (!result.success) {
171
+ for (const issue of result.error.issues)
172
+ add(`schema.${issue.path.join(".") || "frontmatter"}`, issue.message);
173
+ return out;
174
+ }
175
+ const { name, description, metadata: m } = result.data;
176
+ const { tier: tier2, body } = skill;
177
+ for (const message of skillDuplicationWarnings(m, skill.pluginVersion))
178
+ out.push({ rule: "duplication", message, severity: "warning" });
179
+ if (name !== skill.dirName)
180
+ add(
181
+ "name.directory",
182
+ `name must equal the directory name ${skill.dirName}`
183
+ );
184
+ if (m.tier !== void 0 && m.tier !== tier2)
185
+ add("tier.mismatch", `metadata.tier ${m.tier} in a ${tier2} marketplace`);
186
+ if (tier2 !== "internal") {
187
+ if (/[^\x20-\x7E]/u.test(description))
188
+ add("description.ascii", "description must be plain English ASCII");
189
+ if (!/\bUse (?:when|whenever|before|after|for)\b/u.test(description))
190
+ add(
191
+ "description.trigger",
192
+ 'description should say when to use it ("Use when ...")'
193
+ );
194
+ }
195
+ if (tier2 === "open" && m.keywords?.some((k) => /[^\x20-\x7E]/u.test(k)))
196
+ add("keywords.ascii", "metadata.keywords must be English in the open tier");
197
+ if (!m["output-license"] && (tier2 === "paid" || (tier2 === "open" || tier2 === "free") && m.domain.startsWith("asset")))
198
+ add("output-license.required", "metadata.output-license missing");
199
+ if (!m.approval && (tier2 === "paid" || skill.hasScripts))
200
+ add("approval.required", "metadata.approval missing");
201
+ if (tier2 === "open" && m.pair !== void 0)
202
+ add("pair.tier", "metadata.pair is not allowed in the open tier");
203
+ if (tier2 !== "paid" && m["server-tools"] !== void 0)
204
+ add(
205
+ "server-tools.forbidden",
206
+ `metadata.server-tools is not allowed in the ${tier2} tier`
207
+ );
208
+ if (tier2 === "paid") {
209
+ if (!m["server-tools"]?.length)
210
+ add("server-tools.required", "metadata.server-tools missing");
211
+ if (body.includes("job_submit") && (!body.includes("job_estimate") || body.indexOf("job_estimate") > body.indexOf("job_submit")))
212
+ add(
213
+ "server-tools.order",
214
+ "job_estimate must come before job_submit in the body"
215
+ );
216
+ }
217
+ if (tier2 !== "open" && m.install === "default")
218
+ add(
219
+ "install.default",
220
+ `metadata.install default is not allowed in the ${tier2} tier`
221
+ );
222
+ if ([...m.locales ?? []].sort().join(",") !== [...new Set(skill.localeFiles)].sort().join(","))
223
+ add(
224
+ "locales.files",
225
+ "metadata.locales does not match references/*.<locale>.md"
226
+ );
227
+ return out;
228
+ }
229
+
230
+ // src/metadata/profiles/library.ts
231
+ import { z as z3 } from "zod";
232
+ var libraryMetadata = skillMetadataCore.extend({
233
+ "target-version": z3.string().min(1).optional(),
234
+ ecosystem: z3.enum(["npm", "pypi", "crates", "go"]).optional(),
235
+ "target-identity": z3.string().min(1).optional(),
236
+ "selected-version": z3.string().min(1).optional(),
237
+ loading: z3.enum(["manual", "automatic"]).optional()
238
+ });
239
+ var libraryProfile = skillFrontmatter.extend({
240
+ metadata: libraryMetadata.optional()
241
+ });
242
+
243
+ // src/validate/profile.ts
244
+ function localeFiles(skillDir) {
245
+ const references = join2(skillDir, "references");
246
+ if (!existsSync2(references)) return [];
247
+ return readdirSync2(references).flatMap(
248
+ (file) => /\.([a-z]{2})\.md$/u.exec(file)?.[1] ?? []
249
+ );
250
+ }
251
+ function tierOf(front, given) {
252
+ const own = front.metadata?.tier;
253
+ const tier2 = given ?? own;
254
+ return TIERS.includes(tier2) ? tier2 : "open";
255
+ }
256
+ function catalogV12(skillMd, tier2) {
257
+ const text = readFileSync2(skillMd, "utf8");
258
+ const front = frontmatterObject(text);
259
+ const skillDir = dirname2(skillMd);
260
+ const findings = skillFindings({
261
+ tier: tierOf(front, tier2),
262
+ dirName: basename(skillDir),
263
+ front,
264
+ body: bodyOf(text),
265
+ hasScripts: existsSync2(join2(skillDir, "scripts")),
266
+ localeFiles: localeFiles(skillDir)
267
+ });
268
+ return findings.map((finding) => ({
269
+ path: skillMd,
270
+ reason: `${finding.rule}: ${finding.message}`,
271
+ level: finding.severity === "error" ? "error" : "warning"
272
+ }));
273
+ }
274
+ function library(skillMd) {
275
+ const front = frontmatterObject(readFileSync2(skillMd, "utf8"));
276
+ const result = libraryProfile.safeParse(front);
277
+ if (result.success) return [];
278
+ return result.error.issues.map((issue) => ({
279
+ path: skillMd,
280
+ reason: `schema.${issue.path.join(".") || "frontmatter"}: ${issue.message}`,
281
+ level: "error"
282
+ }));
283
+ }
284
+ function profileFindings(skillMd, profile, tier2) {
285
+ if (profile === "catalog-v1") return catalogV12(skillMd, tier2);
286
+ if (profile === "library") return library(skillMd);
287
+ return [];
288
+ }
289
+
290
+ // src/validate.ts
291
+ function selected(skillMd, settings, tier2) {
292
+ return [
293
+ ...profileFindings(skillMd, settings.profile, tier2),
294
+ ...denyListFindings(skillMd, settings.denyList)
295
+ ];
296
+ }
297
+ function validateSkillDir(dir, settings = {}) {
298
+ const root = resolve(dir);
299
+ const skillMd = basename2(root) === "SKILL.md" ? root : join3(root, "SKILL.md");
300
+ if (!existsSync3(skillMd) || !statSync2(skillMd).isFile()) {
301
+ return [{ path: root, reason: "no SKILL.md", level: "error" }];
302
+ }
303
+ const front = frontmatterObject(readFileSync3(skillMd, "utf8"));
304
+ const directory = basename2(skillMd === root ? join3(root, "..") : root);
305
+ return [
306
+ ...specProblems(front, directory).map((reason) => ({
307
+ path: skillMd,
308
+ reason,
309
+ level: "error"
310
+ })),
311
+ ...selected(skillMd, settings)
312
+ ];
313
+ }
314
+ function validateCatalog(options, settings = {}) {
315
+ const findings = [];
316
+ const entries = readCatalog({
317
+ ...options,
318
+ onReject: (r) => findings.push({ ...r, level: "error" }),
319
+ onWarning: (w) => findings.push({ ...w, level: "warning" })
320
+ });
321
+ for (const entry of entries) {
322
+ if (entry.kind !== void 0 && entry.kind !== "skill") continue;
323
+ if (basename2(entry.path) !== "SKILL.md") continue;
324
+ findings.push(...selected(entry.path, settings, entry.tier));
325
+ }
326
+ return findings;
327
+ }
328
+
329
+ export {
330
+ validateSkillDir,
331
+ validateCatalog
332
+ };
333
+ //# sourceMappingURL=chunk-NZS5CD72.js.map
@@ -0,0 +1,48 @@
1
+ import {
2
+ checkoutOf,
3
+ gitCommonDir
4
+ } from "./chunk-IJBSOWHK.js";
5
+
6
+ // src/sessions/state-dir.ts
7
+ import { createHash } from "crypto";
8
+ import { realpathSync } from "fs";
9
+ import { homedir as homedir2 } from "os";
10
+ import { join as join2 } from "path";
11
+
12
+ // src/sessions/paths.ts
13
+ import { homedir } from "os";
14
+ import {
15
+ basename,
16
+ dirname,
17
+ isAbsolute,
18
+ join,
19
+ relative,
20
+ resolve
21
+ } from "path";
22
+ function mainCheckoutBase(dir) {
23
+ const checkout = checkoutOf(dir);
24
+ if (!checkout || basename(checkout.commonDir) !== ".git") return dir;
25
+ const inside = relative(checkout.root, resolve(dir));
26
+ return join(dirname(checkout.commonDir), inside);
27
+ }
28
+ function expandPath(base, path) {
29
+ if (path === "~") return homedir();
30
+ if (path.startsWith("~/")) return join(homedir(), path.slice(2));
31
+ if (path.startsWith("$HOME/")) return join(homedir(), path.slice(6));
32
+ return isAbsolute(path) ? path : resolve(mainCheckoutBase(base), path);
33
+ }
34
+
35
+ // src/sessions/state-dir.ts
36
+ function projectStateDir(root, override, env = process.env) {
37
+ if (override) return expandPath(root, override);
38
+ const anchor = gitCommonDir(root) ?? realpathSync(root);
39
+ const id = createHash("sha256").update(anchor).digest("hex").slice(0, 16);
40
+ const base = env["XDG_STATE_HOME"] || join2(homedir2(), ".local", "state");
41
+ return join2(base, "pmcp", "projects", id);
42
+ }
43
+
44
+ export {
45
+ expandPath,
46
+ projectStateDir
47
+ };
48
+ //# sourceMappingURL=chunk-OEH47H6A.js.map
@@ -0,0 +1,75 @@
1
+ import {
2
+ configOption,
3
+ jsonOption
4
+ } from "./chunk-XNML2KIC.js";
5
+
6
+ // src/commands/specs/inspection.ts
7
+ var statusSpec = {
8
+ name: "status",
9
+ describe: "Show enabled features, projection drift and live workspace state",
10
+ usage: "pmcp status [--config <file>] [--json]",
11
+ options: [configOption, jsonOption]
12
+ };
13
+ var initSpec = {
14
+ name: "init",
15
+ describe: "Create a starting pmcp.toml using this checkout's git detection",
16
+ usage: "pmcp init [--preset solo|multi-session] [--force]",
17
+ options: [
18
+ {
19
+ name: "preset",
20
+ describe: "Starting configuration; default solo.",
21
+ placeholder: "<preset>"
22
+ },
23
+ {
24
+ name: "force",
25
+ describe: "Replace an existing pmcp.toml.",
26
+ boolean: true
27
+ }
28
+ ]
29
+ };
30
+ var hooksSpec = {
31
+ name: "hooks",
32
+ describe: "List compiled policies or simulate a native hook without a runtime",
33
+ usage: "pmcp hooks list | test --runtime claude|codex --event <event> [--command <text> | --path <path> | --tool <name>] [--session-state <file>] [--json]",
34
+ options: [
35
+ configOption,
36
+ jsonOption,
37
+ {
38
+ name: "runtime",
39
+ describe: "Native runtime to inspect.",
40
+ placeholder: "<runtime>"
41
+ },
42
+ {
43
+ name: "event",
44
+ describe: "Neutral or native event name.",
45
+ placeholder: "<event>"
46
+ },
47
+ {
48
+ name: "command",
49
+ describe: "Shell command to classify; never executed.",
50
+ placeholder: "<text>"
51
+ },
52
+ {
53
+ name: "path",
54
+ describe: "Path for a synthetic edit.",
55
+ placeholder: "<path>"
56
+ },
57
+ {
58
+ name: "tool",
59
+ describe: "Native tool name or shell, edit, read, other.",
60
+ placeholder: "<name>"
61
+ },
62
+ {
63
+ name: "session-state",
64
+ describe: "JSON seed for isolated session state.",
65
+ placeholder: "<file>"
66
+ }
67
+ ]
68
+ };
69
+
70
+ export {
71
+ statusSpec,
72
+ initSpec,
73
+ hooksSpec
74
+ };
75
+ //# sourceMappingURL=chunk-OG7QR2DP.js.map
@@ -0,0 +1,52 @@
1
+ // src/git/exec.ts
2
+ import { spawnSync } from "child_process";
3
+ var LOCAL_ENV = [
4
+ "GIT_DIR",
5
+ "GIT_WORK_TREE",
6
+ "GIT_INDEX_FILE",
7
+ "GIT_OBJECT_DIRECTORY",
8
+ "GIT_ALTERNATE_OBJECT_DIRECTORIES",
9
+ "GIT_COMMON_DIR",
10
+ "GIT_PREFIX"
11
+ ];
12
+ function cleanEnv(extra = {}) {
13
+ const env = { ...process.env };
14
+ for (const name of LOCAL_ENV) delete env[name];
15
+ return { ...env, ...extra };
16
+ }
17
+ function git(cwd, args, extra) {
18
+ const run = spawnSync("git", args, {
19
+ cwd,
20
+ encoding: "utf8",
21
+ env: cleanEnv(extra),
22
+ maxBuffer: 256 * 1024 * 1024
23
+ });
24
+ const stderr = run.stderr || run.error?.message || "";
25
+ return { status: run.status ?? 1, stdout: run.stdout ?? "", stderr };
26
+ }
27
+ function gitText(cwd, args) {
28
+ const run = git(cwd, args);
29
+ if (run.status !== 0) return "";
30
+ return run.stdout.trim();
31
+ }
32
+ function gitOk(cwd, args) {
33
+ return git(cwd, args).status === 0;
34
+ }
35
+ function runCommand(argv, cwd, extra) {
36
+ const [bin, ...rest] = argv;
37
+ if (bin === void 0) return 0;
38
+ const run = spawnSync(bin, rest, {
39
+ cwd,
40
+ stdio: ["ignore", 2, 2],
41
+ env: cleanEnv(extra)
42
+ });
43
+ return run.status ?? 1;
44
+ }
45
+
46
+ export {
47
+ git,
48
+ gitText,
49
+ gitOk,
50
+ runCommand
51
+ };
52
+ //# sourceMappingURL=chunk-OPYFEHKG.js.map
@@ -0,0 +1,83 @@
1
+ import {
2
+ ProjectError
3
+ } from "./chunk-NRBQK6UX.js";
4
+
5
+ // src/project/backup.ts
6
+ import { createHash } from "crypto";
7
+ import {
8
+ existsSync,
9
+ lstatSync,
10
+ mkdirSync,
11
+ mkdtempSync,
12
+ readFileSync,
13
+ writeFileSync
14
+ } from "fs";
15
+ import { homedir } from "os";
16
+ import { dirname, isAbsolute, join, relative, resolve } from "path";
17
+ function backupFiles(root, paths) {
18
+ const base = join(homedir(), ".cache/pmcp/project-backups");
19
+ const inside = relative(resolve(root), resolve(base));
20
+ if (!isAbsolute(inside) && inside !== ".." && !inside.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`)) {
21
+ throw new ProjectError("Project backups must be outside the project");
22
+ }
23
+ mkdirSync(base, { recursive: true, mode: 448 });
24
+ const directory = lstatSync(base);
25
+ if (directory.isSymbolicLink() || !directory.isDirectory()) {
26
+ throw new ProjectError("Project backup directory must be a real directory");
27
+ }
28
+ if (process.getuid && (directory.uid !== process.getuid() || (directory.mode & 63) !== 0)) {
29
+ throw new ProjectError(
30
+ "Project backup directory must be private and operator-owned"
31
+ );
32
+ }
33
+ const snapshots = [...new Set(paths)].map((path) => {
34
+ const absolute = resolve(root, path);
35
+ const within = relative(resolve(root), absolute);
36
+ if (isAbsolute(within) || within === ".." || within.startsWith("../") || within.startsWith("..\\")) {
37
+ throw new ProjectError("Backup paths must stay inside the project");
38
+ }
39
+ if (!existsSync(absolute)) {
40
+ return { path, contents: null };
41
+ }
42
+ const stat = lstatSync(absolute);
43
+ if (!stat.isFile() || stat.isSymbolicLink()) {
44
+ throw new ProjectError(
45
+ `Refusing to back up a nonregular config file: ${path}`
46
+ );
47
+ }
48
+ return { path, contents: readFileSync(absolute) };
49
+ });
50
+ const destination = mkdtempSync(join(base, "project-"));
51
+ const entries = snapshots.map(({ path, contents }) => {
52
+ if (contents === null) {
53
+ return { path, present: false };
54
+ }
55
+ const output = join(destination, "files", path);
56
+ mkdirSync(dirname(output), { recursive: true, mode: 448 });
57
+ writeFileSync(output, contents, { mode: 384 });
58
+ return {
59
+ path,
60
+ present: true,
61
+ sha256: createHash("sha256").update(contents).digest("hex")
62
+ };
63
+ });
64
+ writeFileSync(
65
+ join(destination, "receipt.json"),
66
+ JSON.stringify(
67
+ {
68
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
69
+ projectRoot: resolve(root),
70
+ entries
71
+ },
72
+ null,
73
+ 2
74
+ ) + "\n",
75
+ { mode: 384 }
76
+ );
77
+ return destination;
78
+ }
79
+
80
+ export {
81
+ backupFiles
82
+ };
83
+ //# sourceMappingURL=chunk-P4N7DBD5.js.map