@wirecat/cli-template 0.8.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.
Files changed (125) hide show
  1. package/.github/workflows/ci.yml +3 -3
  2. package/.github/workflows/release.yml +63 -0
  3. package/.gitleaks.toml +18 -0
  4. package/AGENTS.md +9 -15
  5. package/CHANGELOG.md +87 -1
  6. package/README.md +4 -3
  7. package/bin/release +5 -3
  8. package/contracts/plan.json +2 -2
  9. package/dist/bin/clidev.js +34 -12
  10. package/dist/bundle/all-profiles-XHC7BG3P.js +24 -0
  11. package/dist/bundle/anthropic-N6B3ZZHQ.js +70 -0
  12. package/dist/bundle/bun-HUJLS7KP.js +169 -0
  13. package/dist/bundle/bun-sqlite-OWFO2TVR.js +69 -0
  14. package/dist/bundle/chunk-222FANS2.js +161 -0
  15. package/dist/bundle/chunk-2CFBHYFA.js +884 -0
  16. package/dist/bundle/chunk-2KQZ24GI.js +82 -0
  17. package/dist/bundle/chunk-2TBVT4SZ.js +31 -0
  18. package/dist/bundle/chunk-437W3Z2M.js +76 -0
  19. package/dist/bundle/chunk-4QRLPOJ7.js +18 -0
  20. package/dist/bundle/chunk-54AJONOM.js +54 -0
  21. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  22. package/dist/bundle/chunk-6CBWO7OF.js +73 -0
  23. package/dist/bundle/chunk-75LVQQEK.js +35782 -0
  24. package/dist/bundle/chunk-7RB76E2L.js +264 -0
  25. package/dist/bundle/chunk-7RXBN7HP.js +63 -0
  26. package/dist/bundle/chunk-ABP7FDMJ.js +122 -0
  27. package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
  28. package/dist/bundle/chunk-AP7QKYBG.js +3531 -0
  29. package/dist/bundle/chunk-ASMH7JWZ.js +288 -0
  30. package/dist/bundle/chunk-B4EED2RF.js +100 -0
  31. package/dist/bundle/chunk-B4LM2B6F.js +1900 -0
  32. package/dist/bundle/chunk-BDSDQCV4.js +281 -0
  33. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  34. package/dist/bundle/chunk-DMCN22H6.js +35 -0
  35. package/dist/bundle/chunk-E42W72PQ.js +151 -0
  36. package/dist/bundle/chunk-EFHLQXG6.js +5104 -0
  37. package/dist/bundle/chunk-FIHDGZIB.js +34352 -0
  38. package/dist/bundle/chunk-FWVKHD2L.js +48 -0
  39. package/dist/bundle/chunk-FXS3X76A.js +193 -0
  40. package/dist/bundle/chunk-HTQTIKWP.js +928 -0
  41. package/dist/bundle/chunk-IJ3IA7EK.js +24 -0
  42. package/dist/bundle/chunk-JEBSORH7.js +3379 -0
  43. package/dist/bundle/chunk-JTTW5ZKF.js +45 -0
  44. package/dist/bundle/chunk-LSEF4QC3.js +3075 -0
  45. package/dist/bundle/chunk-LY7GS2YI.js +58 -0
  46. package/dist/bundle/chunk-MFS52LTZ.js +570 -0
  47. package/dist/bundle/chunk-MNSD5BX2.js +78 -0
  48. package/dist/bundle/chunk-MTGLJCAZ.js +24 -0
  49. package/dist/bundle/chunk-MZVV2JZT.js +744 -0
  50. package/dist/bundle/chunk-NE3NSB5O.js +8341 -0
  51. package/dist/bundle/chunk-NTLPDH76.js +440 -0
  52. package/dist/bundle/chunk-O3PBQVAB.js +447 -0
  53. package/dist/bundle/chunk-O5EHUB2V.js +2 -0
  54. package/dist/bundle/chunk-O5LMDQTO.js +82 -0
  55. package/dist/bundle/chunk-OPJ24VGH.js +1028 -0
  56. package/dist/bundle/chunk-OPPMGPFW.js +164 -0
  57. package/dist/bundle/chunk-QGNNMPUB.js +158 -0
  58. package/dist/bundle/chunk-QVJLOUQB.js +2 -0
  59. package/dist/bundle/chunk-S57AMKLX.js +6848 -0
  60. package/dist/bundle/chunk-TARN7CHN.js +215 -0
  61. package/dist/bundle/chunk-TJLGI3N6.js +1095 -0
  62. package/dist/bundle/chunk-VMTM46FH.js +7532 -0
  63. package/dist/bundle/chunk-W2IDKBNB.js +2315 -0
  64. package/dist/bundle/chunk-XFXBXQBS.js +630 -0
  65. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  66. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  67. package/dist/bundle/clidev.js +22 -0
  68. package/dist/bundle/command-contract-PEM3S634.js +29 -0
  69. package/dist/bundle/dist-ESHIQU4M.js +7577 -0
  70. package/dist/bundle/echarts-2QGL2JP5.js +42501 -0
  71. package/dist/bundle/embed-HHAAGHA6.js +35 -0
  72. package/dist/bundle/embedder-W2OGVVYH.js +108 -0
  73. package/dist/bundle/first-run-WCJUDUBU.js +23 -0
  74. package/dist/bundle/first-screen-U4DFUKUC.js +27 -0
  75. package/dist/bundle/instructions-OTZHT6NV.js +9 -0
  76. package/dist/bundle/mcp-OQBZXELQ.js +165 -0
  77. package/dist/bundle/mcp-VVF6J7SQ.js +151 -0
  78. package/dist/bundle/mcp-Y7VCIZ2J.js +78 -0
  79. package/dist/bundle/node-P4E63KXA.js +2340 -0
  80. package/dist/bundle/node-SYD4GX5O.js +176 -0
  81. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  82. package/dist/bundle/node-sqlite-X2DGRFOZ.js +45 -0
  83. package/dist/bundle/oauth-42M34GQ5.js +17 -0
  84. package/dist/bundle/open-SWXRCDLN.js +19 -0
  85. package/dist/bundle/process-KAFGXZ7Q.js +91 -0
  86. package/dist/bundle/program-EHR4G7VN.js +16967 -0
  87. package/dist/bundle/prompt-ZQTMHRGX.js +12 -0
  88. package/dist/bundle/recognize-TTED4SE3.js +190 -0
  89. package/dist/bundle/remote-C37XJ4BP.js +26 -0
  90. package/dist/bundle/rerank-APFZAMQL.js +49 -0
  91. package/dist/bundle/serve-DDPIHDVZ.js +19 -0
  92. package/dist/bundle/server-L5GNG7KC.js +793 -0
  93. package/dist/bundle/server-LKVYA2AE.js +39 -0
  94. package/dist/bundle/state-WWPPHERF.js +33 -0
  95. package/dist/bundle/store-H6UIA4PK.js +120 -0
  96. package/dist/bundle/store-maintenance-command-EYBT64A2.js +40 -0
  97. package/dist/commands/mcp.d.ts.map +1 -1
  98. package/dist/commands/mcp.js +45 -30
  99. package/dist/commands/mcp.js.map +1 -1
  100. package/dist/version.d.ts +1 -1
  101. package/dist/version.d.ts.map +1 -1
  102. package/dist/version.js +1 -1
  103. package/dist/version.js.map +1 -1
  104. package/docs/commands.md +38 -22
  105. package/docs/dev/TESTING.md +14 -3
  106. package/docs/dev/reference-clis.md +17 -9
  107. package/docs/dev/skills/release/SKILL.md +9 -6
  108. package/docs/dev/skills/release/fresh-audit.md +4 -0
  109. package/docs/dev/test-matrix.md +10 -11
  110. package/docs/security.md +4 -0
  111. package/docs/usage.md +7 -6
  112. package/kit/dist/new.js +17 -2
  113. package/package.json +7 -5
  114. package/scripts/audit.sh +5 -3
  115. package/scripts/smoke-bundle.ts +63 -0
  116. package/scripts/test-matrix-untested.ts +4 -10
  117. package/scripts/version-level.test.ts +17 -1
  118. package/scripts/version-level.ts +35 -7
  119. package/skills/clidev-cli/SKILL.md +8 -0
  120. package/src/commands/mcp.ts +54 -33
  121. package/src/mcp-http.test.ts +20 -13
  122. package/src/mcp.test.ts +3 -3
  123. package/src/program.test.ts +8 -2
  124. package/src/roots.test.ts +2 -7
  125. package/src/version.ts +1 -1
@@ -0,0 +1,82 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ MAX_SECRET_INPUT,
5
+ bufferedInput,
6
+ inputPolicy
7
+ } from "./chunk-O5LMDQTO.js";
8
+ import {
9
+ CliError
10
+ } from "./chunk-EFHLQXG6.js";
11
+ import {
12
+ __name
13
+ } from "./chunk-ZVVMGPBJ.js";
14
+
15
+ // 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/terminal/prompt.js
16
+ import { createInterface } from "node:readline";
17
+ import { Writable } from "node:stream";
18
+ var readSecret = /* @__PURE__ */ __name(async (prompt, { input = process.stdin, output = process.stderr, echo = false, signal: givenSignal } = {}) => {
19
+ const policy = inputPolicy(input);
20
+ const signals = [givenSignal, policy.signal].filter((one) => one !== void 0);
21
+ const signal = signals.length ? AbortSignal.any(signals) : void 0;
22
+ const cancelled = /* @__PURE__ */ __name(() => new CliError("cancelled", "cancelled \u2014 nothing was stored"), "cancelled");
23
+ if (signal?.aborted)
24
+ throw cancelled();
25
+ if (input.isTTY && policy.noInput)
26
+ throw new CliError("validation_error", "interactive input is disabled \u2014 provide the input through a pipe", {
27
+ reason: "input.required"
28
+ });
29
+ if (!input.isTTY) {
30
+ return (await bufferedInput(input, {
31
+ maxBytes: Math.min(policy.maxBytes ?? MAX_SECRET_INPUT, MAX_SECRET_INPUT),
32
+ ...signal ? { signal } : {}
33
+ })).toString("utf8").trim();
34
+ }
35
+ let muted = false;
36
+ const shim = new Writable({
37
+ write(chunk, _encoding, done) {
38
+ if (!muted)
39
+ output.write(chunk);
40
+ done();
41
+ }
42
+ });
43
+ const reader = createInterface({ input, output: shim, terminal: true });
44
+ const abort = /* @__PURE__ */ __name(() => reader.close(), "abort");
45
+ let bytes = 0;
46
+ let inputFailure;
47
+ const data = /* @__PURE__ */ __name((chunk) => {
48
+ bytes += Buffer.byteLength(chunk);
49
+ if (bytes > Math.min(policy.maxBytes ?? MAX_SECRET_INPUT, MAX_SECRET_INPUT)) {
50
+ inputFailure = new CliError("validation_error", "secret input exceeds its byte limit", {
51
+ reason: "input.too-large",
52
+ retryable: false
53
+ });
54
+ reader.close();
55
+ }
56
+ }, "data");
57
+ const inputError = /* @__PURE__ */ __name((error) => {
58
+ inputFailure = error;
59
+ reader.close();
60
+ }, "inputError");
61
+ input.on("data", data).on("error", inputError);
62
+ try {
63
+ const answer = await new Promise((resolve, reject) => {
64
+ const cancel = /* @__PURE__ */ __name(() => reject(inputFailure ?? cancelled()), "cancel");
65
+ reader.once("SIGINT", cancel);
66
+ reader.once("close", cancel);
67
+ signal?.addEventListener("abort", abort, { once: true });
68
+ reader.question(prompt, resolve);
69
+ muted = !echo;
70
+ });
71
+ return answer.trim();
72
+ } finally {
73
+ input.off("data", data).off("error", inputError);
74
+ signal?.removeEventListener("abort", abort);
75
+ reader.close();
76
+ output.write("\n");
77
+ }
78
+ }, "readSecret");
79
+
80
+ export {
81
+ readSecret
82
+ };
@@ -0,0 +1,31 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ CliError,
5
+ finite,
6
+ getDotPath,
7
+ maxValue,
8
+ minValue,
9
+ number,
10
+ optional,
11
+ pipe,
12
+ safeParse
13
+ } from "./chunk-EFHLQXG6.js";
14
+ import {
15
+ __name
16
+ } from "./chunk-ZVVMGPBJ.js";
17
+
18
+ // 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/models/options.js
19
+ var checkedOptions = /* @__PURE__ */ __name((provider, schema, options) => {
20
+ const parsed = safeParse(schema, options);
21
+ if (!parsed.success) {
22
+ throw new CliError("validation_error", `${provider} option ${getDotPath(parsed.issues[0]) ?? "options"} is unknown or has the wrong type`);
23
+ }
24
+ return parsed.output;
25
+ }, "checkedOptions");
26
+ var range = /* @__PURE__ */ __name((min, max) => optional(pipe(number(), finite(), minValue(min), maxValue(max))), "range");
27
+
28
+ export {
29
+ checkedOptions,
30
+ range
31
+ };
@@ -0,0 +1,76 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ __name
5
+ } from "./chunk-ZVVMGPBJ.js";
6
+
7
+ // 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/stdio-wire.js
8
+ import { PassThrough, Writable } from "node:stream";
9
+ var lineReader = /* @__PURE__ */ __name((onMessage) => {
10
+ let rest = "";
11
+ return (chunk) => {
12
+ const lines = (rest + chunk.toString()).split("\n");
13
+ rest = lines.pop() ?? "";
14
+ for (const line of lines) {
15
+ try {
16
+ const message = JSON.parse(line);
17
+ if (message !== null && typeof message === "object")
18
+ onMessage(message);
19
+ } catch {
20
+ }
21
+ }
22
+ };
23
+ }, "lineReader");
24
+ var answeredWire = /* @__PURE__ */ __name((source, sink) => {
25
+ const asked = /* @__PURE__ */ new Set();
26
+ let settle;
27
+ const input = new PassThrough();
28
+ const onData = lineReader(({ id, method }) => {
29
+ if (id !== void 0 && typeof method === "string")
30
+ asked.add(JSON.stringify(id));
31
+ });
32
+ const output = new Writable({
33
+ write: /* @__PURE__ */ __name((chunk, _encoding, done) => {
34
+ noteAnswer(chunk);
35
+ sink.write(chunk, done);
36
+ }, "write")
37
+ });
38
+ const noteAnswer = lineReader(({ id, method }) => {
39
+ if (id === void 0 || method !== void 0)
40
+ return;
41
+ asked.delete(JSON.stringify(id));
42
+ if (asked.size === 0)
43
+ settle?.();
44
+ });
45
+ const forward = /* @__PURE__ */ __name((chunk) => {
46
+ onData(chunk);
47
+ input.write(chunk);
48
+ }, "forward");
49
+ source.on("data", forward);
50
+ const ended = new Promise((resolve) => {
51
+ source.once("end", resolve);
52
+ source.once("close", resolve);
53
+ });
54
+ return {
55
+ input,
56
+ output,
57
+ ended,
58
+ answered: /* @__PURE__ */ __name(() => new Promise((resolve) => {
59
+ if (asked.size === 0)
60
+ resolve();
61
+ else
62
+ settle = resolve;
63
+ }), "answered"),
64
+ /** Lets go of the real stdin, so it no longer holds the process open. */
65
+ release: /* @__PURE__ */ __name(() => {
66
+ source.off("data", forward);
67
+ if (source.listenerCount("data") === 0)
68
+ source.pause();
69
+ input.end();
70
+ }, "release")
71
+ };
72
+ }, "answeredWire");
73
+
74
+ export {
75
+ answeredWire
76
+ };
@@ -0,0 +1,18 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ resolvePaths
5
+ } from "./chunk-EFHLQXG6.js";
6
+ import {
7
+ __name
8
+ } from "./chunk-ZVVMGPBJ.js";
9
+
10
+ // 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/store/path.js
11
+ import { join } from "node:path";
12
+ var wirecatDirectory = /* @__PURE__ */ __name((env = process.env, platform) => resolvePaths({ appName: "WireCat", prefix: "WIRECAT", env, ...platform ? { platform } : {} }).state, "wirecatDirectory");
13
+ var storePath = /* @__PURE__ */ __name((env = process.env) => env.MESSAGING_STORE ?? join(wirecatDirectory(env), "wirecat.db"), "storePath");
14
+
15
+ export {
16
+ wirecatDirectory,
17
+ storePath
18
+ };
@@ -0,0 +1,54 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ readSharedSection,
5
+ writeSharedSection
6
+ } from "./chunk-2CFBHYFA.js";
7
+ import {
8
+ CliError
9
+ } from "./chunk-EFHLQXG6.js";
10
+ import {
11
+ __name
12
+ } from "./chunk-ZVVMGPBJ.js";
13
+
14
+ // 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/cli/setup-answers.js
15
+ var PERMISSION_ANSWERS = ["readonly", "allow"];
16
+ var QUESTIONS = ["languages", "tools", "permissions"];
17
+ var SECTION = "setup";
18
+ var readSetupAnswers = /* @__PURE__ */ __name((path) => {
19
+ const section = readSharedSection(path, SECTION);
20
+ if (section === void 0)
21
+ return {};
22
+ const answers = section;
23
+ if (section === null || typeof section !== "object" || Array.isArray(section) || answers.languages !== void 0 && answers.languages !== true || answers.tools !== void 0 && answers.tools !== true || answers.permissions !== void 0 && !PERMISSION_ANSWERS.includes(answers.permissions))
24
+ throw new CliError("configuration_error", `${path}: ${SECTION} holds what setup asked \u2014 languages: true, tools: true, permissions: ${PERMISSION_ANSWERS.join(" | ")}`);
25
+ return answers;
26
+ }, "readSetupAnswers");
27
+ var unanswered = /* @__PURE__ */ __name((answers) => QUESTIONS.filter((question) => answers[question] === void 0), "unanswered");
28
+ var writeSetupAnswers = /* @__PURE__ */ __name((path, answers) => {
29
+ let kept = {};
30
+ try {
31
+ kept = readSetupAnswers(path);
32
+ } catch (error) {
33
+ if (!(error instanceof CliError) || !error.message.includes(`${SECTION} holds`))
34
+ throw error;
35
+ }
36
+ writeSharedSection(path, SECTION, { ...kept, ...answers });
37
+ }, "writeSetupAnswers");
38
+ var permissionCeiling = /* @__PURE__ */ __name((path) => {
39
+ let answer;
40
+ try {
41
+ answer = readSetupAnswers(path).permissions;
42
+ } catch {
43
+ return "readonly";
44
+ }
45
+ return answer === "allow" ? void 0 : answer;
46
+ }, "permissionCeiling");
47
+
48
+ export {
49
+ QUESTIONS,
50
+ readSetupAnswers,
51
+ unanswered,
52
+ writeSetupAnswers,
53
+ permissionCeiling
54
+ };