@wirecat/wordpress-cli 0.0.0-stage → 0.1.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 (256) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE +204 -0
  3. package/README.md +248 -2
  4. package/contracts/wirecat.json +2535 -0
  5. package/dist/bin/wordpress.d.ts +3 -0
  6. package/dist/bin/wordpress.d.ts.map +1 -0
  7. package/dist/bin/wordpress.js +40 -0
  8. package/dist/bin/wordpress.js.map +1 -0
  9. package/dist/bundle/agent-LKBRYKNB.js +37 -0
  10. package/dist/bundle/all-profiles-OEV7VFQG.js +320 -0
  11. package/dist/bundle/anthropic-JKTZP2DW.js +91 -0
  12. package/dist/bundle/app-server-7LWLDDE2.js +249 -0
  13. package/dist/bundle/bun-2FLR4IV4.js +169 -0
  14. package/dist/bundle/bun-sqlite-GRSRX5P4.js +76 -0
  15. package/dist/bundle/chunk-2BI25SEE.js +259 -0
  16. package/dist/bundle/chunk-2UEGJ5AJ.js +52 -0
  17. package/dist/bundle/chunk-2XUV7HNE.js +58 -0
  18. package/dist/bundle/chunk-2Z7UOXFC.js +16 -0
  19. package/dist/bundle/chunk-3BM6KBWP.js +2788 -0
  20. package/dist/bundle/chunk-3BRAZVHR.js +1010 -0
  21. package/dist/bundle/chunk-3LMW7U7F.js +1233 -0
  22. package/dist/bundle/chunk-3LVTQFGB.js +2000 -0
  23. package/dist/bundle/chunk-3TKFFSFU.js +106 -0
  24. package/dist/bundle/chunk-3UX4VJWD.js +78 -0
  25. package/dist/bundle/chunk-4HEXAGKT.js +334 -0
  26. package/dist/bundle/chunk-4HP6KGBI.js +32 -0
  27. package/dist/bundle/chunk-4ZAQMDLD.js +1308 -0
  28. package/dist/bundle/chunk-4ZTB7LS3.js +87 -0
  29. package/dist/bundle/chunk-5XPHFV7H.js +2333 -0
  30. package/dist/bundle/chunk-5Z3P543G.js +80 -0
  31. package/dist/bundle/chunk-6UYDKCV6.js +794 -0
  32. package/dist/bundle/chunk-7GNB4LBX.js +50 -0
  33. package/dist/bundle/chunk-7HJFBOAT.js +161 -0
  34. package/dist/bundle/chunk-7JVKQ6NM.js +206 -0
  35. package/dist/bundle/chunk-7QH5BZUG.js +142 -0
  36. package/dist/bundle/chunk-A474OVIW.js +1392 -0
  37. package/dist/bundle/chunk-AENEMQL3.js +1068 -0
  38. package/dist/bundle/chunk-AL7I4DT4.js +65718 -0
  39. package/dist/bundle/chunk-ARGRGTPX.js +108 -0
  40. package/dist/bundle/chunk-AV2ZJ4WX.js +7 -0
  41. package/dist/bundle/chunk-BAXNAOOL.js +76 -0
  42. package/dist/bundle/chunk-BH63B66W.js +407 -0
  43. package/dist/bundle/chunk-CCOSG3F2.js +24616 -0
  44. package/dist/bundle/chunk-CFQQTDSA.js +46 -0
  45. package/dist/bundle/chunk-CGCUOT67.js +388 -0
  46. package/dist/bundle/chunk-CHPWBQUK.js +39 -0
  47. package/dist/bundle/chunk-D72URWJE.js +532 -0
  48. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  49. package/dist/bundle/chunk-DQSOYH6N.js +20 -0
  50. package/dist/bundle/chunk-ECYOTDJM.js +14 -0
  51. package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
  52. package/dist/bundle/chunk-EHW45LLT.js +100 -0
  53. package/dist/bundle/chunk-F3AV5ZSL.js +338 -0
  54. package/dist/bundle/chunk-F4BX7TH2.js +15 -0
  55. package/dist/bundle/chunk-F5ZAN7OC.js +6848 -0
  56. package/dist/bundle/chunk-FMMYBVCH.js +38 -0
  57. package/dist/bundle/chunk-FNB4SWTY.js +66 -0
  58. package/dist/bundle/chunk-FQROWBKV.js +12660 -0
  59. package/dist/bundle/chunk-FV2HJOSC.js +771 -0
  60. package/dist/bundle/chunk-GCAJW4SR.js +53 -0
  61. package/dist/bundle/chunk-GPRJXJC7.js +102 -0
  62. package/dist/bundle/chunk-HCOZUOSN.js +54 -0
  63. package/dist/bundle/chunk-HM6AMYHR.js +72 -0
  64. package/dist/bundle/chunk-HVXOA4FO.js +23 -0
  65. package/dist/bundle/chunk-HWQ7572G.js +95 -0
  66. package/dist/bundle/chunk-IJVTN5L3.js +82 -0
  67. package/dist/bundle/chunk-IZDDBOHU.js +3610 -0
  68. package/dist/bundle/chunk-JAE5B4G7.js +388 -0
  69. package/dist/bundle/chunk-K2Y5K37O.js +218 -0
  70. package/dist/bundle/chunk-KCH224US.js +9581 -0
  71. package/dist/bundle/chunk-KZJQPJK5.js +230 -0
  72. package/dist/bundle/chunk-L7P3LUDQ.js +286 -0
  73. package/dist/bundle/chunk-LECMHK2F.js +18 -0
  74. package/dist/bundle/chunk-LWEMZJLG.js +1332 -0
  75. package/dist/bundle/chunk-LWTETL2O.js +185 -0
  76. package/dist/bundle/chunk-MEYYH47C.js +25 -0
  77. package/dist/bundle/chunk-MJ6LTG4L.js +170 -0
  78. package/dist/bundle/chunk-NMQRSEZM.js +37 -0
  79. package/dist/bundle/chunk-ODVGFCBE.js +557 -0
  80. package/dist/bundle/chunk-OEQNP56V.js +633 -0
  81. package/dist/bundle/chunk-OV6WQY3L.js +39 -0
  82. package/dist/bundle/chunk-PL5P7UKW.js +25216 -0
  83. package/dist/bundle/chunk-PPNTY7LD.js +733 -0
  84. package/dist/bundle/chunk-PRZYRA66.js +358 -0
  85. package/dist/bundle/chunk-PV5UYGRJ.js +41594 -0
  86. package/dist/bundle/chunk-QYTOLPNI.js +52 -0
  87. package/dist/bundle/chunk-R7Y3XU66.js +362 -0
  88. package/dist/bundle/chunk-S4UUN6LD.js +1410 -0
  89. package/dist/bundle/chunk-SD5CXGIG.js +188 -0
  90. package/dist/bundle/chunk-SXY5G62I.js +288 -0
  91. package/dist/bundle/chunk-T37TAXVL.js +29 -0
  92. package/dist/bundle/chunk-T5SOY3AE.js +1197 -0
  93. package/dist/bundle/chunk-TJ7OORSO.js +1876 -0
  94. package/dist/bundle/chunk-TRYYWV7J.js +291 -0
  95. package/dist/bundle/chunk-U6VLNYCO.js +73 -0
  96. package/dist/bundle/chunk-UC7JLE6J.js +58 -0
  97. package/dist/bundle/chunk-UUIOAZPH.js +156 -0
  98. package/dist/bundle/chunk-UXQ24OY6.js +4072 -0
  99. package/dist/bundle/chunk-VBRRMGON.js +1007 -0
  100. package/dist/bundle/chunk-VRIBES2C.js +319 -0
  101. package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
  102. package/dist/bundle/chunk-XT5XYQEZ.js +3414 -0
  103. package/dist/bundle/chunk-XTAS5Z3G.js +2231 -0
  104. package/dist/bundle/chunk-XYQVVW4R.js +24 -0
  105. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  106. package/dist/bundle/chunk-YHWFF6DN.js +39 -0
  107. package/dist/bundle/chunk-YUDVRFXN.js +63 -0
  108. package/dist/bundle/chunk-Z3I2MCUT.js +131 -0
  109. package/dist/bundle/chunk-ZDI3WC7V.js +353 -0
  110. package/dist/bundle/chunk-ZVQ7KFMT.js +274 -0
  111. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  112. package/dist/bundle/command-contract-P7YE4EKS.js +37 -0
  113. package/dist/bundle/command-server-entry-XIMCBWMV.js +166 -0
  114. package/dist/bundle/decode-6XK55WYV.js +297 -0
  115. package/dist/bundle/definitions-GIQCGYPR.js +7986 -0
  116. package/dist/bundle/dispatch-JQBAZWCL.js +411 -0
  117. package/dist/bundle/dist-2TV3NVE5.js +7577 -0
  118. package/dist/bundle/dist-PAKDDIBT.js +191 -0
  119. package/dist/bundle/echarts-YRRVLEX3.js +42501 -0
  120. package/dist/bundle/embed-L3EEQSGX.js +38 -0
  121. package/dist/bundle/embedder-BIKLBV3J.js +111 -0
  122. package/dist/bundle/failure-I6AAF5R5.js +25 -0
  123. package/dist/bundle/first-run-W6G6TYZ2.js +29 -0
  124. package/dist/bundle/first-screen-ITIAJIBU.js +37 -0
  125. package/dist/bundle/hast-util-from-html-ZHU6HGIE.js +10531 -0
  126. package/dist/bundle/hast-util-to-html-IIFHILP5.js +998 -0
  127. package/dist/bundle/hast-util-to-mdast-D62XX3NR.js +2272 -0
  128. package/dist/bundle/instructions-AG7SRWTR.js +11 -0
  129. package/dist/bundle/mcp-YGOAUNC3.js +167 -0
  130. package/dist/bundle/mdast-util-from-markdown-WVUJDSUO.js +1900 -0
  131. package/dist/bundle/mdast-util-gfm-KN2D32QS.js +1040 -0
  132. package/dist/bundle/mdast-util-to-hast-AYJV7KAE.js +879 -0
  133. package/dist/bundle/mdast-util-to-markdown-UCAJNHJO.js +18 -0
  134. package/dist/bundle/meeting-combined-CQJ3JHHU.js +24 -0
  135. package/dist/bundle/meeting-model-MZ7VVBNK.js +25 -0
  136. package/dist/bundle/meeting-semantic-DADWRRHP.js +22 -0
  137. package/dist/bundle/micromark-extension-gfm-EEJRRJ36.js +1771 -0
  138. package/dist/bundle/node-GJQYN4FT.js +176 -0
  139. package/dist/bundle/node-JJ3WDCNJ.js +2340 -0
  140. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  141. package/dist/bundle/node-sqlite-TPR62DT2.js +74 -0
  142. package/dist/bundle/oauth-WGY7JQVW.js +20 -0
  143. package/dist/bundle/open-DE7QZNAN.js +23 -0
  144. package/dist/bundle/openai-NHEFT3HS.js +238 -0
  145. package/dist/bundle/process-MEKCZMX3.js +91 -0
  146. package/dist/bundle/program-EP2S5BTM.js +38857 -0
  147. package/dist/bundle/prompt-PWY53BYH.js +17 -0
  148. package/dist/bundle/recognize-74TXHKMQ.js +26 -0
  149. package/dist/bundle/remote-F5TJZ5ER.js +31 -0
  150. package/dist/bundle/rerank-HWUO52UF.js +52 -0
  151. package/dist/bundle/schemas-4K6WWS5N.js +2157 -0
  152. package/dist/bundle/serve-I2USUY4X.js +199 -0
  153. package/dist/bundle/server-GDYDNO6K.js +79 -0
  154. package/dist/bundle/server-KYUW2AHB.js +212 -0
  155. package/dist/bundle/sqlite-runtime-N6VFGBJK.js +20 -0
  156. package/dist/bundle/state-L6JSCN77.js +36 -0
  157. package/dist/bundle/store-EPG2YPN3.js +291 -0
  158. package/dist/bundle/store-SQWQJE32.js +181 -0
  159. package/dist/bundle/store-maintenance-command-FTGSICVA.js +66 -0
  160. package/dist/bundle/surface-SNMHY6GP.js +65 -0
  161. package/dist/bundle/wordpress.js +183 -0
  162. package/dist/commands/api.d.ts +22 -0
  163. package/dist/commands/api.d.ts.map +1 -0
  164. package/dist/commands/api.js +37 -0
  165. package/dist/commands/api.js.map +1 -0
  166. package/dist/commands/content.d.ts +4 -0
  167. package/dist/commands/content.d.ts.map +1 -0
  168. package/dist/commands/content.js +94 -0
  169. package/dist/commands/content.js.map +1 -0
  170. package/dist/commands/session.d.ts +8 -0
  171. package/dist/commands/session.d.ts.map +1 -0
  172. package/dist/commands/session.js +28 -0
  173. package/dist/commands/session.js.map +1 -0
  174. package/dist/config.d.ts +13 -0
  175. package/dist/config.d.ts.map +1 -0
  176. package/dist/config.js +69 -0
  177. package/dist/config.js.map +1 -0
  178. package/dist/context.d.ts +37 -0
  179. package/dist/context.d.ts.map +1 -0
  180. package/dist/context.js +31 -0
  181. package/dist/context.js.map +1 -0
  182. package/dist/generated/definitions.d.ts +3 -0
  183. package/dist/generated/definitions.d.ts.map +1 -0
  184. package/dist/generated/definitions.js +7982 -0
  185. package/dist/generated/definitions.js.map +1 -0
  186. package/dist/generated/manifest.d.ts +6 -0
  187. package/dist/generated/manifest.d.ts.map +1 -0
  188. package/dist/generated/manifest.js +8830 -0
  189. package/dist/generated/manifest.js.map +1 -0
  190. package/dist/generated/schemas.d.ts +229 -0
  191. package/dist/generated/schemas.d.ts.map +1 -0
  192. package/dist/generated/schemas.js +2019 -0
  193. package/dist/generated/schemas.js.map +1 -0
  194. package/dist/generated/types.d.ts +3365 -0
  195. package/dist/generated/types.d.ts.map +1 -0
  196. package/dist/generated/types.js +5 -0
  197. package/dist/generated/types.js.map +1 -0
  198. package/dist/generated/wirecat-config.d.ts +11 -0
  199. package/dist/generated/wirecat-config.d.ts.map +1 -0
  200. package/dist/generated/wirecat-config.js +337 -0
  201. package/dist/generated/wirecat-config.js.map +1 -0
  202. package/dist/identity.d.ts +28 -0
  203. package/dist/identity.d.ts.map +1 -0
  204. package/dist/identity.js +29 -0
  205. package/dist/identity.js.map +1 -0
  206. package/dist/index.d.ts +3 -0
  207. package/dist/index.d.ts.map +1 -0
  208. package/dist/index.js +3 -0
  209. package/dist/index.js.map +1 -0
  210. package/dist/program.d.ts +6 -0
  211. package/dist/program.d.ts.map +1 -0
  212. package/dist/program.js +53 -0
  213. package/dist/program.js.map +1 -0
  214. package/dist/version.d.ts +2 -0
  215. package/dist/version.d.ts.map +1 -0
  216. package/dist/version.js +2 -0
  217. package/dist/version.js.map +1 -0
  218. package/dist/wcat.d.ts +3 -0
  219. package/dist/wcat.d.ts.map +1 -0
  220. package/dist/wcat.js +4 -0
  221. package/dist/wcat.js.map +1 -0
  222. package/package.json +87 -4
  223. package/skills/wordpress-cli/SKILL.md +88 -0
  224. package/skills/wordpress-cli/references/api/api-block-directory.md +17 -0
  225. package/skills/wordpress-cli/references/api/api-block-patterns.md +13 -0
  226. package/skills/wordpress-cli/references/api/api-block-types.md +34 -0
  227. package/skills/wordpress-cli/references/api/api-blocks.md +159 -0
  228. package/skills/wordpress-cli/references/api/api-categories.md +69 -0
  229. package/skills/wordpress-cli/references/api/api-comments.md +79 -0
  230. package/skills/wordpress-cli/references/api/api-font-collections.md +16 -0
  231. package/skills/wordpress-cli/references/api/api-font-families.md +122 -0
  232. package/skills/wordpress-cli/references/api/api-global-styles.md +29 -0
  233. package/skills/wordpress-cli/references/api/api-media.md +106 -0
  234. package/skills/wordpress-cli/references/api/api-menu-items.md +115 -0
  235. package/skills/wordpress-cli/references/api/api-menu-locations.md +22 -0
  236. package/skills/wordpress-cli/references/api/api-menus.md +69 -0
  237. package/skills/wordpress-cli/references/api/api-navigation.md +155 -0
  238. package/skills/wordpress-cli/references/api/api-pages.md +161 -0
  239. package/skills/wordpress-cli/references/api/api-pattern-directory.md +23 -0
  240. package/skills/wordpress-cli/references/api/api-plugins.md +25 -0
  241. package/skills/wordpress-cli/references/api/api-posts.md +166 -0
  242. package/skills/wordpress-cli/references/api/api-search.md +21 -0
  243. package/skills/wordpress-cli/references/api/api-settings.md +19 -0
  244. package/skills/wordpress-cli/references/api/api-sidebars.md +34 -0
  245. package/skills/wordpress-cli/references/api/api-statuses.md +22 -0
  246. package/skills/wordpress-cli/references/api/api-tags.md +69 -0
  247. package/skills/wordpress-cli/references/api/api-taxonomies.md +23 -0
  248. package/skills/wordpress-cli/references/api/api-template-parts.md +38 -0
  249. package/skills/wordpress-cli/references/api/api-templates.md +38 -0
  250. package/skills/wordpress-cli/references/api/api-themes.md +12 -0
  251. package/skills/wordpress-cli/references/api/api-types.md +22 -0
  252. package/skills/wordpress-cli/references/api/api-users.md +149 -0
  253. package/skills/wordpress-cli/references/api/api-widget-types.md +46 -0
  254. package/skills/wordpress-cli/references/api/api-widgets.md +57 -0
  255. package/skills/wordpress-cli/references/api/api-wp-pattern-category.md +69 -0
  256. package/skills/wordpress-cli/references/api.md +44 -0
@@ -0,0 +1,46 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ __name
5
+ } from "./chunk-ZVVMGPBJ.js";
6
+
7
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/executable.js
8
+ import { existsSync } from "node:fs";
9
+ import { win32 } from "node:path";
10
+ var variable = /* @__PURE__ */ __name((env, name) => Object.entries(env).find(([key]) => key.toUpperCase() === name)?.[1], "variable");
11
+ var executableOnPath = /* @__PURE__ */ __name((command, env, platform = process.platform, exists = existsSync) => {
12
+ if (platform !== "win32" || win32.isAbsolute(command))
13
+ return command;
14
+ if (/[\\/]/.test(command))
15
+ return command;
16
+ const extensions = win32.extname(command) ? [""] : (variable(env, "PATHEXT") ?? ".EXE;.COM;.CMD;.BAT").split(";").filter((ext) => /^\.[a-z0-9]+$/i.test(ext));
17
+ for (const entry of (variable(env, "PATH") ?? "").split(";")) {
18
+ const directory = entry.replace(/^"(.*)"$/, "$1");
19
+ for (const extension of extensions) {
20
+ const candidate = win32.join(directory, command + extension);
21
+ if (exists(candidate))
22
+ return candidate;
23
+ }
24
+ }
25
+ return command;
26
+ }, "executableOnPath");
27
+ var executableEnvironment = /* @__PURE__ */ __name((env, platform = process.platform) => {
28
+ if (platform !== "win32")
29
+ return env;
30
+ const configured = variable(env, "COMSPEC");
31
+ const system = variable(env, "SYSTEMROOT");
32
+ const shell = configured ? configured : system && win32.isAbsolute(system) ? win32.join(system, "System32", "cmd.exe") : void 0;
33
+ if (!shell)
34
+ return env;
35
+ const result = { ...env };
36
+ for (const key of Object.keys(result))
37
+ if (key.toUpperCase() === "COMSPEC")
38
+ delete result[key];
39
+ result.comspec = shell;
40
+ return result;
41
+ }, "executableEnvironment");
42
+
43
+ export {
44
+ executableOnPath,
45
+ executableEnvironment
46
+ };
@@ -0,0 +1,388 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ CHECK_EVERY_MS,
5
+ isNewer,
6
+ readNoticeState,
7
+ writeUpdateState
8
+ } from "./chunk-7QH5BZUG.js";
9
+ import {
10
+ executableEnvironment,
11
+ executableOnPath
12
+ } from "./chunk-CFQQTDSA.js";
13
+ import {
14
+ Command,
15
+ Option,
16
+ annotate
17
+ } from "./chunk-FQROWBKV.js";
18
+ import {
19
+ require_cross_spawn
20
+ } from "./chunk-D72URWJE.js";
21
+ import {
22
+ refuseOwnerHomeInTests
23
+ } from "./chunk-3BM6KBWP.js";
24
+ import {
25
+ CliError
26
+ } from "./chunk-HM6AMYHR.js";
27
+ import {
28
+ __name,
29
+ __toESM
30
+ } from "./chunk-ZVVMGPBJ.js";
31
+
32
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/skill/index.js
33
+ import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
34
+ import { homedir } from "node:os";
35
+ import { basename, dirname, join, relative, resolve, sep } from "node:path";
36
+ import { fileURLToPath, pathToFileURL } from "node:url";
37
+ var import_cross_spawn = __toESM(require_cross_spawn(), 1);
38
+ var SKILL_TARGETS = ["claude", "agents"];
39
+ var homeOf = /* @__PURE__ */ __name((env) => {
40
+ refuseOwnerHomeInTests(env);
41
+ return env.HOME || env.USERPROFILE || homedir();
42
+ }, "homeOf");
43
+ var skillPath = /* @__PURE__ */ __name((target, appName, env) => join(homeOf(env), target === "claude" ? ".claude" : ".agents", "skills", appName, "SKILL.md"), "skillPath");
44
+ var FRONTMATTER = /^---(\r?\n)([\s\S]*?\r?\n)?---(\r?\n|$)/;
45
+ var scalar = /* @__PURE__ */ __name((key, indent) => new RegExp(`^${indent}${key}:[ \\t]*["']?([^"'\\r\\n]*?)["']?[ \\t]*\\r?\\n?$`), "scalar");
46
+ var frontmatterLines = /* @__PURE__ */ __name((content) => (FRONTMATTER.exec(content)?.[2] ?? "").split(/(?<=\n)/), "frontmatterLines");
47
+ var metadataBlock = /* @__PURE__ */ __name((lines) => {
48
+ const start = lines.findIndex((line) => /^metadata:/.test(line));
49
+ if (start === -1)
50
+ return void 0;
51
+ if (!/^metadata:[ \t]*\r?\n?$/.test(lines[start])) {
52
+ throw new CliError("configuration_error", "SKILL.md: write `metadata` as an indented block, not on one line");
53
+ }
54
+ let end = start + 1;
55
+ while (end < lines.length && /^[ \t]/.test(lines[end]))
56
+ end++;
57
+ return [start, end];
58
+ }, "metadataBlock");
59
+ var skillVersion = /* @__PURE__ */ __name((content) => {
60
+ const lines = frontmatterLines(content);
61
+ const block = metadataBlock(lines);
62
+ const nested = block && lines.slice(block[0] + 1, block[1]).find((line2) => scalar("version", "[ \\t]+").test(line2));
63
+ const line = nested ?? lines.find((line2) => scalar("version", "").test(line2));
64
+ return line === void 0 ? void 0 : scalar("version", "[ \\t]*").exec(line)?.[1];
65
+ }, "skillVersion");
66
+ var skillName = /* @__PURE__ */ __name((content) => {
67
+ const line = frontmatterLines(content).find((line2) => scalar("name", "").test(line2));
68
+ return line === void 0 ? void 0 : scalar("name", "").exec(line)?.[1];
69
+ }, "skillName");
70
+ var withVersion = /* @__PURE__ */ __name((content, version) => {
71
+ const match = FRONTMATTER.exec(content);
72
+ if (!match)
73
+ return `---
74
+ metadata:
75
+ version: "${version}"
76
+ ---
77
+ ${content}`;
78
+ const [whole, eol = "\n", body = "", close = ""] = match;
79
+ const lines = body.split(/(?<=\n)/).filter((line) => line !== "");
80
+ const block = metadataBlock(lines);
81
+ if (!block) {
82
+ lines.push(`metadata:${eol}`, ` version: "${version}"${eol}`);
83
+ } else {
84
+ const [start, end] = block;
85
+ const indent = /^[ \t]+/.exec(lines[start + 1] ?? "")?.[0] ?? " ";
86
+ const at = lines.slice(start + 1, end).findIndex((line) => scalar("version", "[ \\t]+").test(line));
87
+ if (at === -1)
88
+ lines.splice(start + 1, 0, `${indent}version: "${version}"${eol}`);
89
+ else {
90
+ const old = lines[start + 1 + at];
91
+ const lineEol = /\r?\n$/.exec(old)?.[0] ?? "";
92
+ lines[start + 1 + at] = `${/^[ \t]+/.exec(old)?.[0]}version: "${version}"${lineEol}`;
93
+ }
94
+ }
95
+ return `---${eol}${lines.join("")}---${close}${content.slice(whole.length)}`;
96
+ }, "withVersion");
97
+ var skillFiles = /* @__PURE__ */ __name((skill) => {
98
+ const root = dirname(fileURLToPath(skill));
99
+ const found = [];
100
+ const walk = /* @__PURE__ */ __name((folder) => {
101
+ for (const entry of readdirSync(folder, { withFileTypes: true })) {
102
+ if (entry.name.startsWith("."))
103
+ continue;
104
+ const path = join(folder, entry.name);
105
+ if (entry.isDirectory())
106
+ walk(path);
107
+ else if (entry.isFile() && path !== join(root, "SKILL.md"))
108
+ found.push(relative(root, path).split(sep).join("/"));
109
+ }
110
+ }, "walk");
111
+ walk(root);
112
+ return found.sort();
113
+ }, "skillFiles");
114
+ var writeSkillFolder = /* @__PURE__ */ __name((app, skill, folder) => {
115
+ const source = readFileSync(skill, "utf8");
116
+ const name = skillName(source);
117
+ if (name !== app.appName) {
118
+ throw new CliError("configuration_error", `SKILL.md is named ${name === void 0 ? "nothing" : `"${name}"`}, but installs into a directory "${app.appName}"; the two must match`);
119
+ }
120
+ const root = dirname(fileURLToPath(skill));
121
+ for (const file of skillFiles(skill)) {
122
+ const target = join(folder, file);
123
+ mkdirSync(dirname(target), { recursive: true });
124
+ writeFileSync(target, readFileSync(join(root, file)));
125
+ }
126
+ const path = join(folder, "SKILL.md");
127
+ mkdirSync(folder, { recursive: true });
128
+ writeFileSync(path, withVersion(source, app.version));
129
+ return path;
130
+ }, "writeSkillFolder");
131
+ var installSkill = /* @__PURE__ */ __name((app, skill, { targets = SKILL_TARGETS, env = process.env } = {}) => targets.map((target) => writeSkillFolder(app, skill, dirname(skillPath(target, app.appName, env)))), "installSkill");
132
+ var skillStatus = /* @__PURE__ */ __name((app, env = process.env) => SKILL_TARGETS.map((target) => {
133
+ const path = skillPath(target, app.appName, env);
134
+ return { target, ...copyStatus(app, path) ?? { path, installed: null, state: "missing" } };
135
+ }), "skillStatus");
136
+ var copyStatus = /* @__PURE__ */ __name((app, path) => {
137
+ let content;
138
+ try {
139
+ content = readFileSync(path, "utf8");
140
+ } catch {
141
+ return void 0;
142
+ }
143
+ const installed = skillVersion(content);
144
+ if (installed === void 0)
145
+ return { path, installed: null, state: "unversioned" };
146
+ return { path, installed, state: isNewer(app.version, installed) ? "stale" : "current" };
147
+ }, "copyStatus");
148
+ var runProgram = /* @__PURE__ */ __name((file, args, env) => {
149
+ const result = import_cross_spawn.default.sync(executableOnPath(file, env), [...args], {
150
+ encoding: "utf8",
151
+ timeout: 3e4,
152
+ maxBuffer: 256e3,
153
+ env: executableEnvironment(env)
154
+ });
155
+ return { status: result.status, ...result.error ? { error: result.error } : {}, stdout: result.stdout ?? "" };
156
+ }, "runProgram");
157
+ var hermesHome = /* @__PURE__ */ __name((env, platform = process.platform) => {
158
+ refuseOwnerHomeInTests(env, platform);
159
+ const set = env.HERMES_HOME?.trim();
160
+ if (set)
161
+ return set;
162
+ if (platform === "win32")
163
+ return join(env.LOCALAPPDATA || join(homeOf(env), "AppData", "Local"), "hermes");
164
+ return join(homeOf(env), ".hermes");
165
+ }, "hermesHome");
166
+ var hermesCopyPath = /* @__PURE__ */ __name((appName, env) => join(hermesHome(env), "skills", appName, "SKILL.md"), "hermesCopyPath");
167
+ var EXTERNAL_DIRS = "skills.external_dirs";
168
+ var externalDirs = /* @__PURE__ */ __name((env, run) => {
169
+ const answer = run("hermes", ["config", "get", EXTERNAL_DIRS, "--json"], env);
170
+ if (answer.error || answer.status !== 0)
171
+ return void 0;
172
+ let value;
173
+ try {
174
+ value = JSON.parse(answer.stdout);
175
+ } catch {
176
+ return void 0;
177
+ }
178
+ if (value === null)
179
+ return [];
180
+ if (typeof value === "string")
181
+ return [value];
182
+ return Array.isArray(value) && value.every((entry) => typeof entry === "string") ? value : void 0;
183
+ }, "externalDirs");
184
+ var expanded = /* @__PURE__ */ __name((entry, env) => resolve(entry.replace(/^~(?=$|[\\/])/, homeOf(env)).replace(/\$\{(\w+)\}|\$(\w+)/g, (whole, braced, bare) => env[braced ?? bare ?? ""] ?? whole)), "expanded");
185
+ var lists = /* @__PURE__ */ __name((dirs, folder, env) => dirs.some((entry) => expanded(entry, env) === resolve(folder)), "lists");
186
+ var removeOwnCopy = /* @__PURE__ */ __name((app, skill, env) => {
187
+ const path = hermesCopyPath(app.appName, env);
188
+ const shipped = new Set(skillFiles(skill));
189
+ const top = /* @__PURE__ */ new Set(["SKILL.md", ...[...shipped].map((file) => file.split("/")[0])]);
190
+ try {
191
+ if (!readdirSync(dirname(path)).every((entry) => top.has(entry)))
192
+ return void 0;
193
+ if (!skillFiles(pathToFileURL(path)).every((file) => shipped.has(file)))
194
+ return void 0;
195
+ if (skillName(readFileSync(path, "utf8")) !== app.appName)
196
+ return void 0;
197
+ rmSync(dirname(path), { recursive: true });
198
+ return path;
199
+ } catch {
200
+ return void 0;
201
+ }
202
+ }, "removeOwnCopy");
203
+ var readFolder = /* @__PURE__ */ __name((folder, env, run) => {
204
+ const dirs = externalDirs(env, run);
205
+ if (dirs === void 0)
206
+ return "Hermes could not be asked for skills.external_dirs";
207
+ if (lists(dirs, folder, env))
208
+ return void 0;
209
+ const set = run("hermes", ["config", "set", EXTERNAL_DIRS, JSON.stringify([...dirs, folder])], env);
210
+ if (set.error || set.status !== 0)
211
+ return "hermes config set failed";
212
+ const after = externalDirs(env, run);
213
+ return after !== void 0 && lists(after, folder, env) ? void 0 : "Hermes did not keep the folder";
214
+ }, "readFolder");
215
+ var installHermesSkill = /* @__PURE__ */ __name((app, skill, { env = process.env, run = runProgram } = {}) => {
216
+ if (!existsSync(hermesHome(env)) && run("hermes", ["--version"], env).error)
217
+ throw new CliError("not_found", "Hermes is not installed here; install Hermes first, or set HERMES_HOME");
218
+ const [shared] = installSkill(app, skill, { targets: ["agents"], env });
219
+ const reason = readFolder(dirname(dirname(shared)), env, run);
220
+ if (reason === void 0) {
221
+ const removed = removeOwnCopy(app, skill, env);
222
+ return { written: [shared], hermes: { via: "external_dirs", path: shared, ...removed ? { removed } : {} } };
223
+ }
224
+ const copy = writeSkillFolder(app, skill, dirname(hermesCopyPath(app.appName, env)));
225
+ return { written: [shared, copy], hermes: { via: "copy", path: copy, reason } };
226
+ }, "installHermesSkill");
227
+ var hermesSkillStatus = /* @__PURE__ */ __name((app, { env = process.env, run = runProgram } = {}) => {
228
+ const own = copyStatus(app, hermesCopyPath(app.appName, env));
229
+ if (own)
230
+ return { ...own, via: "copy" };
231
+ const shared = skillPath("agents", app.appName, env);
232
+ const dirs = existsSync(hermesHome(env)) ? externalDirs(env, run) : void 0;
233
+ const read = dirs !== void 0 && lists(dirs, dirname(dirname(shared)), env) ? copyStatus(app, shared) : void 0;
234
+ if (read)
235
+ return { ...read, via: "external_dirs" };
236
+ return { path: shared, installed: null, state: "missing", via: null };
237
+ }, "hermesSkillStatus");
238
+ var skillParts = /* @__PURE__ */ __name((skill) => {
239
+ try {
240
+ return Object.fromEntries(skillFiles(skill).filter((file) => file.endsWith(".md")).reverse().map((file) => [basename(file, ".md"), new URL(file, skill)]));
241
+ } catch {
242
+ return {};
243
+ }
244
+ }, "skillParts");
245
+ var skillCommand = /* @__PURE__ */ __name((app, skill, environment, more = {}) => {
246
+ const command = new Command("skill").description("the instructions an agent is given for this tool");
247
+ const machine = /* @__PURE__ */ __name((self) => {
248
+ const { json, jsonl } = self.optsWithGlobals();
249
+ return json === true || jsonl === true;
250
+ }, "machine");
251
+ const shown = { ...skillParts(skill), ...more };
252
+ const named = Object.keys(shown);
253
+ const show = annotate(command.command("show"), { effects: { remote: "none", local: "read" } }).summary("print the tool's instructions for AI agents").description(`print SKILL.md \u2014 \`${app.command} skill install\` puts it where Claude Code, Codex, Gemini CLI and OpenClaw look for it, and where Hermes does on request; --for prints the copy already there`);
254
+ if (named.length > 0)
255
+ show.argument("[name]", `a part of this skill, or a skill shipped for a task: ${named.join(", ")}`);
256
+ show.addOption(new Option("--for <agents>", "print the copy installed for these agents instead of this version's").choices(SKILL_TARGETS));
257
+ show.action(function(given) {
258
+ const name = typeof given === "string" ? given : void 0;
259
+ const { renderer, streams, env } = environment(this);
260
+ const { for: target } = this.opts();
261
+ if (target !== void 0) {
262
+ if (name !== void 0)
263
+ throw new CliError("validation_error", `only ${app.appName} is installed; leave out "${name}" with --for`);
264
+ const path = skillPath(target, app.appName, env ?? process.env);
265
+ let content2;
266
+ try {
267
+ content2 = readFileSync(path, "utf8").trimEnd();
268
+ } catch {
269
+ throw new CliError("not_found", `no skill is installed for ${target} at ${path} \u2014 \`${app.command} skill install --for ${target}\` writes it`);
270
+ }
271
+ if (machine(this))
272
+ renderer.result({ name: app.appName, target, path, installed: skillVersion(content2) ?? null, content: content2 });
273
+ else
274
+ streams.data(content2);
275
+ return;
276
+ }
277
+ const source = name === void 0 ? skill : shown[name];
278
+ if (!source) {
279
+ throw new CliError("validation_error", `no skill "${name}" \u2014 there are: ${named.join(", ")}`);
280
+ }
281
+ const content = name === void 0 ? readFileSync(source, "utf8").trimEnd() : readFileSync(source, "utf8").trimEnd().replaceAll("{{command}}", app.command);
282
+ if (machine(this))
283
+ renderer.result({ name: name ?? app.appName, content });
284
+ else
285
+ streams.data(content);
286
+ });
287
+ annotate(command.command("install"), { effects: { remote: "none", local: "write" } }).summary("install the tool's instructions for AI agents").description(`write SKILL.md to ~/.claude/skills/${app.appName}/ (Claude Code) and ~/.agents/skills/${app.appName}/ (Codex, Gemini CLI, OpenClaw); --for hermes also has Hermes read ~/.agents/skills, which changes Hermes's own settings, so all leaves it out`).addOption(new Option("--for <agents>", "which agents to install for").choices(["claude", "agents", "hermes", "all"]).default("all")).action(function({ for: chosen }) {
288
+ const { renderer, env } = environment(this);
289
+ if (chosen === "hermes") {
290
+ const { written: written2, hermes } = installHermesSkill(app, skill, env ? { env } : {});
291
+ renderer.result({ name: app.appName, version: app.version, written: written2, hermes });
292
+ renderer.success(hermes.via === "external_dirs" ? `${app.appName} ${app.version} skill installed: ${hermes.path}; Hermes reads ${dirname(dirname(hermes.path))} (skills.external_dirs)` : `${app.appName} ${app.version} skill installed: ${hermes.path}, a copy for Hermes (${hermes.reason})`);
293
+ if (hermes.removed)
294
+ renderer.note(`removed the earlier copy Hermes would also have found: ${hermes.removed}`);
295
+ return;
296
+ }
297
+ const targets = chosen === "all" ? SKILL_TARGETS : [chosen];
298
+ const written = installSkill(app, skill, { targets, ...env ? { env } : {} });
299
+ renderer.result({ name: app.appName, version: app.version, written });
300
+ renderer.success(`${app.appName} ${app.version} skill installed: ${written.join(", ")}`);
301
+ });
302
+ annotate(command.command("status"), {
303
+ effects: { remote: "none", local: "read" },
304
+ examples: [`${app.command} skill status`, `${app.command} skill status --json`]
305
+ }).summary("whether the installed instructions for AI agents match this version").description(`for each place \`${app.command} skill install\` writes to, and for the copy Hermes reads: the path, the version installed there, and whether it is current, stale, missing or unversioned`).action(function() {
306
+ const { renderer, env } = environment(this);
307
+ const targets = skillStatus(app, env ?? process.env);
308
+ const hermes = hermesSkillStatus(app, env ? { env } : {});
309
+ renderer.result({ name: app.appName, version: app.version, targets, hermes });
310
+ });
311
+ return command;
312
+ }, "skillCommand");
313
+ var isAgent = /* @__PURE__ */ __name((env) => Boolean(env.AI_AGENT || env.CLAUDECODE), "isAgent");
314
+ var needsInstall = /* @__PURE__ */ __name((app, env) => {
315
+ const states = skillStatus(app, env).map(({ state }) => state);
316
+ return states.every((state) => state === "missing") || states.some((state) => state === "stale" || state === "unversioned");
317
+ }, "needsInstall");
318
+ var skillHint = /* @__PURE__ */ __name(({ app, argv, env, statePath, enabled = true, now = Date.now }) => {
319
+ try {
320
+ if (!enabled || !isAgent(env))
321
+ return void 0;
322
+ if (argv.includes("skill") || argv.includes("complete"))
323
+ return void 0;
324
+ const at = now();
325
+ const shown = readNoticeState(statePath).skillHintAt;
326
+ if (shown !== void 0 && at - shown < CHECK_EVERY_MS)
327
+ return void 0;
328
+ if (!needsInstall(app, env))
329
+ return void 0;
330
+ writeUpdateState(statePath, { skillHintAt: at });
331
+ return `agents: \`${app.command} skill install\` installs this tool's guide`;
332
+ } catch {
333
+ return void 0;
334
+ }
335
+ }, "skillHint");
336
+ var skillResource = /* @__PURE__ */ __name((app, skill) => {
337
+ const uri = `${app.command}://skill`;
338
+ return {
339
+ uri,
340
+ name: "skill",
341
+ title: `${app.appName} SKILL.md`,
342
+ description: `How to use ${app.command}: the guide an agent is given for this tool.`,
343
+ mimeType: "text/markdown",
344
+ read: /* @__PURE__ */ __name(() => ({ contents: [{ uri, mimeType: "text/markdown", text: readFileSync(skill, "utf8") }] }), "read"),
345
+ instruction: `- The full guide is the resource ${uri}; \`${app.command} skill install\` installs it as an agent skill.`
346
+ };
347
+ }, "skillResource");
348
+ var skillResources = /* @__PURE__ */ __name((app, skill) => {
349
+ const main = skillResource(app, skill);
350
+ let parts = [];
351
+ try {
352
+ parts = skillFiles(skill).filter((file) => file.endsWith(".md"));
353
+ } catch {
354
+ }
355
+ if (parts.length === 0)
356
+ return [main];
357
+ return [
358
+ {
359
+ ...main,
360
+ instruction: `- The guide is the resource ${main.uri}; the parts it links are ${main.uri}/<path>, read only the one a task needs. \`${app.command} skill install\` installs it as an agent skill.`
361
+ },
362
+ ...parts.map((file) => {
363
+ const uri = `${main.uri}/${file}`;
364
+ return {
365
+ uri,
366
+ name: `skill/${file}`,
367
+ title: `${app.appName} ${file}`,
368
+ description: `A part of the ${app.command} guide that ${main.uri} links to.`,
369
+ mimeType: "text/markdown",
370
+ read: /* @__PURE__ */ __name(() => ({
371
+ contents: [{ uri, mimeType: "text/markdown", text: readFileSync(new URL(file, skill), "utf8") }]
372
+ }), "read"),
373
+ instruction: ""
374
+ };
375
+ })
376
+ ];
377
+ }, "skillResources");
378
+
379
+ export {
380
+ skillVersion,
381
+ writeSkillFolder,
382
+ installSkill,
383
+ skillStatus,
384
+ hermesCopyPath,
385
+ skillCommand,
386
+ skillHint,
387
+ skillResources
388
+ };
@@ -0,0 +1,39 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ check,
5
+ custom,
6
+ pipe,
7
+ transform
8
+ } from "./chunk-S4UUN6LD.js";
9
+ import {
10
+ __name
11
+ } from "./chunk-ZVVMGPBJ.js";
12
+
13
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/codegen/runtime.js
14
+ var isLossless = /* @__PURE__ */ __name((input) => typeof input === "object" && input !== null && input.isLosslessNumber === true && typeof input.value === "string", "isLossless");
15
+ var INTEGER = /^-?\d+$/;
16
+ var INT64_MIN = -(2n ** 63n);
17
+ var INT64_MAX = 2n ** 63n - 1n;
18
+ var digitsOf = /* @__PURE__ */ __name((input) => {
19
+ if (isLossless(input))
20
+ return INTEGER.test(input.value) ? input.value : void 0;
21
+ if (typeof input === "bigint")
22
+ return input.toString();
23
+ if (typeof input === "number" && Number.isSafeInteger(input))
24
+ return String(input);
25
+ return void 0;
26
+ }, "digitsOf");
27
+ var inRange = /* @__PURE__ */ __name((value, { minimum, maximum }) => (minimum === void 0 || value >= minimum) && (maximum === void 0 || value <= maximum), "inRange");
28
+ var integer = /* @__PURE__ */ __name((range = {}) => pipe(custom((input) => {
29
+ const digits = digitsOf(input);
30
+ return digits !== void 0 && Number.isSafeInteger(Number(digits));
31
+ }, "expected an integer within \xB12^53"), transform((input) => Number(digitsOf(input))), check((value) => inRange(value, range), "integer out of range")), "integer");
32
+ var number = /* @__PURE__ */ __name((range = {}) => pipe(custom((input) => isLossless(input) ? Number.isFinite(Number(input.value)) : Number.isFinite(input), "expected a number"), transform((input) => isLossless(input) ? Number(input.value) : input), check((value) => inRange(value, range), "number out of range")), "number");
33
+ var unique = /* @__PURE__ */ __name((items) => new Set(items.map((item) => JSON.stringify(item))).size === items.length, "unique");
34
+
35
+ export {
36
+ integer,
37
+ number,
38
+ unique
39
+ };