@wirecat/cli-template 0.9.0 → 0.10.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/.github/workflows/ci.yml +1 -0
- package/.github/workflows/release.yml +63 -0
- package/CHANGELOG.md +42 -1
- package/bin/release +5 -3
- package/dist/bin/clidev.js +34 -12
- package/dist/bundle/all-profiles-XHC7BG3P.js +24 -0
- package/dist/bundle/anthropic-N6B3ZZHQ.js +70 -0
- package/dist/bundle/bun-HUJLS7KP.js +169 -0
- package/dist/bundle/bun-sqlite-OWFO2TVR.js +69 -0
- package/dist/bundle/chunk-222FANS2.js +161 -0
- package/dist/bundle/chunk-2CFBHYFA.js +884 -0
- package/dist/bundle/chunk-2KQZ24GI.js +82 -0
- package/dist/bundle/chunk-2TBVT4SZ.js +31 -0
- package/dist/bundle/chunk-437W3Z2M.js +76 -0
- package/dist/bundle/chunk-4QRLPOJ7.js +18 -0
- package/dist/bundle/chunk-54AJONOM.js +54 -0
- package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
- package/dist/bundle/chunk-6CBWO7OF.js +73 -0
- package/dist/bundle/chunk-75LVQQEK.js +35782 -0
- package/dist/bundle/chunk-7RB76E2L.js +264 -0
- package/dist/bundle/chunk-7RXBN7HP.js +63 -0
- package/dist/bundle/chunk-ABP7FDMJ.js +122 -0
- package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
- package/dist/bundle/chunk-AP7QKYBG.js +3531 -0
- package/dist/bundle/chunk-ASMH7JWZ.js +288 -0
- package/dist/bundle/chunk-B4EED2RF.js +100 -0
- package/dist/bundle/chunk-B4LM2B6F.js +1900 -0
- package/dist/bundle/chunk-BDSDQCV4.js +281 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DMCN22H6.js +35 -0
- package/dist/bundle/chunk-E42W72PQ.js +151 -0
- package/dist/bundle/chunk-EFHLQXG6.js +5104 -0
- package/dist/bundle/chunk-FIHDGZIB.js +34352 -0
- package/dist/bundle/chunk-FWVKHD2L.js +48 -0
- package/dist/bundle/chunk-FXS3X76A.js +193 -0
- package/dist/bundle/chunk-HTQTIKWP.js +928 -0
- package/dist/bundle/chunk-IJ3IA7EK.js +24 -0
- package/dist/bundle/chunk-JEBSORH7.js +3379 -0
- package/dist/bundle/chunk-JTTW5ZKF.js +45 -0
- package/dist/bundle/chunk-LSEF4QC3.js +3075 -0
- package/dist/bundle/chunk-LY7GS2YI.js +58 -0
- package/dist/bundle/chunk-MFS52LTZ.js +570 -0
- package/dist/bundle/chunk-MNSD5BX2.js +78 -0
- package/dist/bundle/chunk-MTGLJCAZ.js +24 -0
- package/dist/bundle/chunk-MZVV2JZT.js +744 -0
- package/dist/bundle/chunk-NE3NSB5O.js +8341 -0
- package/dist/bundle/chunk-NTLPDH76.js +440 -0
- package/dist/bundle/chunk-O3PBQVAB.js +447 -0
- package/dist/bundle/chunk-O5EHUB2V.js +2 -0
- package/dist/bundle/chunk-O5LMDQTO.js +82 -0
- package/dist/bundle/chunk-OPJ24VGH.js +1028 -0
- package/dist/bundle/chunk-OPPMGPFW.js +164 -0
- package/dist/bundle/chunk-QGNNMPUB.js +158 -0
- package/dist/bundle/chunk-QVJLOUQB.js +2 -0
- package/dist/bundle/chunk-S57AMKLX.js +6848 -0
- package/dist/bundle/chunk-TARN7CHN.js +215 -0
- package/dist/bundle/chunk-TJLGI3N6.js +1095 -0
- package/dist/bundle/chunk-VMTM46FH.js +7532 -0
- package/dist/bundle/chunk-W2IDKBNB.js +2315 -0
- package/dist/bundle/chunk-XFXBXQBS.js +630 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/clidev.js +22 -0
- package/dist/bundle/command-contract-PEM3S634.js +29 -0
- package/dist/bundle/dist-ESHIQU4M.js +7577 -0
- package/dist/bundle/echarts-2QGL2JP5.js +42501 -0
- package/dist/bundle/embed-HHAAGHA6.js +35 -0
- package/dist/bundle/embedder-W2OGVVYH.js +108 -0
- package/dist/bundle/first-run-WCJUDUBU.js +23 -0
- package/dist/bundle/first-screen-U4DFUKUC.js +27 -0
- package/dist/bundle/instructions-OTZHT6NV.js +9 -0
- package/dist/bundle/mcp-OQBZXELQ.js +165 -0
- package/dist/bundle/mcp-VVF6J7SQ.js +151 -0
- package/dist/bundle/mcp-Y7VCIZ2J.js +78 -0
- package/dist/bundle/node-P4E63KXA.js +2340 -0
- package/dist/bundle/node-SYD4GX5O.js +176 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-sqlite-X2DGRFOZ.js +45 -0
- package/dist/bundle/oauth-42M34GQ5.js +17 -0
- package/dist/bundle/open-SWXRCDLN.js +19 -0
- package/dist/bundle/process-KAFGXZ7Q.js +91 -0
- package/dist/bundle/program-EHR4G7VN.js +16967 -0
- package/dist/bundle/prompt-ZQTMHRGX.js +12 -0
- package/dist/bundle/recognize-TTED4SE3.js +190 -0
- package/dist/bundle/remote-C37XJ4BP.js +26 -0
- package/dist/bundle/rerank-APFZAMQL.js +49 -0
- package/dist/bundle/serve-DDPIHDVZ.js +19 -0
- package/dist/bundle/server-L5GNG7KC.js +793 -0
- package/dist/bundle/server-LKVYA2AE.js +39 -0
- package/dist/bundle/state-WWPPHERF.js +33 -0
- package/dist/bundle/store-H6UIA4PK.js +120 -0
- package/dist/bundle/store-maintenance-command-EYBT64A2.js +40 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/docs/commands.md +9 -13
- package/docs/dev/TESTING.md +8 -0
- package/docs/dev/reference-clis.md +7 -5
- package/docs/dev/skills/release/SKILL.md +9 -6
- package/docs/dev/skills/release/fresh-audit.md +4 -0
- package/kit/dist/new.js +1 -0
- package/package.json +7 -5
- package/scripts/audit.sh +3 -2
- package/scripts/smoke-bundle.ts +63 -0
- package/scripts/version-level.test.ts +17 -1
- package/scripts/version-level.ts +35 -7
- package/skills/clidev-cli/SKILL.md +8 -0
- package/src/version.ts +1 -1
- package/lint/baseline/unknown-verb.json +0 -1
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
holdLock,
|
|
5
|
+
readLock,
|
|
6
|
+
releaseLock,
|
|
7
|
+
takeLock
|
|
8
|
+
} from "./chunk-6CBWO7OF.js";
|
|
9
|
+
import {
|
|
10
|
+
__name
|
|
11
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
12
|
+
|
|
13
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_9d12b0091b773232c527328da5835651/node_modules/@wirecat/cli-core/dist/mcp/http/state.js
|
|
14
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
15
|
+
|
|
16
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_9d12b0091b773232c527328da5835651/node_modules/@wirecat/cli-core/dist/mcp/http/activity.js
|
|
17
|
+
import { randomBytes } from "node:crypto";
|
|
18
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
19
|
+
import { dirname } from "node:path";
|
|
20
|
+
var WRITE_EVERY_MS = 2e3;
|
|
21
|
+
var TOOL_NAME = /^[A-Za-z0-9_.-]{1,64}$/;
|
|
22
|
+
var httpActivityFile = /* @__PURE__ */ __name((tokenFile) => `${tokenFile.replace(/\.json$/, "")}.activity.json`, "httpActivityFile");
|
|
23
|
+
var localDay = /* @__PURE__ */ __name((ms) => {
|
|
24
|
+
const d = new Date(ms);
|
|
25
|
+
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
26
|
+
}, "localDay");
|
|
27
|
+
var readActivity = /* @__PURE__ */ __name((path) => {
|
|
28
|
+
if (!existsSync(path))
|
|
29
|
+
return {};
|
|
30
|
+
try {
|
|
31
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
32
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
|
33
|
+
} catch {
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
}, "readActivity");
|
|
37
|
+
var calledTools = /* @__PURE__ */ __name((body) => (Array.isArray(body) ? body : [body]).flatMap((message) => {
|
|
38
|
+
if (!message || typeof message !== "object")
|
|
39
|
+
return [];
|
|
40
|
+
const { method, params } = message;
|
|
41
|
+
const name = params?.name;
|
|
42
|
+
return method === "tools/call" && typeof name === "string" && TOOL_NAME.test(name) ? [name] : [];
|
|
43
|
+
}), "calledTools");
|
|
44
|
+
var activityRecorder = /* @__PURE__ */ __name((path, now = Date.now) => {
|
|
45
|
+
const activity = readActivity(path);
|
|
46
|
+
let timer;
|
|
47
|
+
const write = /* @__PURE__ */ __name(() => {
|
|
48
|
+
timer = void 0;
|
|
49
|
+
try {
|
|
50
|
+
mkdirSync(dirname(path), { recursive: true, mode: 448 });
|
|
51
|
+
const temporary = `${path}.${randomBytes(8).toString("hex")}.tmp`;
|
|
52
|
+
writeFileSync(temporary, JSON.stringify(activity), { mode: 384, flag: "wx" });
|
|
53
|
+
chmodSync(temporary, 384);
|
|
54
|
+
renameSync(temporary, path);
|
|
55
|
+
} catch {
|
|
56
|
+
}
|
|
57
|
+
}, "write");
|
|
58
|
+
return {
|
|
59
|
+
record: /* @__PURE__ */ __name((clientId, tools) => {
|
|
60
|
+
const at = now();
|
|
61
|
+
const iso = new Date(at).toISOString();
|
|
62
|
+
const day = localDay(at);
|
|
63
|
+
const before = activity[clientId];
|
|
64
|
+
const counted = before?.day === day ? before.toolCalls : 0;
|
|
65
|
+
const last = tools.at(-1);
|
|
66
|
+
activity[clientId] = {
|
|
67
|
+
lastRequestAt: iso,
|
|
68
|
+
day,
|
|
69
|
+
toolCalls: counted + tools.length,
|
|
70
|
+
...last ? { lastTool: last, lastToolAt: iso } : before?.lastTool ? { lastTool: before.lastTool, ...before.lastToolAt ? { lastToolAt: before.lastToolAt } : {} } : {}
|
|
71
|
+
};
|
|
72
|
+
if (last) {
|
|
73
|
+
clearTimeout(timer);
|
|
74
|
+
write();
|
|
75
|
+
} else if (!timer) {
|
|
76
|
+
timer = setTimeout(write, WRITE_EVERY_MS);
|
|
77
|
+
timer.unref();
|
|
78
|
+
}
|
|
79
|
+
}, "record"),
|
|
80
|
+
flush: /* @__PURE__ */ __name(() => {
|
|
81
|
+
if (!timer)
|
|
82
|
+
return;
|
|
83
|
+
clearTimeout(timer);
|
|
84
|
+
write();
|
|
85
|
+
}, "flush")
|
|
86
|
+
};
|
|
87
|
+
}, "activityRecorder");
|
|
88
|
+
|
|
89
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_9d12b0091b773232c527328da5835651/node_modules/@wirecat/cli-core/dist/mcp/http/state.js
|
|
90
|
+
var ACCESS_SECONDS = 60 * 60;
|
|
91
|
+
var REFRESH_SECONDS = 30 * 24 * 60 * 60;
|
|
92
|
+
var readStored = /* @__PURE__ */ __name((path) => existsSync2(path) ? JSON.parse(readFileSync2(path, "utf8")) : { clients: [], tokens: [] }, "readStored");
|
|
93
|
+
var mcpHttpMarker = /* @__PURE__ */ __name((envPrefix) => `${envPrefix}_MCP_HTTP`, "mcpHttpMarker");
|
|
94
|
+
var httpLogFile = /* @__PURE__ */ __name((tokenFile) => `${tokenFile.replace(/\.json$/, "")}.log`, "httpLogFile");
|
|
95
|
+
var httpLockFile = /* @__PURE__ */ __name((tokenFile) => `${tokenFile.replace(/\.json$/, "")}.lock`, "httpLockFile");
|
|
96
|
+
var httpLaunchFile = /* @__PURE__ */ __name((lockFile) => `${lockFile.replace(/\.lock$/, "")}.launch.json`, "httpLaunchFile");
|
|
97
|
+
var readHttpLaunch = /* @__PURE__ */ __name((path) => {
|
|
98
|
+
try {
|
|
99
|
+
const launch = JSON.parse(readFileSync2(path, "utf8"));
|
|
100
|
+
return typeof launch.invocation === "string" && Array.isArray(launch.argv) && launch.argv.every((word) => typeof word === "string") && typeof launch.env === "object" && launch.env !== null ? launch : void 0;
|
|
101
|
+
} catch {
|
|
102
|
+
return void 0;
|
|
103
|
+
}
|
|
104
|
+
}, "readHttpLaunch");
|
|
105
|
+
var readHttpLock = /* @__PURE__ */ __name((path) => {
|
|
106
|
+
const lock = readLock(path);
|
|
107
|
+
return lock && typeof lock.port === "number" && typeof lock.publicUrl === "string" ? lock : void 0;
|
|
108
|
+
}, "readHttpLock");
|
|
109
|
+
var httpLock = /* @__PURE__ */ __name((path, first) => {
|
|
110
|
+
let current = first;
|
|
111
|
+
const held = takeLock(path, current);
|
|
112
|
+
return {
|
|
113
|
+
held,
|
|
114
|
+
update: /* @__PURE__ */ __name((change) => {
|
|
115
|
+
current = { ...current, ...change };
|
|
116
|
+
holdLock(path, current);
|
|
117
|
+
}, "update"),
|
|
118
|
+
release: /* @__PURE__ */ __name(() => releaseLock(path), "release")
|
|
119
|
+
};
|
|
120
|
+
}, "httpLock");
|
|
121
|
+
var signedInClients = /* @__PURE__ */ __name((tokenFile, now = Date.now()) => {
|
|
122
|
+
const seconds = Math.floor(now / 1e3);
|
|
123
|
+
const { clients, tokens } = readStored(tokenFile);
|
|
124
|
+
const activity = readActivity(httpActivityFile(tokenFile));
|
|
125
|
+
const today = localDay(now);
|
|
126
|
+
const last = /* @__PURE__ */ new Map();
|
|
127
|
+
for (const token of tokens) {
|
|
128
|
+
if (token.expiresAt <= seconds)
|
|
129
|
+
continue;
|
|
130
|
+
const issued = token.expiresAt - (token.kind === "access" ? ACCESS_SECONDS : REFRESH_SECONDS);
|
|
131
|
+
last.set(token.clientId, Math.max(last.get(token.clientId) ?? 0, issued));
|
|
132
|
+
}
|
|
133
|
+
return clients.filter((client) => last.has(client.id)).map((client) => {
|
|
134
|
+
const did = activity[client.id];
|
|
135
|
+
return {
|
|
136
|
+
claimedName: client.name ?? null,
|
|
137
|
+
lastLoginAt: new Date((last.get(client.id) ?? 0) * 1e3).toISOString(),
|
|
138
|
+
lastRequestAt: did?.lastRequestAt ?? null,
|
|
139
|
+
lastTool: did?.lastTool ?? null,
|
|
140
|
+
lastToolAt: did?.lastToolAt ?? null,
|
|
141
|
+
toolCallsToday: did?.day === today ? did.toolCalls : 0
|
|
142
|
+
};
|
|
143
|
+
}).sort((a, b) => b.lastLoginAt.localeCompare(a.lastLoginAt));
|
|
144
|
+
}, "signedInClients");
|
|
145
|
+
|
|
146
|
+
export {
|
|
147
|
+
httpActivityFile,
|
|
148
|
+
calledTools,
|
|
149
|
+
activityRecorder,
|
|
150
|
+
ACCESS_SECONDS,
|
|
151
|
+
REFRESH_SECONDS,
|
|
152
|
+
readStored,
|
|
153
|
+
mcpHttpMarker,
|
|
154
|
+
httpLogFile,
|
|
155
|
+
httpLockFile,
|
|
156
|
+
httpLaunchFile,
|
|
157
|
+
readHttpLaunch,
|
|
158
|
+
readHttpLock,
|
|
159
|
+
httpLock,
|
|
160
|
+
signedInClients
|
|
161
|
+
};
|