Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions changes/release-1.0.md
Original file line number Diff line number Diff line change
@@ -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
<count>`, 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.
1 change: 1 addition & 0 deletions contracts/help.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <count>` | let this run mark deleted up to this many of what its full list no longer has, when the guard holds it. |
| `--max-pages <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
Expand Down
3 changes: 2 additions & 1 deletion docs/dev/test-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
|---|---|---|---|
Expand Down Expand Up @@ -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` | | ✅ | |
Expand Down
5 changes: 5 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <count>` 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
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
32 changes: 16 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions scripts/spec-model.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -11,7 +11,7 @@ const NAMESPACES = ["wp/v2"]
*/
export const specModel = async (
root: string,
): Promise<{ model: ApiModel; notes: string[]; overrides: Record<string, Override> }> => {
): Promise<{ model: ApiModel; notes: string[]; overrides: Record<string, ModelOverride> }> => {
const { document, omissions, overrides } = wpJsonToOpenApi(readWpJson(join(root, "spec/wordpress")), {
namespaces: NAMESPACES,
})
Expand Down
31 changes: 31 additions & 0 deletions src/content-options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([])
})
2 changes: 1 addition & 1 deletion src/generated/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Record<string, SchemaNode>> = {
BlockDirectoryItem: {
Expand Down
7 changes: 6 additions & 1 deletion src/generated/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [
{
Expand Down
Loading