@wirecat/amo-cli 0.5.0 → 0.7.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 (281) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +2 -2
  3. package/contracts/wirecat.json +14 -0
  4. package/dist/amo/button.js +1 -1
  5. package/dist/amo/json.js +1 -1
  6. package/dist/amo/oauth.js +3 -5
  7. package/dist/amo/transport.js +3 -7
  8. package/dist/api-keys.js +1 -1
  9. package/dist/bin/amo.js +11 -11
  10. package/dist/bundle/amo.js +5 -183
  11. package/dist/bundle/{chunk-3PYE55JY.js → chunk-3HWD4BKU.js} +4 -6
  12. package/dist/bundle/{chunk-M6VZXAJC.js → chunk-4EXURQQQ.js} +21 -19
  13. package/dist/bundle/chunk-AEWYRB6F.js +8 -0
  14. package/dist/bundle/{chunk-WUFX4TKA.js → chunk-GL7CRTHR.js} +3 -3
  15. package/dist/bundle/chunk-N2UB32VN.js +76 -0
  16. package/dist/bundle/{chunk-KZ2FIDI3.js → chunk-PVVSHDMQ.js} +7 -15
  17. package/dist/bundle/program-SQH3SPOW.js +2352 -0
  18. package/dist/bundle/{instructions-AMH5RWVJ.js → source-C65ZJUTW.js} +5 -6
  19. package/dist/bundle/store-SJ2TOUGU.js +12 -0
  20. package/dist/bundle/writer-I7GBI3VE.js +12 -0
  21. package/dist/commands/account.js +1 -1
  22. package/dist/commands/api.js +1 -3
  23. package/dist/commands/crm-shared.js +2 -3
  24. package/dist/commands/schedule.js +1 -1
  25. package/dist/commands/session.js +1 -8
  26. package/dist/commands/write.js +1 -2
  27. package/dist/config.js +1 -2
  28. package/dist/context.js +1 -2
  29. package/dist/crm/activities.js +1 -1
  30. package/dist/crm/records.js +1 -1
  31. package/dist/crm/source.js +1 -1
  32. package/dist/crm/writer.js +1 -1
  33. package/dist/identity.js +4 -0
  34. package/dist/program.js +1 -2
  35. package/dist/setup/flow.js +1 -1
  36. package/dist/store.js +1 -1
  37. package/dist/version.js +1 -1
  38. package/dist/whoami.js +1 -1
  39. package/package.json +3 -3
  40. package/scenarios/first-sync.md +13 -11
  41. package/scenarios/keep-in-sync.md +7 -6
  42. package/scenarios/safe-agent-writes.md +10 -9
  43. package/dist/amo/account.d.ts +0 -18
  44. package/dist/amo/account.d.ts.map +0 -1
  45. package/dist/amo/account.js.map +0 -1
  46. package/dist/amo/allow-list.d.ts +0 -31
  47. package/dist/amo/allow-list.d.ts.map +0 -1
  48. package/dist/amo/allow-list.js.map +0 -1
  49. package/dist/amo/button.d.ts +0 -53
  50. package/dist/amo/button.d.ts.map +0 -1
  51. package/dist/amo/button.js.map +0 -1
  52. package/dist/amo/errors.d.ts +0 -12
  53. package/dist/amo/errors.d.ts.map +0 -1
  54. package/dist/amo/errors.js.map +0 -1
  55. package/dist/amo/json.d.ts +0 -3
  56. package/dist/amo/json.d.ts.map +0 -1
  57. package/dist/amo/json.js.map +0 -1
  58. package/dist/amo/oauth.d.ts +0 -64
  59. package/dist/amo/oauth.d.ts.map +0 -1
  60. package/dist/amo/oauth.js.map +0 -1
  61. package/dist/amo/operation.d.ts +0 -45
  62. package/dist/amo/operation.d.ts.map +0 -1
  63. package/dist/amo/operation.js.map +0 -1
  64. package/dist/amo/operations.d.ts +0 -3
  65. package/dist/amo/operations.d.ts.map +0 -1
  66. package/dist/amo/operations.js.map +0 -1
  67. package/dist/amo/routes.d.ts +0 -67
  68. package/dist/amo/routes.d.ts.map +0 -1
  69. package/dist/amo/routes.js.map +0 -1
  70. package/dist/amo/transport.d.ts +0 -62
  71. package/dist/amo/transport.d.ts.map +0 -1
  72. package/dist/amo/transport.js.map +0 -1
  73. package/dist/api-keys.d.ts +0 -47
  74. package/dist/api-keys.d.ts.map +0 -1
  75. package/dist/api-keys.js.map +0 -1
  76. package/dist/bin/amo.d.ts +0 -3
  77. package/dist/bin/amo.d.ts.map +0 -1
  78. package/dist/bin/amo.js.map +0 -1
  79. package/dist/bundle/agent-EFMUK732.js +0 -41
  80. package/dist/bundle/all-profiles-PIWUQWBA.js +0 -320
  81. package/dist/bundle/anthropic-47CMXBPQ.js +0 -90
  82. package/dist/bundle/app-server-QRBQODF2.js +0 -257
  83. package/dist/bundle/areas-QVHVU57Z.js +0 -63
  84. package/dist/bundle/bun-OPDGMZZQ.js +0 -169
  85. package/dist/bundle/bun-sqlite-7I4X7CZW.js +0 -75
  86. package/dist/bundle/chunk-2JHVQMVC.js +0 -16
  87. package/dist/bundle/chunk-2XBDILVW.js +0 -53
  88. package/dist/bundle/chunk-3DEQUYEG.js +0 -185
  89. package/dist/bundle/chunk-3GX6KM2E.js +0 -5302
  90. package/dist/bundle/chunk-3HC5F3P7.js +0 -24
  91. package/dist/bundle/chunk-3YM4B2GT.js +0 -63
  92. package/dist/bundle/chunk-43OW5NTG.js +0 -338
  93. package/dist/bundle/chunk-43PMSR33.js +0 -357
  94. package/dist/bundle/chunk-4N7PP76S.js +0 -6848
  95. package/dist/bundle/chunk-4VN7RI4I.js +0 -1718
  96. package/dist/bundle/chunk-57HFPNMF.js +0 -189
  97. package/dist/bundle/chunk-5UTB3ADZ.js +0 -360
  98. package/dist/bundle/chunk-633NQY2R.js +0 -80
  99. package/dist/bundle/chunk-63N46DJU.js +0 -12278
  100. package/dist/bundle/chunk-6D4VWSJD.js +0 -259
  101. package/dist/bundle/chunk-6JTHXWPE.js +0 -64
  102. package/dist/bundle/chunk-6QGUK3H7.js +0 -161
  103. package/dist/bundle/chunk-6WS6GJ4V.js +0 -30
  104. package/dist/bundle/chunk-7IR2G5XY.js +0 -559
  105. package/dist/bundle/chunk-7IWIFVXH.js +0 -52
  106. package/dist/bundle/chunk-ABX7BBS4.js +0 -388
  107. package/dist/bundle/chunk-ADLS6FVG.js +0 -24600
  108. package/dist/bundle/chunk-ADTI5RUO.js +0 -1007
  109. package/dist/bundle/chunk-AKRIUNYP.js +0 -1197
  110. package/dist/bundle/chunk-BIKOE2IW.js +0 -614
  111. package/dist/bundle/chunk-BVVMIAQ6.js +0 -37727
  112. package/dist/bundle/chunk-CGW5R4UD.js +0 -362
  113. package/dist/bundle/chunk-D4NE7EON.js +0 -170
  114. package/dist/bundle/chunk-D72URWJE.js +0 -532
  115. package/dist/bundle/chunk-DFDN6AUB.js +0 -21
  116. package/dist/bundle/chunk-DNCLQPOM.js +0 -7
  117. package/dist/bundle/chunk-DPV53EZC.js +0 -206
  118. package/dist/bundle/chunk-DQ6S5TFZ.js +0 -9539
  119. package/dist/bundle/chunk-DSJ6EAOA.js +0 -4172
  120. package/dist/bundle/chunk-DVZ75WZJ.js +0 -3752
  121. package/dist/bundle/chunk-EH6ZEJGT.js +0 -932
  122. package/dist/bundle/chunk-EHK73OSW.js +0 -2017
  123. package/dist/bundle/chunk-FNV5HLHX.js +0 -1068
  124. package/dist/bundle/chunk-FV4GQNIK.js +0 -136
  125. package/dist/bundle/chunk-G2TU5RYY.js +0 -332
  126. package/dist/bundle/chunk-GDK7ETSB.js +0 -218
  127. package/dist/bundle/chunk-GGMAIIVE.js +0 -38
  128. package/dist/bundle/chunk-GLYWZQY4.js +0 -86
  129. package/dist/bundle/chunk-H4AFNENN.js +0 -1343
  130. package/dist/bundle/chunk-HOF7GQWW.js +0 -142
  131. package/dist/bundle/chunk-HSPEU6S7.js +0 -209
  132. package/dist/bundle/chunk-IA7LLLEI.js +0 -100
  133. package/dist/bundle/chunk-IB55P46L.js +0 -334
  134. package/dist/bundle/chunk-IG2TJQJ7.js +0 -79
  135. package/dist/bundle/chunk-JG6LCSEX.js +0 -407
  136. package/dist/bundle/chunk-JLXXUEAM.js +0 -72
  137. package/dist/bundle/chunk-JXT6GY4V.js +0 -1023
  138. package/dist/bundle/chunk-K7YY6SXR.js +0 -738
  139. package/dist/bundle/chunk-KEKXERBE.js +0 -67181
  140. package/dist/bundle/chunk-KZN2BG3P.js +0 -721
  141. package/dist/bundle/chunk-LKH3UKLO.js +0 -230
  142. package/dist/bundle/chunk-LZPKBN3C.js +0 -193
  143. package/dist/bundle/chunk-MDEPJZYJ.js +0 -106
  144. package/dist/bundle/chunk-NB7EOAUZ.js +0 -123
  145. package/dist/bundle/chunk-NISH4UXM.js +0 -58
  146. package/dist/bundle/chunk-NSKMNIY6.js +0 -460
  147. package/dist/bundle/chunk-PL5P7UKW.js +0 -25216
  148. package/dist/bundle/chunk-PPSAWFJD.js +0 -1293
  149. package/dist/bundle/chunk-Q7ICVP25.js +0 -18
  150. package/dist/bundle/chunk-QFOP3KUP.js +0 -2603
  151. package/dist/bundle/chunk-R53XXHEI.js +0 -76
  152. package/dist/bundle/chunk-RIMPFMZE.js +0 -1251
  153. package/dist/bundle/chunk-RN6RT5CB.js +0 -58
  154. package/dist/bundle/chunk-RRTMPSQR.js +0 -29
  155. package/dist/bundle/chunk-S4ZHQMNM.js +0 -133
  156. package/dist/bundle/chunk-S6JG4YUH.js +0 -72
  157. package/dist/bundle/chunk-TAVI73RW.js +0 -288
  158. package/dist/bundle/chunk-TLG6ECZ2.js +0 -54
  159. package/dist/bundle/chunk-TXDR6YSF.js +0 -23
  160. package/dist/bundle/chunk-TY7NDMFY.js +0 -46
  161. package/dist/bundle/chunk-U5RJJ2EC.js +0 -353
  162. package/dist/bundle/chunk-UDSL3MUU.js +0 -2333
  163. package/dist/bundle/chunk-V2CNGXWX.js +0 -798
  164. package/dist/bundle/chunk-VB7FZOYX.js +0 -633
  165. package/dist/bundle/chunk-VZ5PPYDG.js +0 -77
  166. package/dist/bundle/chunk-W5JRXIG6.js +0 -27995
  167. package/dist/bundle/chunk-WIHN3ELW.js +0 -2793
  168. package/dist/bundle/chunk-WOPVBRPV.js +0 -29
  169. package/dist/bundle/chunk-WXJYMMEL.js +0 -95
  170. package/dist/bundle/chunk-XCCU2E3Z.js +0 -274
  171. package/dist/bundle/chunk-XEQQJBBO.js +0 -92
  172. package/dist/bundle/chunk-XUT7DSM5.js +0 -108
  173. package/dist/bundle/chunk-Y5E2WNWB.js +0 -35
  174. package/dist/bundle/chunk-YWDFYQOU.js +0 -82
  175. package/dist/bundle/chunk-ZLUIRFJX.js +0 -780
  176. package/dist/bundle/chunk-ZVVMGPBJ.js +0 -50
  177. package/dist/bundle/cli-3NXOSENF.js +0 -1239
  178. package/dist/bundle/command-contract-LNSAV5LA.js +0 -39
  179. package/dist/bundle/command-server-entry-4ZQPNUL4.js +0 -168
  180. package/dist/bundle/decode-K7U7X5EL.js +0 -296
  181. package/dist/bundle/dispatch-56FECRCU.js +0 -411
  182. package/dist/bundle/dist-PAKDDIBT.js +0 -191
  183. package/dist/bundle/dist-T54K3FJV.js +0 -7577
  184. package/dist/bundle/echarts-O3TNDAXJ.js +0 -42501
  185. package/dist/bundle/embed-SWLVG73O.js +0 -37
  186. package/dist/bundle/embedder-EJN75BPV.js +0 -110
  187. package/dist/bundle/failure-WDSX6H3B.js +0 -24
  188. package/dist/bundle/first-run-WPGUUC4Z.js +0 -28
  189. package/dist/bundle/first-screen-JMNEUQ46.js +0 -40
  190. package/dist/bundle/mcp-5HFPWC3W.js +0 -167
  191. package/dist/bundle/meeting-combined-5TKG2RYD.js +0 -24
  192. package/dist/bundle/meeting-model-YXXNETKC.js +0 -24
  193. package/dist/bundle/meeting-semantic-U7EUB3ET.js +0 -21
  194. package/dist/bundle/node-EGMCBAO7.js +0 -176
  195. package/dist/bundle/node-P4E63KXA.js +0 -2340
  196. package/dist/bundle/node-TLZSIHIJ.js +0 -21
  197. package/dist/bundle/node-sqlite-YVOGMDSP.js +0 -73
  198. package/dist/bundle/oauth-2SNRBIJM.js +0 -19
  199. package/dist/bundle/open-ABCPY5IH.js +0 -22
  200. package/dist/bundle/openai-4D6PXJR7.js +0 -237
  201. package/dist/bundle/process-SGHEN6MQ.js +0 -91
  202. package/dist/bundle/program-CBDQBZZ3.js +0 -4971
  203. package/dist/bundle/prompt-2QUK5QST.js +0 -16
  204. package/dist/bundle/recognize-QMQSJRIH.js +0 -25
  205. package/dist/bundle/remote-U7TC2BLZ.js +0 -30
  206. package/dist/bundle/rerank-5UPVXGVV.js +0 -51
  207. package/dist/bundle/serve-VX6GUM6J.js +0 -198
  208. package/dist/bundle/server-FOPC6DJ3.js +0 -219
  209. package/dist/bundle/server-OIVNOMVK.js +0 -87
  210. package/dist/bundle/source-HWS5SJIV.js +0 -46
  211. package/dist/bundle/sqlite-runtime-77NKDEXN.js +0 -19
  212. package/dist/bundle/state-X2HU6GB2.js +0 -35
  213. package/dist/bundle/store-2U4U6KL4.js +0 -184
  214. package/dist/bundle/store-3CHPHFP7.js +0 -301
  215. package/dist/bundle/store-Z3747L5F.js +0 -34
  216. package/dist/bundle/store-maintenance-command-UOSZJTVP.js +0 -74
  217. package/dist/bundle/surface-MUT72QON.js +0 -73
  218. package/dist/bundle/writer-RBKQ64ZM.js +0 -48
  219. package/dist/commands/account.d.ts +0 -4
  220. package/dist/commands/account.d.ts.map +0 -1
  221. package/dist/commands/account.js.map +0 -1
  222. package/dist/commands/api.d.ts +0 -3
  223. package/dist/commands/api.d.ts.map +0 -1
  224. package/dist/commands/api.js.map +0 -1
  225. package/dist/commands/crm-shared.d.ts +0 -8
  226. package/dist/commands/crm-shared.d.ts.map +0 -1
  227. package/dist/commands/crm-shared.js.map +0 -1
  228. package/dist/commands/schedule.d.ts +0 -3
  229. package/dist/commands/schedule.d.ts.map +0 -1
  230. package/dist/commands/schedule.js.map +0 -1
  231. package/dist/commands/session.d.ts +0 -35
  232. package/dist/commands/session.d.ts.map +0 -1
  233. package/dist/commands/session.js.map +0 -1
  234. package/dist/commands/write.d.ts +0 -14
  235. package/dist/commands/write.d.ts.map +0 -1
  236. package/dist/commands/write.js.map +0 -1
  237. package/dist/config.d.ts +0 -4
  238. package/dist/config.d.ts.map +0 -1
  239. package/dist/config.js.map +0 -1
  240. package/dist/context.d.ts +0 -62
  241. package/dist/context.d.ts.map +0 -1
  242. package/dist/context.js.map +0 -1
  243. package/dist/crm/activities.d.ts +0 -32
  244. package/dist/crm/activities.d.ts.map +0 -1
  245. package/dist/crm/activities.js.map +0 -1
  246. package/dist/crm/records.d.ts +0 -20
  247. package/dist/crm/records.d.ts.map +0 -1
  248. package/dist/crm/records.js.map +0 -1
  249. package/dist/crm/source.d.ts +0 -41
  250. package/dist/crm/source.d.ts.map +0 -1
  251. package/dist/crm/source.js.map +0 -1
  252. package/dist/crm/writer.d.ts +0 -14
  253. package/dist/crm/writer.d.ts.map +0 -1
  254. package/dist/crm/writer.js.map +0 -1
  255. package/dist/identity.d.ts +0 -7
  256. package/dist/identity.d.ts.map +0 -1
  257. package/dist/identity.js.map +0 -1
  258. package/dist/index.d.ts +0 -3
  259. package/dist/index.d.ts.map +0 -1
  260. package/dist/index.js.map +0 -1
  261. package/dist/program.d.ts +0 -6
  262. package/dist/program.d.ts.map +0 -1
  263. package/dist/program.js.map +0 -1
  264. package/dist/reasons.d.ts +0 -10
  265. package/dist/reasons.d.ts.map +0 -1
  266. package/dist/reasons.js.map +0 -1
  267. package/dist/setup/flow.d.ts +0 -2
  268. package/dist/setup/flow.d.ts.map +0 -1
  269. package/dist/setup/flow.js.map +0 -1
  270. package/dist/store.d.ts +0 -15
  271. package/dist/store.d.ts.map +0 -1
  272. package/dist/store.js.map +0 -1
  273. package/dist/version.d.ts +0 -2
  274. package/dist/version.d.ts.map +0 -1
  275. package/dist/version.js.map +0 -1
  276. package/dist/wcat.d.ts +0 -3
  277. package/dist/wcat.d.ts.map +0 -1
  278. package/dist/wcat.js.map +0 -1
  279. package/dist/whoami.d.ts +0 -24
  280. package/dist/whoami.d.ts.map +0 -1
  281. package/dist/whoami.js.map +0 -1
@@ -1,357 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- WIRECAT_TOOLS
5
- } from "./chunk-NB7EOAUZ.js";
6
- import {
7
- hasOwnAction,
8
- isHidden
9
- } from "./chunk-WOPVBRPV.js";
10
- import {
11
- commandPathOf,
12
- outputOf
13
- } from "./chunk-S4ZHQMNM.js";
14
- import {
15
- Command,
16
- Help,
17
- NO_EFFECTS,
18
- Option,
19
- annotate,
20
- commandAt,
21
- environmentOf,
22
- metaOf,
23
- takesProfile
24
- } from "./chunk-63N46DJU.js";
25
- import {
26
- wrapAnsi
27
- } from "./chunk-EH6ZEJGT.js";
28
- import {
29
- writes
30
- } from "./chunk-QFOP3KUP.js";
31
- import {
32
- CliError
33
- } from "./chunk-S6JG4YUH.js";
34
- import {
35
- __name
36
- } from "./chunk-ZVVMGPBJ.js";
37
-
38
- // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/cli/help/command-help.js
39
- var ARGUMENT_KINDS = {
40
- chat: "chat",
41
- chats: "chat",
42
- message: "message",
43
- messages: "message",
44
- post: "message",
45
- person: "person",
46
- people: "person",
47
- task: "task",
48
- meeting: "meeting",
49
- folder: "folder",
50
- folders: "folder",
51
- topic: "topic",
52
- note: "note",
53
- document: "document",
54
- model: "model"
55
- };
56
- var ENTITY_KINDS = {
57
- message: "message",
58
- message_link: "message",
59
- chat: "chat",
60
- contact: "person",
61
- member: "person",
62
- person: "person",
63
- task: "task",
64
- meeting: "meeting",
65
- meeting_details: "meeting",
66
- meeting_hit: "meeting",
67
- meeting_summary: "meeting",
68
- folder: "folder",
69
- topic: "topic",
70
- note: "note",
71
- document: "document",
72
- model: "model"
73
- };
74
- var HOME = {
75
- chat: "chats",
76
- message: "messages",
77
- person: "contacts",
78
- task: "tasks",
79
- meeting: "meetings",
80
- folder: "folders",
81
- topic: "topics",
82
- note: "notes",
83
- document: "documents",
84
- model: "models"
85
- };
86
- var SAMPLES = {
87
- chat: "Team",
88
- message: "1234",
89
- post: "1234",
90
- person: "Anna",
91
- people: "Anna",
92
- task: "12",
93
- meeting: "123",
94
- folder: "Work",
95
- topic: "General",
96
- model: "default",
97
- query: '"invoice"',
98
- text: '"on my way"',
99
- title: '"Weekly sync"',
100
- name: "daily",
101
- id: "1",
102
- file: "./report.pdf",
103
- link: "https://example.com/join/abc",
104
- url: "https://example.com",
105
- since: "1d",
106
- duration: "1d",
107
- limit: "20"
108
- };
109
- var MAX_NEXT = 3;
110
- var choices = /* @__PURE__ */ new WeakMap();
111
- var nextUsually = /* @__PURE__ */ __name((command, choice) => {
112
- choices.set(command, choice);
113
- return command;
114
- }, "nextUsually");
115
- var kindOfArgument = /* @__PURE__ */ __name((argument) => ARGUMENT_KINDS[argument.name()], "kindOfArgument");
116
- var runs = /* @__PURE__ */ __name((command) => command.commands.length === 0 || hasOwnAction(command), "runs");
117
- var leaves = /* @__PURE__ */ __name((command) => command.commands.filter((child) => !isHidden(child)).flatMap((child) => [...runs(child) ? [child] : [], ...leaves(child)]), "leaves");
118
- var rootOf = /* @__PURE__ */ __name((command) => {
119
- let at = command;
120
- while (at.parent)
121
- at = at.parent;
122
- return at;
123
- }, "rootOf");
124
- var call = /* @__PURE__ */ __name((command) => [
125
- rootOf(command).name(),
126
- ...commandPathOf(command),
127
- ...command.registeredArguments.map((one) => one.required ? `<${one.name()}>` : `[${one.name()}]`)
128
- ].join(" "), "call");
129
- var fieldsOf = /* @__PURE__ */ __name((schema) => {
130
- const variants = schema.anyOf;
131
- if (variants)
132
- return variants.flatMap(fieldsOf);
133
- const required = schema.required ?? [];
134
- return [...required, ...Object.keys(schema.properties ?? {})];
135
- }, "fieldsOf");
136
- var returnsOf = /* @__PURE__ */ __name((command) => {
137
- const output = metaOf(command).output;
138
- const { item, coverage } = outputOf(command);
139
- if (!output || coverage !== "declared-entity")
140
- return "";
141
- const fields = [...new Set(fieldsOf(item))];
142
- const noun = (output.view ? `${output.entity} ${output.view}` : output.entity).replaceAll("_", " ");
143
- const more = fields.length > 8 ? `, and ${fields.length - 8} more` : "";
144
- const root = rootOf(command);
145
- const schema = commandAt(root, "commands info") ? `; every field: ${root.name()} commands info ${commandPathOf(command).join(" ")}` : "";
146
- return `${noun} \u2014 ${fields.slice(0, 8).join(", ")}${more}${schema}`;
147
- }, "returnsOf");
148
- var nextOf = /* @__PURE__ */ __name((command) => {
149
- const root = rootOf(command);
150
- const choice = choices.get(command) ?? {};
151
- const drop = new Set(choice.drop ?? []);
152
- const pinned = (choice.pin ?? []).flatMap((path) => commandAt(root, path) ?? []);
153
- const output = metaOf(command).output;
154
- const kind = output ? ENTITY_KINDS[output.entity] : void 0;
155
- const all = leaves(root);
156
- const derived = kind ? all.filter((other) => other !== command && !pinned.includes(other)).filter((other) => other.registeredArguments.some((argument) => kindOfArgument(argument) === kind)).map((other, order) => ({ other, order })).sort((a, b) => {
157
- const rank = /* @__PURE__ */ __name((other) => [
158
- Number(writes(metaOf(other).effects)),
159
- Number(!other.registeredArguments.some((one) => one.required && kindOfArgument(one) === kind)),
160
- Number(commandPathOf(other)[0] !== HOME[kind]),
161
- Number(other.parent !== command.parent)
162
- ], "rank");
163
- const [left, right] = [rank(a.other), rank(b.other)];
164
- return left.reduce((found, value, at) => found || value - (right[at] ?? 0), 0) || a.order - b.order;
165
- }).map(({ other }) => other) : [];
166
- return [...pinned, ...derived].filter((other) => !drop.has(commandPathOf(other).join(" "))).slice(0, MAX_NEXT);
167
- }, "nextOf");
168
- var sample = /* @__PURE__ */ __name((name) => SAMPLES[name] ?? `<${name}>`, "sample");
169
- var generatedExample = /* @__PURE__ */ __name((command) => {
170
- const { query } = metaOf(command);
171
- const words = command.registeredArguments.flatMap((argument) => {
172
- const name = argument.name();
173
- if (name === "query" && query)
174
- return [];
175
- if (!argument.required && SAMPLES[name] === void 0)
176
- return [];
177
- return [argument.argChoices?.[0] ?? sample(name)];
178
- });
179
- const options = command.options.filter((option) => option.mandatory).flatMap((option) => {
180
- const flag = option.long ?? option.short ?? option.flags;
181
- const placeholder = /[<[]([^>\]]+)[>\]]/.exec(option.flags)?.[1];
182
- if (!(option.required || option.optional))
183
- return [flag];
184
- return [flag, option.argChoices?.[0] ?? sample(placeholder ?? option.attributeName())];
185
- });
186
- return [rootOf(command).name(), ...commandPathOf(command), ...words, ...options].join(" ");
187
- }, "generatedExample");
188
- var profiled = /* @__PURE__ */ new WeakSet();
189
- var EXAMPLE_PROFILE = "personal";
190
- var withProfile = /* @__PURE__ */ __name((command, example) => {
191
- const root = rootOf(command);
192
- const top = commandPathOf(command)[0];
193
- if (!profiled.has(root) || top === void 0 || !takesProfile(command))
194
- return example;
195
- if (example.split(" ").includes("--profiles"))
196
- return example;
197
- const prefix = `${root.name()} ${top}`;
198
- return example === prefix || example.startsWith(`${prefix} `) ? `${root.name()} ${EXAMPLE_PROFILE} ${example.slice(root.name().length + 1)}` : example;
199
- }, "withProfile");
200
- var commandHelp = /* @__PURE__ */ __name((command) => {
201
- const written = metaOf(command).examples ?? [];
202
- return {
203
- returns: returnsOf(command),
204
- next: nextOf(command).map(call),
205
- examples: (written.length > 0 ? written : [generatedExample(command)]).map((one) => withProfile(command, one)),
206
- origin: written.length > 0 ? "written" : "generated"
207
- };
208
- }, "commandHelp");
209
- var LABEL = 15;
210
- var commandHelpText = /* @__PURE__ */ __name((command) => {
211
- const { returns, next, examples } = commandHelp(command);
212
- const rows = /* @__PURE__ */ __name((label, values) => values.map((value, at) => `${(at === 0 ? label : "").padEnd(LABEL)}${value}`), "rows");
213
- const availability = environmentOf(command).discoveryAvailability?.({
214
- ...metaOf(command),
215
- path: commandPathOf(command)
216
- });
217
- const profileMatters = profiled.has(rootOf(command)) && takesProfile(command);
218
- const access = !availability ? [] : availability.available ? profileMatters ? rows("Availability:", ["available for this profile"]) : [] : rows("Availability:", [`unavailable \u2014 ${availability.reason}`]);
219
- return [
220
- "",
221
- ...access,
222
- ...rows("Returns:", returns ? [returns] : []),
223
- ...rows("Next usually:", next),
224
- ...rows("Example:", examples),
225
- ""
226
- ].join("\n");
227
- }, "commandHelpText");
228
- var commandHelpMarkdown = /* @__PURE__ */ __name((root, path) => {
229
- const command = commandAt(root, path.join(" "));
230
- if (!command || !runs(command))
231
- return [];
232
- const { returns, next, examples } = commandHelp(command);
233
- const code = /* @__PURE__ */ __name((values) => values.map((value) => `\`${value}\``).join(", "), "code");
234
- return [
235
- ...returns ? [`**Returns:** ${returns}`] : [],
236
- ...next.length > 0 ? [`**Next usually:** ${code(next)}`] : [],
237
- `**Example:** ${code(examples)}`
238
- ];
239
- }, "commandHelpMarkdown");
240
- var installCommandHelp = /* @__PURE__ */ __name((program, { profile = true } = {}) => {
241
- if (profile)
242
- profiled.add(program);
243
- for (const command of leaves(program))
244
- command.addHelpText("after", () => commandHelpText(command));
245
- }, "installCommandHelp");
246
- var exampleReport = /* @__PURE__ */ __name((program) => {
247
- const written = [];
248
- const generated = [];
249
- for (const command of leaves(program))
250
- (commandHelp(command).origin === "written" ? written : generated).push(commandPathOf(command).join(" "));
251
- const total = written.length + generated.length;
252
- const text = [
253
- `${program.name()}: ${written.length} of ${total} commands have a written example; ${generated.length} show a generated one:`,
254
- ...generated.map((path) => ` ${program.name()} ${path}`),
255
- ""
256
- ].join("\n");
257
- return { written, generated, text };
258
- }, "exampleReport");
259
-
260
- // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/cli/help/first-screen.js
261
- var WIDTH = 100;
262
- var widest = /* @__PURE__ */ __name((texts) => texts.reduce((most, text) => Math.max(most, text.length), 0), "widest");
263
- var block = /* @__PURE__ */ __name((title, rows, column) => rows.length === 0 ? [] : ["", `${title}:`, ...rows.map(([left, right]) => ` ${left.padEnd(column)}${right}`)], "block");
264
- var TOPICS = [
265
- ["--json", "output"],
266
- ["--offline", "offline"],
267
- ["--timeout", "timeouts"],
268
- ["--dry-run", "dry run"]
269
- ];
270
- var optionTopics = /* @__PURE__ */ __name((program) => {
271
- const longs = new Set(program.options.map((option) => option.long));
272
- const topics = TOPICS.filter(([long]) => longs.has(long)).map(([, topic]) => topic);
273
- return topics.length > 0 ? topics.join(", ") : "the options every command takes";
274
- }, "optionTopics");
275
- var pointers = /* @__PURE__ */ __name((program, cli, start, profile) => {
276
- const has = /* @__PURE__ */ __name((path) => commandAt(program, path) !== void 0, "has");
277
- const next = [
278
- has("commands") ? [`${cli} commands`, "every command, by section"] : void 0,
279
- has("guide") ? [`${cli} guide`, "scenarios: command sequences for common tasks"] : void 0,
280
- [`${cli} help options`, optionTopics(program)]
281
- ].filter((row) => row !== void 0);
282
- const rows = [
283
- ...start ? [["Start here:", start, profile ? "(any profile name works)" : ""]] : [],
284
- ...has("account list") ? [["", `${cli} account list`, "your profiles and their logged-in accounts"]] : [],
285
- ...next.map(([command = "", does = ""], at) => [at === 0 ? "Next:" : "", command, does]),
286
- ...has("skill show") ? [["For agents:", `${cli} skill show`, "rules and the discovery loop"]] : []
287
- ];
288
- const width = widest(rows.map(([, command]) => command)) + 2;
289
- return ["", ...rows.map(([label, command, does]) => `${label.padEnd(14)}${command.padEnd(width)}${does}`.trimEnd())];
290
- }, "pointers");
291
- var firstScreen = /* @__PURE__ */ __name((program, screen = {}) => {
292
- const cli = program.name();
293
- const profile = screen.profile !== false;
294
- const pitch = screen.pitch ?? program.description().split("\n")[0] ?? "";
295
- const can = (screen.can ?? []).map(({ command, does }) => [command, does]);
296
- const works = WIRECAT_TOOLS.filter((tool) => tool.command !== cli).map(({ command, shown, does }) => [shown ?? command, does]);
297
- const column = Math.max(22, widest([...can, ...works].map(([left]) => left))) + 2;
298
- const start = screen.start ?? (commandAt(program, "setup") ? `${cli} ${EXAMPLE_PROFILE} setup` : void 0);
299
- return [
300
- wrapAnsi(`${cli} \u2014 ${pitch}`, WIDTH),
301
- "",
302
- `Usage: ${cli} ${profile ? "<profile> " : ""}<command> [options]`,
303
- ...profile ? ["Account commands start with your profile, a name you choose; none is ever assumed."] : [],
304
- ...block("What you can do", can, column),
305
- ...block("Works with", works, column),
306
- ...pointers(program, cli, start, profile),
307
- ""
308
- ].join("\n");
309
- }, "firstScreen");
310
- var optionsScreen = /* @__PURE__ */ __name((program) => {
311
- const helper = program.createHelp();
312
- const width = helper.longestOptionTermLength(program, helper);
313
- return [
314
- `Options for every ${program.name()} command:`,
315
- ...helper.visibleOptions(program).map((option) => helper.formatItem(helper.optionTerm(option), width, helper.optionDescription(option), helper)),
316
- ""
317
- ].join("\n");
318
- }, "optionsScreen");
319
- var installHelp = /* @__PURE__ */ __name((program, screen = {}) => {
320
- let full = false;
321
- const own = program.configureHelp();
322
- program.configureHelp({
323
- ...own,
324
- // Commander copies this configuration to children made with `.command()`, so only the root gets the screen.
325
- formatHelp: /* @__PURE__ */ __name((command, helper) => command === program && !full ? firstScreen(program, screen) : (own.formatHelp ?? Help.prototype.formatHelp).call(helper, command, helper), "formatHelp")
326
- });
327
- installCommandHelp(program, { profile: screen.profile !== false });
328
- program.addOption(new Option("--help-all", "the full help: every command and option").hideHelp());
329
- program.on("option:help-all", () => {
330
- full = true;
331
- program.help();
332
- });
333
- if (program.commands.some((command) => command.name() === "help"))
334
- return program;
335
- const help = annotate(new Command("help"), { effects: NO_EFFECTS, mcp: false }).description("this screen; help options: the options for every command; help <command>: that command's help").argument("[topic...]", "options, or a command path").action((topic) => {
336
- if (topic.length === 0)
337
- return program.outputHelp();
338
- if (topic.length === 1 && topic[0] === "options")
339
- return program.configureOutput().writeOut?.(optionsScreen(program));
340
- const command = commandAt(program, topic.join(" "));
341
- if (!command)
342
- throw new CliError("validation_error", `no command "${topic.join(" ")}" \u2014 run \`${program.name()} help\`, or \`${program.name()} help options\``, { available: program.commands.map((one) => one.name()).filter((name) => name !== "help") });
343
- command.outputHelp();
344
- });
345
- program.addCommand(help, { hidden: true });
346
- return program;
347
- }, "installHelp");
348
-
349
- export {
350
- nextUsually,
351
- commandHelp,
352
- commandHelpText,
353
- commandHelpMarkdown,
354
- exampleReport,
355
- firstScreen,
356
- installHelp
357
- };