@wirecat/drive-cli 0.44.0 → 0.45.1
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/dist/bin/drive.js +35 -40
- package/dist/bundle/all-profiles-O7CNQ7FO.js +26 -0
- package/dist/bundle/anthropic-6T67J2CE.js +71 -0
- package/dist/bundle/app-server-BVBZT3UY.js +237 -0
- package/dist/bundle/bun-O6RL6LRQ.js +169 -0
- package/dist/bundle/bun-sqlite-54W7JUY3.js +70 -0
- package/dist/bundle/chunk-2DLAJGRN.js +62 -0
- package/dist/bundle/chunk-37MAA6F2.js +5624 -0
- package/dist/bundle/chunk-3HRDEJJW.js +161 -0
- package/dist/bundle/chunk-3Z7WSD2A.js +433 -0
- package/dist/bundle/chunk-44FV5JAS.js +1855 -0
- package/dist/bundle/chunk-4DW6QGEV.js +164 -0
- package/dist/bundle/chunk-4NGLRHWO.js +24 -0
- package/dist/bundle/chunk-5DPV7X27.js +663 -0
- package/dist/bundle/chunk-5FONRUG6.js +24805 -0
- package/dist/bundle/chunk-5MGIL5LW.js +846 -0
- package/dist/bundle/chunk-5TC3NCAF.js +42 -0
- package/dist/bundle/chunk-6Y2BYFXQ.js +65 -0
- package/dist/bundle/chunk-A3FU4RR6.js +150 -0
- package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
- package/dist/bundle/chunk-AIXLOMH4.js +63 -0
- package/dist/bundle/chunk-AOOD3RMK.js +384 -0
- package/dist/bundle/chunk-AUS6TKP5.js +1975 -0
- package/dist/bundle/chunk-B2J6FJNL.js +19 -0
- package/dist/bundle/chunk-BEXHAGXH.js +3542 -0
- package/dist/bundle/chunk-BHE7ZY2N.js +2352 -0
- package/dist/bundle/chunk-BJ3JRO34.js +2356 -0
- package/dist/bundle/chunk-BQUPOB5H.js +2315 -0
- package/dist/bundle/chunk-CFZWPIVC.js +1092 -0
- package/dist/bundle/chunk-CKR3DVUK.js +754 -0
- package/dist/bundle/chunk-CVIKKIGE.js +76 -0
- package/dist/bundle/chunk-D67JGWSC.js +190 -0
- package/dist/bundle/chunk-DDYR6DYL.js +78 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DL7D6Y3B.js +18102 -0
- package/dist/bundle/chunk-DORXXBFC.js +484 -0
- package/dist/bundle/chunk-DXKVEOSS.js +53 -0
- package/dist/bundle/chunk-DXQEJWI3.js +522 -0
- package/dist/bundle/chunk-FEULDMWM.js +35598 -0
- package/dist/bundle/chunk-G3FAOS52.js +630 -0
- package/dist/bundle/chunk-GHOWRW7E.js +237 -0
- package/dist/bundle/chunk-GNFHZZ55.js +264 -0
- package/dist/bundle/chunk-GNI7INK6.js +18 -0
- package/dist/bundle/chunk-GOR3Z2FR.js +17 -0
- package/dist/bundle/chunk-GQW4GRYR.js +886 -0
- package/dist/bundle/chunk-GWPKIRNQ.js +220 -0
- package/dist/bundle/chunk-GYCUY4CL.js +9 -0
- package/dist/bundle/chunk-HEPIOCHN.js +8181 -0
- package/dist/bundle/chunk-HTQTIKWP.js +928 -0
- package/dist/bundle/chunk-IAW5A7OR.js +1913 -0
- package/dist/bundle/chunk-IGMRWQP3.js +1071 -0
- package/dist/bundle/chunk-IKNU5A5Y.js +82 -0
- package/dist/bundle/chunk-JVTVAZ5X.js +1054 -0
- package/dist/bundle/chunk-K74PQVQZ.js +168 -0
- package/dist/bundle/chunk-K7FRUB33.js +795 -0
- package/dist/bundle/chunk-KADPV4YA.js +45 -0
- package/dist/bundle/chunk-KJMBV574.js +16225 -0
- package/dist/bundle/chunk-LHIL46I3.js +31 -0
- package/dist/bundle/chunk-LJARCTGL.js +60 -0
- package/dist/bundle/chunk-LOTQ2HMT.js +3954 -0
- package/dist/bundle/chunk-MAXN7COO.js +99 -0
- package/dist/bundle/chunk-MFS52LTZ.js +570 -0
- package/dist/bundle/chunk-MFSIOSUM.js +1714 -0
- package/dist/bundle/chunk-NB2N6L3R.js +138 -0
- package/dist/bundle/chunk-NDNTLUPS.js +58 -0
- package/dist/bundle/chunk-NLEB26GA.js +288 -0
- package/dist/bundle/chunk-NP3XLLN3.js +73 -0
- package/dist/bundle/chunk-NW7IMGRR.js +6848 -0
- package/dist/bundle/chunk-O5EHUB2V.js +2 -0
- package/dist/bundle/chunk-OWXTPXIQ.js +215 -0
- package/dist/bundle/chunk-PDBBBUY7.js +166 -0
- package/dist/bundle/chunk-PH74B2VZ.js +122 -0
- package/dist/bundle/chunk-PJ7IQVOM.js +421 -0
- package/dist/bundle/chunk-Q2Z3VCM4.js +2 -0
- package/dist/bundle/chunk-QTJUH3LS.js +15572 -0
- package/dist/bundle/chunk-QW36EOAM.js +106 -0
- package/dist/bundle/chunk-QWSRPXCJ.js +281 -0
- package/dist/bundle/chunk-R2A3K7ZF.js +193 -0
- package/dist/bundle/chunk-R2QRP7EJ.js +835 -0
- package/dist/bundle/chunk-RCS2SCX5.js +375 -0
- package/dist/bundle/chunk-RJ633GFA.js +25 -0
- package/dist/bundle/chunk-SBZB7HMU.js +1055 -0
- package/dist/bundle/chunk-SMHQA5J6.js +459 -0
- package/dist/bundle/chunk-SWMMR3FR.js +48 -0
- package/dist/bundle/chunk-TRMIV3OA.js +18 -0
- package/dist/bundle/chunk-VAGF723Z.js +74 -0
- package/dist/bundle/chunk-VCYFEWPD.js +18078 -0
- package/dist/bundle/chunk-VHQNVG3J.js +263 -0
- package/dist/bundle/chunk-VHT2WI4I.js +2941 -0
- package/dist/bundle/chunk-VYBOYBLX.js +100 -0
- package/dist/bundle/chunk-WUFCYDKB.js +71 -0
- package/dist/bundle/chunk-XAZQTJXR.js +3402 -0
- package/dist/bundle/chunk-XEBFFKXO.js +111 -0
- package/dist/bundle/chunk-XF5MFUEB.js +498 -0
- package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-ZBM4GEV2.js +120 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/command-contract-MXCBV3GJ.js +38 -0
- package/dist/bundle/dist-MWTMOYWT.js +7577 -0
- package/dist/bundle/dist-PY3MVR3G.js +21 -0
- package/dist/bundle/drive.js +50 -0
- package/dist/bundle/echarts-LD3AI55P.js +42501 -0
- package/dist/bundle/embed-FJKIIM43.js +37 -0
- package/dist/bundle/embedder-NNQ5ZC25.js +110 -0
- package/dist/bundle/entry-ZYSNPDSD.js +15 -0
- package/dist/bundle/failure-MJJXFR63.js +37 -0
- package/dist/bundle/first-run-KA2UPZAU.js +24 -0
- package/dist/bundle/first-screen-VQ3RXDMF.js +36 -0
- package/dist/bundle/google-ZYDFTHLN.js +32 -0
- package/dist/bundle/google-api-2GT5PAW2.js +82 -0
- package/dist/bundle/identity-JQFQXQIR.js +10 -0
- package/dist/bundle/instructions-RZMSW3OC.js +11 -0
- package/dist/bundle/login-JU6NKW5P.js +158 -0
- package/dist/bundle/mcp-2PZDI7WE.js +501 -0
- package/dist/bundle/mcp-JOQMFGBC.js +95 -0
- package/dist/bundle/mcp-OQBZXELQ.js +165 -0
- package/dist/bundle/mdast-util-from-markdown-FXEPSNER.js +1958 -0
- package/dist/bundle/mdast-util-gfm-SZM5GBDF.js +2103 -0
- package/dist/bundle/micromark-extension-gfm-GRL24TU6.js +1838 -0
- package/dist/bundle/node-P4E63KXA.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-ZRLYQL7J.js +176 -0
- package/dist/bundle/node-sqlite-TXPSRROT.js +46 -0
- package/dist/bundle/oauth-NAIBKERJ.js +18 -0
- package/dist/bundle/open-3P5EPXPV.js +20 -0
- package/dist/bundle/process-LL77573L.js +91 -0
- package/dist/bundle/program-CZ55L6EW.js +24078 -0
- package/dist/bundle/prompt-3TX2SWOY.js +13 -0
- package/dist/bundle/reasons-GF2TYGX6.js +11 -0
- package/dist/bundle/recognize-IFXOJHEA.js +191 -0
- package/dist/bundle/remote-663M42Y5.js +28 -0
- package/dist/bundle/rerank-OT2F2DBV.js +51 -0
- package/dist/bundle/serve-PDNNI6O6.js +20 -0
- package/dist/bundle/server-BFOEPMR7.js +56 -0
- package/dist/bundle/server-K566PJ7H.js +69 -0
- package/dist/bundle/services-5MCTECBU.js +333 -0
- package/dist/bundle/sqlite-runtime-BF3KDM7W.js +17 -0
- package/dist/bundle/state-SZX65E74.js +34 -0
- package/dist/bundle/store-TCWNLA3V.js +125 -0
- package/dist/bundle/store-UKPGGAPW.js +142 -0
- package/dist/bundle/store-maintenance-command-QHLUVBTJ.js +57 -0
- package/dist/bundle/terminal-TFCTWLOS.js +11 -0
- package/dist/bundle/tokens-DFCFRF7I.js +103 -0
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +82 -36
- package/dist/commands/mcp.js.map +1 -1
- package/dist/contract-overrides.d.ts.map +1 -1
- package/dist/contract-overrides.js +59 -53
- package/dist/contract-overrides.js.map +1 -1
- package/dist/mcp.d.ts +6 -5
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +13 -10
- package/dist/mcp.js.map +1 -1
- package/dist/program.js +4 -4
- package/dist/program.js.map +1 -1
- package/dist/registry.d.ts +2 -2
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +3 -3
- package/dist/registry.js.map +1 -1
- package/dist/state.d.ts +13 -2
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +12 -2
- package/dist/state.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -5
- package/skills/drive-cli/SKILL.md +1 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
executableEnvironment,
|
|
5
|
+
executableOnPath,
|
|
6
|
+
require_cross_spawn
|
|
7
|
+
} from "./chunk-MFS52LTZ.js";
|
|
8
|
+
import {
|
|
9
|
+
__name,
|
|
10
|
+
__toESM
|
|
11
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
12
|
+
|
|
13
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/mcp/index.js
|
|
14
|
+
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
15
|
+
var realRun = /* @__PURE__ */ __name((file, args) => {
|
|
16
|
+
const result = import_cross_spawn.default.sync(executableOnPath(file, process.env), args, {
|
|
17
|
+
encoding: "utf8",
|
|
18
|
+
timeout: 1e4,
|
|
19
|
+
maxBuffer: 256e3,
|
|
20
|
+
env: executableEnvironment(process.env)
|
|
21
|
+
});
|
|
22
|
+
return { status: result.status, error: result.error, stdout: result.stdout ?? "", stderr: result.stderr ?? "" };
|
|
23
|
+
}, "realRun");
|
|
24
|
+
var executable = /* @__PURE__ */ __name((client) => client === "codex" ? "codex" : "claude", "executable");
|
|
25
|
+
var presentIn = /* @__PURE__ */ __name((client, name, run) => {
|
|
26
|
+
const state = lookUp(client, name, run);
|
|
27
|
+
if (state === "unavailable")
|
|
28
|
+
throw new Error(`${executable(client)} is not installed or could not be started`);
|
|
29
|
+
return state === "registered";
|
|
30
|
+
}, "presentIn");
|
|
31
|
+
var setupArguments = /* @__PURE__ */ __name((client, name, entry) => {
|
|
32
|
+
const variables = Object.entries(entry.env ?? {}).flatMap(([key, value]) => ["--env", `${key}=${value}`]);
|
|
33
|
+
if (client === "codex")
|
|
34
|
+
return ["mcp", "add", name, ...variables, "--", entry.command, ...entry.args];
|
|
35
|
+
return ["mcp", "add", "--scope", "user", name, ...variables, "--", entry.command, ...entry.args];
|
|
36
|
+
}, "setupArguments");
|
|
37
|
+
var checkName = /* @__PURE__ */ __name((name) => {
|
|
38
|
+
if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(name))
|
|
39
|
+
throw new Error("the MCP name must be letters, digits, _ or -");
|
|
40
|
+
}, "checkName");
|
|
41
|
+
var lookUp = /* @__PURE__ */ __name((client, name, run) => {
|
|
42
|
+
const file = executable(client);
|
|
43
|
+
const existing = run(file, ["mcp", "get", name, ...client === "codex" ? ["--json"] : []]);
|
|
44
|
+
if (existing.error)
|
|
45
|
+
return "unavailable";
|
|
46
|
+
if (existing.status === 0)
|
|
47
|
+
return "registered";
|
|
48
|
+
if (!/No MCP server named/i.test(existing.stdout + existing.stderr)) {
|
|
49
|
+
throw new Error(`${file} could not check its MCP configuration`);
|
|
50
|
+
}
|
|
51
|
+
return "missing";
|
|
52
|
+
}, "lookUp");
|
|
53
|
+
var stdioEntryStatus = /* @__PURE__ */ __name((client, name, { run = realRun } = {}) => {
|
|
54
|
+
checkName(name);
|
|
55
|
+
return { client, name, state: lookUp(client, name, run) };
|
|
56
|
+
}, "stdioEntryStatus");
|
|
57
|
+
var removeArguments = /* @__PURE__ */ __name((client, name) => (
|
|
58
|
+
// Claude Code without a scope removes from whichever scope holds the name, which may be a project's own entry.
|
|
59
|
+
client === "codex" ? ["mcp", "remove", name] : ["mcp", "remove", "--scope", "user", name]
|
|
60
|
+
), "removeArguments");
|
|
61
|
+
var removeStdioEntry = /* @__PURE__ */ __name((client, name, { run = realRun } = {}) => {
|
|
62
|
+
checkName(name);
|
|
63
|
+
if (!presentIn(client, name, run))
|
|
64
|
+
return { client, name, removed: false };
|
|
65
|
+
const file = executable(client);
|
|
66
|
+
const removed = run(file, removeArguments(client, name));
|
|
67
|
+
if (removed.status !== 0 || removed.error)
|
|
68
|
+
throw new Error(`${file} could not remove ${name}`);
|
|
69
|
+
return { client, name, removed: true };
|
|
70
|
+
}, "removeStdioEntry");
|
|
71
|
+
var installStdioEntry = /* @__PURE__ */ __name((client, name, entry, { run = realRun } = {}) => {
|
|
72
|
+
checkName(name);
|
|
73
|
+
if (!entry.command || entry.args.some((arg) => arg.includes("\0")))
|
|
74
|
+
throw new Error("invalid MCP command");
|
|
75
|
+
const file = executable(client);
|
|
76
|
+
if (presentIn(client, name, run))
|
|
77
|
+
throw new Error(`${name} is already configured in ${file}; remove it there first`);
|
|
78
|
+
const args = setupArguments(client, name, entry);
|
|
79
|
+
const added = run(file, args);
|
|
80
|
+
if (added.status !== 0 || added.error)
|
|
81
|
+
throw new Error(`${file} could not add ${name}`);
|
|
82
|
+
return { client, name, command: [entry.command, ...entry.args] };
|
|
83
|
+
}, "installStdioEntry");
|
|
84
|
+
var probeStdio = /* @__PURE__ */ __name(async (entry, { timeoutMs = 1e4, start = /* @__PURE__ */ __name((file, args, env) => (0, import_cross_spawn.default)(executableOnPath(file, env), args, {
|
|
85
|
+
env: executableEnvironment(env),
|
|
86
|
+
stdio: "pipe"
|
|
87
|
+
}), "start") } = {}) => {
|
|
88
|
+
const child = start(entry.command, entry.args, { ...process.env, ...entry.env });
|
|
89
|
+
let buffer = "";
|
|
90
|
+
let timer;
|
|
91
|
+
const pending = /* @__PURE__ */ new Map();
|
|
92
|
+
const request = /* @__PURE__ */ __name((id, method, params) => new Promise((resolve, reject) => {
|
|
93
|
+
pending.set(id, { resolve, reject });
|
|
94
|
+
child.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", id, method, params })}
|
|
95
|
+
`);
|
|
96
|
+
}), "request");
|
|
97
|
+
const fail = /* @__PURE__ */ __name((error) => {
|
|
98
|
+
for (const waiter of pending.values())
|
|
99
|
+
waiter.reject(error);
|
|
100
|
+
pending.clear();
|
|
101
|
+
}, "fail");
|
|
102
|
+
child.on("error", () => fail(new Error("the MCP server could not be started")));
|
|
103
|
+
child.on("exit", () => fail(new Error("the MCP server exited before answering")));
|
|
104
|
+
child.stdin.on("error", () => fail(new Error("the MCP server closed its input")));
|
|
105
|
+
child.stdout.setEncoding("utf8");
|
|
106
|
+
child.stdout.on("data", (chunk) => {
|
|
107
|
+
buffer += chunk;
|
|
108
|
+
if (buffer.length > 1e6)
|
|
109
|
+
return fail(new Error("the MCP server sent too much output"));
|
|
110
|
+
for (let newline = buffer.indexOf("\n"); newline !== -1; newline = buffer.indexOf("\n")) {
|
|
111
|
+
const line = buffer.slice(0, newline);
|
|
112
|
+
buffer = buffer.slice(newline + 1);
|
|
113
|
+
try {
|
|
114
|
+
const value = JSON.parse(line);
|
|
115
|
+
if (typeof value.id !== "number")
|
|
116
|
+
continue;
|
|
117
|
+
const waiter = pending.get(value.id);
|
|
118
|
+
if (!waiter)
|
|
119
|
+
continue;
|
|
120
|
+
pending.delete(value.id);
|
|
121
|
+
if (value.error)
|
|
122
|
+
waiter.reject(new Error("the MCP server rejected the handshake"));
|
|
123
|
+
else
|
|
124
|
+
waiter.resolve(value.result ?? {});
|
|
125
|
+
} catch {
|
|
126
|
+
fail(new Error("the MCP server sent invalid JSON"));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
try {
|
|
131
|
+
timer = setTimeout(() => fail(new Error("the MCP server did not answer in time")), timeoutMs);
|
|
132
|
+
await request(1, "initialize", {
|
|
133
|
+
protocolVersion: "2025-11-25",
|
|
134
|
+
capabilities: {},
|
|
135
|
+
clientInfo: { name: "cli-base-mcp-doctor", version: "1" }
|
|
136
|
+
});
|
|
137
|
+
child.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" })}
|
|
138
|
+
`);
|
|
139
|
+
const result = await request(2, "tools/list", {});
|
|
140
|
+
const tools = result.tools;
|
|
141
|
+
if (!Array.isArray(tools))
|
|
142
|
+
throw new Error("the MCP server returned no tool list");
|
|
143
|
+
const named = tools.filter((item) => item !== null && typeof item === "object" && "name" in item && typeof item.name === "string");
|
|
144
|
+
if (named.length !== tools.length)
|
|
145
|
+
throw new Error("the MCP server returned an invalid tool list");
|
|
146
|
+
return {
|
|
147
|
+
tools: named.map((item) => item.name),
|
|
148
|
+
potentialWrites: named.filter((item) => item.annotations?.readOnlyHint !== true).map((item) => item.name)
|
|
149
|
+
};
|
|
150
|
+
} finally {
|
|
151
|
+
if (timer)
|
|
152
|
+
clearTimeout(timer);
|
|
153
|
+
pending.clear();
|
|
154
|
+
child.stdin.end();
|
|
155
|
+
child.kill();
|
|
156
|
+
}
|
|
157
|
+
}, "probeStdio");
|
|
158
|
+
export {
|
|
159
|
+
installStdioEntry,
|
|
160
|
+
probeStdio,
|
|
161
|
+
removeArguments,
|
|
162
|
+
removeStdioEntry,
|
|
163
|
+
setupArguments,
|
|
164
|
+
stdioEntryStatus
|
|
165
|
+
};
|