diff --git a/changes/release-1.0.md b/changes/release-1.0.md new file mode 100644 index 0000000..3033af6 --- /dev/null +++ b/changes/release-1.0.md @@ -0,0 +1,12 @@ +### Changed — may break callers + +- **b24 is built on cli-core 1.0 and cli-base 1.0.** After its first run the store is at version 74, and only tools + on cli-core 1.0 open it: upgrade every WireCat CLI on this computer together. The migration keeps a rollback copy, + and refuses to run when it cannot write one (`store migrate --no-backup` migrates anyway). +- **`sync --rescan` no longer lets a sync mark most of a kind deleted.** It only lists everything again. When the + guard holds a pass, `sync --allow-deletions ` lets it mark at most that many records deleted. The flag is + for the owner in a terminal; the MCP server does not offer it. +- **MCP no longer offers `schedule exec`.** It is the timer's own entry and runs only a schedule file in b24's + schedules folder. An agent runs a saved schedule with `schedule run `. See + [Security](../docs/security.md#timers). +- **An MCP call that names a refused folder answers `permission_error`**, not `validation_error`. diff --git a/contracts/wirecat.json b/contracts/wirecat.json index 67b31c9..a22c243 100644 --- a/contracts/wirecat.json +++ b/contracts/wirecat.json @@ -1616,7 +1616,8 @@ ], "signIn": { "gives": "Lets your agent read and change the portal's CRM with the rights of the employee who made the webhook, or who signed in through a local application.", - "asks": "An inbound webhook address, from Developer resources → Common use cases → Other → Inbound webhook, with the crm, user_basic and department scopes, task for tasks, telephony for calls, disk and documentgenerator for files; or a local application's code and key." + "asks": "An inbound webhook address, from Developer resources → Common use cases → Other → Inbound webhook, with the crm, user_basic and department scopes, task for tasks, telephony for calls, disk and documentgenerator for files; or a local application's code and key.", + "setupFrom": "0.0.0" }, "skill": { "status": [ diff --git a/docs/commands.md b/docs/commands.md index 5653dfc..55f2d5e 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -131,6 +131,7 @@ b24 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 CRM in this run. | | `--embed` | also index new activities and tasks for search all by meaning, with a model already downloaded. | @@ -203,9 +204,13 @@ bring the store up to this build's schema, then normalize, index and stem the me **Changes something on this computer only.** ```sh -b24 store migrate +b24 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: b24 commands info store migrate **Example:** `b24 work store migrate` diff --git a/docs/dev/DESIGN.md b/docs/dev/DESIGN.md index 5bdc1e0..ada21c7 100644 --- a/docs/dev/DESIGN.md +++ b/docs/dev/DESIGN.md @@ -139,7 +139,9 @@ and `type`); field names are from the REST 3.0 field pages and the `user.get` an - **No parent company, no dates** ([fields-company](https://apidocs.bitrix24.com/api-reference/crm/rest-v3/items/fields-company.html)). Bitrix24 has neither, so neither is stored. - **On a timer.** `schedule` is cli-core's shared command, mounted as cli-core gives it, so `b24 schedule command --every 1h -- sync` keeps the store fresh. The owner ruled on 2026-11-13 that an agent may - run `schedule run` and `schedule exec` over MCP, behind their own permission keys; installing or removing a timer + run `schedule run` and `schedule exec` over MCP, behind their own permission keys. Since cli-core 0.736 MCP no + longer offers `schedule exec`, cli-core's security fix: it runs only a file in the tool's own schedules folder, and + an agent runs a saved schedule with `schedule run `. Installing or removing a timer stays behind `permissions.mcp.authority`, as in every CLI on cli-core. ### Search diff --git a/docs/dev/test-matrix.md b/docs/dev/test-matrix.md index 2217cb4..2e6c930 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. -**234 ✅ · 91 ⛔ · 0 ❌** — 112 commands, 213 options. +**235 ✅ · 92 ⛔ · 0 ❌** — 112 commands, 215 options. | Command | Option | | Note | |---|---|---|---| @@ -23,6 +23,7 @@ Measured from the test run (`coverage/argv.jsonl`), not searched for — see | `session list` | | ✅ | | | `sync` | | ✅ | | | `sync` | `--rescan` | ✅ | | +| `sync` | `--allow-deletions` | ✅ | | | `sync` | `--max-pages` | ✅ | | | `sync` | `--embed` | ⛔ | cli-core's CRM sync embeds activities; its src/crm/cli/activity-meaning.test.ts drives sync --embed and search all by meaning on a CRM program with the small test model, and a test here would need a model on disk | | `store status` | | ✅ | | @@ -31,6 +32,7 @@ Measured from the test run (`coverage/argv.jsonl`), not searched for — see | `store info` | | ⛔ | cli-core's addStoreMaintenanceCommands, mounted by addCrmCommands; its store and src/crm/cli/store-file tests drive them on a CRM program | | `store check` | | ⛔ | cli-core's addStoreMaintenanceCommands, mounted by addCrmCommands; its store and src/crm/cli/store-file tests drive them on a CRM program | | `store migrate` | | ⛔ | cli-core's addStoreMaintenanceCommands, mounted by addCrmCommands; its store and src/crm/cli/store-file tests drive them on a CRM program | +| `store migrate` | `--no-backup` | ⛔ | cli-core's addStoreMaintenanceCommands, mounted by addCrmCommands; its store and src/crm/cli/store-file tests drive them on a CRM program | | `store rebuild` | | ⛔ | cli-core's addStoreMaintenanceCommands, mounted by addCrmCommands; its store and src/crm/cli/store-file tests drive them on a CRM program | | `store backup` | | ⛔ | cli-core's addStoreMaintenanceCommands, mounted by addCrmCommands; its store and src/crm/cli/store-file tests drive them on a CRM program | | `store backup` | `--encrypt` | ⛔ | cli-core's addStoreMaintenanceCommands, mounted by addCrmCommands; its store and src/crm/cli/store-file tests drive them on a CRM program | diff --git a/lint/baseline/unknown-verb.json b/lint/baseline/unknown-verb.json index b2b5a5b..fe51488 100644 --- a/lint/baseline/unknown-verb.json +++ b/lint/baseline/unknown-verb.json @@ -1 +1 @@ -["meetings people"] +[] diff --git a/package.json b/package.json index 560b51c..e39e01e 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "docs:spell": "cspell lint --config cspell.json --no-progress --no-summary README.md SECURITY.md CHANGELOG.md AGENTS.md CLAUDE.md 'docs/*.md' 'skills/**/*.md'" }, "dependencies": { - "@wirecat/cli-core": "0.751.0", + "@wirecat/cli-core": "1.0.0", "commander": "15.0.0", "valibot": "1.5.0" }, @@ -71,7 +71,7 @@ "@cspell/dict-ru_ru": "2.3.4", "@types/node": "22.20.5", "@vitest/coverage-v8": "5.0.5", - "@wirecat/cli-base": "0.127.0", + "@wirecat/cli-base": "1.0.0", "@wirecat/cli-testing": "0.7.0", "cspell": "10.4.0", "esbuild": "0.28.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6fda0a4..7f10748 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,8 +13,8 @@ importers: .: dependencies: '@wirecat/cli-core': - specifier: 0.751.0 - version: 0.751.0(@wirecat/cli-base@0.127.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) + 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 @@ -41,8 +41,8 @@ importers: specifier: 5.0.5 version: 5.0.5(vitest@5.0.5) '@wirecat/cli-base': - specifier: 0.127.0 - version: 0.127.0(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-testing': specifier: 0.7.0 version: 0.7.0 @@ -1161,16 +1161,16 @@ packages: '@wasm-audio-decoders/opus-ml@0.0.3': resolution: {integrity: sha512-SEeTmk0eb3q5etJA/NHCRWW6BivTx9tqvNTmG0kg2ynuATEQRUZnwQE6Ibvl1BBvqIGHqI57+qyJMWmJBwb5XQ==} - '@wirecat/cli-base@0.127.0': - resolution: {integrity: sha512-w7LkZhICv4d08N/vEWT4BnxeWt9tPpkVEOFBIUL7sR+JX5PNTHJj3vVTTT/pWhqtmVBFvsFA1xtdoHEX2GfZwQ==} - 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 @@ -1189,14 +1189,14 @@ packages: '@wirecat/cli-core-sqlite@1.1.0': resolution: {integrity: sha512-GpGlh/dAIX/nblBYCdT6DfWSLFxav9mxxeELQAfEuw+QZdT9unKxbi5xa02s/s4JS1P7n0PQx2sCABj4FlMRNw==} - '@wirecat/cli-core@0.751.0': - resolution: {integrity: sha512-jZ6F9wthLPyB3KC480ZFoAa51DWeaadcvK80Bmqn5scYthDHujvd1LAxvs7nJcenP1mnucnrMbnwvkiogRu4bA==} + '@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 @@ -3282,7 +3282,7 @@ snapshots: dependencies: '@wasm-audio-decoders/common': 9.0.7 - '@wirecat/cli-base@0.127.0(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 @@ -3303,7 +3303,7 @@ snapshots: '@wirecat/cli-core-sqlite@1.1.0': {} - '@wirecat/cli-core@0.751.0(@wirecat/cli-base@0.127.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)': + '@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) @@ -3313,7 +3313,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.127.0(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/src/commands/crm-options.test.ts b/src/commands/crm-options.test.ts index 82890d8..0b37626 100644 --- a/src/commands/crm-options.test.ts +++ b/src/commands/crm-options.test.ts @@ -6,6 +6,7 @@ describe("every option of the CRM commands runs against the fake portal", () => const { portal } = await synced() for (const argv of [ ["sync", "--rescan", "--max-pages", "50"], + ["sync", "--allow-deletions", "5"], ["deals", "list", "--limit", "1", "--page", "2"], ["leads", "list", "--limit", "5", "--page", "1"], ["pipelines", "list", "kind:deal"], diff --git a/src/commands/crm-shared.ts b/src/commands/crm-shared.ts index 5112d70..aebfe91 100644 --- a/src/commands/crm-shared.ts +++ b/src/commands/crm-shared.ts @@ -48,7 +48,7 @@ const openProfile = async (command: Command, { readOnly }: { readOnly: boolean } const portal = () => (transport ??= transportFor(command, signInOf(command))) let source: ReturnType | undefined const asked = async () => { - const { crmSettingKey } = await import("@wirecat/cli-core/store") + const { crmSettingKey } = await import("@wirecat/cli-core/store/areas") const scope = await store.crm.scope(account) return { mode: scope.mode, @@ -61,7 +61,7 @@ const openProfile = async (command: Command, { readOnly }: { readOnly: boolean } const copy = { fields: (kind: CrmKind) => store.crm.fields(account, kind), contacts: async (externalIds: readonly string[]) => { - const { crmIdentityId } = await import("@wirecat/cli-core/store") + const { crmIdentityId } = await import("@wirecat/cli-core/store/areas") const held = new Set() for (const externalId of externalIds) if (await store.people.personOf({ provider: PROVIDER.name, id: crmIdentityId(account, externalId) })) diff --git a/src/commands/meetings.ts b/src/commands/meetings.ts index 17880ae..fe65eb2 100644 --- a/src/commands/meetings.ts +++ b/src/commands/meetings.ts @@ -211,7 +211,7 @@ export const meetingsMount = () => { await Promise.all([ import("@wirecat/cli-core/crm/cli"), import("../store.js"), - import("@wirecat/cli-core/store"), + import("@wirecat/cli-core/store/areas"), import("../calls/source.js"), import("../calls/recordings.js"), import("../crm/source.js"), @@ -237,7 +237,7 @@ export const meetingsMount = () => { // The CRM sync's own rule decides whose calls are copied: the signed-in user, or the users chosen in // `unassigned` that rule keeps. A stored `all` refuses, as the CRM sync does: a copy is never the whole portal. const users = async () => { - const { crmSettingKey } = await import("@wirecat/cli-core/store") + const { crmSettingKey } = await import("@wirecat/cli-core/store/areas") const scope = await store.crm.scope(account) const source = crm.bitrixCrmSource(portal, Date.now, memory.NO_MEMORY, async () => ({ mode: scope.mode, diff --git a/src/crm/scope.test.ts b/src/crm/scope.test.ts index dad5a2f..f19d6de 100644 --- a/src/crm/scope.test.ts +++ b/src/crm/scope.test.ts @@ -121,7 +121,7 @@ describe("sync scope", () => { // The id pass marks only rows saved an hour before it started, so a row a sync is still writing is never taken. vi.useFakeTimers({ toFake: ["Date"], now: Date.now() + 2 * 3_600_000 }) try { - await b24(["work", "sync", "--rescan", "--json"], { portal: crm }) + await b24(["work", "sync", "--rescan", "--allow-deletions", "1", "--json"], { portal: crm }) } finally { vi.useRealTimers() }