@wirecat/cli-template 0.13.2 → 0.15.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 (121) hide show
  1. package/.github/workflows/changelog-guard.yml +1 -1
  2. package/.github/workflows/ci.yml +1 -1
  3. package/.github/workflows/monthly.yml +1 -1
  4. package/.github/workflows/release.yml +1 -1
  5. package/CHANGELOG.md +35 -0
  6. package/config/parity-groups.json +32 -1
  7. package/contracts/mcp-tools.json +100 -0
  8. package/dist/bin/clidev.js +6 -2
  9. package/dist/bundle/{all-profiles-MJ6XSFOO.js → all-profiles-NVB2HT2S.js} +6 -6
  10. package/dist/bundle/{anthropic-W5UKBZUB.js → anthropic-ICTW7CNQ.js} +4 -4
  11. package/dist/bundle/{app-server-EZ46JAHB.js → app-server-OW5LT5XV.js} +40 -38
  12. package/dist/bundle/{bun-HB6O2TTT.js → bun-ILPS6AYA.js} +2 -2
  13. package/dist/bundle/{bun-sqlite-KBXOW2ES.js → bun-sqlite-JE6FJFQT.js} +3 -3
  14. package/dist/bundle/{chunk-KJTNT4SW.js → chunk-2DAXUNTS.js} +2 -2
  15. package/dist/bundle/chunk-3MDNAYQA.js +34 -0
  16. package/dist/bundle/chunk-3WDYHOAF.js +91 -0
  17. package/dist/bundle/{chunk-EGRB55FF.js → chunk-45244QQ6.js} +14 -12
  18. package/dist/bundle/{chunk-JHO2LL2J.js → chunk-4MU2UM4C.js} +7 -7
  19. package/dist/bundle/{chunk-N2Z3MCOF.js → chunk-5GTMQTQH.js} +37 -35
  20. package/dist/bundle/chunk-62JRF2JA.js +35 -0
  21. package/dist/bundle/{chunk-TGB5F7NC.js → chunk-66VMJGV6.js} +4 -4
  22. package/dist/bundle/{chunk-V3ZTQ24B.js → chunk-6AW4DDK4.js} +4 -4
  23. package/dist/bundle/{chunk-PJOVK7PG.js → chunk-7F5VMLVK.js} +49 -24
  24. package/dist/bundle/{chunk-YJNUDHJD.js → chunk-7UPBPE3Z.js} +139 -35
  25. package/dist/bundle/{chunk-MFS52LTZ.js → chunk-7Z4HR6GO.js} +1 -1
  26. package/dist/bundle/{chunk-E42W72PQ.js → chunk-AS2PJNQ2.js} +7 -5
  27. package/dist/bundle/{chunk-Z7MSIRSQ.js → chunk-CGFQT3LQ.js} +1 -1
  28. package/dist/bundle/{chunk-QKWRL4OD.js → chunk-DQIBGCF3.js} +6 -6
  29. package/dist/bundle/{chunk-RUKDZEID.js → chunk-DZLHY4IA.js} +3 -3
  30. package/dist/bundle/{chunk-TAYOKLGF.js → chunk-EMHCXXNJ.js} +7 -6
  31. package/dist/bundle/{chunk-AK257OMS.js → chunk-EX2FV7YJ.js} +209 -78
  32. package/dist/bundle/{chunk-IBBN7Z3A.js → chunk-F34HGYWF.js} +12 -3
  33. package/dist/bundle/{chunk-KRCCGWWS.js → chunk-FC53WQHG.js} +1 -1
  34. package/dist/bundle/{chunk-ERGB4NJA.js → chunk-G45R7M42.js} +1 -1
  35. package/dist/bundle/{chunk-ZLY6GUAS.js → chunk-G7W53MQP.js} +3 -3
  36. package/dist/bundle/{chunk-FZZIU4B7.js → chunk-GHF72SHT.js} +8196 -5601
  37. package/dist/bundle/{chunk-JAOGZMKQ.js → chunk-GUFPQZUA.js} +2 -2
  38. package/dist/bundle/{chunk-EFHLQXG6.js → chunk-IOJ2DTCY.js} +162 -55
  39. package/dist/bundle/{chunk-7IXL4UFK.js → chunk-KJ3UADR3.js} +8 -8
  40. package/dist/bundle/{chunk-L5WWMP5M.js → chunk-KLFYY7KC.js} +144 -31
  41. package/dist/bundle/{chunk-NOVLCHDV.js → chunk-LATYBJ4T.js} +2 -2
  42. package/dist/bundle/{chunk-QBP7OMN5.js → chunk-LFLSV353.js} +2 -2
  43. package/dist/bundle/{chunk-HDY5X3WQ.js → chunk-LU4A2T7Y.js} +4 -4
  44. package/dist/bundle/{chunk-SVDF6NJF.js → chunk-MWUHBEDN.js} +14 -14
  45. package/dist/bundle/{chunk-JRK73FOW.js → chunk-NENYWEXF.js} +1 -1
  46. package/dist/bundle/{chunk-ERKR3VJ5.js → chunk-NG7MOJBT.js} +141 -46
  47. package/dist/bundle/{chunk-2B5U4Z5H.js → chunk-NH6LZ3H3.js} +8 -13
  48. package/dist/bundle/{chunk-IGHEW777.js → chunk-NRZV7K4M.js} +5 -40
  49. package/dist/bundle/{chunk-4LURWBVV.js → chunk-NVGOHYTE.js} +188 -22
  50. package/dist/bundle/{chunk-OV6PHTAY.js → chunk-NVNUUHT5.js} +17130 -2232
  51. package/dist/bundle/chunk-PIJUGF5F.js +392 -0
  52. package/dist/bundle/{chunk-PBN4RBHS.js → chunk-R2JKPHH5.js} +8 -8
  53. package/dist/bundle/{chunk-PDGXMKJS.js → chunk-R5RYPD23.js} +2 -2
  54. package/dist/bundle/{chunk-35KYY65W.js → chunk-SOYOOU2D.js} +3 -3
  55. package/dist/bundle/{chunk-FDBINRWA.js → chunk-TJJ2XSJP.js} +5 -5
  56. package/dist/bundle/{chunk-O3UXNU3S.js → chunk-U6QD3J3F.js} +3 -3
  57. package/dist/bundle/{chunk-VYSUKHKL.js → chunk-VOTEB3AN.js} +1 -1
  58. package/dist/bundle/{chunk-IN3FVRPK.js → chunk-VS5LGSTM.js} +1 -1
  59. package/dist/bundle/{chunk-QJ6XW4DM.js → chunk-VVGPAHUN.js} +6211 -1207
  60. package/dist/bundle/{chunk-MJRSEUKG.js → chunk-VXOR76ZL.js} +13 -89
  61. package/dist/bundle/{chunk-CXQXVKUY.js → chunk-YIVY2WI3.js} +1 -1
  62. package/dist/bundle/{chunk-VLNKTMV7.js → chunk-YOJLIVGO.js} +959 -350
  63. package/dist/bundle/clidev.js +3 -3
  64. package/dist/bundle/command-contract-3MPKXBVL.js +28 -0
  65. package/dist/bundle/{decode-AMXUVKNY.js → decode-NXB5UKMO.js} +18 -16
  66. package/dist/bundle/{echarts-GJDMQ2AQ.js → echarts-DRDGGHJT.js} +2 -2
  67. package/dist/bundle/{embed-L4CRZ2XQ.js → embed-IKZ24BMC.js} +4 -4
  68. package/dist/bundle/{embedder-IBGV4M2K.js → embedder-GMQ24DOQ.js} +7 -7
  69. package/dist/bundle/{first-run-VTKC2IBV.js → first-run-PURIGDLD.js} +8 -8
  70. package/dist/bundle/first-screen-B2CF2CET.js +26 -0
  71. package/dist/bundle/{instructions-YJECS4KN.js → instructions-EOQOXY6V.js} +1 -1
  72. package/dist/bundle/{mcp-OQBZXELQ.js → mcp-7HBLFGCW.js} +2 -2
  73. package/dist/bundle/{mcp-GBSAK3VW.js → mcp-ASNYBQ5B.js} +38 -37
  74. package/dist/bundle/mcp-EY2NUYDQ.js +82 -0
  75. package/dist/bundle/{node-NQG4EVZR.js → node-52WF2326.js} +2 -2
  76. package/dist/bundle/{node-sqlite-BR7F3BLB.js → node-sqlite-73Z4SFOA.js} +9 -3
  77. package/dist/bundle/{oauth-J7UAWNIK.js → oauth-EVTPAMZP.js} +5 -5
  78. package/dist/bundle/{open-BR47R5UE.js → open-46WZAPJ3.js} +3 -2
  79. package/dist/bundle/openai-GWRDAHDU.js +248 -0
  80. package/dist/bundle/{process-66I7RDPJ.js → process-YIQPKLZI.js} +1 -1
  81. package/dist/bundle/{program-EM4FKOCK.js → program-37NVH5YJ.js} +11354 -9564
  82. package/dist/bundle/{prompt-NE5JJ7UP.js → prompt-IVEYRLS5.js} +3 -3
  83. package/dist/bundle/{recognize-GC3YFVIA.js → recognize-WVEKHODM.js} +4 -2
  84. package/dist/bundle/{remote-QELOMKQM.js → remote-4K5VPMC7.js} +5 -5
  85. package/dist/bundle/{rerank-BH6TZ2SP.js → rerank-V24UJZYJ.js} +5 -5
  86. package/dist/bundle/{serve-WWLRNDT2.js → serve-PJWSOV7F.js} +7 -7
  87. package/dist/bundle/server-3TPCEZ6P.js +40 -0
  88. package/dist/bundle/server-GQX5MZTT.js +53 -0
  89. package/dist/bundle/{state-2BEGXAMO.js → state-ZPYGECVP.js} +4 -4
  90. package/dist/bundle/{store-AH6WZMCF.js → store-6JQCLPQF.js} +14 -9
  91. package/dist/bundle/store-maintenance-command-ND4ADMGC.js +42 -0
  92. package/dist/config.d.ts +2 -0
  93. package/dist/config.d.ts.map +1 -1
  94. package/dist/config.js +4 -2
  95. package/dist/config.js.map +1 -1
  96. package/dist/program.d.ts.map +1 -1
  97. package/dist/program.js +2 -1
  98. package/dist/program.js.map +1 -1
  99. package/dist/version.d.ts +1 -1
  100. package/dist/version.js +1 -1
  101. package/docs/commands.md +37 -11
  102. package/docs/dev/reference-clis.md +1 -1
  103. package/docs/dev/skills/design-interview/SKILL.md +2 -2
  104. package/docs/dev/test-matrix.md +5 -1
  105. package/kit/dist/interview.js +1 -0
  106. package/kit/dist/new.js +8 -3
  107. package/package.json +3 -3
  108. package/src/config.ts +5 -2
  109. package/src/program.test.ts +86 -1
  110. package/src/program.ts +2 -1
  111. package/src/version.ts +1 -1
  112. package/dist/bundle/chunk-IDWW4TU2.js +0 -18
  113. package/dist/bundle/chunk-MUSYGFCY.js +0 -3556
  114. package/dist/bundle/chunk-O5EHUB2V.js +0 -2
  115. package/dist/bundle/command-contract-75VJ36U4.js +0 -29
  116. package/dist/bundle/first-screen-X5IJKBSU.js +0 -27
  117. package/dist/bundle/mcp-RDZGYPSY.js +0 -78
  118. package/dist/bundle/server-DE6NLNUF.js +0 -52
  119. package/dist/bundle/server-ZPSQKOAH.js +0 -39
  120. package/dist/bundle/store-maintenance-command-PBXX3IEV.js +0 -40
  121. /package/dist/bundle/{chunk-GOO67PDU.js → chunk-NL2DQPT7.js} +0 -0
@@ -1,10 +1,13 @@
1
1
  import { chmodSync, mkdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs"
2
2
  import { join } from "node:path"
3
+ import { annotate } from "@wirecat/cli-base/commands"
4
+ import { REMOTE_READ, run as runShared } from "@wirecat/cli-core/cli"
5
+ import { Command } from "commander"
3
6
  import { expect, it, vi } from "vitest"
4
7
  import { doctorReport } from "./commands/doctor.js"
5
8
  import { configuration } from "./config.js"
6
9
  import { IDENTITY } from "./identity.js"
7
- import { run } from "./program.js"
10
+ import { definition, run } from "./program.js"
8
11
 
9
12
  const ran = async (argv: string[]) => {
10
13
  const out: string[] = []
@@ -177,3 +180,85 @@ it("a failed run keeps the words typed, and record_input false masks them", asyn
177
180
  expect((await ran(["personal", "config", "unset", "record_input"])).code).toBe(0)
178
181
  }
179
182
  })
183
+
184
+ it("runs list --compact prints one plain line per run and the next page as a # line, not JSON", async () => {
185
+ for (const _ of [1, 2]) expect((await ran(["--no-such-flag"])).code).toBe(2)
186
+ const { code, out } = await ran(["runs", "list", "--limit", "1", "--compact"])
187
+ expect(code).toBe(0)
188
+ expect(out.trim().split("\n")).toEqual([
189
+ expect.stringContaining("failed"),
190
+ "# more: clidev runs list --page 2 --limit 1 --compact",
191
+ ])
192
+ expect(() => JSON.parse(out)).toThrow()
193
+ })
194
+
195
+ it("config migrate writes the missing defaults, keeps the owner's value, and repeats as a no-op", async () => {
196
+ const file = join(process.env.CLIDEV_CONFIG_DIR ?? "", "config.json")
197
+ mkdirSync(join(file, ".."), { recursive: true })
198
+ writeFileSync(file, '{ "defaults": { "limit": 5 } }')
199
+ try {
200
+ const first = await ran(["config", "migrate", "--json"])
201
+ expect(first.code).toBe(0)
202
+ expect(json(first.out).item.added).toContain("defaults.record")
203
+ expect(JSON.parse(readFileSync(file, "utf8")).defaults).toMatchObject({ limit: 5, record: expect.any(Boolean) })
204
+ const again = await ran(["config", "migrate", "--json"])
205
+ expect(json(again.out).item.added).toEqual([])
206
+ } finally {
207
+ rmSync(file)
208
+ }
209
+ })
210
+
211
+ it("config repair --dry-run changes nothing, and config repair fixes the JSON with a backup", async () => {
212
+ const dir = process.env.CLIDEV_CONFIG_DIR ?? ""
213
+ const file = join(dir, "config.json")
214
+ const broken = '{ "defaults": { "limit": 5, }, }'
215
+ mkdirSync(dir, { recursive: true })
216
+ writeFileSync(file, broken)
217
+ let backup = ""
218
+ try {
219
+ const preview = await ran(["config", "repair", "--dry-run", "--json"])
220
+ expect(preview.code).toBe(0)
221
+ expect(json(preview.out).item).toMatchObject({ dry_run: true, repaired: false, backup: null })
222
+ expect(readFileSync(file, "utf8")).toBe(broken)
223
+
224
+ const fixed = await ran(["config", "repair", "--json"])
225
+ expect(fixed.code).toBe(0)
226
+ const item = json(fixed.out).item
227
+ expect(item).toMatchObject({
228
+ repaired: true,
229
+ changes: expect.arrayContaining([{ kind: "trailing_comma", line: 1 }]),
230
+ })
231
+ backup = String(item.backup)
232
+ expect(readFileSync(backup, "utf8")).toBe(broken)
233
+ expect(JSON.parse(readFileSync(file, "utf8"))).toEqual({ defaults: { limit: 5 } })
234
+ } finally {
235
+ rmSync(file)
236
+ if (backup) rmSync(backup)
237
+ }
238
+ })
239
+
240
+ it("a deny in the profile stops a read command before its action runs", async () => {
241
+ const reached: string[] = []
242
+ const probe = annotate(new Command("probe"), { effects: REMOTE_READ, offline: false }).action(() => {
243
+ reached.push("probe")
244
+ })
245
+ const withProbe = { ...definition(), commands: () => [...definition().commands(), probe] }
246
+ const dir = process.env.CLIDEV_CONFIG_DIR ?? ""
247
+ mkdirSync(dir, { recursive: true })
248
+ writeFileSync(
249
+ join(dir, "config.json"),
250
+ JSON.stringify({ profiles: { personal: { permissions: { probe: "deny" } } } }),
251
+ )
252
+ const err: string[] = []
253
+ try {
254
+ const code = await runShared(["personal", "probe", "--json"], withProbe, {
255
+ streams: { data: () => {}, diagnostic: (text) => err.push(text) },
256
+ tty: false,
257
+ })
258
+ expect(code).not.toBe(0)
259
+ expect(err.join("\n")).toContain("permission_error")
260
+ expect(reached).toEqual([])
261
+ } finally {
262
+ rmSync(join(dir, "config.json"))
263
+ }
264
+ })
package/src/program.ts CHANGED
@@ -33,7 +33,8 @@ const update = appUpdate({
33
33
 
34
34
  export const definition = (): ProgramDefinition => ({
35
35
  app: IDENTITY,
36
- configuration: { resolveSettings: configuration.resolveSettings },
36
+ // The whole object: cli-core refuses a command by its key only when it gets the permission table too.
37
+ configuration,
37
38
  commands: () => [
38
39
  commandsCommand(IDENTITY),
39
40
  doctorCommand(),
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = "0.13.2"
1
+ export const VERSION = "0.15.0"
@@ -1,18 +0,0 @@
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.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/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
- };