@wirecat/cli-template 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.
Files changed (119) hide show
  1. package/.github/workflows/ci.yml +18 -0
  2. package/.github/workflows/release.yml +63 -0
  3. package/CHANGELOG.md +72 -1
  4. package/CLAUDE.md +1 -3
  5. package/bin/release +5 -3
  6. package/contracts/help.snap +2 -0
  7. package/dist/bin/clidev.js +34 -12
  8. package/dist/bundle/all-profiles-MJ6XSFOO.js +24 -0
  9. package/dist/bundle/anthropic-W5UKBZUB.js +70 -0
  10. package/dist/bundle/app-server-EZ46JAHB.js +217 -0
  11. package/dist/bundle/bun-HB6O2TTT.js +169 -0
  12. package/dist/bundle/bun-sqlite-KBXOW2ES.js +69 -0
  13. package/dist/bundle/chunk-2B5U4Z5H.js +100 -0
  14. package/dist/bundle/chunk-35KYY65W.js +122 -0
  15. package/dist/bundle/chunk-4LURWBVV.js +752 -0
  16. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  17. package/dist/bundle/chunk-7IXL4UFK.js +158 -0
  18. package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
  19. package/dist/bundle/chunk-AK257OMS.js +8353 -0
  20. package/dist/bundle/chunk-CXQXVKUY.js +24 -0
  21. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  22. package/dist/bundle/chunk-E42W72PQ.js +151 -0
  23. package/dist/bundle/chunk-EFHLQXG6.js +5104 -0
  24. package/dist/bundle/chunk-EGRB55FF.js +264 -0
  25. package/dist/bundle/chunk-ERGB4NJA.js +53 -0
  26. package/dist/bundle/chunk-ERKR3VJ5.js +1146 -0
  27. package/dist/bundle/chunk-FDBINRWA.js +884 -0
  28. package/dist/bundle/chunk-FZZIU4B7.js +34514 -0
  29. package/dist/bundle/chunk-GOO67PDU.js +2 -0
  30. package/dist/bundle/chunk-HDY5X3WQ.js +281 -0
  31. package/dist/bundle/chunk-HTQTIKWP.js +928 -0
  32. package/dist/bundle/chunk-IBBN7Z3A.js +630 -0
  33. package/dist/bundle/chunk-IDWW4TU2.js +18 -0
  34. package/dist/bundle/chunk-IGHEW777.js +164 -0
  35. package/dist/bundle/chunk-IN3FVRPK.js +76 -0
  36. package/dist/bundle/chunk-JAOGZMKQ.js +48 -0
  37. package/dist/bundle/chunk-JHO2LL2J.js +459 -0
  38. package/dist/bundle/chunk-JRK73FOW.js +78 -0
  39. package/dist/bundle/chunk-KAREKBUZ.js +24 -0
  40. package/dist/bundle/chunk-KJTNT4SW.js +82 -0
  41. package/dist/bundle/chunk-L5WWMP5M.js +1904 -0
  42. package/dist/bundle/chunk-MFS52LTZ.js +570 -0
  43. package/dist/bundle/chunk-MJRSEUKG.js +442 -0
  44. package/dist/bundle/chunk-MUSYGFCY.js +3556 -0
  45. package/dist/bundle/chunk-N2Z3MCOF.js +779 -0
  46. package/dist/bundle/chunk-NOVLCHDV.js +45 -0
  47. package/dist/bundle/chunk-O3UXNU3S.js +54 -0
  48. package/dist/bundle/chunk-O5EHUB2V.js +2 -0
  49. package/dist/bundle/chunk-OV6PHTAY.js +36226 -0
  50. package/dist/bundle/chunk-PBN4RBHS.js +2315 -0
  51. package/dist/bundle/chunk-PDGXMKJS.js +31 -0
  52. package/dist/bundle/chunk-PJOVK7PG.js +191 -0
  53. package/dist/bundle/chunk-QBP7OMN5.js +58 -0
  54. package/dist/bundle/chunk-QJ6XW4DM.js +7556 -0
  55. package/dist/bundle/chunk-QKWRL4OD.js +1028 -0
  56. package/dist/bundle/chunk-RUKDZEID.js +73 -0
  57. package/dist/bundle/chunk-SVDF6NJF.js +215 -0
  58. package/dist/bundle/chunk-TAYOKLGF.js +193 -0
  59. package/dist/bundle/chunk-TGB5F7NC.js +288 -0
  60. package/dist/bundle/chunk-V3ZTQ24B.js +161 -0
  61. package/dist/bundle/chunk-VLNKTMV7.js +3103 -0
  62. package/dist/bundle/chunk-VYSUKHKL.js +63 -0
  63. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  64. package/dist/bundle/chunk-YJNUDHJD.js +3390 -0
  65. package/dist/bundle/chunk-Z7MSIRSQ.js +6848 -0
  66. package/dist/bundle/chunk-ZLY6GUAS.js +82 -0
  67. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  68. package/dist/bundle/clidev.js +22 -0
  69. package/dist/bundle/command-contract-75VJ36U4.js +29 -0
  70. package/dist/bundle/decode-AMXUVKNY.js +158 -0
  71. package/dist/bundle/dist-ESHIQU4M.js +7577 -0
  72. package/dist/bundle/echarts-GJDMQ2AQ.js +42501 -0
  73. package/dist/bundle/embed-L4CRZ2XQ.js +35 -0
  74. package/dist/bundle/embedder-IBGV4M2K.js +108 -0
  75. package/dist/bundle/first-run-VTKC2IBV.js +23 -0
  76. package/dist/bundle/first-screen-X5IJKBSU.js +27 -0
  77. package/dist/bundle/instructions-YJECS4KN.js +11 -0
  78. package/dist/bundle/mcp-G6XP2IRO.js +151 -0
  79. package/dist/bundle/mcp-OQBZXELQ.js +165 -0
  80. package/dist/bundle/mcp-RDZGYPSY.js +78 -0
  81. package/dist/bundle/node-NQG4EVZR.js +176 -0
  82. package/dist/bundle/node-P4E63KXA.js +2340 -0
  83. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  84. package/dist/bundle/node-sqlite-BR7F3BLB.js +61 -0
  85. package/dist/bundle/oauth-J7UAWNIK.js +17 -0
  86. package/dist/bundle/open-BR47R5UE.js +19 -0
  87. package/dist/bundle/process-66I7RDPJ.js +91 -0
  88. package/dist/bundle/program-K6347XBZ.js +17279 -0
  89. package/dist/bundle/prompt-NE5JJ7UP.js +12 -0
  90. package/dist/bundle/recognize-GC3YFVIA.js +21 -0
  91. package/dist/bundle/remote-QELOMKQM.js +26 -0
  92. package/dist/bundle/rerank-BH6TZ2SP.js +49 -0
  93. package/dist/bundle/serve-WWLRNDT2.js +19 -0
  94. package/dist/bundle/server-DE6NLNUF.js +52 -0
  95. package/dist/bundle/server-ZPSQKOAH.js +39 -0
  96. package/dist/bundle/state-2BEGXAMO.js +33 -0
  97. package/dist/bundle/store-AH6WZMCF.js +120 -0
  98. package/dist/bundle/store-maintenance-command-PBXX3IEV.js +40 -0
  99. package/dist/version.d.ts +1 -1
  100. package/dist/version.d.ts.map +1 -1
  101. package/dist/version.js +1 -1
  102. package/dist/version.js.map +1 -1
  103. package/docs/commands.md +9 -13
  104. package/docs/dev/TESTING.md +10 -0
  105. package/docs/dev/reference-clis.md +7 -5
  106. package/docs/dev/skills/release/SKILL.md +15 -8
  107. package/docs/dev/skills/release/fresh-audit.md +4 -0
  108. package/docs/dev/test-matrix.md +1 -1
  109. package/kit/dist/new.js +1 -0
  110. package/package.json +8 -5
  111. package/scripts/audit.sh +14 -3
  112. package/scripts/smoke-bundle.ts +64 -0
  113. package/scripts/smoke.ts +18 -0
  114. package/scripts/test-matrix-untested.ts +1 -1
  115. package/scripts/version-level.test.ts +17 -1
  116. package/scripts/version-level.ts +35 -7
  117. package/skills/clidev-cli/SKILL.md +8 -0
  118. package/src/version.ts +1 -1
  119. package/lint/baseline/unknown-verb.json +0 -1
@@ -35,6 +35,24 @@ jobs:
35
35
  contracts:upgrade
36
36
  checks: |
37
37
  bash scripts/audit.sh
38
+ pnpm smoke:node
39
+
40
+ # WC-TOOL-6: engines allows ^22.16.0; node-ci.yml runs Node 24 only.
41
+ node-22:
42
+ runs-on: ubuntu-latest
43
+ steps:
44
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
45
+ with:
46
+ persist-credentials: false
47
+ - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
48
+ - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
49
+ with:
50
+ node-version: 22.16.0
51
+ cache: pnpm
52
+ - run: pnpm install --frozen-lockfile --ignore-scripts
53
+ - run: pnpm build
54
+ - run: pnpm test
55
+ - run: pnpm smoke:node
38
56
 
39
57
  version:
40
58
  if: github.event_name == 'pull_request'
@@ -189,3 +189,66 @@ jobs:
189
189
  run: |
190
190
  awk -v v="$VERSION" '$0 ~ "^## "v" " {on=1; next} /^## / && on {exit} on' CHANGELOG.md |
191
191
  gh release create "v$VERSION" --title "$VERSION" --notes-file -
192
+
193
+ # The template's own release publishes @wirecat/cli-template, which has no skill on ClawHub.
194
+ # ClawHub's own workflow, pinned: it runs the ClawHub CLI from this commit and needs id-token only to read which
195
+ # commit that is. It publishes the skill only when it changed, as the next patch of ClawHub's own version line.
196
+ clawhub-dry-run:
197
+ needs: build
198
+ if: inputs.dry_run && github.repository != 'WireCatLabs/cli-template'
199
+ permissions:
200
+ contents: read
201
+ id-token: write
202
+ uses: openclaw/clawhub/.github/workflows/skill-publish.yml@52358852d3510f1150756d48e8a72cb8c8e698e0 # main, 2026-10-25
203
+ with:
204
+ skill_path: skills/clidev-cli
205
+ owner: wirecat
206
+ dry_run: true
207
+
208
+ # After the tag, so a ClawHub failure never holds back the npm release. The same CLI commit as the dry run, but run
209
+ # here instead of through ClawHub's workflow, which GitHub cannot let fail: a version stuck pending ClawHub's scan
210
+ # is not counted as the latest, so the next publish picks it again and gets "already exists" (openclaw/clawhub#4046).
211
+ # That one error warns; any other fails. Bump CLAWHUB_SHA together with the dry run's pin.
212
+ clawhub:
213
+ needs: tag
214
+ if: ${{ !inputs.dry_run && github.repository != 'WireCatLabs/cli-template' }}
215
+ runs-on: ubuntu-latest
216
+ permissions:
217
+ contents: read
218
+ env:
219
+ SKILL_PATH: skills/clidev-cli
220
+ CLAWHUB_SLUG: wirecat-clidev
221
+ CLAWHUB_SHA: 52358852d3510f1150756d48e8a72cb8c8e698e0
222
+ CLAWHUB_URL: https://clawhub.ai
223
+ steps:
224
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
225
+ with:
226
+ persist-credentials: false
227
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
228
+ with:
229
+ repository: openclaw/clawhub
230
+ ref: ${{ env.CLAWHUB_SHA }}
231
+ path: clawhub-source
232
+ persist-credentials: false
233
+ - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
234
+ with:
235
+ bun-version: 1.4.4
236
+ - run: bun install --frozen-lockfile
237
+ working-directory: clawhub-source
238
+ - name: publish the skill
239
+ env:
240
+ CLAWHUB_TOKEN: ${{ secrets.CLAWHUB_TOKEN }}
241
+ CLAWHUB_CONFIG_PATH: ${{ runner.temp }}/clawhub-config.json
242
+ run: |
243
+ (umask 077; jq -n --arg r "$CLAWHUB_URL" --arg t "$CLAWHUB_TOKEN" '{registry: $r, token: $t}' > "$CLAWHUB_CONFIG_PATH")
244
+ status=0
245
+ output=$(bun clawhub-source/packages/clawhub/src/cli.ts --workdir "$GITHUB_WORKSPACE" \
246
+ --site "$CLAWHUB_URL" --registry "$CLAWHUB_URL" skill publish "$SKILL_PATH" --slug "$CLAWHUB_SLUG" --json \
247
+ --owner wirecat --tags latest --source-repo "$GITHUB_REPOSITORY" --source-commit "$GITHUB_SHA" \
248
+ --source-path "$SKILL_PATH" --source-ref "$GITHUB_REF" 2>&1) || status=$?
249
+ echo "$output"
250
+ if [ "$status" -ne 0 ] && grep -q "already exists" <<< "$output"; then
251
+ echo "::warning::ClawHub already has this skill version, still pending its stalled scan — not republished (openclaw/clawhub#4046)"
252
+ exit 0
253
+ fi
254
+ exit "$status"
package/CHANGELOG.md CHANGED
@@ -3,7 +3,78 @@
3
3
  Notable changes to `@wirecat/cli-template`. One section per version, newest first; versions follow
4
4
  [semantic versioning](https://semver.org), so before `1.0.0` the skeleton may still change.
5
5
 
6
- <!-- cspell:words katex smol whatsapp -->
6
+ <!-- cspell:words clawhub gcal katex openclaw smol whatsapp -->
7
+
8
+ ## 0.11.0 — 31.10.2026
9
+
10
+ ### Added
11
+
12
+ - **`pnpm test:slow`** lists the 20 slowest tests and the 10 slowest files (WC-TEST-5).
13
+ - **A Node 22.16.0 job in `ci.yml`** builds, runs the tests and runs the built bin, since `engines` allows Node 22 and
14
+ full validation runs only on Node 24 (WC-TOOL-6).
15
+ - **The release skill re-checks the comparison page** at each release: each mark against the release build, and the
16
+ check date and version in the intro (WC-CMP-11).
17
+
18
+ ### Changed — may break callers
19
+
20
+ - **The skeleton runs on cli-core 0.495.0** (from 0.469.0); cli-base stays at 0.65.0. The root help's "Works with"
21
+ list now names gcal and mail.
22
+
23
+ ### Fixed
24
+
25
+ - **`scripts/audit.sh` passes the CLI's own entity schemas and error reasons** (`--schemas`, `--reasons`) from
26
+ `commands info`, so the audit measures same-entity-schema and same-error-reason for it, as gcal-cli's does.
27
+ - **The scripts that run the CLI in throwaway folders hide the keyring** with `DBUS_SESSION_BUS_ADDRESS=disabled:`:
28
+ `scripts/audit.sh`, `scripts/smoke.ts` and `scripts/smoke-bundle.ts`. Moved folders alone do not hide it, since it
29
+ is reached over D-Bus. `scripts/` is not updated by `upgrade`, so an existing CLI copies these by hand;
30
+ `scripts/audit.sh` is updated.
31
+ - **`pnpm package:check` refuses a `files` list that ships `src`, `scripts`, `.github`, `bin/release`, `config`, `lint`,
32
+ `contracts`, `docs/dev` or `template.json`** (WC-REL-16); it only checked that npm packs what `files` names. The
33
+ template's own package still ships them, since `new` copies them. `scripts/` is not updated by `upgrade`, so an
34
+ existing CLI copies the check from `scripts/smoke.ts` by hand.
35
+ - **0.10.0's note that runs record successes too was wrong for the skeleton.** A built skeleton keeps only a failed
36
+ run, from a terminal or an agent, and also with `--record`, as the README and the settings page say.
37
+
38
+ ## 0.10.0 — 31.10.2026
39
+
40
+ ### Changed — may break callers
41
+
42
+ - **The skeleton runs on cli-core 0.469.0 and cli-base 0.65.0**; a CLI that pins cli-base moves both pins together.
43
+ A non-messenger CLI no longer offers messenger settings or the `follow-ups` and `link-conversations` skills
44
+ (cli-core 0.468); runs record successes too, under cli-core 0.467's rules. cli-base 0.64 adds `cli-dev bundle`, the
45
+ shared build that ships the bin as an esbuild bundle, and calendar words in the command vocabulary. cli-base 0.65 adds
46
+ the verbs `serve` and `revoke`, and `cli-dev lint` fails on a baseline entry that names them: the skeleton's
47
+ `lint/baseline/unknown-verb.json` (`mcp serve`, `mcp revoke`) is gone, and a CLI made from the template removes the
48
+ same entries. `<cli> upgrade` now restarts the HTTP MCP server that `mcp server start` started, on the new version,
49
+ and names the MCP sessions over stdio that still run the old one (cli-core #2117).
50
+
51
+ ### Added
52
+
53
+ - **A CLI made from the template publishes its skill on ClawHub as `wirecat-<command>` after each release.** `release.yml`
54
+ gets a dry run through ClawHub's pinned workflow and, after the tag, a publish that only warns while ClawHub still holds
55
+ the version pending its scan ([openclaw/clawhub#4046](https://github.com/openclaw/clawhub/issues/4046)); the template's
56
+ own release skips both. The skill names its binary and npm package for OpenClaw (`metadata.openclaw`). It needs the
57
+ `CLAWHUB_TOKEN` secret, which the WireCatLabs organization shares.
58
+ - **`new --category calendar` names gcal-cli as the reference CLI** in `AGENTS.md` and `DESIGN.md`, and the
59
+ Reference CLIs page lists it, instead of "No reference CLI for this category yet". gcal-cli is the WireCat Google
60
+ Calendar CLI. A CLI made before this keeps what it wrote; edit its `AGENTS.md` by hand if you want the link.
61
+ - **`scripts/audit.sh` audits beside gcal-cli too**: it installs `@wirecat/gcal-cli` with the other published CLIs
62
+ and passes its `gcal` bin to `cli-dev audit`.
63
+ - **An agent publishes a release itself.** The release skill and `bin/release` let an agent merge the release pull
64
+ request and run `bin/release`, which publishes from GitHub Actions. `bin/release --local` stays the owner's, for
65
+ the first release.
66
+
67
+ ### Fixed
68
+
69
+ - **The release audit never uses the owner's accounts.** Its prompt now says: no sign-in, every folder moved, the
70
+ keyring hidden with `DBUS_SESSION_BUS_ADDRESS=disabled:`, and no command that writes to a service.
71
+ - **`bin/release` raises the next free version to the level the changelog needs.** When npm already had the version, it
72
+ took the next patch, so a release with `Added` (`0.1.1` taken, `0.1.2` proposed) failed `version:check` and stopped;
73
+ it now proposes `0.2.0`. A generated CLI gets it with the next template update.
74
+ - **A CLI made from the template starts from an esbuild bundle.** `pnpm build` runs `tsc`, then cli-base's
75
+ `cli-dev bundle` ([WC-LAY-10](https://github.com/WireCatLabs/cli-base/blob/main/docs/standards/layout.md)), and the
76
+ bin becomes a loader for `dist/bundle/`: the skeleton's `config show --help` starts in 151 ms instead of 366.
77
+ `scripts/smoke-bundle.ts` runs the bundle under Node (`pnpm smoke:node`, in CI) and Bun (`pnpm smoke:bun`).
7
78
 
8
79
  ## 0.9.0 — 27.10.2026
9
80
 
package/CLAUDE.md CHANGED
@@ -8,9 +8,7 @@ permissions. A gap in cli-core is fixed in cli-core.
8
8
 
9
9
  ## Local rules
10
10
 
11
- - **Before `1.0.0`, `Added` raises the minor too.** This narrows the handbook's
12
- [WC-REL-7](node_modules/@wirecat/cli-base/docs/standards/releases.md): the levels are in step 6 of the
13
- [release skill](docs/dev/skills/release/SKILL.md), and `pnpm version:check` refuses a version raised too little.
11
+ None yet.
14
12
 
15
13
  Add a rule here only when it holds for `clidev` alone, and link the handbook rule it narrows.
16
14
 
package/bin/release CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env sh
2
- # Publishes the version in package.json and tags it. Run on a clean `main` that matches origin/main; the owner runs
3
- # it, never an agent. When npm already has that version, or a higher one, it raises it to the next free one through a
4
- # pull request and publishes that (WC-REL-5). Nothing is published until `pnpm release:check` passes.
2
+ # Publishes the version in package.json and tags it. Run on a clean `main` that matches origin/main. An agent may run
3
+ # it without --local; --local is for the owner's first release only. When npm already has that version, or a higher
4
+ # one, it raises it to the next free one through a pull request and publishes that (WC-REL-5). Nothing is published
5
+ # until `pnpm release:check` passes.
5
6
  #
6
7
  # bin/release # publishes from GitHub Actions (.github/workflows/release.yml, npm trusted publishing)
7
8
  # bin/release --local # publishes from this computer: NPM_TOKEN if exported, else the keyring, else `npm login`
@@ -110,6 +111,7 @@ next=$(pnpm exec cli-dev next-version "$version" "$latest" "$versions")
110
111
  if [ "$next" != "$version" ]; then
111
112
  taken=""
112
113
  if published; then taken=1; why="$version is already on npm"; else why="$version is not above npm's latest $latest"; fi
114
+ next=$(node --experimental-strip-types scripts/version-level.ts --next "$next")
113
115
  echo "$why — publishing $next instead"
114
116
  # A version npm already has keeps its changelog section; the unreleased one becomes the new version.
115
117
  node -e 'const fs = require("fs"); const [o, n, taken] = process.argv.slice(1)
@@ -9,7 +9,9 @@ Works with:
9
9
  wa WhatsApp in the same local store: search, review and tasks offline
10
10
  zm Zoom meetings: transcripts and summaries, searchable with your other WireCat data
11
11
  drive Google Drive and Docs as local text, searchable with your other WireCat data
12
+ gcal Google Calendar events, searchable with your other WireCat data
12
13
  memo context <person> one person across messengers, mail, notes and meetings
14
+ mail IMAP mail in the same local store: search your mailbox offline, next to your other WireCat data
13
15
 
14
16
  Next: clidev commands every command, by section
15
17
  clidev help options output, offline, timeouts, dry run
@@ -1,14 +1,36 @@
1
1
  #!/usr/bin/env node
2
- import { enableCompileCache } from "node:module";
3
- import { catchCrashes } from "@wirecat/cli-base";
4
- import { IDENTITY } from "../identity.js";
5
- enableCompileCache();
6
- const stopCatching = catchCrashes({ cli: IDENTITY.command, interactive: process.stdout.isTTY === true });
7
- const { run } = await import("../program.js");
8
- try {
9
- process.exitCode = await run(process.argv.slice(2));
2
+ // cli-dev bundle loader
3
+ import * as module from "node:module"
4
+
5
+ const words = process.argv.slice(2)
6
+ // As the CLI answers it, unless a test records the argv: then the CLI writes the record too.
7
+ if (
8
+ words.length === 1 &&
9
+ (words[0] === "--version" || words[0] === "-V") &&
10
+ !Object.keys(process.env).some((key) => key.endsWith("_TEST_ARGV_LOG"))
11
+ ) {
12
+ process.stdout.write("0.11.0\n")
13
+ } else {
14
+ // Before the bundle compiles: the bundle's own call comes after its chunks.
15
+ module.enableCompileCache()
16
+ const serves = ((words) => {
17
+ const plain = words.filter((word) => !word.startsWith("-"));
18
+ return plain
19
+ .slice(0, 4)
20
+ .some((word, at) => word === "serve" || word === "watch" || (word === "mcp" && plain[at + 1] === undefined));
21
+ })(words)
22
+ if (serves && module.registerHooks) {
23
+ const bundle = new URL("../bundle/", import.meta.url).href
24
+ module.registerHooks({
25
+ resolve: (specifier, context, next) =>
26
+ specifier.startsWith("./") && context.parentURL?.startsWith(bundle)
27
+ ? { url: new URL(specifier, context.parentURL).href, format: "module", shortCircuit: true }
28
+ : next(specifier, context),
29
+ })
30
+ }
31
+ const running = import("../bundle/clidev.js")
32
+ const chunks = ["../bundle/all-profiles-MJ6XSFOO.js","../bundle/anthropic-W5UKBZUB.js","../bundle/app-server-EZ46JAHB.js","../bundle/bun-HB6O2TTT.js","../bundle/bun-sqlite-KBXOW2ES.js","../bundle/decode-AMXUVKNY.js","../bundle/dist-ESHIQU4M.js","../bundle/echarts-GJDMQ2AQ.js","../bundle/embed-L4CRZ2XQ.js","../bundle/embedder-IBGV4M2K.js","../bundle/first-screen-X5IJKBSU.js","../bundle/instructions-YJECS4KN.js","../bundle/mcp-G6XP2IRO.js","../bundle/mcp-OQBZXELQ.js","../bundle/mcp-RDZGYPSY.js","../bundle/node-NQG4EVZR.js","../bundle/node-P4E63KXA.js","../bundle/node-TLZSIHIJ.js","../bundle/node-sqlite-BR7F3BLB.js","../bundle/oauth-J7UAWNIK.js","../bundle/open-BR47R5UE.js","../bundle/process-66I7RDPJ.js","../bundle/program-K6347XBZ.js","../bundle/prompt-NE5JJ7UP.js","../bundle/recognize-GC3YFVIA.js","../bundle/remote-QELOMKQM.js","../bundle/rerank-BH6TZ2SP.js","../bundle/serve-WWLRNDT2.js","../bundle/server-DE6NLNUF.js","../bundle/server-ZPSQKOAH.js","../bundle/state-2BEGXAMO.js","../bundle/store-AH6WZMCF.js","../bundle/store-maintenance-command-PBXX3IEV.js"]
33
+ // After the server answers its first request, so it starts no later.
34
+ if (serves) setTimeout(() => void Promise.allSettled(chunks.map((chunk) => import(chunk))), 2000).unref()
35
+ await running
10
36
  }
11
- finally {
12
- stopCatching();
13
- }
14
- //# sourceMappingURL=clidev.js.map
@@ -0,0 +1,24 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ CHILD_IDLE_MS,
5
+ allProfilesServer,
6
+ serveAllProfilesOverHttp,
7
+ serveAllProfilesOverStdio,
8
+ withProfile
9
+ } from "./chunk-HDY5X3WQ.js";
10
+ import "./chunk-IN3FVRPK.js";
11
+ import "./chunk-IBBN7Z3A.js";
12
+ import "./chunk-5D4AEUVA.js";
13
+ import "./chunk-MJRSEUKG.js";
14
+ import "./chunk-O5EHUB2V.js";
15
+ import "./chunk-EFHLQXG6.js";
16
+ import "./chunk-Y5E2WNWB.js";
17
+ import "./chunk-ZVVMGPBJ.js";
18
+ export {
19
+ CHILD_IDLE_MS,
20
+ allProfilesServer,
21
+ serveAllProfilesOverHttp,
22
+ serveAllProfilesOverStdio,
23
+ withProfile
24
+ };
@@ -0,0 +1,70 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ checkedOptions
5
+ } from "./chunk-PDGXMKJS.js";
6
+ import {
7
+ messagesFor,
8
+ systemFor
9
+ } from "./chunk-NOVLCHDV.js";
10
+ import {
11
+ Anthropic
12
+ } from "./chunk-ADLS6FVG.js";
13
+ import {
14
+ array,
15
+ optional,
16
+ strictObject,
17
+ string
18
+ } from "./chunk-EFHLQXG6.js";
19
+ import "./chunk-Y5E2WNWB.js";
20
+ import {
21
+ __name
22
+ } from "./chunk-ZVVMGPBJ.js";
23
+
24
+ // 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/models/anthropic.js
25
+ var options = strictObject({
26
+ stop_sequences: optional(array(string()))
27
+ });
28
+ var anthropic = {
29
+ images: true,
30
+ baseUrl: "https://api.anthropic.com",
31
+ validate: /* @__PURE__ */ __name((given) => checkedOptions("anthropic", options, given), "validate"),
32
+ complete: /* @__PURE__ */ __name(async (target, request, checked, apiKey, fetcher) => {
33
+ const client = new Anthropic({
34
+ apiKey: apiKey ?? "",
35
+ authToken: null,
36
+ fetch: /* @__PURE__ */ __name((input, init) => fetcher(input, { ...init, redirect: "error" }), "fetch"),
37
+ baseURL: target.baseUrl,
38
+ maxRetries: 0,
39
+ logLevel: "off",
40
+ timeout: 12e4
41
+ });
42
+ const response = await client.messages.stream({
43
+ ...checked,
44
+ model: target.model,
45
+ system: systemFor(request),
46
+ messages: [
47
+ ...messagesFor(request),
48
+ ...request.images === void 0 ? [] : [
49
+ {
50
+ role: "user",
51
+ content: request.images.map((image) => ({
52
+ type: "image",
53
+ source: { type: "base64", media_type: image.mimeType, data: image.data }
54
+ }))
55
+ }
56
+ ]
57
+ ],
58
+ max_tokens: request.maxTokens
59
+ }).finalMessage();
60
+ if (response.stop_reason !== "end_turn")
61
+ throw new Error("incomplete response");
62
+ return {
63
+ text: response.content.filter((block) => block.type === "text").map((block) => block.text).join(""),
64
+ tokens: response.usage.input_tokens + response.usage.output_tokens + (response.usage.cache_creation_input_tokens ?? 0) + (response.usage.cache_read_input_tokens ?? 0)
65
+ };
66
+ }, "complete")
67
+ };
68
+ export {
69
+ anthropic
70
+ };
@@ -0,0 +1,217 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ PER_RUN,
5
+ envelope
6
+ } from "./chunk-N2Z3MCOF.js";
7
+ import "./chunk-ERKR3VJ5.js";
8
+ import {
9
+ mcpUrlOf
10
+ } from "./chunk-JAOGZMKQ.js";
11
+ import {
12
+ answeredWire
13
+ } from "./chunk-IN3FVRPK.js";
14
+ import {
15
+ answered,
16
+ failed,
17
+ registerCommands,
18
+ runCommandForAgent,
19
+ toolsFromCommands
20
+ } from "./chunk-YJNUDHJD.js";
21
+ import {
22
+ agentJson,
23
+ skillResource
24
+ } from "./chunk-4LURWBVV.js";
25
+ import {
26
+ StdioServerTransport,
27
+ serveStdio
28
+ } from "./chunk-IBBN7Z3A.js";
29
+ import "./chunk-L5WWMP5M.js";
30
+ import "./chunk-FZZIU4B7.js";
31
+ import "./chunk-KJTNT4SW.js";
32
+ import "./chunk-E42W72PQ.js";
33
+ import "./chunk-MFS52LTZ.js";
34
+ import {
35
+ appInstructions
36
+ } from "./chunk-ERGB4NJA.js";
37
+ import {
38
+ McpServer
39
+ } from "./chunk-5D4AEUVA.js";
40
+ import {
41
+ mcpHttpMarker
42
+ } from "./chunk-V3ZTQ24B.js";
43
+ import "./chunk-RUKDZEID.js";
44
+ import "./chunk-OV6PHTAY.js";
45
+ import "./chunk-PBN4RBHS.js";
46
+ import "./chunk-35KYY65W.js";
47
+ import "./chunk-NOVLCHDV.js";
48
+ import "./chunk-IGHEW777.js";
49
+ import "./chunk-MUSYGFCY.js";
50
+ import {
51
+ DEFAULT_OUTPUT_BYTES,
52
+ changesAuthorityAt,
53
+ describeProgram,
54
+ environmentOf,
55
+ fetchesOnlyAt,
56
+ judgedTargets,
57
+ readOnlyLockOf,
58
+ rootOf2 as rootOf
59
+ } from "./chunk-QJ6XW4DM.js";
60
+ import "./chunk-MJRSEUKG.js";
61
+ import "./chunk-O3UXNU3S.js";
62
+ import "./chunk-VYSUKHKL.js";
63
+ import "./chunk-VLNKTMV7.js";
64
+ import "./chunk-O5EHUB2V.js";
65
+ import "./chunk-FDBINRWA.js";
66
+ import "./chunk-QKWRL4OD.js";
67
+ import "./chunk-EGRB55FF.js";
68
+ import "./chunk-IDWW4TU2.js";
69
+ import "./chunk-2B5U4Z5H.js";
70
+ import {
71
+ CliError,
72
+ mcpErrorResult
73
+ } from "./chunk-EFHLQXG6.js";
74
+ import "./chunk-Y5E2WNWB.js";
75
+ import "./chunk-Z7MSIRSQ.js";
76
+ import {
77
+ __name
78
+ } from "./chunk-ZVVMGPBJ.js";
79
+
80
+ // 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/mcp/app-server.js
81
+ var EXCLUDED = [["mcp"]];
82
+ var createAppServer = /* @__PURE__ */ __name((command, context, options) => {
83
+ const { app } = options;
84
+ const root = rootOf(command);
85
+ const environment = environmentOf(command);
86
+ if (!environment.runCommand)
87
+ throw new Error("the MCP server runs inside run(), which hands it the program");
88
+ const program = { run: environment.runCommand, commands: describeProgram(root) };
89
+ const flags = command.optsWithGlobals();
90
+ const overrides = flags.permission ?? [];
91
+ const { settings } = context;
92
+ const levels = /* @__PURE__ */ __name(() => options.resolveSettings(flags, { env: context.env }).permissions, "levels");
93
+ const readOnly = /* @__PURE__ */ __name(() => readOnlyLockOf(app, context.env) !== void 0, "readOnly");
94
+ const authority = changesAuthorityAt(root);
95
+ const targets = judgedTargets(root);
96
+ const passed = Object.fromEntries(Object.entries(environment).filter(([key]) => !PER_RUN.has(key)));
97
+ const tools = toolsFromCommands(program.commands, {
98
+ includeUnavailable: true,
99
+ exclude: EXCLUDED,
100
+ levels: settings.permissions,
101
+ currentLevels: levels,
102
+ readOnly: readOnly(),
103
+ authority,
104
+ fetchOnly: fetchesOnlyAt(root),
105
+ permissions: options.permissions
106
+ });
107
+ const availability = /* @__PURE__ */ __name((one) => () => {
108
+ const permitted = one.availability?.() ?? { available: true };
109
+ if (!permitted.available)
110
+ return permitted;
111
+ return options.availability?.(one.path, settings.profile) ?? permitted;
112
+ }, "availability");
113
+ const commands = Object.fromEntries(tools.map((one) => [
114
+ one.command,
115
+ {
116
+ title: one.title,
117
+ description: one.description,
118
+ writes: one.writes,
119
+ availability: availability(one),
120
+ input: one.input,
121
+ run: /* @__PURE__ */ __name(async (input, ctx) => {
122
+ const own = options.availability?.(one.path, settings.profile);
123
+ if (own && !own.available)
124
+ return failed(new CliError("permission_error", `${one.command}: ${own.reason ?? "unavailable for this profile"}`, {
125
+ ...own.permission ? { permission: own.permission } : {}
126
+ }), app.errors);
127
+ const traceparent = ctx?.mcpReq?._meta?.traceparent;
128
+ const env = typeof traceparent === "string" ? { ...context.env, TRACEPARENT: traceparent } : context.env;
129
+ const answer = await runCommandForAgent(program, one.path, input, {
130
+ profile: settings.profile,
131
+ readOnly: readOnly(),
132
+ env,
133
+ levels,
134
+ overrides,
135
+ authority,
136
+ permissions: options.permissions,
137
+ environment: passed
138
+ });
139
+ if ("error" in answer)
140
+ return mcpErrorResult(JSON.parse(agentJson(answer.error)));
141
+ try {
142
+ return answered(envelope(one.command, answer.result), DEFAULT_OUTPUT_BYTES, targets);
143
+ } catch (error) {
144
+ return failed(error, app.errors);
145
+ }
146
+ }, "run")
147
+ }
148
+ ]));
149
+ const skill = options.skill ? skillResource(app, options.skill) : void 0;
150
+ const build = /* @__PURE__ */ __name(() => {
151
+ const server = new McpServer({ name: app.command, version: app.version }, {
152
+ instructions: appInstructions({
153
+ command: app.command,
154
+ name: options.name,
155
+ profile: settings.profile,
156
+ untrusted: options.untrusted,
157
+ ...skill ? { skill: skill.instruction } : {}
158
+ })
159
+ });
160
+ registerCommands(server, app.command, commands, app.errors, void 0, app.messenger);
161
+ if (skill) {
162
+ const { uri, name, title, description, mimeType, read } = skill;
163
+ server.registerResource(name, uri, { title, description, mimeType }, read);
164
+ }
165
+ return server;
166
+ }, "build");
167
+ return { build, offered: Object.keys(commands) };
168
+ }, "createAppServer");
169
+ var serveAppOverStdio = /* @__PURE__ */ __name(async (command, context, options) => {
170
+ const { build } = createAppServer(command, context, options);
171
+ const { stdin, stdout, signal } = environmentOf(command);
172
+ const own = stdin && stdout && stdin !== process.stdin;
173
+ const wire = answeredWire(own ? stdin : process.stdin, own ? stdout : process.stdout);
174
+ const handle = serveStdio(build, {
175
+ transport: new StdioServerTransport(wire.input, wire.output),
176
+ onerror: /* @__PURE__ */ __name((error) => context.renderer.note(`mcp: ${error.message}`), "onerror")
177
+ });
178
+ const ended = await new Promise((resolve) => {
179
+ wire.ended.then(() => resolve("input"));
180
+ if (own)
181
+ signal?.addEventListener("abort", () => resolve("stopped"), { once: true });
182
+ else {
183
+ process.once("SIGINT", () => resolve("stopped"));
184
+ process.once("SIGTERM", () => resolve("stopped"));
185
+ }
186
+ });
187
+ if (ended === "input")
188
+ await wire.answered();
189
+ wire.release();
190
+ await handle.close();
191
+ }, "serveAppOverStdio");
192
+ var serveAppOverHttp = /* @__PURE__ */ __name(async (command, context, options, http) => {
193
+ const { app } = options;
194
+ const { build } = createAppServer(command, context, options);
195
+ const { serveOverHttp } = await import("./serve-WWLRNDT2.js");
196
+ const listening = await serveOverHttp(build, {
197
+ ...http,
198
+ appName: app.command,
199
+ onCode: /* @__PURE__ */ __name((code, expires) => context.renderer.note(context.env[mcpHttpMarker(app.envPrefix)] === void 0 ? `login code for a new browser app: ${code} (until ${expires.toTimeString().slice(0, 5)}; a new one after each login)` : `a new login code for a browser app: \`${app.command} ${context.settings.profile} mcp server status\``), "onCode"),
200
+ onError: /* @__PURE__ */ __name((error) => context.renderer.note(`mcp: ${error.message}`), "onError")
201
+ }).catch((error) => {
202
+ if (error.code === "EADDRINUSE")
203
+ throw new CliError("configuration_error", `port ${http.port} is in use \u2014 pass another with --port`);
204
+ throw error;
205
+ });
206
+ context.renderer.note(`serving on ${listening.url.href} \u2014 point your tunnel at it; connectors use ${mcpUrlOf(http.publicUrl).href}`);
207
+ await new Promise((resolve) => {
208
+ process.once("SIGINT", resolve);
209
+ process.once("SIGTERM", resolve);
210
+ });
211
+ await listening.close();
212
+ }, "serveAppOverHttp");
213
+ export {
214
+ createAppServer,
215
+ serveAppOverHttp,
216
+ serveAppOverStdio
217
+ };