@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.
- package/CHANGELOG.md +33 -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 +3 -5
- package/dist/amo/transport.js +3 -7
- 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-3PYE55JY.js → chunk-3HWD4BKU.js} +4 -6
- package/dist/bundle/{chunk-M6VZXAJC.js → chunk-4EXURQQQ.js} +21 -19
- package/dist/bundle/chunk-AEWYRB6F.js +8 -0
- package/dist/bundle/{chunk-WUFX4TKA.js → chunk-GL7CRTHR.js} +3 -3
- package/dist/bundle/chunk-N2UB32VN.js +76 -0
- package/dist/bundle/{chunk-KZ2FIDI3.js → chunk-PVVSHDMQ.js} +7 -15
- package/dist/bundle/program-SQH3SPOW.js +2352 -0
- package/dist/bundle/{instructions-AMH5RWVJ.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 -8
- 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-EFMUK732.js +0 -41
- package/dist/bundle/all-profiles-PIWUQWBA.js +0 -320
- package/dist/bundle/anthropic-47CMXBPQ.js +0 -90
- package/dist/bundle/app-server-QRBQODF2.js +0 -257
- package/dist/bundle/areas-QVHVU57Z.js +0 -63
- package/dist/bundle/bun-OPDGMZZQ.js +0 -169
- package/dist/bundle/bun-sqlite-7I4X7CZW.js +0 -75
- package/dist/bundle/chunk-2JHVQMVC.js +0 -16
- package/dist/bundle/chunk-2XBDILVW.js +0 -53
- package/dist/bundle/chunk-3DEQUYEG.js +0 -185
- package/dist/bundle/chunk-3GX6KM2E.js +0 -5302
- package/dist/bundle/chunk-3HC5F3P7.js +0 -24
- package/dist/bundle/chunk-3YM4B2GT.js +0 -63
- package/dist/bundle/chunk-43OW5NTG.js +0 -338
- package/dist/bundle/chunk-43PMSR33.js +0 -357
- package/dist/bundle/chunk-4N7PP76S.js +0 -6848
- package/dist/bundle/chunk-4VN7RI4I.js +0 -1718
- package/dist/bundle/chunk-57HFPNMF.js +0 -189
- package/dist/bundle/chunk-5UTB3ADZ.js +0 -360
- package/dist/bundle/chunk-633NQY2R.js +0 -80
- package/dist/bundle/chunk-63N46DJU.js +0 -12278
- package/dist/bundle/chunk-6D4VWSJD.js +0 -259
- package/dist/bundle/chunk-6JTHXWPE.js +0 -64
- package/dist/bundle/chunk-6QGUK3H7.js +0 -161
- package/dist/bundle/chunk-6WS6GJ4V.js +0 -30
- package/dist/bundle/chunk-7IR2G5XY.js +0 -559
- package/dist/bundle/chunk-7IWIFVXH.js +0 -52
- package/dist/bundle/chunk-ABX7BBS4.js +0 -388
- package/dist/bundle/chunk-ADLS6FVG.js +0 -24600
- package/dist/bundle/chunk-ADTI5RUO.js +0 -1007
- package/dist/bundle/chunk-AKRIUNYP.js +0 -1197
- package/dist/bundle/chunk-BIKOE2IW.js +0 -614
- package/dist/bundle/chunk-BVVMIAQ6.js +0 -37727
- package/dist/bundle/chunk-CGW5R4UD.js +0 -362
- package/dist/bundle/chunk-D4NE7EON.js +0 -170
- package/dist/bundle/chunk-D72URWJE.js +0 -532
- package/dist/bundle/chunk-DFDN6AUB.js +0 -21
- package/dist/bundle/chunk-DNCLQPOM.js +0 -7
- package/dist/bundle/chunk-DPV53EZC.js +0 -206
- package/dist/bundle/chunk-DQ6S5TFZ.js +0 -9539
- package/dist/bundle/chunk-DSJ6EAOA.js +0 -4172
- package/dist/bundle/chunk-DVZ75WZJ.js +0 -3752
- package/dist/bundle/chunk-EH6ZEJGT.js +0 -932
- package/dist/bundle/chunk-EHK73OSW.js +0 -2017
- package/dist/bundle/chunk-FNV5HLHX.js +0 -1068
- package/dist/bundle/chunk-FV4GQNIK.js +0 -136
- package/dist/bundle/chunk-G2TU5RYY.js +0 -332
- package/dist/bundle/chunk-GDK7ETSB.js +0 -218
- package/dist/bundle/chunk-GGMAIIVE.js +0 -38
- package/dist/bundle/chunk-GLYWZQY4.js +0 -86
- package/dist/bundle/chunk-H4AFNENN.js +0 -1343
- package/dist/bundle/chunk-HOF7GQWW.js +0 -142
- package/dist/bundle/chunk-HSPEU6S7.js +0 -209
- package/dist/bundle/chunk-IA7LLLEI.js +0 -100
- package/dist/bundle/chunk-IB55P46L.js +0 -334
- package/dist/bundle/chunk-IG2TJQJ7.js +0 -79
- package/dist/bundle/chunk-JG6LCSEX.js +0 -407
- package/dist/bundle/chunk-JLXXUEAM.js +0 -72
- package/dist/bundle/chunk-JXT6GY4V.js +0 -1023
- package/dist/bundle/chunk-K7YY6SXR.js +0 -738
- package/dist/bundle/chunk-KEKXERBE.js +0 -67181
- package/dist/bundle/chunk-KZN2BG3P.js +0 -721
- package/dist/bundle/chunk-LKH3UKLO.js +0 -230
- package/dist/bundle/chunk-LZPKBN3C.js +0 -193
- package/dist/bundle/chunk-MDEPJZYJ.js +0 -106
- package/dist/bundle/chunk-NB7EOAUZ.js +0 -123
- package/dist/bundle/chunk-NISH4UXM.js +0 -58
- package/dist/bundle/chunk-NSKMNIY6.js +0 -460
- package/dist/bundle/chunk-PL5P7UKW.js +0 -25216
- package/dist/bundle/chunk-PPSAWFJD.js +0 -1293
- package/dist/bundle/chunk-Q7ICVP25.js +0 -18
- package/dist/bundle/chunk-QFOP3KUP.js +0 -2603
- package/dist/bundle/chunk-R53XXHEI.js +0 -76
- package/dist/bundle/chunk-RIMPFMZE.js +0 -1251
- package/dist/bundle/chunk-RN6RT5CB.js +0 -58
- package/dist/bundle/chunk-RRTMPSQR.js +0 -29
- package/dist/bundle/chunk-S4ZHQMNM.js +0 -133
- package/dist/bundle/chunk-S6JG4YUH.js +0 -72
- package/dist/bundle/chunk-TAVI73RW.js +0 -288
- package/dist/bundle/chunk-TLG6ECZ2.js +0 -54
- package/dist/bundle/chunk-TXDR6YSF.js +0 -23
- package/dist/bundle/chunk-TY7NDMFY.js +0 -46
- package/dist/bundle/chunk-U5RJJ2EC.js +0 -353
- package/dist/bundle/chunk-UDSL3MUU.js +0 -2333
- package/dist/bundle/chunk-V2CNGXWX.js +0 -798
- package/dist/bundle/chunk-VB7FZOYX.js +0 -633
- package/dist/bundle/chunk-VZ5PPYDG.js +0 -77
- package/dist/bundle/chunk-W5JRXIG6.js +0 -27995
- package/dist/bundle/chunk-WIHN3ELW.js +0 -2793
- package/dist/bundle/chunk-WOPVBRPV.js +0 -29
- package/dist/bundle/chunk-WXJYMMEL.js +0 -95
- package/dist/bundle/chunk-XCCU2E3Z.js +0 -274
- package/dist/bundle/chunk-XEQQJBBO.js +0 -92
- package/dist/bundle/chunk-XUT7DSM5.js +0 -108
- package/dist/bundle/chunk-Y5E2WNWB.js +0 -35
- package/dist/bundle/chunk-YWDFYQOU.js +0 -82
- package/dist/bundle/chunk-ZLUIRFJX.js +0 -780
- package/dist/bundle/chunk-ZVVMGPBJ.js +0 -50
- package/dist/bundle/cli-3NXOSENF.js +0 -1239
- package/dist/bundle/command-contract-LNSAV5LA.js +0 -39
- package/dist/bundle/command-server-entry-4ZQPNUL4.js +0 -168
- package/dist/bundle/decode-K7U7X5EL.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-O3TNDAXJ.js +0 -42501
- package/dist/bundle/embed-SWLVG73O.js +0 -37
- package/dist/bundle/embedder-EJN75BPV.js +0 -110
- package/dist/bundle/failure-WDSX6H3B.js +0 -24
- package/dist/bundle/first-run-WPGUUC4Z.js +0 -28
- package/dist/bundle/first-screen-JMNEUQ46.js +0 -40
- package/dist/bundle/mcp-5HFPWC3W.js +0 -167
- package/dist/bundle/meeting-combined-5TKG2RYD.js +0 -24
- package/dist/bundle/meeting-model-YXXNETKC.js +0 -24
- package/dist/bundle/meeting-semantic-U7EUB3ET.js +0 -21
- package/dist/bundle/node-EGMCBAO7.js +0 -176
- package/dist/bundle/node-P4E63KXA.js +0 -2340
- package/dist/bundle/node-TLZSIHIJ.js +0 -21
- package/dist/bundle/node-sqlite-YVOGMDSP.js +0 -73
- package/dist/bundle/oauth-2SNRBIJM.js +0 -19
- package/dist/bundle/open-ABCPY5IH.js +0 -22
- package/dist/bundle/openai-4D6PXJR7.js +0 -237
- package/dist/bundle/process-SGHEN6MQ.js +0 -91
- package/dist/bundle/program-CBDQBZZ3.js +0 -4971
- package/dist/bundle/prompt-2QUK5QST.js +0 -16
- package/dist/bundle/recognize-QMQSJRIH.js +0 -25
- package/dist/bundle/remote-U7TC2BLZ.js +0 -30
- package/dist/bundle/rerank-5UPVXGVV.js +0 -51
- package/dist/bundle/serve-VX6GUM6J.js +0 -198
- package/dist/bundle/server-FOPC6DJ3.js +0 -219
- package/dist/bundle/server-OIVNOMVK.js +0 -87
- package/dist/bundle/source-HWS5SJIV.js +0 -46
- package/dist/bundle/sqlite-runtime-77NKDEXN.js +0 -19
- package/dist/bundle/state-X2HU6GB2.js +0 -35
- package/dist/bundle/store-2U4U6KL4.js +0 -184
- package/dist/bundle/store-3CHPHFP7.js +0 -301
- package/dist/bundle/store-Z3747L5F.js +0 -34
- package/dist/bundle/store-maintenance-command-UOSZJTVP.js +0 -74
- package/dist/bundle/surface-MUT72QON.js +0 -73
- package/dist/bundle/writer-RBKQ64ZM.js +0 -48
- 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,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
|
-
};
|