@wirecat/amo-cli 0.6.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.
- package/CHANGELOG.md +17 -0
- package/README.md +2 -2
- package/contracts/wirecat.json +14 -0
- package/dist/amo/button.js +1 -1
- package/dist/amo/json.js +1 -1
- package/dist/amo/oauth.js +1 -2
- package/dist/amo/transport.js +1 -2
- package/dist/api-keys.js +1 -1
- package/dist/bin/amo.js +11 -11
- package/dist/bundle/amo.js +5 -183
- package/dist/bundle/{chunk-FYOPPKAN.js → chunk-3HWD4BKU.js} +4 -6
- package/dist/bundle/{chunk-GOCMJBEE.js → chunk-4EXURQQQ.js} +21 -19
- package/dist/bundle/chunk-AEWYRB6F.js +8 -0
- package/dist/bundle/{chunk-SWCJM3YD.js → chunk-GL7CRTHR.js} +3 -3
- package/dist/bundle/chunk-N2UB32VN.js +76 -0
- package/dist/bundle/{chunk-RNWUCAJJ.js → chunk-PVVSHDMQ.js} +7 -15
- package/dist/bundle/program-SQH3SPOW.js +2352 -0
- package/dist/bundle/{instructions-4H7UREH2.js → source-C65ZJUTW.js} +5 -6
- package/dist/bundle/store-SJ2TOUGU.js +12 -0
- package/dist/bundle/writer-I7GBI3VE.js +12 -0
- package/dist/commands/account.js +1 -1
- package/dist/commands/api.js +1 -3
- package/dist/commands/crm-shared.js +2 -3
- package/dist/commands/schedule.js +1 -1
- package/dist/commands/session.js +1 -3
- package/dist/commands/write.js +1 -2
- package/dist/config.js +1 -2
- package/dist/context.js +1 -2
- package/dist/crm/activities.js +1 -1
- package/dist/crm/records.js +1 -1
- package/dist/crm/source.js +1 -1
- package/dist/crm/writer.js +1 -1
- package/dist/identity.js +4 -0
- package/dist/program.js +1 -2
- package/dist/setup/flow.js +1 -1
- package/dist/store.js +1 -1
- package/dist/version.js +1 -1
- package/dist/whoami.js +1 -1
- package/package.json +3 -3
- package/scenarios/first-sync.md +13 -11
- package/scenarios/keep-in-sync.md +7 -6
- package/scenarios/safe-agent-writes.md +10 -9
- package/dist/amo/account.d.ts +0 -18
- package/dist/amo/account.d.ts.map +0 -1
- package/dist/amo/account.js.map +0 -1
- package/dist/amo/allow-list.d.ts +0 -31
- package/dist/amo/allow-list.d.ts.map +0 -1
- package/dist/amo/allow-list.js.map +0 -1
- package/dist/amo/button.d.ts +0 -53
- package/dist/amo/button.d.ts.map +0 -1
- package/dist/amo/button.js.map +0 -1
- package/dist/amo/errors.d.ts +0 -12
- package/dist/amo/errors.d.ts.map +0 -1
- package/dist/amo/errors.js.map +0 -1
- package/dist/amo/json.d.ts +0 -3
- package/dist/amo/json.d.ts.map +0 -1
- package/dist/amo/json.js.map +0 -1
- package/dist/amo/oauth.d.ts +0 -64
- package/dist/amo/oauth.d.ts.map +0 -1
- package/dist/amo/oauth.js.map +0 -1
- package/dist/amo/operation.d.ts +0 -45
- package/dist/amo/operation.d.ts.map +0 -1
- package/dist/amo/operation.js.map +0 -1
- package/dist/amo/operations.d.ts +0 -3
- package/dist/amo/operations.d.ts.map +0 -1
- package/dist/amo/operations.js.map +0 -1
- package/dist/amo/routes.d.ts +0 -67
- package/dist/amo/routes.d.ts.map +0 -1
- package/dist/amo/routes.js.map +0 -1
- package/dist/amo/transport.d.ts +0 -62
- package/dist/amo/transport.d.ts.map +0 -1
- package/dist/amo/transport.js.map +0 -1
- package/dist/api-keys.d.ts +0 -47
- package/dist/api-keys.d.ts.map +0 -1
- package/dist/api-keys.js.map +0 -1
- package/dist/bin/amo.d.ts +0 -3
- package/dist/bin/amo.d.ts.map +0 -1
- package/dist/bin/amo.js.map +0 -1
- package/dist/bundle/agent-VVACEKSX.js +0 -42
- package/dist/bundle/all-profiles-QNUKL4NA.js +0 -320
- package/dist/bundle/anthropic-PQN6MNP7.js +0 -90
- package/dist/bundle/app-server-Q2QEA7GP.js +0 -258
- package/dist/bundle/areas-27FRPBF3.js +0 -71
- package/dist/bundle/bun-F4M4KCNA.js +0 -169
- package/dist/bundle/bun-sqlite-P5IDBDVR.js +0 -75
- package/dist/bundle/chunk-22KAQPX7.js +0 -58
- package/dist/bundle/chunk-2JGNMZ55.js +0 -338
- package/dist/bundle/chunk-2VDHC7QO.js +0 -288
- package/dist/bundle/chunk-34ZOMVUK.js +0 -185
- package/dist/bundle/chunk-3J3EDSXF.js +0 -1939
- package/dist/bundle/chunk-3TYER5IK.js +0 -80
- package/dist/bundle/chunk-5NGLCDYQ.js +0 -106
- package/dist/bundle/chunk-5SQTHOBI.js +0 -12313
- package/dist/bundle/chunk-6GE36KUE.js +0 -360
- package/dist/bundle/chunk-6GZKY3HV.js +0 -3752
- package/dist/bundle/chunk-6OV2TRGF.js +0 -362
- package/dist/bundle/chunk-7CPIZFOE.js +0 -460
- package/dist/bundle/chunk-A5K2NU3K.js +0 -37780
- package/dist/bundle/chunk-ADLS6FVG.js +0 -24600
- package/dist/bundle/chunk-AEC4H5WZ.js +0 -259
- package/dist/bundle/chunk-APBEDWOE.js +0 -1718
- package/dist/bundle/chunk-AQ5RIOUE.js +0 -633
- package/dist/bundle/chunk-B7L5MSRP.js +0 -136
- package/dist/bundle/chunk-C7JPYWYQ.js +0 -77
- package/dist/bundle/chunk-D72URWJE.js +0 -532
- package/dist/bundle/chunk-DFDN6AUB.js +0 -21
- package/dist/bundle/chunk-DIZEHPS6.js +0 -1347
- package/dist/bundle/chunk-DNCLQPOM.js +0 -7
- package/dist/bundle/chunk-DPV53EZC.js +0 -206
- package/dist/bundle/chunk-DUPCDJ3W.js +0 -357
- package/dist/bundle/chunk-DWT24UVR.js +0 -388
- package/dist/bundle/chunk-DXWJORSY.js +0 -1703
- package/dist/bundle/chunk-DY3PLWIH.js +0 -332
- package/dist/bundle/chunk-DYWHAJRK.js +0 -1259
- package/dist/bundle/chunk-EH6ZEJGT.js +0 -932
- package/dist/bundle/chunk-EXRM3ML4.js +0 -76
- package/dist/bundle/chunk-FFER7KJI.js +0 -407
- package/dist/bundle/chunk-FIP2DG7W.js +0 -64
- package/dist/bundle/chunk-FTH6WGYO.js +0 -24
- package/dist/bundle/chunk-FWRLGIF6.js +0 -5304
- package/dist/bundle/chunk-G3N2RHGF.js +0 -738
- package/dist/bundle/chunk-G46PNDWL.js +0 -58
- package/dist/bundle/chunk-G6NY7LFB.js +0 -230
- package/dist/bundle/chunk-GRGCZSES.js +0 -1007
- package/dist/bundle/chunk-GVSKLZRD.js +0 -30
- package/dist/bundle/chunk-GZ7WBU5Y.js +0 -18
- package/dist/bundle/chunk-HN2LCLGT.js +0 -1068
- package/dist/bundle/chunk-HO4JGD4Q.js +0 -16
- package/dist/bundle/chunk-HOF7GQWW.js +0 -142
- package/dist/bundle/chunk-HUAHLO6N.js +0 -29
- package/dist/bundle/chunk-IDCZ4LWS.js +0 -150
- package/dist/bundle/chunk-IN3VL7UU.js +0 -560
- package/dist/bundle/chunk-ISQ23VKV.js +0 -123
- package/dist/bundle/chunk-JVBCQHCS.js +0 -80
- package/dist/bundle/chunk-K5W7YEHB.js +0 -9541
- package/dist/bundle/chunk-KAFSS35C.js +0 -193
- package/dist/bundle/chunk-KLRCTMES.js +0 -100
- package/dist/bundle/chunk-KYRYD4CR.js +0 -38
- package/dist/bundle/chunk-LBZSURLL.js +0 -798
- package/dist/bundle/chunk-LC7ZD2RW.js +0 -92
- package/dist/bundle/chunk-LH6FJYMO.js +0 -334
- package/dist/bundle/chunk-LJKINNWC.js +0 -209
- package/dist/bundle/chunk-M36XP74N.js +0 -86
- package/dist/bundle/chunk-MNPGZCKE.js +0 -361
- package/dist/bundle/chunk-MRPMORLH.js +0 -353
- package/dist/bundle/chunk-NNREILWP.js +0 -189
- package/dist/bundle/chunk-NSOY4FMN.js +0 -159
- package/dist/bundle/chunk-OEEWVKJX.js +0 -53
- package/dist/bundle/chunk-OGJFDKDL.js +0 -161
- package/dist/bundle/chunk-PATZAYFZ.js +0 -453
- package/dist/bundle/chunk-PCR6GFNP.js +0 -1171
- package/dist/bundle/chunk-PL5P7UKW.js +0 -25216
- package/dist/bundle/chunk-Q4MH2O5E.js +0 -108
- package/dist/bundle/chunk-QFOP3KUP.js +0 -2603
- package/dist/bundle/chunk-QQRJEWKB.js +0 -1197
- package/dist/bundle/chunk-S6JG4YUH.js +0 -72
- package/dist/bundle/chunk-SDVUGWD7.js +0 -614
- package/dist/bundle/chunk-SEFE6PGL.js +0 -218
- package/dist/bundle/chunk-SYRDEMQE.js +0 -68141
- package/dist/bundle/chunk-SYYQZDHJ.js +0 -95
- package/dist/bundle/chunk-T3W4V4A6.js +0 -63
- package/dist/bundle/chunk-TCT5D2X2.js +0 -6848
- package/dist/bundle/chunk-TES7MB6I.js +0 -82
- package/dist/bundle/chunk-TXDR6YSF.js +0 -23
- package/dist/bundle/chunk-TY7NDMFY.js +0 -46
- package/dist/bundle/chunk-U6XPWCWM.js +0 -133
- package/dist/bundle/chunk-UFKC7TIX.js +0 -28404
- package/dist/bundle/chunk-UNWF3TH5.js +0 -274
- package/dist/bundle/chunk-W3BOR6AT.js +0 -2333
- package/dist/bundle/chunk-WIHN3ELW.js +0 -2793
- package/dist/bundle/chunk-X76RS6JO.js +0 -1043
- package/dist/bundle/chunk-Y5E2WNWB.js +0 -35
- package/dist/bundle/chunk-YF3S26TS.js +0 -4172
- package/dist/bundle/chunk-ZCQ4H7CA.js +0 -54
- package/dist/bundle/chunk-ZOZV32IR.js +0 -170
- package/dist/bundle/chunk-ZTKHXDEU.js +0 -52
- package/dist/bundle/chunk-ZVVMGPBJ.js +0 -50
- package/dist/bundle/cli-EAD3WZLR.js +0 -1254
- package/dist/bundle/command-contract-SMEJ2ICG.js +0 -40
- package/dist/bundle/command-server-entry-YTZP6I4T.js +0 -169
- package/dist/bundle/decode-57BE5OBT.js +0 -296
- package/dist/bundle/dispatch-56FECRCU.js +0 -411
- package/dist/bundle/dist-PAKDDIBT.js +0 -191
- package/dist/bundle/dist-T54K3FJV.js +0 -7577
- package/dist/bundle/echarts-QMAA7HH5.js +0 -42501
- package/dist/bundle/embed-NFGFYUO4.js +0 -37
- package/dist/bundle/embedder-SRBOJMXX.js +0 -110
- package/dist/bundle/failure-WDSX6H3B.js +0 -24
- package/dist/bundle/first-run-HWRUL2GR.js +0 -28
- package/dist/bundle/first-screen-ATN4D3FQ.js +0 -41
- package/dist/bundle/mcp-5HFPWC3W.js +0 -167
- package/dist/bundle/meeting-combined-BGDEHCWY.js +0 -26
- package/dist/bundle/meeting-model-WWGVRXPL.js +0 -24
- package/dist/bundle/meeting-semantic-ZQ47BL2Z.js +0 -21
- package/dist/bundle/node-P3PUHKYH.js +0 -176
- package/dist/bundle/node-P4E63KXA.js +0 -2340
- package/dist/bundle/node-TLZSIHIJ.js +0 -21
- package/dist/bundle/node-sqlite-JOTSNH3P.js +0 -73
- package/dist/bundle/oauth-XPSAL6VO.js +0 -19
- package/dist/bundle/open-PO52FVA5.js +0 -22
- package/dist/bundle/openai-WITYLMY5.js +0 -237
- package/dist/bundle/process-AFIXYXWL.js +0 -91
- package/dist/bundle/program-JODTZNBZ.js +0 -4920
- package/dist/bundle/prompt-XORLAXHY.js +0 -16
- package/dist/bundle/recognize-JKMZHDYS.js +0 -25
- package/dist/bundle/remote-3IMEJTEH.js +0 -30
- package/dist/bundle/rerank-3F2E6NNN.js +0 -51
- package/dist/bundle/serve-6BWU3NMB.js +0 -198
- package/dist/bundle/server-GPSB5WFG.js +0 -220
- package/dist/bundle/server-HMCC64ZU.js +0 -88
- package/dist/bundle/source-E72OS27D.js +0 -47
- package/dist/bundle/sqlite-runtime-YHYQDUXE.js +0 -19
- package/dist/bundle/state-R7W4U6T4.js +0 -35
- package/dist/bundle/store-HTVRL7FB.js +0 -312
- package/dist/bundle/store-IWW6U6QN.js +0 -34
- package/dist/bundle/store-TBZ3ZS6H.js +0 -186
- package/dist/bundle/store-maintenance-command-CJM2VLMW.js +0 -75
- package/dist/bundle/surface-5GBWNYBE.js +0 -74
- package/dist/bundle/writer-TW2Q55VJ.js +0 -49
- package/dist/commands/account.d.ts +0 -4
- package/dist/commands/account.d.ts.map +0 -1
- package/dist/commands/account.js.map +0 -1
- package/dist/commands/api.d.ts +0 -3
- package/dist/commands/api.d.ts.map +0 -1
- package/dist/commands/api.js.map +0 -1
- package/dist/commands/crm-shared.d.ts +0 -8
- package/dist/commands/crm-shared.d.ts.map +0 -1
- package/dist/commands/crm-shared.js.map +0 -1
- package/dist/commands/schedule.d.ts +0 -3
- package/dist/commands/schedule.d.ts.map +0 -1
- package/dist/commands/schedule.js.map +0 -1
- package/dist/commands/session.d.ts +0 -35
- package/dist/commands/session.d.ts.map +0 -1
- package/dist/commands/session.js.map +0 -1
- package/dist/commands/write.d.ts +0 -14
- package/dist/commands/write.d.ts.map +0 -1
- package/dist/commands/write.js.map +0 -1
- package/dist/config.d.ts +0 -4
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/context.d.ts +0 -62
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js.map +0 -1
- package/dist/crm/activities.d.ts +0 -32
- package/dist/crm/activities.d.ts.map +0 -1
- package/dist/crm/activities.js.map +0 -1
- package/dist/crm/records.d.ts +0 -20
- package/dist/crm/records.d.ts.map +0 -1
- package/dist/crm/records.js.map +0 -1
- package/dist/crm/source.d.ts +0 -41
- package/dist/crm/source.d.ts.map +0 -1
- package/dist/crm/source.js.map +0 -1
- package/dist/crm/writer.d.ts +0 -14
- package/dist/crm/writer.d.ts.map +0 -1
- package/dist/crm/writer.js.map +0 -1
- package/dist/identity.d.ts +0 -7
- package/dist/identity.d.ts.map +0 -1
- package/dist/identity.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/program.d.ts +0 -6
- package/dist/program.d.ts.map +0 -1
- package/dist/program.js.map +0 -1
- package/dist/reasons.d.ts +0 -10
- package/dist/reasons.d.ts.map +0 -1
- package/dist/reasons.js.map +0 -1
- package/dist/setup/flow.d.ts +0 -2
- package/dist/setup/flow.d.ts.map +0 -1
- package/dist/setup/flow.js.map +0 -1
- package/dist/store.d.ts +0 -15
- package/dist/store.d.ts.map +0 -1
- package/dist/store.js.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
- package/dist/wcat.d.ts +0 -3
- package/dist/wcat.d.ts.map +0 -1
- package/dist/wcat.js.map +0 -1
- package/dist/whoami.d.ts +0 -24
- package/dist/whoami.d.ts.map +0 -1
- package/dist/whoami.js.map +0 -1
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
|
|
4
|
-
// node_modules/.pnpm/@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/monthly.js
|
|
5
|
-
import { dirname, join } from "node:path";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
|
-
var CI_PAGE = join(dirname(fileURLToPath(new URL("standards/monthly.js", import.meta.resolve("@wirecat/cli-base")).href)), "../../docs/standards/ci.md");
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
singleLine
|
|
5
|
-
} from "./chunk-S6JG4YUH.js";
|
|
6
|
-
import {
|
|
7
|
-
__name
|
|
8
|
-
} from "./chunk-ZVVMGPBJ.js";
|
|
9
|
-
|
|
10
|
-
// node_modules/.pnpm/@wirecat+cli-base@1.0.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@1.0.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@1.0.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
|
-
};
|
|
@@ -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-ISQ23VKV.js";
|
|
6
|
-
import {
|
|
7
|
-
hasOwnAction,
|
|
8
|
-
isHidden
|
|
9
|
-
} from "./chunk-HUAHLO6N.js";
|
|
10
|
-
import {
|
|
11
|
-
commandPathOf,
|
|
12
|
-
outputOf
|
|
13
|
-
} from "./chunk-U6XPWCWM.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-5SQTHOBI.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@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/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@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/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("session list") ? [["", `${cli} session 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
|
-
};
|