@wirecat/attio-cli 0.9.0 → 0.11.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 +23 -0
- package/contracts/wirecat.json +1 -0
- package/dist/bin/attio.js +11 -11
- package/dist/bundle/attio.js +5 -166
- package/dist/bundle/{chunk-6E5QWCBK.js → chunk-OFEXB726.js} +2 -1
- package/dist/bundle/chunk-TQAECZFO.js +13 -0
- package/dist/bundle/{definitions-FODOIPM2.js → definitions-J73IBAHT.js} +1 -1
- package/dist/bundle/program-4R7RYWV3.js +6210 -0
- package/dist/bundle/{schemas-YGSTNU6F.js → schemas-G3HFAS45.js} +576 -29
- package/dist/commands/api.js +1 -2
- package/dist/commands/crm.js +12 -4
- package/dist/commands/schedule.js +1 -1
- package/dist/commands/session.js +1 -2
- package/dist/config.js +1 -2
- package/dist/context.js +1 -1
- package/dist/identity.js +1 -0
- package/dist/program.js +1 -2
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/dist/activities.d.ts +0 -4
- package/dist/activities.d.ts.map +0 -1
- package/dist/activities.js.map +0 -1
- package/dist/bin/attio.d.ts +0 -3
- package/dist/bin/attio.d.ts.map +0 -1
- package/dist/bin/attio.js.map +0 -1
- package/dist/bundle/agent-C3SZOGZS.js +0 -38
- package/dist/bundle/all-profiles-673VSTRG.js +0 -320
- package/dist/bundle/anthropic-V4RZS5XM.js +0 -91
- package/dist/bundle/app-server-CTEDPA5H.js +0 -249
- package/dist/bundle/bun-F4M4KCNA.js +0 -169
- package/dist/bundle/bun-sqlite-33JTNHCK.js +0 -76
- package/dist/bundle/chunk-2R2EX5I6.js +0 -54
- package/dist/bundle/chunk-5EH7S4RM.js +0 -362
- package/dist/bundle/chunk-5N2V6XO7.js +0 -119
- package/dist/bundle/chunk-5WY6RURV.js +0 -161
- package/dist/bundle/chunk-6V7ZUJI6.js +0 -4072
- package/dist/bundle/chunk-AOKAYQSJ.js +0 -2338
- package/dist/bundle/chunk-AQ5RIOUE.js +0 -633
- package/dist/bundle/chunk-B4DVW2BA.js +0 -185
- package/dist/bundle/chunk-C7JPYWYQ.js +0 -77
- package/dist/bundle/chunk-D72URWJE.js +0 -532
- package/dist/bundle/chunk-DBHZ7TQ7.js +0 -69828
- 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-E2L4R6EI.js +0 -388
- package/dist/bundle/chunk-EDWRHVHD.js +0 -218
- package/dist/bundle/chunk-EH6ZEJGT.js +0 -932
- package/dist/bundle/chunk-EV6B3GHM.js +0 -323
- package/dist/bundle/chunk-FBWECICU.js +0 -259
- package/dist/bundle/chunk-FFER7KJI.js +0 -407
- package/dist/bundle/chunk-FTH6WGYO.js +0 -24
- package/dist/bundle/chunk-G3PK5BZB.js +0 -1222
- package/dist/bundle/chunk-G46PNDWL.js +0 -58
- package/dist/bundle/chunk-G6NY7LFB.js +0 -230
- package/dist/bundle/chunk-GLU36VKA.js +0 -52
- package/dist/bundle/chunk-GZ7WBU5Y.js +0 -18
- package/dist/bundle/chunk-HMYBAVIE.js +0 -86
- package/dist/bundle/chunk-HOJJPSLU.js +0 -288
- package/dist/bundle/chunk-HUAHLO6N.js +0 -29
- package/dist/bundle/chunk-ISQ23VKV.js +0 -123
- package/dist/bundle/chunk-J2LSOG3A.js +0 -12766
- package/dist/bundle/chunk-K5L77R7P.js +0 -66
- package/dist/bundle/chunk-KKRFVN4X.js +0 -1835
- package/dist/bundle/chunk-KLRCTMES.js +0 -100
- package/dist/bundle/chunk-KYRYD4CR.js +0 -38
- package/dist/bundle/chunk-L5QLKUQR.js +0 -794
- package/dist/bundle/chunk-MFSWMNSZ.js +0 -334
- package/dist/bundle/chunk-MYK2F5LD.js +0 -1251
- package/dist/bundle/chunk-NBNQLNVV.js +0 -388
- package/dist/bundle/chunk-O3DZDITT.js +0 -274
- package/dist/bundle/chunk-OEEWVKJX.js +0 -53
- package/dist/bundle/chunk-P5XYQZVW.js +0 -80
- package/dist/bundle/chunk-P6OJKJJS.js +0 -1197
- package/dist/bundle/chunk-P6S3ZRVW.js +0 -106
- package/dist/bundle/chunk-PL5P7UKW.js +0 -25216
- package/dist/bundle/chunk-QBJRK733.js +0 -1068
- package/dist/bundle/chunk-QBYE26ZC.js +0 -131
- package/dist/bundle/chunk-QPPOIWPY.js +0 -1246
- package/dist/bundle/chunk-R2CEA7MK.js +0 -743
- package/dist/bundle/chunk-S4UUN6LD.js +0 -1410
- package/dist/bundle/chunk-S6JG4YUH.js +0 -72
- package/dist/bundle/chunk-SKUY7JDA.js +0 -164
- package/dist/bundle/chunk-T35IOBPJ.js +0 -1341
- package/dist/bundle/chunk-T3W4V4A6.js +0 -63
- package/dist/bundle/chunk-TB3LN5G2.js +0 -50
- 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-U7UTYALA.js +0 -353
- package/dist/bundle/chunk-UOWHMOU3.js +0 -188
- package/dist/bundle/chunk-UXDUWGX6.js +0 -2791
- package/dist/bundle/chunk-V5I3QHDU.js +0 -558
- package/dist/bundle/chunk-VCDIKCFE.js +0 -1007
- package/dist/bundle/chunk-VJHUMB7U.js +0 -338
- package/dist/bundle/chunk-W4KLHM2K.js +0 -95
- package/dist/bundle/chunk-W5LKEOGN.js +0 -142
- package/dist/bundle/chunk-WLDZWHSF.js +0 -170
- package/dist/bundle/chunk-WQEEYEWO.js +0 -3752
- package/dist/bundle/chunk-WRF6TY63.js +0 -1521
- package/dist/bundle/chunk-WXYOELRI.js +0 -108
- package/dist/bundle/chunk-WZBPUOWM.js +0 -76
- package/dist/bundle/chunk-XGNZD52X.js +0 -592
- package/dist/bundle/chunk-XQUUANA2.js +0 -24600
- package/dist/bundle/chunk-Y5E2WNWB.js +0 -35
- package/dist/bundle/chunk-YQH4J6YZ.js +0 -358
- package/dist/bundle/chunk-Z7Y2I5YR.js +0 -44045
- package/dist/bundle/chunk-ZBCC7MBN.js +0 -9671
- package/dist/bundle/chunk-ZVVMGPBJ.js +0 -50
- package/dist/bundle/command-contract-ZL67KMYL.js +0 -37
- package/dist/bundle/command-server-entry-COR2VDRU.js +0 -166
- package/dist/bundle/decode-33SGRQM6.js +0 -297
- package/dist/bundle/dispatch-2FTOHA5D.js +0 -411
- package/dist/bundle/dist-EM7KLEG4.js +0 -7577
- package/dist/bundle/dist-PAKDDIBT.js +0 -191
- package/dist/bundle/echarts-QMAA7HH5.js +0 -42501
- package/dist/bundle/embed-W4ZBXPWD.js +0 -38
- package/dist/bundle/embedder-73CCZC52.js +0 -111
- package/dist/bundle/failure-OHIXWTR6.js +0 -25
- package/dist/bundle/first-run-MOSUMMVX.js +0 -28
- package/dist/bundle/first-screen-GUXBF3SL.js +0 -38
- package/dist/bundle/instructions-4H7UREH2.js +0 -11
- package/dist/bundle/mcp-5HFPWC3W.js +0 -167
- package/dist/bundle/meeting-combined-QMIZOBBJ.js +0 -24
- package/dist/bundle/meeting-model-2UYVGXD5.js +0 -25
- package/dist/bundle/meeting-semantic-LEJPUIN3.js +0 -22
- package/dist/bundle/node-KM3CUABH.js +0 -2340
- package/dist/bundle/node-P3PUHKYH.js +0 -176
- package/dist/bundle/node-TLZSIHIJ.js +0 -21
- package/dist/bundle/node-sqlite-UHPODTKB.js +0 -74
- package/dist/bundle/oauth-T3DWL7OV.js +0 -20
- package/dist/bundle/open-ODWX32PF.js +0 -23
- package/dist/bundle/openai-GSXXHKPX.js +0 -238
- package/dist/bundle/process-AFIXYXWL.js +0 -91
- package/dist/bundle/program-SXSUG335.js +0 -35250
- package/dist/bundle/prompt-GVTYTFK7.js +0 -17
- package/dist/bundle/recognize-XDSZEZP5.js +0 -26
- package/dist/bundle/remote-ZWZKMEY6.js +0 -31
- package/dist/bundle/rerank-OBZQ54NL.js +0 -52
- package/dist/bundle/serve-NY5MUTNW.js +0 -199
- package/dist/bundle/server-JK334V5Y.js +0 -212
- package/dist/bundle/server-VOPYQCUD.js +0 -79
- package/dist/bundle/sqlite-runtime-2NHF4S6G.js +0 -20
- package/dist/bundle/state-YGWZZWPM.js +0 -36
- package/dist/bundle/store-LRQUTFJR.js +0 -306
- package/dist/bundle/store-ND6KU4RI.js +0 -181
- package/dist/bundle/store-maintenance-command-GLYGQM2V.js +0 -66
- package/dist/bundle/surface-P53WLLXP.js +0 -65
- package/dist/commands/api.d.ts +0 -12
- package/dist/commands/api.d.ts.map +0 -1
- package/dist/commands/api.js.map +0 -1
- package/dist/commands/crm.d.ts +0 -7
- package/dist/commands/crm.d.ts.map +0 -1
- package/dist/commands/crm.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 -8
- package/dist/commands/session.d.ts.map +0 -1
- package/dist/commands/session.js.map +0 -1
- package/dist/config.d.ts +0 -13
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/context.d.ts +0 -37
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js.map +0 -1
- package/dist/generated/definitions.d.ts +0 -3
- package/dist/generated/definitions.d.ts.map +0 -1
- package/dist/generated/definitions.js.map +0 -1
- package/dist/generated/manifest.d.ts +0 -6
- package/dist/generated/manifest.d.ts.map +0 -1
- package/dist/generated/manifest.js.map +0 -1
- package/dist/generated/schemas.d.ts +0 -383
- package/dist/generated/schemas.d.ts.map +0 -1
- package/dist/generated/schemas.js.map +0 -1
- package/dist/generated/types.d.ts +0 -10166
- package/dist/generated/types.d.ts.map +0 -1
- package/dist/generated/types.js.map +0 -1
- package/dist/generated/wirecat-config.d.ts +0 -15
- package/dist/generated/wirecat-config.d.ts.map +0 -1
- package/dist/generated/wirecat-config.js.map +0 -1
- package/dist/hooks.d.ts +0 -33
- package/dist/hooks.d.ts.map +0 -1
- package/dist/hooks.js.map +0 -1
- package/dist/identity.d.ts +0 -33
- 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/links.d.ts +0 -10
- package/dist/links.d.ts.map +0 -1
- package/dist/links.js.map +0 -1
- package/dist/meetings.d.ts +0 -57
- package/dist/meetings.d.ts.map +0 -1
- package/dist/meetings.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/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
|
@@ -1,411 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
require_cross_spawn
|
|
5
|
-
} from "./chunk-D72URWJE.js";
|
|
6
|
-
import {
|
|
7
|
-
BUILT_IN_COMMANDS,
|
|
8
|
-
DESCRIBE_FLAG,
|
|
9
|
-
DESCRIBE_MAX_BYTES,
|
|
10
|
-
FIRST_PARTY_TOOLS,
|
|
11
|
-
PROGRAM_PREFIX,
|
|
12
|
-
TOOL_NAME,
|
|
13
|
-
fileState,
|
|
14
|
-
parseDescribe,
|
|
15
|
-
shimFiles,
|
|
16
|
-
writeShim
|
|
17
|
-
} from "./chunk-DPV53EZC.js";
|
|
18
|
-
import "./chunk-Y5E2WNWB.js";
|
|
19
|
-
import {
|
|
20
|
-
CliError
|
|
21
|
-
} from "./chunk-S6JG4YUH.js";
|
|
22
|
-
import {
|
|
23
|
-
__name,
|
|
24
|
-
__toESM
|
|
25
|
-
} from "./chunk-ZVVMGPBJ.js";
|
|
26
|
-
|
|
27
|
-
// 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/dispatch.js
|
|
28
|
-
var import_cross_spawn2 = __toESM(require_cross_spawn(), 1);
|
|
29
|
-
import { randomUUID } from "node:crypto";
|
|
30
|
-
import { constants } from "node:os";
|
|
31
|
-
|
|
32
|
-
// 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/path.js
|
|
33
|
-
import { readdirSync, statSync } from "node:fs";
|
|
34
|
-
import { join } from "node:path";
|
|
35
|
-
var variable = /* @__PURE__ */ __name((env, name, platform) => platform === "win32" ? Object.entries(env).find(([key]) => key.toUpperCase() === name)?.[1] : env[name], "variable");
|
|
36
|
-
var pathEntries = /* @__PURE__ */ __name(({ env, platform }) => {
|
|
37
|
-
const raw = variable(env, "PATH", platform) ?? "";
|
|
38
|
-
const entries = raw.split(platform === "win32" ? ";" : ":").map((entry) => entry.replace(/^"(.*)"$/, "$1"));
|
|
39
|
-
const seen = /* @__PURE__ */ new Set();
|
|
40
|
-
return entries.filter((entry) => {
|
|
41
|
-
const key = platform === "win32" ? entry.toLowerCase().replace(/[\\/]+$/, "") : entry.replace(/\/+$/, "");
|
|
42
|
-
if (entry === "" || seen.has(key))
|
|
43
|
-
return false;
|
|
44
|
-
seen.add(key);
|
|
45
|
-
return true;
|
|
46
|
-
});
|
|
47
|
-
}, "pathEntries");
|
|
48
|
-
var programExtensions = /* @__PURE__ */ __name(({ env, platform }) => platform === "win32" ? (variable(env, "PATHEXT", platform) ?? ".COM;.EXE;.BAT;.CMD").split(";").filter((ext) => /^\.[a-z0-9]+$/i.test(ext)).map((ext) => ext.toLowerCase()) : [""], "programExtensions");
|
|
49
|
-
var isProgram = /* @__PURE__ */ __name((path, platform) => {
|
|
50
|
-
try {
|
|
51
|
-
const stat = statSync(path);
|
|
52
|
-
return stat.isFile() && (platform === "win32" || (stat.mode & 73) !== 0);
|
|
53
|
-
} catch {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
}, "isProgram");
|
|
57
|
-
var findOnPath = /* @__PURE__ */ __name((command, search) => {
|
|
58
|
-
const extensions = programExtensions(search);
|
|
59
|
-
return pathEntries(search).flatMap((dir) => {
|
|
60
|
-
for (const extension of extensions) {
|
|
61
|
-
const path = join(dir, command + extension);
|
|
62
|
-
if (isProgram(path, search.platform))
|
|
63
|
-
return [path];
|
|
64
|
-
}
|
|
65
|
-
return [];
|
|
66
|
-
});
|
|
67
|
-
}, "findOnPath");
|
|
68
|
-
var findTools = /* @__PURE__ */ __name((search) => {
|
|
69
|
-
const extensions = programExtensions(search);
|
|
70
|
-
const tools = /* @__PURE__ */ new Map();
|
|
71
|
-
for (const dir of pathEntries(search)) {
|
|
72
|
-
let files;
|
|
73
|
-
try {
|
|
74
|
-
files = readdirSync(dir);
|
|
75
|
-
} catch {
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
const here = /* @__PURE__ */ new Map();
|
|
79
|
-
for (const file of files) {
|
|
80
|
-
if (!(search.platform === "win32" ? file.toLowerCase() : file).startsWith(PROGRAM_PREFIX))
|
|
81
|
-
continue;
|
|
82
|
-
const extension = extensions.find((ext) => ext !== "" && file.toLowerCase().endsWith(ext)) ?? "";
|
|
83
|
-
if (search.platform === "win32" && extension === "")
|
|
84
|
-
continue;
|
|
85
|
-
const base = search.platform === "win32" ? file.toLowerCase() : file;
|
|
86
|
-
const name = base.slice(PROGRAM_PREFIX.length, base.length - extension.length);
|
|
87
|
-
if (!TOOL_NAME.test(name))
|
|
88
|
-
continue;
|
|
89
|
-
const best = here.get(name);
|
|
90
|
-
const rank = /* @__PURE__ */ __name((path2) => extensions.findIndex((ext) => path2.toLowerCase().endsWith(ext)), "rank");
|
|
91
|
-
const path = join(dir, file);
|
|
92
|
-
if (best !== void 0 && rank(best) <= rank(path))
|
|
93
|
-
continue;
|
|
94
|
-
if (isProgram(path, search.platform))
|
|
95
|
-
here.set(name, path);
|
|
96
|
-
}
|
|
97
|
-
for (const [name, path] of here)
|
|
98
|
-
tools.set(name, [...tools.get(name) ?? [], path]);
|
|
99
|
-
}
|
|
100
|
-
return new Map([...tools].sort(([a], [b]) => a < b ? -1 : 1));
|
|
101
|
-
}, "findTools");
|
|
102
|
-
var isBuiltIn = /* @__PURE__ */ __name((name) => name === "wcat" || BUILT_IN_COMMANDS.includes(name), "isBuiltIn");
|
|
103
|
-
|
|
104
|
-
// 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/probe.js
|
|
105
|
-
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
106
|
-
import { readFileSync } from "node:fs";
|
|
107
|
-
var probeDescribe = /* @__PURE__ */ __name((path, { env, timeoutMs }) => new Promise((resolve) => {
|
|
108
|
-
let child;
|
|
109
|
-
try {
|
|
110
|
-
child = (0, import_cross_spawn.default)(path, [DESCRIBE_FLAG], { stdio: ["ignore", "pipe", "ignore"], env, windowsHide: true });
|
|
111
|
-
} catch {
|
|
112
|
-
resolve(void 0);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
const chunks = [];
|
|
116
|
-
let size = 0;
|
|
117
|
-
let settled = false;
|
|
118
|
-
const settle = /* @__PURE__ */ __name((answer) => {
|
|
119
|
-
if (settled)
|
|
120
|
-
return;
|
|
121
|
-
settled = true;
|
|
122
|
-
clearTimeout(timer);
|
|
123
|
-
resolve(answer);
|
|
124
|
-
}, "settle");
|
|
125
|
-
const giveUp = /* @__PURE__ */ __name(() => {
|
|
126
|
-
child.kill();
|
|
127
|
-
child.stdout?.destroy();
|
|
128
|
-
child.unref();
|
|
129
|
-
settle(void 0);
|
|
130
|
-
}, "giveUp");
|
|
131
|
-
const timer = setTimeout(giveUp, timeoutMs);
|
|
132
|
-
child.stdout?.on("data", (chunk) => {
|
|
133
|
-
size += chunk.length;
|
|
134
|
-
if (size > DESCRIBE_MAX_BYTES)
|
|
135
|
-
giveUp();
|
|
136
|
-
else
|
|
137
|
-
chunks.push(chunk);
|
|
138
|
-
});
|
|
139
|
-
child.once("error", () => settle(void 0));
|
|
140
|
-
child.once("close", (code) => settle(code === 0 ? parseDescribe(Buffer.concat(chunks).toString("utf8")) : void 0));
|
|
141
|
-
}), "probeDescribe");
|
|
142
|
-
var baseVersion = /* @__PURE__ */ __name(() => {
|
|
143
|
-
try {
|
|
144
|
-
const raw = readFileSync(new URL("../../package.json", new URL("wcat/probe.js", import.meta.resolve("@wirecat/cli-base")).href), "utf8");
|
|
145
|
-
const { name, version } = JSON.parse(raw);
|
|
146
|
-
return name === "@wirecat/cli-base" && typeof version === "string" ? version : "unknown";
|
|
147
|
-
} catch {
|
|
148
|
-
return "unknown";
|
|
149
|
-
}
|
|
150
|
-
}, "baseVersion");
|
|
151
|
-
|
|
152
|
-
// 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/shortcuts.js
|
|
153
|
-
import { closeSync, openSync, readSync, realpathSync, rmSync } from "node:fs";
|
|
154
|
-
import { basename, dirname } from "node:path";
|
|
155
|
-
var WIRECAT_PACKAGE = /node_modules[\\/]+@wirecat[\\/]/;
|
|
156
|
-
var isWirecatPackage = /* @__PURE__ */ __name((path) => {
|
|
157
|
-
try {
|
|
158
|
-
if (WIRECAT_PACKAGE.test(realpathSync(path)))
|
|
159
|
-
return true;
|
|
160
|
-
const buffer = Buffer.alloc(16 * 1024);
|
|
161
|
-
const fd = openSync(path, "r");
|
|
162
|
-
try {
|
|
163
|
-
const read = readSync(fd, buffer, 0, buffer.length, 0);
|
|
164
|
-
return WIRECAT_PACKAGE.test(buffer.subarray(0, read).toString("latin1"));
|
|
165
|
-
} finally {
|
|
166
|
-
closeSync(fd);
|
|
167
|
-
}
|
|
168
|
-
} catch {
|
|
169
|
-
return false;
|
|
170
|
-
}
|
|
171
|
-
}, "isWirecatPackage");
|
|
172
|
-
var ourShortcut = /* @__PURE__ */ __name((path) => {
|
|
173
|
-
const state = fileState(path);
|
|
174
|
-
return state.state === "ours" && state.mark.kind === "shortcut";
|
|
175
|
-
}, "ourShortcut");
|
|
176
|
-
var statusOf = /* @__PURE__ */ __name((name, program, search) => {
|
|
177
|
-
const files = shimFiles("shortcut", {
|
|
178
|
-
dir: dirname(program),
|
|
179
|
-
name,
|
|
180
|
-
target: basename(program),
|
|
181
|
-
platform: search.platform
|
|
182
|
-
});
|
|
183
|
-
const named = findOnPath(name, search);
|
|
184
|
-
const made = [...files.map((file) => file.path), ...named].find(ourShortcut);
|
|
185
|
-
if (made)
|
|
186
|
-
return { name, status: "made", path: made, program };
|
|
187
|
-
const first = named[0];
|
|
188
|
-
if (first === void 0)
|
|
189
|
-
return { name, status: "free", program };
|
|
190
|
-
return { name, status: isWirecatPackage(first) ? "package" : "taken", path: first, program };
|
|
191
|
-
}, "statusOf");
|
|
192
|
-
var changeFile = /* @__PURE__ */ __name((path, change) => {
|
|
193
|
-
try {
|
|
194
|
-
change();
|
|
195
|
-
} catch (error) {
|
|
196
|
-
throw new CliError("permission_error", `could not change ${path}: ${error.code ?? error}`, {
|
|
197
|
-
reason: "access.denied"
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
}, "changeFile");
|
|
201
|
-
var installedPrograms = /* @__PURE__ */ __name((search) => new Map([...findTools(search)].filter(([name]) => !isBuiltIn(name))), "installedPrograms");
|
|
202
|
-
var chosen = /* @__PURE__ */ __name((names, search) => {
|
|
203
|
-
const installed = installedPrograms(search);
|
|
204
|
-
if (names === void 0 || names.length === 0)
|
|
205
|
-
return [...installed].map(([name, paths]) => [name, paths[0]]);
|
|
206
|
-
const missing = names.filter((name) => !installed.has(name));
|
|
207
|
-
if (missing.length > 0)
|
|
208
|
-
throw new CliError("not_found", `not installed: ${missing.map((name) => `wcat-${name}`).join(", ")}`, {
|
|
209
|
-
reason: "tool.not-installed",
|
|
210
|
-
tool: missing[0],
|
|
211
|
-
installed: [...installed.keys()]
|
|
212
|
-
});
|
|
213
|
-
return [...new Set(names)].map((name) => [name, installed.get(name)[0]]);
|
|
214
|
-
}, "chosen");
|
|
215
|
-
var listShortcuts = /* @__PURE__ */ __name((search, names) => chosen(names, search).map(([name, program]) => statusOf(name, program, search)), "listShortcuts");
|
|
216
|
-
var addShortcuts = /* @__PURE__ */ __name((search, names) => listShortcuts(search, names).map((shortcut) => {
|
|
217
|
-
if (shortcut.status !== "free")
|
|
218
|
-
return { ...shortcut, changed: false };
|
|
219
|
-
const files = shimFiles("shortcut", {
|
|
220
|
-
dir: dirname(shortcut.program),
|
|
221
|
-
name: shortcut.name,
|
|
222
|
-
target: basename(shortcut.program),
|
|
223
|
-
platform: search.platform
|
|
224
|
-
});
|
|
225
|
-
for (const file of files)
|
|
226
|
-
changeFile(file.path, () => writeShim(file));
|
|
227
|
-
return { ...shortcut, status: "made", path: files[0]?.path, changed: true };
|
|
228
|
-
}), "addShortcuts");
|
|
229
|
-
var removeShortcuts = /* @__PURE__ */ __name((search, names) => listShortcuts(search, names).map((shortcut) => {
|
|
230
|
-
if (shortcut.status !== "made")
|
|
231
|
-
return { ...shortcut, changed: false };
|
|
232
|
-
const files = shimFiles("shortcut", {
|
|
233
|
-
dir: dirname(shortcut.path),
|
|
234
|
-
name: shortcut.name,
|
|
235
|
-
target: basename(shortcut.program),
|
|
236
|
-
platform: search.platform
|
|
237
|
-
});
|
|
238
|
-
for (const file of files)
|
|
239
|
-
if (ourShortcut(file.path))
|
|
240
|
-
changeFile(file.path, () => rmSync(file.path, { force: true }));
|
|
241
|
-
return { ...statusOf(shortcut.name, shortcut.program, search), changed: true };
|
|
242
|
-
}), "removeShortcuts");
|
|
243
|
-
|
|
244
|
-
// 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/dispatch.js
|
|
245
|
-
var DEFAULT_DESCRIBE_TIMEOUT_MS = 2e3;
|
|
246
|
-
var listTools = /* @__PURE__ */ __name(async (context) => {
|
|
247
|
-
const installed = installedPrograms(context);
|
|
248
|
-
const timeoutMs = context.describeTimeoutMs ?? DEFAULT_DESCRIBE_TIMEOUT_MS;
|
|
249
|
-
const found = await Promise.all([...installed].map(async ([name, paths]) => {
|
|
250
|
-
const [path, ...shadowed] = paths;
|
|
251
|
-
const own = context.self?.command === name ? context.self : void 0;
|
|
252
|
-
const described = own ?? await probeDescribe(path, { env: context.env, timeoutMs });
|
|
253
|
-
return {
|
|
254
|
-
name,
|
|
255
|
-
installed: true,
|
|
256
|
-
path,
|
|
257
|
-
...described?.version ? { version: described.version } : {},
|
|
258
|
-
...described?.description ? { description: described.description } : {},
|
|
259
|
-
...described?.docs ? { docs_url: described.docs } : {},
|
|
260
|
-
...shadowed.length > 0 ? { shadowed } : {}
|
|
261
|
-
};
|
|
262
|
-
}));
|
|
263
|
-
const missing = FIRST_PARTY_TOOLS.filter((tool) => tool.package && !installed.has(tool.name)).map((tool) => ({
|
|
264
|
-
name: tool.name,
|
|
265
|
-
installed: false,
|
|
266
|
-
package: tool.package,
|
|
267
|
-
install: `npm install -g ${tool.package}`
|
|
268
|
-
}));
|
|
269
|
-
return [...found, ...missing];
|
|
270
|
-
}, "listTools");
|
|
271
|
-
var envelope = /* @__PURE__ */ __name((items, started) => ({
|
|
272
|
-
items,
|
|
273
|
-
page: { mode: "page", limit: Math.max(items.length, 1), has_more: false },
|
|
274
|
-
meta: { run_id: randomUUID(), duration_ms: Math.max(0, Math.round(performance.now() - started)), complete: true }
|
|
275
|
-
}), "envelope");
|
|
276
|
-
var column = /* @__PURE__ */ __name((rows) => {
|
|
277
|
-
const widths = rows[0]?.map((_, at) => rows.reduce((wide, row) => Math.max(wide, (row[at] ?? "").length), 0)) ?? [];
|
|
278
|
-
return rows.map((row) => ` ${row.map((cell, at) => cell.padEnd(widths[at] ?? 0)).join(" ")}`.trimEnd());
|
|
279
|
-
}, "column");
|
|
280
|
-
var USAGE = [
|
|
281
|
-
"wcat <tool> [arguments] run a tool: wcat tg --help",
|
|
282
|
-
"wcat shortcuts [add|remove] [tool...] short names, such as tg, for installed tools",
|
|
283
|
-
"wcat --json the list below as JSON"
|
|
284
|
-
];
|
|
285
|
-
var listText = /* @__PURE__ */ __name((tools) => {
|
|
286
|
-
const installed = tools.filter((tool) => tool.installed);
|
|
287
|
-
const missing = tools.filter((tool) => !tool.installed);
|
|
288
|
-
return [
|
|
289
|
-
"wcat runs WireCat tools, and any other wcat-<name> program on PATH.",
|
|
290
|
-
"",
|
|
291
|
-
...USAGE,
|
|
292
|
-
"",
|
|
293
|
-
installed.length > 0 ? "Installed:" : "Installed: none",
|
|
294
|
-
...column(installed.map((tool) => [tool.name, tool.version ?? "", tool.description ?? "(no description)"])),
|
|
295
|
-
...missing.length > 0 ? ["", "Not installed:", ...column(missing.map((tool) => [tool.name, tool.install ?? ""]))] : [],
|
|
296
|
-
""
|
|
297
|
-
].join("\n");
|
|
298
|
-
}, "listText");
|
|
299
|
-
var shadowWarnings = /* @__PURE__ */ __name((tools) => tools.filter((tool) => tool.shadowed).map((tool) => `wcat: ${(tool.shadowed?.length ?? 0) + 1} programs are named ${PROGRAM_PREFIX}${tool.name}; wcat runs the first:
|
|
300
|
-
${[tool.path, ...tool.shadowed ?? []].map((path) => ` ${path}`).join("\n")}
|
|
301
|
-
`).join(""), "shadowWarnings");
|
|
302
|
-
var shortcutText = /* @__PURE__ */ __name((shortcuts2) => {
|
|
303
|
-
if (shortcuts2.length === 0)
|
|
304
|
-
return "No wcat-<name> programs are installed.\n";
|
|
305
|
-
const said = /* @__PURE__ */ __name((shortcut) => {
|
|
306
|
-
switch (shortcut.status) {
|
|
307
|
-
case "made":
|
|
308
|
-
return `made: ${shortcut.path}`;
|
|
309
|
-
case "free":
|
|
310
|
-
return shortcut.changed ? "removed" : "free: wcat shortcuts add makes it";
|
|
311
|
-
case "package":
|
|
312
|
-
return `installed by the package: ${shortcut.path}`;
|
|
313
|
-
case "taken":
|
|
314
|
-
return `taken by ${shortcut.path}`;
|
|
315
|
-
}
|
|
316
|
-
}, "said");
|
|
317
|
-
return `${column(shortcuts2.map((shortcut) => [shortcut.name, said(shortcut)])).join("\n")}
|
|
318
|
-
`;
|
|
319
|
-
}, "shortcutText");
|
|
320
|
-
var signalNumber = /* @__PURE__ */ __name((signal) => constants.signals[signal] ?? 1, "signalNumber");
|
|
321
|
-
var runTool = /* @__PURE__ */ __name((path, args, context) => new Promise((resolve, reject) => {
|
|
322
|
-
const signals = context.signals ?? process;
|
|
323
|
-
const child = (0, import_cross_spawn2.default)(path, [...args], { stdio: "inherit", env: context.env });
|
|
324
|
-
const pass = /* @__PURE__ */ __name((signal) => () => child.kill(signal), "pass");
|
|
325
|
-
const term = pass("SIGTERM");
|
|
326
|
-
const hup = pass("SIGHUP");
|
|
327
|
-
const ignore = /* @__PURE__ */ __name(() => {
|
|
328
|
-
}, "ignore");
|
|
329
|
-
signals.on("SIGTERM", term).on("SIGHUP", hup).on("SIGINT", ignore);
|
|
330
|
-
const done = /* @__PURE__ */ __name(() => signals.off("SIGTERM", term).off("SIGHUP", hup).off("SIGINT", ignore), "done");
|
|
331
|
-
child.once("error", (error) => {
|
|
332
|
-
done();
|
|
333
|
-
reject(new CliError("configuration_error", `could not start ${path}: ${error.message}`));
|
|
334
|
-
});
|
|
335
|
-
child.once("exit", (code, signal) => {
|
|
336
|
-
done();
|
|
337
|
-
resolve(code ?? (signal ? 128 + signalNumber(signal) : 1));
|
|
338
|
-
});
|
|
339
|
-
}), "runTool");
|
|
340
|
-
var fail = /* @__PURE__ */ __name(async (error, json, context) => {
|
|
341
|
-
const { errorObjectOf, exitCodeOfError, renderError } = await import("./failure-OHIXWTR6.js");
|
|
342
|
-
const object = errorObjectOf(error);
|
|
343
|
-
context.stderr.write(`${renderError(object, { cli: "wcat", interactive: !json })}
|
|
344
|
-
`);
|
|
345
|
-
return exitCodeOfError(object);
|
|
346
|
-
}, "fail");
|
|
347
|
-
var shortcuts = /* @__PURE__ */ __name(async (args, json, context) => {
|
|
348
|
-
const [action, ...names] = args;
|
|
349
|
-
const started = performance.now();
|
|
350
|
-
const result = action === "add" ? addShortcuts(context, names) : action === "remove" ? removeShortcuts(context, names) : action === void 0 || action === "list" ? listShortcuts(context, names) : void 0;
|
|
351
|
-
if (result === void 0)
|
|
352
|
-
throw new CliError("validation_error", `wcat shortcuts takes list, add or remove, not "${action}"`, {
|
|
353
|
-
reason: "input.invalid"
|
|
354
|
-
});
|
|
355
|
-
context.stdout.write(json ? `${JSON.stringify(envelope(result, started))}
|
|
356
|
-
` : shortcutText(result));
|
|
357
|
-
return 0;
|
|
358
|
-
}, "shortcuts");
|
|
359
|
-
var runWcat = /* @__PURE__ */ __name(async (args, context) => {
|
|
360
|
-
const [first, ...rest] = args;
|
|
361
|
-
const json = args.includes("--json");
|
|
362
|
-
const words = args.filter((word) => word !== "--json");
|
|
363
|
-
const started = performance.now();
|
|
364
|
-
try {
|
|
365
|
-
if (first === "--version" || first === "-V" || first === "version") {
|
|
366
|
-
const tools = await listTools(context);
|
|
367
|
-
const by = context.self ? `, run by ${PROGRAM_PREFIX}${context.self.command} ${context.self.version}` : "";
|
|
368
|
-
context.stdout.write(`wcat ${baseVersion()} (@wirecat/cli-base${by})
|
|
369
|
-
|
|
370
|
-
${listText(tools)}`);
|
|
371
|
-
return 0;
|
|
372
|
-
}
|
|
373
|
-
if (words.length === 0 || first === "--help" || first === "-h" || first === "help") {
|
|
374
|
-
const tools = await listTools(context);
|
|
375
|
-
if (json)
|
|
376
|
-
context.stdout.write(`${JSON.stringify(envelope(tools, started))}
|
|
377
|
-
`);
|
|
378
|
-
else {
|
|
379
|
-
context.stderr.write(shadowWarnings(tools));
|
|
380
|
-
context.stdout.write(listText(tools));
|
|
381
|
-
}
|
|
382
|
-
return 0;
|
|
383
|
-
}
|
|
384
|
-
if (first === "shortcuts")
|
|
385
|
-
return await shortcuts(words.slice(1), json, context);
|
|
386
|
-
if (BUILT_IN_COMMANDS.includes(first))
|
|
387
|
-
throw new CliError("validation_error", `wcat ${first} is reserved for a later version of wcat`, {
|
|
388
|
-
reason: "input.invalid"
|
|
389
|
-
});
|
|
390
|
-
if (first?.startsWith("-"))
|
|
391
|
-
throw new CliError("validation_error", `wcat does not take ${first} before a tool's name`, {
|
|
392
|
-
reason: "input.invalid"
|
|
393
|
-
});
|
|
394
|
-
const name = first;
|
|
395
|
-
const [path, ...shadowed] = TOOL_NAME.test(name) ? findOnPath(`${PROGRAM_PREFIX}${name}`, context) : [];
|
|
396
|
-
if (path === void 0) {
|
|
397
|
-
const installed = [...installedPrograms(context).keys()];
|
|
398
|
-
throw new CliError("not_found", `no ${PROGRAM_PREFIX}${name} on PATH; installed: ${installed.length > 0 ? installed.join(", ") : "none"}`, { reason: "tool.not-installed", tool: name, installed });
|
|
399
|
-
}
|
|
400
|
-
if (shadowed.length > 0 && context.stderr.isTTY)
|
|
401
|
-
context.stderr.write(shadowWarnings([{ name, installed: true, path, shadowed }]));
|
|
402
|
-
return await runTool(path, rest, context);
|
|
403
|
-
} catch (error) {
|
|
404
|
-
return fail(error, json, context);
|
|
405
|
-
}
|
|
406
|
-
}, "runWcat");
|
|
407
|
-
export {
|
|
408
|
-
listTools,
|
|
409
|
-
runTool,
|
|
410
|
-
runWcat
|
|
411
|
-
};
|