diff --git a/changes/release-1.0.md b/changes/release-1.0.md new file mode 100644 index 00000000..9ab7d005 --- /dev/null +++ b/changes/release-1.0.md @@ -0,0 +1,10 @@ +### Changed — may break callers + +- **tg builds on cli-core 1.0.0 and cli-base 1.0.0.** The store moves to version 73 on its first open: an id is never + handed out twice, and only tools on cli-core 1.0 open the store after that. Upgrade every installed WireCat CLI + before you run this version. The migration writes a rollback copy first and refuses to run without one. +- **An MCP call that names a refused place answers `permission_error`**, not `validation_error`. Before any MCP call + runs, each option and argument that takes a local file or folder is checked by its real path: a call cannot name a + credential folder, a folder of a WireCat tool or the message store. A shell run is unchanged. +- **`schedule exec` is no longer offered over MCP.** It runs only a schedule file in the tool's own schedules folder. + An agent runs a saved schedule with `schedule run `. diff --git a/contracts/upgrade.json b/contracts/upgrade.json index ca99d6f8..f944fec8 100644 --- a/contracts/upgrade.json +++ b/contracts/upgrade.json @@ -51,7 +51,7 @@ "exit": 0, "stream": "stdout", "kind": "json", - "diagnostic": "4 terms\n" + "diagnosticPattern": "(?:the store moved to schema \\d+; every other WireCat CLI that uses it needs a version that speaks it — run ` upgrade` for each\n)?4 terms\n" }, { "id": "candidate-store-first-read", diff --git a/docs/commands.md b/docs/commands.md index cab84ddc..f14d46c8 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -3413,9 +3413,13 @@ bring the store up to this build's schema, then normalize, index and stem the me **Changes something on this computer only.** ```sh -tg store migrate +tg store migrate [options] ``` +| Option | What it does | +|---|---| +| `--no-backup` | migrate even when no rollback copy can be written; older tools then cannot open the store again. | + **Returns:** store migration — path, exists, from, to, normalized, indexed, terms, stemmed, and 1 more; every field: tg commands info store migrate **Example:** `tg personal store migrate` diff --git a/docs/dev/test-matrix.md b/docs/dev/test-matrix.md index 1068472b..e5fdb3ae 100644 --- a/docs/dev/test-matrix.md +++ b/docs/dev/test-matrix.md @@ -7,7 +7,7 @@ ran it · ⛔ not tested offline, with the reason and where it is checked instea Measured from the test run (`coverage/argv.jsonl`), not searched for — see [TESTING.md](TESTING.md) for how, and for the states and failures that cut across commands. -**2413 ✅ · 154 ⛔ · 0 ❌** — 547 commands, 2020 options. +**2413 ✅ · 155 ⛔ · 0 ❌** — 547 commands, 2021 options. | Command | Option | | Note | |---|---|---|---| @@ -423,6 +423,7 @@ Measured from the test run (`coverage/argv.jsonl`), not searched for — see | `store info` | | ✅ | | | `store check` | | ✅ | | | `store migrate` | | ✅ | | +| `store migrate` | `--no-backup` | ⛔ | cli-core src/cli/messenger/store-maintenance.test.ts covers store migrate; consumer mounts the shared command | | `store rebuild` | | ✅ | | | `store backup` | | ✅ | | | `store backup` | `--encrypt` | ✅ | | diff --git a/package.json b/package.json index c723a0fc..683cdcc1 100644 --- a/package.json +++ b/package.json @@ -72,8 +72,8 @@ }, "dependencies": { "@mtcute/node": "0.32.7", - "@wirecat/cli-base": "0.126.1", - "@wirecat/cli-core": "0.753.0", + "@wirecat/cli-base": "1.0.0", + "@wirecat/cli-core": "1.0.0", "commander": "15.0.0", "undici": "8.12.3", "valibot": "1.5.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5ac742f2..ee165974 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,11 +16,11 @@ importers: specifier: 0.32.7 version: 0.32.7 '@wirecat/cli-base': - specifier: 0.126.1 - version: 0.126.1(commander@15.0.0)(esbuild@0.28.2)(typescript@7.0.2)(vitest@5.0.5) + specifier: 1.0.0 + version: 1.0.0(commander@15.0.0)(esbuild@0.28.2)(typescript@7.0.2)(vitest@5.0.5) '@wirecat/cli-core': - specifier: 0.753.0 - version: 0.753.0(@napi-rs/canvas@1.0.13)(@wirecat/cli-base@0.126.1(commander@15.0.0)(esbuild@0.28.2)(typescript@7.0.2)(vitest@5.0.5))(commander@15.0.0)(typescript@7.0.2)(zod@4.6.7) + specifier: 1.0.0 + version: 1.0.0(@napi-rs/canvas@1.0.13)(@wirecat/cli-base@1.0.0(commander@15.0.0)(esbuild@0.28.2)(typescript@7.0.2)(vitest@5.0.5))(commander@15.0.0)(typescript@7.0.2)(zod@4.6.7) commander: specifier: 15.0.0 version: 15.0.0 @@ -1292,16 +1292,16 @@ packages: '@wasm-audio-decoders/opus-ml@0.0.3': resolution: {integrity: sha512-SEeTmk0eb3q5etJA/NHCRWW6BivTx9tqvNTmG0kg2ynuATEQRUZnwQE6Ibvl1BBvqIGHqI57+qyJMWmJBwb5XQ==} - '@wirecat/cli-base@0.126.1': - resolution: {integrity: sha512-pZyRiK4Z9O3QZuOgwGZt+ISsaA2UU+u4AarnHjmIWG9aeAJ3ot2Hz7Dbctj2msjb7JgvR2+S7+OS+ZNGKcolQA==} - engines: {node: '>=22'} + '@wirecat/cli-base@1.0.0': + resolution: {integrity: sha512-PJ61d6z0CsWOmoWgf7uvlEo3EstpL2DplXiORPIqgmh0bn/ZGMOhRpDqN43Kh7WickaFSmeX74YQigHXkRO6rA==} + engines: {node: ^22.16.0 || >=24} hasBin: true peerDependencies: '@scalar/openapi-upgrader': ^0.4.6 - commander: '>=15' + commander: ^15.0.0 esbuild: ^0.28.0 swagger-converter: ^2.1.0 - vitest: '>=5' + vitest: ^5.0.0 peerDependenciesMeta: '@scalar/openapi-upgrader': optional: true @@ -1320,14 +1320,14 @@ packages: '@wirecat/cli-core-sqlite@1.1.0': resolution: {integrity: sha512-GpGlh/dAIX/nblBYCdT6DfWSLFxav9mxxeELQAfEuw+QZdT9unKxbi5xa02s/s4JS1P7n0PQx2sCABj4FlMRNw==} - '@wirecat/cli-core@0.753.0': - resolution: {integrity: sha512-jW9Sc/eDgRTmFvP+8Mc7+lyqwtuVZwphKkfCGi9H6t6RvBzfQOOIrSVN3lyVD21mChTGtOrRFRoWHQkPfI+UgQ==} + '@wirecat/cli-core@1.0.0': + resolution: {integrity: sha512-0avQTqu3FAFKE0s+8Pz1Up/TMHTYqCdDn37lcZmkH30sMCMrgJwHzoG4Q0fjVzPsB85u+zBVHHhtQjF/eSTpuw==} engines: {node: ^22.16.0 || >=24} hasBin: true peerDependencies: '@napi-rs/canvas': '>=0.1.69 <2' - '@wirecat/cli-base': '>=0.125.0 <1.0.0' - commander: '>=15' + '@wirecat/cli-base': ^1.0.0-0 + commander: ^15.0.0 mysql2: ^3.24.6 pg: ^8.23.1 ssh2: ^1.17.0 @@ -3662,7 +3662,7 @@ snapshots: dependencies: '@wasm-audio-decoders/common': 9.0.7 - '@wirecat/cli-base@0.126.1(commander@15.0.0)(esbuild@0.28.2)(typescript@7.0.2)(vitest@5.0.5)': + '@wirecat/cli-base@1.0.0(commander@15.0.0)(esbuild@0.28.2)(typescript@7.0.2)(vitest@5.0.5)': dependencies: '@valibot/to-json-schema': 1.8.0(valibot@1.5.0(typescript@7.0.2)) cli-table3: 0.6.5 @@ -3683,7 +3683,7 @@ snapshots: '@wirecat/cli-core-sqlite@1.1.0': {} - '@wirecat/cli-core@0.753.0(@napi-rs/canvas@1.0.13)(@wirecat/cli-base@0.126.1(commander@15.0.0)(esbuild@0.28.2)(typescript@7.0.2)(vitest@5.0.5))(commander@15.0.0)(typescript@7.0.2)(zod@4.6.7)': + '@wirecat/cli-core@1.0.0(@napi-rs/canvas@1.0.13)(@wirecat/cli-base@1.0.0(commander@15.0.0)(esbuild@0.28.2)(typescript@7.0.2)(vitest@5.0.5))(commander@15.0.0)(typescript@7.0.2)(zod@4.6.7)': dependencies: '@anthropic-ai/sdk': 1.3.0(zod@4.6.7) '@bomb.sh/tab': 0.0.22(commander@15.0.0) @@ -3693,7 +3693,7 @@ snapshots: '@valibot/to-json-schema': 1.8.0(valibot@1.5.0(typescript@7.0.2)) '@wasm-audio-decoders/flac': 0.2.11 '@wasm-audio-decoders/ogg-vorbis': 0.1.20 - '@wirecat/cli-base': 0.126.1(commander@15.0.0)(esbuild@0.28.2)(typescript@7.0.2)(vitest@5.0.5) + '@wirecat/cli-base': 1.0.0(commander@15.0.0)(esbuild@0.28.2)(typescript@7.0.2)(vitest@5.0.5) '@wirecat/cli-core-onnx': 1.2.0 '@wirecat/cli-core-sqlite': 1.1.0 '@xmldom/xmldom': 0.9.12 diff --git a/scripts/bot/generate.ts b/scripts/bot/generate.ts index 67bd4307..95c8d341 100644 --- a/scripts/bot/generate.ts +++ b/scripts/bot/generate.ts @@ -6,8 +6,8 @@ import { coverageGenerator, definitionsGenerator, generate, + type ModelOverride, manifestGenerator, - type Override, typesGenerator, valibotGenerator, writeArtifacts, @@ -35,7 +35,7 @@ const artifacts = generate( }), ], { - overrides: read("spec/bot/effects.json") as Record, + overrides: read("spec/bot/effects.json") as Record, banner: ["Source: spec/bot/api.json", "Run: pnpm bot:generate"], }, ) diff --git a/scripts/bot/source-adapter.test.ts b/scripts/bot/source-adapter.test.ts index db601170..0edfa255 100644 --- a/scripts/bot/source-adapter.test.ts +++ b/scripts/bot/source-adapter.test.ts @@ -1,12 +1,18 @@ import { readFileSync } from "node:fs" -import { applyOverrides, generate, manifestGenerator, type Override, validateModel } from "@wirecat/cli-base/codegen" +import { + applyOverrides, + generate, + type ModelOverride, + manifestGenerator, + validateModel, +} from "@wirecat/cli-base/codegen" import { describe, expect, it } from "vitest" import { adaptBotApi, type BotApiSource } from "./source-adapter.js" const source = JSON.parse(readFileSync(new URL("../../spec/bot/api.json", import.meta.url), "utf8")) as BotApiSource const effects = JSON.parse(readFileSync(new URL("../../spec/bot/effects.json", import.meta.url), "utf8")) as Record< string, - Override + ModelOverride > const model = () => adaptBotApi(source, { sourceUrl: "upstream", sourceRevision: "pinned" }) diff --git a/scripts/test-matrix-untested.ts b/scripts/test-matrix-untested.ts index 33d0904a..39763343 100644 --- a/scripts/test-matrix-untested.ts +++ b/scripts/test-matrix-untested.ts @@ -482,6 +482,12 @@ export const UNTESTED: Untested[] = [ option: "--no-backup", reason: "cli-core src/cli/messenger/store-maintenance.test.ts resets without a copy and checks backup: null", }, + { + command: "store migrate", + option: "--no-backup", + reason: + "cli-core src/cli/messenger/store-maintenance.test.ts covers store migrate; consumer mounts the shared command", + }, { command: "tags add", option: "--contact", diff --git a/src/bot-api.test.ts b/src/bot-api.test.ts index e9bebf50..e36531fc 100644 --- a/src/bot-api.test.ts +++ b/src/bot-api.test.ts @@ -2,8 +2,8 @@ import { mkdirSync, mkdtempSync, truncateSync, writeFileSync } from "node:fs" import { tmpdir } from "node:os" import { join } from "node:path" import { captureStreams, memoryKeyring } from "@wirecat/cli-base" -import type { SchemaNode } from "@wirecat/cli-base/codegen" -import { identifier } from "@wirecat/cli-base/codegen" +import type { SchemaNode } from "@wirecat/cli-base/codegen/runtime" +import { identifier } from "@wirecat/cli-base/codegen/runtime" import { apiFlagOf, apiJson, BotTokenStore, ChatRegistry } from "@wirecat/cli-core/cli" import { beforeEach, describe, expect, it } from "vitest" import { TG } from "./app.js" diff --git a/src/bot/generated/definitions.ts b/src/bot/generated/definitions.ts index 94b106ea..7ac43055 100644 --- a/src/bot/generated/definitions.ts +++ b/src/bot/generated/definitions.ts @@ -2,7 +2,7 @@ // Source: spec/bot/api.json // Run: pnpm bot:generate -import type { SchemaNode } from "@wirecat/cli-base/codegen" +import type { SchemaNode } from "@wirecat/cli-base/codegen/runtime" export const definitions: Readonly> = { Update: { diff --git a/src/bot/generated/manifest.ts b/src/bot/generated/manifest.ts index be92ef4c..eecc16b2 100644 --- a/src/bot/generated/manifest.ts +++ b/src/bot/generated/manifest.ts @@ -2,7 +2,7 @@ // Source: spec/bot/api.json // Run: pnpm bot:generate -import type { ManifestOperation } from "@wirecat/cli-base/codegen" +import type { ManifestOperation } from "@wirecat/cli-base/codegen/runtime" export const operations: readonly ManifestOperation[] = [ { diff --git a/src/commands/bot-api.ts b/src/commands/bot-api.ts index 495fc230..1d3502df 100644 --- a/src/commands/bot-api.ts +++ b/src/commands/bot-api.ts @@ -1,6 +1,6 @@ import { statSync } from "node:fs" import { CliError } from "@wirecat/cli-base" -import type { ManifestOperation } from "@wirecat/cli-base/codegen" +import type { ManifestOperation } from "@wirecat/cli-base/codegen/runtime" import { type ApiCommandInput, apiPlainJson,