@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,50 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ AUTHORITY_KEY,
5
+ BOT_API_KEY,
6
+ authorityAllowed,
7
+ botApiAllowed,
8
+ changesMessenger,
9
+ isBotApi,
10
+ keyForCommand,
11
+ levelFor,
12
+ readKeysForCommand
13
+ } from "./chunk-FQROWBKV.js";
14
+ import {
15
+ writes
16
+ } from "./chunk-3LMW7U7F.js";
17
+ import {
18
+ __name
19
+ } from "./chunk-ZVVMGPBJ.js";
20
+
21
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/cli/command-availability.js
22
+ var commandAvailability = /* @__PURE__ */ __name((info, levels, keyOf, authority, readOnly = false, mcp = true, declared, fetches) => {
23
+ const declaredKey = declared?.keyOf(info.path);
24
+ const key = declared ? declaredKey : keyOf?.(info.path) ?? keyForCommand(info.path);
25
+ const { level } = key ? levelFor(levels, key, declared?.defaults) : { level: "allow" };
26
+ const judged = { ...key ? { permission: key } : {}, level };
27
+ const blocked = /* @__PURE__ */ __name((reason, permission) => ({
28
+ available: false,
29
+ reason,
30
+ ...judged,
31
+ ...permission && permission !== judged.permission ? { permission, level: levelFor(levels, permission).level } : {}
32
+ }), "blocked");
33
+ const declaredChange = Boolean(declaredKey) && (info.effects === void 0 || info.effects.remote === "write");
34
+ if (readOnly && (changesMessenger(info) || declaredChange || authority?.(info.path)))
35
+ return blocked("the read-only lock blocks this change");
36
+ if (mcp && authority?.(info.path) && !authorityAllowed(levels))
37
+ return blocked(`the profile keeps ${AUTHORITY_KEY} off`, AUTHORITY_KEY);
38
+ if (mcp && isBotApi(info.path) && !botApiAllowed(levels))
39
+ return blocked(`the profile requires ${BOT_API_KEY}: allow`, BOT_API_KEY);
40
+ if (level === "deny")
41
+ return blocked(`the profile denies ${key}`);
42
+ if (level === "readonly" && writes(info.effects) && fetches?.(info.path) !== true)
43
+ return blocked(`${key} is readonly in this profile`);
44
+ const denied = (declared ? [] : readKeysForCommand(info.path)).find((read) => levelFor(levels, read).level === "deny");
45
+ return denied ? blocked(`the profile denies ${denied}`, denied) : { available: true, ...judged };
46
+ }, "commandAvailability");
47
+
48
+ export {
49
+ commandAvailability
50
+ };
@@ -0,0 +1,161 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ holdLock,
5
+ readLock,
6
+ releaseLock,
7
+ takeLock
8
+ } from "./chunk-U6VLNYCO.js";
9
+ import {
10
+ __name
11
+ } from "./chunk-ZVVMGPBJ.js";
12
+
13
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/mcp/http/state.js
14
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
15
+
16
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/mcp/http/activity.js
17
+ import { randomBytes } from "node:crypto";
18
+ import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
19
+ import { dirname } from "node:path";
20
+ var WRITE_EVERY_MS = 2e3;
21
+ var TOOL_NAME = /^[A-Za-z0-9_.-]{1,64}$/;
22
+ var httpActivityFile = /* @__PURE__ */ __name((tokenFile) => `${tokenFile.replace(/\.json$/, "")}.activity.json`, "httpActivityFile");
23
+ var localDay = /* @__PURE__ */ __name((ms) => {
24
+ const d = new Date(ms);
25
+ return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
26
+ }, "localDay");
27
+ var readActivity = /* @__PURE__ */ __name((path) => {
28
+ if (!existsSync(path))
29
+ return {};
30
+ try {
31
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
32
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
33
+ } catch {
34
+ return {};
35
+ }
36
+ }, "readActivity");
37
+ var calledTools = /* @__PURE__ */ __name((body) => (Array.isArray(body) ? body : [body]).flatMap((message) => {
38
+ if (!message || typeof message !== "object")
39
+ return [];
40
+ const { method, params } = message;
41
+ const name = params?.name;
42
+ return method === "tools/call" && typeof name === "string" && TOOL_NAME.test(name) ? [name] : [];
43
+ }), "calledTools");
44
+ var activityRecorder = /* @__PURE__ */ __name((path, now = Date.now) => {
45
+ const activity = readActivity(path);
46
+ let timer;
47
+ const write = /* @__PURE__ */ __name(() => {
48
+ timer = void 0;
49
+ try {
50
+ mkdirSync(dirname(path), { recursive: true, mode: 448 });
51
+ const temporary = `${path}.${randomBytes(8).toString("hex")}.tmp`;
52
+ writeFileSync(temporary, JSON.stringify(activity), { mode: 384, flag: "wx" });
53
+ chmodSync(temporary, 384);
54
+ renameSync(temporary, path);
55
+ } catch {
56
+ }
57
+ }, "write");
58
+ return {
59
+ record: /* @__PURE__ */ __name((clientId, tools) => {
60
+ const at = now();
61
+ const iso = new Date(at).toISOString();
62
+ const day = localDay(at);
63
+ const before = activity[clientId];
64
+ const counted = before?.day === day ? before.toolCalls : 0;
65
+ const last = tools.at(-1);
66
+ activity[clientId] = {
67
+ lastRequestAt: iso,
68
+ day,
69
+ toolCalls: counted + tools.length,
70
+ ...last ? { lastTool: last, lastToolAt: iso } : before?.lastTool ? { lastTool: before.lastTool, ...before.lastToolAt ? { lastToolAt: before.lastToolAt } : {} } : {}
71
+ };
72
+ if (last) {
73
+ clearTimeout(timer);
74
+ write();
75
+ } else if (!timer) {
76
+ timer = setTimeout(write, WRITE_EVERY_MS);
77
+ timer.unref();
78
+ }
79
+ }, "record"),
80
+ flush: /* @__PURE__ */ __name(() => {
81
+ if (!timer)
82
+ return;
83
+ clearTimeout(timer);
84
+ write();
85
+ }, "flush")
86
+ };
87
+ }, "activityRecorder");
88
+
89
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/mcp/http/state.js
90
+ var ACCESS_SECONDS = 60 * 60;
91
+ var REFRESH_SECONDS = 30 * 24 * 60 * 60;
92
+ var readStored = /* @__PURE__ */ __name((path) => existsSync2(path) ? JSON.parse(readFileSync2(path, "utf8")) : { clients: [], tokens: [] }, "readStored");
93
+ var mcpHttpMarker = /* @__PURE__ */ __name((envPrefix) => `${envPrefix}_MCP_HTTP`, "mcpHttpMarker");
94
+ var httpLogFile = /* @__PURE__ */ __name((tokenFile) => `${tokenFile.replace(/\.json$/, "")}.log`, "httpLogFile");
95
+ var httpLockFile = /* @__PURE__ */ __name((tokenFile) => `${tokenFile.replace(/\.json$/, "")}.lock`, "httpLockFile");
96
+ var httpLaunchFile = /* @__PURE__ */ __name((lockFile) => `${lockFile.replace(/\.lock$/, "")}.launch.json`, "httpLaunchFile");
97
+ var readHttpLaunch = /* @__PURE__ */ __name((path) => {
98
+ try {
99
+ const launch = JSON.parse(readFileSync2(path, "utf8"));
100
+ return typeof launch.invocation === "string" && Array.isArray(launch.argv) && launch.argv.every((word) => typeof word === "string") && typeof launch.env === "object" && launch.env !== null ? launch : void 0;
101
+ } catch {
102
+ return void 0;
103
+ }
104
+ }, "readHttpLaunch");
105
+ var readHttpLock = /* @__PURE__ */ __name((path) => {
106
+ const lock = readLock(path);
107
+ return lock && typeof lock.port === "number" && typeof lock.publicUrl === "string" ? lock : void 0;
108
+ }, "readHttpLock");
109
+ var httpLock = /* @__PURE__ */ __name((path, first) => {
110
+ let current = first;
111
+ const held = takeLock(path, current);
112
+ return {
113
+ held,
114
+ update: /* @__PURE__ */ __name((change) => {
115
+ current = { ...current, ...change };
116
+ holdLock(path, current);
117
+ }, "update"),
118
+ release: /* @__PURE__ */ __name(() => releaseLock(path), "release")
119
+ };
120
+ }, "httpLock");
121
+ var signedInClients = /* @__PURE__ */ __name((tokenFile, now = Date.now()) => {
122
+ const seconds = Math.floor(now / 1e3);
123
+ const { clients, tokens } = readStored(tokenFile);
124
+ const activity = readActivity(httpActivityFile(tokenFile));
125
+ const today = localDay(now);
126
+ const last = /* @__PURE__ */ new Map();
127
+ for (const token of tokens) {
128
+ if (token.expiresAt <= seconds)
129
+ continue;
130
+ const issued = token.expiresAt - (token.kind === "access" ? ACCESS_SECONDS : REFRESH_SECONDS);
131
+ last.set(token.clientId, Math.max(last.get(token.clientId) ?? 0, issued));
132
+ }
133
+ return clients.filter((client) => last.has(client.id)).map((client) => {
134
+ const did = activity[client.id];
135
+ return {
136
+ claimedName: client.name ?? null,
137
+ lastLoginAt: new Date((last.get(client.id) ?? 0) * 1e3).toISOString(),
138
+ lastRequestAt: did?.lastRequestAt ?? null,
139
+ lastTool: did?.lastTool ?? null,
140
+ lastToolAt: did?.lastToolAt ?? null,
141
+ toolCallsToday: did?.day === today ? did.toolCalls : 0
142
+ };
143
+ }).sort((a, b) => b.lastLoginAt.localeCompare(a.lastLoginAt));
144
+ }, "signedInClients");
145
+
146
+ export {
147
+ httpActivityFile,
148
+ calledTools,
149
+ activityRecorder,
150
+ ACCESS_SECONDS,
151
+ REFRESH_SECONDS,
152
+ readStored,
153
+ mcpHttpMarker,
154
+ httpLogFile,
155
+ httpLockFile,
156
+ httpLaunchFile,
157
+ readHttpLaunch,
158
+ readHttpLock,
159
+ httpLock,
160
+ signedInClients
161
+ };
@@ -0,0 +1,206 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ singleLine
5
+ } from "./chunk-HM6AMYHR.js";
6
+ import {
7
+ __name
8
+ } from "./chunk-ZVVMGPBJ.js";
9
+
10
+ // 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/wcat/names.js
11
+ var FIRST_PARTY_TOOLS = [
12
+ { name: "tg", package: "@wirecat/tg-cli" },
13
+ { name: "max", package: "@wirecat/max-cli" },
14
+ { name: "wa", package: "@wirecat/whatsapp-cli" },
15
+ { name: "zm", package: "@wirecat/zoom-cli" },
16
+ { name: "drive", package: "@wirecat/drive-cli" },
17
+ { name: "memo", package: "@wirecat/cli-memo" },
18
+ { name: "mail", package: "@wirecat/mail-cli" },
19
+ // memo reads email today; the name is held for a tool of its own.
20
+ { name: "email" }
21
+ ];
22
+ var BUILT_IN_COMMANDS = ["help", "version", "shortcuts", "doctor", "update", "upgrade", "app"];
23
+ var RESERVED_NAMES = [
24
+ ...FIRST_PARTY_TOOLS.map((tool) => tool.name),
25
+ ...BUILT_IN_COMMANDS,
26
+ "wcat"
27
+ ];
28
+ var TOOL_NAME = /^[a-z][a-z0-9-]{0,39}$/;
29
+ var PROGRAM_PREFIX = "wcat-";
30
+ var DESCRIBE_FLAG = "--wcat-describe";
31
+ var DESCRIBE_MAX_BYTES = 64 * 1024;
32
+ var DISPATCH_FLAG = "--wcat-dispatch";
33
+
34
+ // 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/wcat/describe.js
35
+ var DESCRIBE_FORMAT = 1;
36
+ var DESCRIBE_MANIFEST_FORMAT = 2;
37
+ var describeAnswer = /* @__PURE__ */ __name((tool, manifest) => {
38
+ const answer = {
39
+ wcat_describe: DESCRIBE_FORMAT,
40
+ name: tool.command,
41
+ version: tool.version,
42
+ description: tool.description,
43
+ ...tool.docs ? { docs_url: tool.docs } : {}
44
+ };
45
+ if (!manifest)
46
+ return answer;
47
+ const full = {
48
+ ...answer,
49
+ wcat_describe: DESCRIBE_MANIFEST_FORMAT,
50
+ desktop: manifest.desktop,
51
+ manifest_sha256: manifest.sha256
52
+ };
53
+ return Buffer.byteLength(`${JSON.stringify(full)}
54
+ `) > DESCRIBE_MAX_BYTES ? answer : full;
55
+ }, "describeAnswer");
56
+ var MAX_TEXT = 200;
57
+ var clean = /* @__PURE__ */ __name((value) => typeof value === "string" && value.trim() !== "" ? singleLine(value.trim()).slice(0, MAX_TEXT) : void 0, "clean");
58
+ var parseDescribe = /* @__PURE__ */ __name((text) => {
59
+ let answer;
60
+ try {
61
+ answer = JSON.parse(text);
62
+ } catch {
63
+ return void 0;
64
+ }
65
+ if (typeof answer !== "object" || answer === null || !("wcat_describe" in answer))
66
+ return void 0;
67
+ const { version, description, docs_url: docs, manifest_sha256: sha } = answer;
68
+ const url = clean(docs);
69
+ return {
70
+ version: clean(version) ?? "",
71
+ description: clean(description) ?? "",
72
+ ...url && /^https?:\/\//.test(url) ? { docs: url } : {},
73
+ ...typeof sha === "string" && /^[0-9a-f]{64}$/.test(sha) ? { manifestSha256: sha } : {}
74
+ };
75
+ }, "parseDescribe");
76
+
77
+ // 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/wcat/shim.js
78
+ import { lstatSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
79
+ import { join } from "node:path";
80
+ var SHIM_FORMAT = 2;
81
+ var MARK = /^(?:#|REM) wirecat-shim (\d+) (launcher|shortcut) (\S+)\r?$/m;
82
+ var NOTE = {
83
+ launcher: "Written by @wirecat/cli-base. Any WireCat tool rewrites it when it breaks; it is safe to delete.",
84
+ shortcut: "Made by `wcat shortcuts add`; `wcat shortcuts remove` takes it out."
85
+ };
86
+ var shellQuote = /* @__PURE__ */ __name((text) => `'${text.replaceAll("'", `'\\''`)}'`, "shellQuote");
87
+ var launcherBody = /* @__PURE__ */ __name((dir, target, name) => [
88
+ 'ok() { [ -f "$1" ] && [ -x "$1" ]; }',
89
+ `dir=${shellQuote(dir)}`,
90
+ `target=${shellQuote(join(dir, target))}`,
91
+ 'if ! ok "$target"; then',
92
+ ' for t in "$dir"/wcat-*; do',
93
+ ' if ok "$t"; then target=$t; break; fi',
94
+ " done",
95
+ "fi",
96
+ `if ok "$target"; then exec "$target" ${DISPATCH_FLAG} "$@"; fi`,
97
+ 'if [ -z "$WIRECAT_LAUNCHER_SKIP" ]; then',
98
+ " WIRECAT_LAUNCHER_SKIP=1; export WIRECAT_LAUNCHER_SKIP",
99
+ " set -f; oldifs=$IFS; IFS=:",
100
+ " for d in $PATH; do",
101
+ ` if [ -n "$d" ] && [ "$d" != "$dir" ] && ok "$d/${name}"; then IFS=$oldifs; exec "$d/${name}" "$@"; fi`,
102
+ " done",
103
+ " IFS=$oldifs; set +f",
104
+ "fi",
105
+ `printf '%s\\n' "${name}: $target is missing and no other ${name}-* program was found in $dir or on PATH." \\`,
106
+ ` "This launcher is safe to delete: $dir/${name}" >&2`,
107
+ "exit 127"
108
+ ], "launcherBody");
109
+ var shimFiles = /* @__PURE__ */ __name((kind, { dir, name, target, platform }) => {
110
+ const mark = `wirecat-shim ${SHIM_FORMAT} ${kind} ${target}`;
111
+ const extra = kind === "launcher" ? ` ${DISPATCH_FLAG}` : "";
112
+ if (platform !== "win32")
113
+ return [
114
+ {
115
+ path: join(dir, name),
116
+ text: [
117
+ "#!/bin/sh",
118
+ `# ${mark}`,
119
+ `# ${NOTE[kind]}`,
120
+ ...kind === "launcher" ? launcherBody(dir, target, name) : [`exec ${shellQuote(join(dir, target))} "$@"`],
121
+ ""
122
+ ].join("\n")
123
+ }
124
+ ];
125
+ return [
126
+ {
127
+ path: join(dir, `${name}.cmd`),
128
+ text: ["@ECHO off", `REM ${mark}`, `REM ${NOTE[kind]}`, `"%~dp0${target}"${extra} %*`, ""].join("\r\n")
129
+ },
130
+ {
131
+ path: join(dir, `${name}.ps1`),
132
+ text: [
133
+ `# ${mark}`,
134
+ `# ${NOTE[kind]}`,
135
+ // PowerShell hands a .cmd its arguments unquoted, so `a&b` would run `b`; npm and pnpm write a .ps1 beside
136
+ // their .cmd, and it is started instead whenever it is there.
137
+ `$stem = Join-Path $PSScriptRoot "${target.replace(/\.(cmd|exe|bat)$/i, "")}"`,
138
+ `$target = if (Test-Path -LiteralPath "$stem.ps1") { "$stem.ps1" } else { Join-Path $PSScriptRoot "${target}" }`,
139
+ "if ($MyInvocation.ExpectingInput) {",
140
+ ` $input | & $target${extra} @args`,
141
+ "} else {",
142
+ ` & $target${extra} @args`,
143
+ "}",
144
+ "exit $LASTEXITCODE",
145
+ ""
146
+ ].join("\r\n")
147
+ }
148
+ ];
149
+ }, "shimFiles");
150
+ var parseShim = /* @__PURE__ */ __name((text) => {
151
+ const found = MARK.exec(text.split("\n", 3).join("\n"));
152
+ if (!found)
153
+ return void 0;
154
+ return { format: Number(found[1]), kind: found[2], target: found[3] };
155
+ }, "parseShim");
156
+ var MAX_SHIM_BYTES = 4096;
157
+ var fileState = /* @__PURE__ */ __name((path) => {
158
+ let stat;
159
+ try {
160
+ stat = lstatSync(path);
161
+ } catch (error) {
162
+ return error.code === "ENOENT" ? { state: "missing" } : { state: "foreign" };
163
+ }
164
+ if (!stat.isFile() || stat.size > MAX_SHIM_BYTES)
165
+ return { state: "foreign" };
166
+ try {
167
+ const text = readFileSync(path, "utf8");
168
+ const mark = parseShim(text);
169
+ return mark ? { state: "ours", mark, text } : { state: "foreign" };
170
+ } catch {
171
+ return { state: "foreign" };
172
+ }
173
+ }, "fileState");
174
+ var exists = /* @__PURE__ */ __name((path) => {
175
+ try {
176
+ return statSync(path).isFile();
177
+ } catch {
178
+ return false;
179
+ }
180
+ }, "exists");
181
+ var writeShim = /* @__PURE__ */ __name(({ path, text }) => {
182
+ const temporary = `${path}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
183
+ try {
184
+ writeFileSync(temporary, text, { mode: 493 });
185
+ renameSync(temporary, path);
186
+ } finally {
187
+ rmSync(temporary, { force: true });
188
+ }
189
+ }, "writeShim");
190
+
191
+ export {
192
+ FIRST_PARTY_TOOLS,
193
+ BUILT_IN_COMMANDS,
194
+ TOOL_NAME,
195
+ PROGRAM_PREFIX,
196
+ DESCRIBE_FLAG,
197
+ DESCRIBE_MAX_BYTES,
198
+ DISPATCH_FLAG,
199
+ describeAnswer,
200
+ parseDescribe,
201
+ SHIM_FORMAT,
202
+ shimFiles,
203
+ fileState,
204
+ exists,
205
+ writeShim
206
+ };
@@ -0,0 +1,142 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ executableEnvironment,
5
+ executableOnPath
6
+ } from "./chunk-CFQQTDSA.js";
7
+ import {
8
+ require_cross_spawn
9
+ } from "./chunk-D72URWJE.js";
10
+ import {
11
+ loadConfigFile,
12
+ saveConfigFile
13
+ } from "./chunk-3BM6KBWP.js";
14
+ import {
15
+ number,
16
+ object,
17
+ optional,
18
+ string
19
+ } from "./chunk-S4UUN6LD.js";
20
+ import {
21
+ __name,
22
+ __toESM
23
+ } from "./chunk-ZVVMGPBJ.js";
24
+
25
+ // 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/update/index.js
26
+ var import_cross_spawn = __toESM(require_cross_spawn(), 1);
27
+ import { existsSync } from "node:fs";
28
+ var updateCommand = /* @__PURE__ */ __name((installer, packageName) => {
29
+ const target = `${packageName}@latest`;
30
+ switch (installer) {
31
+ // pnpm 11 installs only versions a day old (minimumReleaseAge 1440); a fix must reach users the day it ships.
32
+ // Only the package's own scope is exempt — every other dependency keeps the wait.
33
+ case "pnpm":
34
+ return ["pnpm", "add", "-g", target, `--config.minimumReleaseAgeExclude=${ownScope(packageName)}`];
35
+ case "npm":
36
+ return ["npm", "install", "-g", target];
37
+ case "bun":
38
+ return ["bun", "add", "-g", target];
39
+ default:
40
+ return void 0;
41
+ }
42
+ }, "updateCommand");
43
+ var ownScope = /* @__PURE__ */ __name((packageName) => packageName.startsWith("@") ? `${packageName.split("/", 1)[0]}/*` : packageName, "ownScope");
44
+ var isNewer = /* @__PURE__ */ __name((candidate, current) => {
45
+ const parse = /* @__PURE__ */ __name((version) => /^\d+\.\d+\.\d+$/.test(version) ? version.split(".").map(Number) : void 0, "parse");
46
+ const a = parse(candidate);
47
+ const b = parse(current);
48
+ if (!a || !b)
49
+ return false;
50
+ for (let i = 0; i < 3; i++) {
51
+ if (a[i] !== b[i])
52
+ return a[i] > b[i];
53
+ }
54
+ return false;
55
+ }, "isNewer");
56
+ var latestVersion = /* @__PURE__ */ __name(async (packageName, fetch, { timeoutMs = 1e3 } = {}) => {
57
+ try {
58
+ const response = await fetch(`https://registry.npmjs.org/${packageName}/latest`, {
59
+ signal: AbortSignal.timeout(timeoutMs),
60
+ headers: { accept: "application/json" }
61
+ });
62
+ if (!response.ok)
63
+ return void 0;
64
+ const { version } = await response.json();
65
+ return typeof version === "string" ? version : void 0;
66
+ } catch {
67
+ return void 0;
68
+ }
69
+ }, "latestVersion");
70
+ var CHECK_EVERY_MS = 24 * 60 * 60 * 1e3;
71
+ var mayNotify = /* @__PURE__ */ __name(({ format, stderrIsTTY, quiet, enabled, installer, env, offVariables = [] }) => enabled && format === "pretty" && stderrIsTTY && !quiet && updateCommand(installer, "any") !== void 0 && !env.CI && !env.NO_UPDATE_NOTIFIER && offVariables.every((name) => !env[name]), "mayNotify");
72
+ var updateState = object({
73
+ checkedAt: number(),
74
+ latest: optional(string()),
75
+ /** When the skill hint (`cli-base/skill`) was last shown — the other daily notice kept in this file. */
76
+ skillHintAt: optional(number())
77
+ });
78
+ var readNoticeState = /* @__PURE__ */ __name((path) => {
79
+ try {
80
+ return loadConfigFile(path, updateState, () => ({ checkedAt: 0 }));
81
+ } catch {
82
+ return { checkedAt: 0 };
83
+ }
84
+ }, "readNoticeState");
85
+ var readUpdateState = /* @__PURE__ */ __name((path) => {
86
+ const state = readNoticeState(path);
87
+ return state.checkedAt > 0 ? state : void 0;
88
+ }, "readUpdateState");
89
+ var writeUpdateState = /* @__PURE__ */ __name((path, state) => {
90
+ try {
91
+ saveConfigFile(path, { ...readNoticeState(path), ...state });
92
+ } catch {
93
+ }
94
+ }, "writeUpdateState");
95
+ var checkIsDue = /* @__PURE__ */ __name((state, now) => state === void 0 || now - state.checkedAt >= CHECK_EVERY_MS, "checkIsDue");
96
+ var spawnPlan = /* @__PURE__ */ __name(([command, ...args], platform = process.platform, env = process.env, exists = existsSync) => ({ file: executableOnPath(command, env, platform, exists), args, shell: false }), "spawnPlan");
97
+ var runUpdate = /* @__PURE__ */ __name((argv) => {
98
+ const { file, args, shell } = spawnPlan(argv);
99
+ const { status, error } = import_cross_spawn.default.sync(file, args, {
100
+ stdio: ["inherit", 2, 2],
101
+ shell,
102
+ env: executableEnvironment(process.env)
103
+ });
104
+ if (error)
105
+ throw new Error(`could not start ${argv[0]}: ${error.message}`);
106
+ return status ?? 1;
107
+ }, "runUpdate");
108
+ var updateNotice = /* @__PURE__ */ __name(async ({ argv, packageName, command, upgradeCommand = "upgrade", version, statePath, fetch, now = Date.now, ...context }) => {
109
+ try {
110
+ const path = commandWords(argv).slice(0, 2);
111
+ if (path.includes("complete") || path.includes(upgradeCommand))
112
+ return void 0;
113
+ if (!mayNotify(context))
114
+ return void 0;
115
+ const at = now();
116
+ let state = readUpdateState(statePath);
117
+ if (checkIsDue(state, at)) {
118
+ const found = await latestVersion(packageName, fetch, { timeoutMs: 1e3 });
119
+ const seen = found ?? state?.latest;
120
+ state = seen ? { checkedAt: at, latest: seen } : { checkedAt: at };
121
+ writeUpdateState(statePath, state);
122
+ }
123
+ return state?.latest && isNewer(state.latest, version) ? `${command} ${state.latest} is out \u2014 you have ${version}. \`${command} ${upgradeCommand}\` installs it.` : void 0;
124
+ } catch {
125
+ return void 0;
126
+ }
127
+ }, "updateNotice");
128
+ var commandWords = /* @__PURE__ */ __name((argv) => {
129
+ const end = argv.indexOf("--");
130
+ return argv.slice(0, end < 0 ? void 0 : end).filter((word) => !word.startsWith("-"));
131
+ }, "commandWords");
132
+
133
+ export {
134
+ updateCommand,
135
+ isNewer,
136
+ latestVersion,
137
+ CHECK_EVERY_MS,
138
+ readNoticeState,
139
+ writeUpdateState,
140
+ runUpdate,
141
+ updateNotice
142
+ };