diff --git a/changes/release-1.0.md b/changes/release-1.0.md new file mode 100644 index 0000000..0647758 --- /dev/null +++ b/changes/release-1.0.md @@ -0,0 +1,9 @@ +### Changed — may break callers + +- **`sync --rescan` no longer lets a sync mark most of the copy deleted.** It only lists everything again; a sync that + would mark most posts deleted is still held. The one way past it is the new owner-only `sync --allow-deletions + `, with the number the held message names. An MCP client is not offered the flag. See + [usage](../docs/usage.md#sync). +- **Built on cli-core 1.0.0 and cli-base 1.0.0.** The generated API files read their types from + `@wirecat/cli-base/codegen/runtime`, and `scripts/spec-model.ts` uses `ModelOverride`. Store version 73 comes with + cli-core 1.0: once a 1.0 tool opens the store, a 0.x tool refuses it, so upgrade every WireCat CLI together. diff --git a/contracts/help.snap b/contracts/help.snap index 1780bdb..6b8add5 100644 --- a/contracts/help.snap +++ b/contracts/help.snap @@ -14,6 +14,7 @@ Works with: mail IMAP mail in the same local store: search your mailbox offline, next to your other WireCat data b24 Bitrix24 CRM: deals, leads and pipelines, searchable with your other WireCat data amo amoCRM and Kommo: deals, contacts and companies, searchable with your other WireCat data + attio Attio CRM: deals, people and companies, searchable with your other WireCat data pbx Asterisk PBX calls and recordings, searchable with your other WireCat data notion Notion pages and databases as local text, searchable with your other WireCat data ydisk Yandex Disk folders as local text, searchable with your other WireCat data diff --git a/docs/commands.md b/docs/commands.md index c46371f..abd2204 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -2782,6 +2782,7 @@ wordpress sync [options] | Option | What it does | |---|---| | `--rescan` | list everything again, every id too, dropping a round in progress. | +| `--allow-deletions ` | let this run mark deleted up to this many of what its full list no longer has, when the guard holds it. | | `--max-pages ` | at most this many requests to the source in this run. | **Returns:** content sync — provider, account, state, complete, channels, due, metrics, synced, and 1 more; every field: wordpress commands info sync diff --git a/docs/dev/test-matrix.md b/docs/dev/test-matrix.md index 826fa39..a65baf1 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. -**868 ✅ · 24 ⛔ · 0 ❌** — 190 commands, 702 options. +**869 ✅ · 24 ⛔ · 0 ❌** — 190 commands, 703 options. | Command | Option | | Note | |---|---|---|---| @@ -790,6 +790,7 @@ Measured from the test run (`coverage/argv.jsonl`), not searched for — see | `api wp-pattern-category-delete` | `--force` | ✅ | | | `sync` | | ✅ | | | `sync` | `--rescan` | ✅ | | +| `sync` | `--allow-deletions` | ✅ | | | `sync` | `--max-pages` | ✅ | | | `channels list` | | ✅ | | | `posts list` | | ✅ | | diff --git a/docs/usage.md b/docs/usage.md index 4ec0e72..b0bedc0 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -58,6 +58,11 @@ copy. `--max-pages` caps the requests in one run. The next sync goes on from where it stopped. +A sync that would mark most of the copy deleted at once marks nothing and says why: WordPress listed far fewer posts +than the copy holds, most often because the sign-in lost rights. Check the sign-in first. If the posts really are +gone, run `wordpress blog sync --allow-deletions ` with the number the message names. `--rescan` lists +everything again but does not lift this hold. Only you can pass `--allow-deletions`: an MCP client is not offered it. + ## Read posts and pages ```sh diff --git a/package.json b/package.json index 3c701cc..68b8d10 100644 --- a/package.json +++ b/package.json @@ -62,8 +62,8 @@ "source:check": "node --experimental-strip-types scripts/source-check.ts" }, "dependencies": { - "@wirecat/cli-base": "0.126.1", - "@wirecat/cli-core": "0.718.0", + "@wirecat/cli-base": "1.0.0", + "@wirecat/cli-core": "1.0.0", "commander": "15.0.0", "valibot": "1.5.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ad652b0..1124c24 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,11 +13,11 @@ importers: .: dependencies: '@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.718.0 - version: 0.718.0(@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(@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 @@ -1185,16 +1185,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 @@ -1213,14 +1213,14 @@ packages: '@wirecat/cli-core-sqlite@1.1.0': resolution: {integrity: sha512-GpGlh/dAIX/nblBYCdT6DfWSLFxav9mxxeELQAfEuw+QZdT9unKxbi5xa02s/s4JS1P7n0PQx2sCABj4FlMRNw==} - '@wirecat/cli-core@0.718.0': - resolution: {integrity: sha512-2h5pSWF6BmYyUkxOyc6cPw6ai2p8n3I7dXsrSzcfyHxqHfkcssZ8EcuqJl6wWfCBMtyWSi+U23gg/g4asoOs+w==} + '@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 @@ -3340,7 +3340,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 @@ -3361,7 +3361,7 @@ snapshots: '@wirecat/cli-core-sqlite@1.1.0': {} - '@wirecat/cli-core@0.718.0(@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(@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) @@ -3371,7 +3371,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/spec-model.ts b/scripts/spec-model.ts index 1523664..67b6d68 100644 --- a/scripts/spec-model.ts +++ b/scripts/spec-model.ts @@ -1,5 +1,5 @@ import { join } from "node:path" -import { type ApiModel, adaptOpenApi, type Override, readWpJson, wpJsonToOpenApi } from "@wirecat/cli-base/codegen" +import { type ApiModel, adaptOpenApi, type ModelOverride, readWpJson, wpJsonToOpenApi } from "@wirecat/cli-base/codegen" // The WordPress namespaces the CLI offers. A plugin's namespace belongs to the sites that run the plugin; // batch/v1 is never offered, as one batch call runs other routes' writes past their own keys. @@ -11,7 +11,7 @@ const NAMESPACES = ["wp/v2"] */ export const specModel = async ( root: string, -): Promise<{ model: ApiModel; notes: string[]; overrides: Record }> => { +): Promise<{ model: ApiModel; notes: string[]; overrides: Record }> => { const { document, omissions, overrides } = wpJsonToOpenApi(readWpJson(join(root, "spec/wordpress")), { namespaces: NAMESPACES, }) diff --git a/src/content-options.test.ts b/src/content-options.test.ts index d25f47d..6aa273a 100644 --- a/src/content-options.test.ts +++ b/src/content-options.test.ts @@ -230,3 +230,34 @@ it("keeps an author the fallback list leaves out", async () => { expect(users.items.find((one) => one.external_id === quiet)).toMatchObject({ external_id: quiet }) expect(users.items.find((one) => one.external_id === quiet)?.deleted_at ?? null).toBeNull() }) + +// The mass-deletion guard is the owner's to lift, by count: a rescan only lists everything again. +it("holds a sync that would mark every post deleted, rescan or not, until --allow-deletions names the count", async () => { + const keyring = memoryKeyring() + const [login, password] = FAKE_API_TOKEN.split(":") as [string, string] + await runCli(["guard", "session", "start", "--site", FAKE_SITE, "--login", login, "--json"], { + keyring, + service: fakeServiceApi(), + stdin: password, + }) + const service = contentManifestFake(SOURCE, { api: API.manifest }) + const ran = (argv: string[]) => runCli(["guard", ...argv, "--json"], { keyring, service }) + const posts = async () => + ((await ran(["posts", "list"])).json() as { items: { external_id: string; type: string }[] }).items.filter( + (one) => one.type === "post", + ) + expect((await ran(["sync"])).code).toBe(0) + const ids = service.ids("post") + const listed = (await posts()).length + expect(listed).toBeGreaterThan(0) + for (const id of ids) service.remove("post", id) + + const held = await ran(["sync", "--rescan"]) + expect(held.code, held.err).toBe(0) + expect(held.out).toContain(`--allow-deletions ${ids.length}`) + expect((await posts()).length).toBe(listed) + + const allowed = await ran(["sync", "--rescan", "--allow-deletions", String(ids.length)]) + expect(allowed.code, allowed.err).toBe(0) + expect(await posts()).toEqual([]) +}) diff --git a/src/generated/definitions.ts b/src/generated/definitions.ts index eacda51..bd3cd10 100644 --- a/src/generated/definitions.ts +++ b/src/generated/definitions.ts @@ -2,7 +2,7 @@ // Source: spec/wordpress/, checked against provenance.json // Run: pnpm generate -import type { SchemaNode } from "@wirecat/cli-base/codegen" +import type { SchemaNode } from "@wirecat/cli-base/codegen/runtime" export const definitions: Readonly> = { BlockDirectoryItem: { diff --git a/src/generated/manifest.ts b/src/generated/manifest.ts index 84dd4dd..fea4702 100644 --- a/src/generated/manifest.ts +++ b/src/generated/manifest.ts @@ -2,7 +2,12 @@ // Source: spec/wordpress/, checked against provenance.json // Run: pnpm generate -import type { ApiServer, ManifestOperation, SecurityRequirement, SecurityScheme } from "@wirecat/cli-base/codegen" +import type { + ApiServer, + ManifestOperation, + SecurityRequirement, + SecurityScheme, +} from "@wirecat/cli-base/codegen/runtime" export const operations: readonly ManifestOperation[] = [ {