Repository navigation
feat!: cli-core 1.0.0-rc.0, the stable API, store version 73 and the 1.0 fixes - #3338
Merged
Merged
Conversation
…, read commander internals in one place - Remove searchAllIncludingMeetings and its five types, SyncOptions.limitError and MeetingTranscriptDocumentStore.transcriptMeetings. No downstream CLI names them on main. - Peer ranges: @wirecat/cli-base ">=0.125.0 <1.0.0 || ^1.0.0-0" so cli-base 1.0 can come first; commander "^15.0.0" instead of ">=15". - src/cli/commander-internals.ts is the only reader of commander fields with no public accessor (_actionHandler, _hidden, _getHelpOption, unknownOption). It is not exported from any entry point; its test fails when a commander release renames one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
./store pointed at src/store/index.ts, the barrel cli-core's own modules use, so every row type, query constant and maintenance helper under src/store/sqlite/ was a public promise. ./store now points at src/store/public.ts: the same barrel without the ~390 names declared under src/store/sqlite/, except StoreOptions, which openStore takes. The 76 of those names that downstream CLIs import on main (mostly cli-memo; also drive, mail, zoom, beeline, notion) are re-exported from the new experimental entry ./store/areas under the same names. src/store/index.ts is unchanged for internal use. Checked with a TypeScript probe that copies dist away from drizzle-orm: no exported name of any entry has a member whose type fails to resolve (depth 5), before or after. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…te ids About 120 references to a private journal (NEED-…, SEC-…, BUG-…, FIND-…) sat in doc comments that tsc copies into the published .d.ts files, where readers cannot resolve them. Each is removed where the sentence already says why, or replaced by the plain reason. Plain // comments, which do not ship, are unchanged. docs:check now fails when a built .d.ts carries such an id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rks the rest inside them package.json lists the stable export subpaths in wirecat.stable: ".", ./cli, ./cli/start, ./mcp, ./sends, ./skill-validation, ./sqlite-runtime, ./store, ./testing and ./update. Every other entry point is experimental as a whole. Inside them, about 990 declarations carry @experimental: the values fewer than two CLIs import on main (cli-template counts as all of them), and the types no stable name reaches. MessageStore stays stable in accounts, chats, messages, people, tags and close; its other 56 areas are tagged, as their family entry points are experimental. MessageStore moves into src/store/message-store.ts (store.ts was at the 500-line cap), and ./cli stops re-exporting five cli-base names no CLI imports from it. README and REFERENCE describe the 1.0 promise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mental MessageStoreAreas cli-base's api-report reads @experimental on whole declarations only, so tags on MessageStore's members left all 62 areas in the stable snapshot. The six stable members (accounts, chats, messages, people, tags, close) now form MessageStoreCore; the rest form MessageStoreAreas, tagged @experimental. MessageStore extends both, so callers that name it change nothing. Checked with cli-base's release/1.0 cli-dev api-report: the store report keeps MessageStoreCore and leaves MessageStoreAreas out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…able part ./codegen is experimental in cli-base 1.0, and cli-core's stable types must not name experimental codegen types. Every src import of manifest types, identifier, the sign-in helpers, graphqlDocument and parseSelection now comes from @wirecat/cli-base/codegen/runtime. The test fakes (fakeApi, graphqlFake, sampleOf) stay on ./codegen; they are used only by the experimental crm/testing and tracker/testing entries and by tests. Needs cli-base 1.0.0-rc.0: the peer range becomes ^1.0.0-0, and the cli-base dev dependency must move to the rc when it is on npm (typechecked here against cli-base's release/1.0 worktree through a local, uncommitted link). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ext tag - The changelog and its fragments accept cli-base's seven headings: `Changed — experimental` and `Deprecated` join the five. The list is local until cli-core takes a cli-base that exports all seven (released 0.132.0 has five), in cli-base's order, which fragments are collected in. - scripts/next-version.mjs takes the repository root as an optional fourth argument. It then builds the section the release will publish, fragments included, and raises the version to the level its headings need with cli-base's levelledVersion: after 1.0.0 a stable break (`Changed — may break callers`, `Removed`) becomes a major. Without the root it answers as before, which ci.yml's version job relies on. A taken x.y.0 still steps the minor, since package.json keeps the last release's number. - bin/release passes the root, says when the headings raised the number, and stops on a version that raises the major over npm's latest unless `--major` is given. - A pre-release publishes under npm's `next` tag, from bin/release --local and from release.yml (dry run and publish), as cli-base does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tract REFERENCE.md named 5 of the 613 reasons cli-core raises. A caller that matches on a reason had no list to match against, and nothing stopped a reason from vanishing in a release. - scripts/reasons-docs.ts writes docs/reasons.md's table from the built REASONS (CORE_REASONS): reason, code, one-line meaning and detail keys, sorted. `pnpm reasons:docs` writes it; `--check` runs in `pnpm docs:check` and fails when the page and src/errors/reasons.ts disagree. - The committed page is the baseline, so no git history or tag is needed in CI. A listed reason that is gone, or that moved to another code, blocks both the check and the writer until a changes/ fragment names it in backticks under "Changed — may break callers" or "Removed". A rename is a removal plus an addition. - The page says what may change: new reasons and reworded messages in any release, a removal or a recode only as a break (a major from 1.0.0 on). Every reason counts as stable for now; marking some experimental is left to the stable/experimental markers when they land. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…itution Shellcheck (SC2046) flagged the $(case …) form copied from cli-base. The tag is now a variable: next for a pre-release, latest otherwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n pull requests Parity covered 9 of the 19 CLIs that depend on cli-core, so a break in amo, asterisk, attio, beeline, hubspot, linear, notion, slack, wordpress or ydisk showed up only when that CLI bumped. - downstream.json lists all 19 public consumers (cli-template keeps its own job). `cli` is the file name under dist/bin/: `slack` for slack-cli's `slk`, `pbx` for asterisk-cli. ydisk's repository is ydisk-cli. - A release (`tests`), the monthly run and a run by hand build, typecheck, start, generate and, on a release, test all of them. A pull request and a push to main build the 7 marked `"pr": true`: tg, max and wa (the manifest and wording jobs read their builds), memo, mail, drive and attio (a CRM built from a config). Before, a pull request ran 9 legs; now 7, and a release 19. - downstream-result.sh sums the list the matrix ran (CLIS from downstream-list), so a leg left out on a pull request is not reported as "no result". Without CLIS it reads the whole file, as bin/downstream-check does. - Not listed: cli-docs (the website, no CLI, pinned to 0.590.0) and cli-testing (a benchmark subpackage). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ule exec leaving MCP Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…onnect change ydisk-cli joins the downstream list with this branch, and its main does not compile against cli-core: #3234 made FileConflictCommands.connect take the body, and src/commands/mirrors.ts:935 still returns the connection. Listed until 2026-11-30, as the other #3258 adopters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
INT-1 from the 1.0 review. A run asks SEARCH for a folder's UIDs, then the listing (FETCH) for those UIDs. When the server left one UID out of its FETCH answer, a run without a budget (memo's timer, a script) did not compare the two: the message was missing from what the run saw, and the deletion proof marked it deleted, dropping its text, attachment text, chunks, vectors and places. Up to 4 messages per run, or under 20 %, passed the mass-deletion guard. The search had just shown the message is there, so it is "not seen this run", not "deleted at the source". Now any folder whose listing returned fewer UIDs than its search found skips the deletion check for the run, budgeted or not, before the location-based proof and the full-window proof. The run says why in deletionsSkipped. Case from the review: 10 stored mails, the second run's server drops UID 103 from FETCH once; before, deleted === 1; now 0, and the mail keeps its text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a gap is held INT-4 from the 1.0 review. In the CRM, tracker and content syncs, --rescan did two things: it listed everything again, and it switched off the guard that holds an id pass which would mark most of a kind deleted (an empty list, or more than half of ten or more stored rows). --rescan is also the advice for unrelated problems (a stuck round, a changed scope), so an agent running it during a rights outage let a 90 % "deletion" through. Now --rescan only lists again. The one way past the guard is the owner-only --allow-deletions <count> (allowDeletions in syncCrm, syncTracker and syncContent): a held pass goes through when it would mark at most that many rows deleted, and the held message names the number. The flag name and type come from cli-base's flag catalogue, where file mirrors use it the same way. Being owner-only, MCP servers do not offer it. The content sync's "the site's address changed" hold still lifts with --rescan: that is a scope change, not the guard. INT-3 from the 1.0 review. The CRM id pass marked rows deleted even when the adapter had reported, through context.gap, that it could not read the whole kind (a Bitrix24 or amo sign-in that lost rights to one pipeline). 2 of 12 deals, or 400 of 1,000, is under the 50 % guard, so those deals were marked deleted and the digest and stage tasks reported them gone. The tracker engine already held such a pass; the CRM engine now does too, and no flag lifts it. Both engines also keep the mark in the pass state, so a gap reported in an earlier run of a pass that spans several runs still holds it. Cases from the review, now tests: - 12 deals stored; next day the adapter reports a gap for deals and leaves out d3 and d4: before, unlisted === 2; now the pass is held, also with rescan and allowDeletions, and a whole list later marks the two (src/crm/sync.test.ts). - crmSyncContract, contentSyncContract and the tracker test: a list that would mark most rows deleted stays held under rescan, and allowDeletions with the named count lets it through. BREAKING CHANGE: sync --rescan no longer marks most of a kind deleted; pass --allow-deletions <count>. The kits' contracts check this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…le feed event is not marked deleted
INT-2 from the 1.0 review. When a recurring series was deleted between
the round's listing and its occurrences() call, the provider answered
not_found (Google events.instances answers 404/410 then, per its docs).
The error failed the calendar, the round stayed in progress, and every
later run resumed it and failed on the same series first: the cursor
never moved, markUnseen never ran, and the daily full round never
started, until the owner happened to run --rescan.
Now a not_found from occurrences() keeps the series' stored slots as
they are (slots: null, counted as seen), drops the series from the
round, and the round ends. The slots are not cancelled on that signal
alone: the next listing, which names a deleted series, cancels them.
INT-6 from the 1.0 review. readFeed dropped from its entries an event it
could not read (an RRULE the expander refuses, or Outlook's usual
TZID=Customized Time Zone), and the next full round, not seeing it,
marked it and its slots deleted although the feed still held it. Now
readFeed names those UIDs, the ICS source returns them in the new
ChangePage.kept, the round keeps them, and markUnseen leaves them and a
kept series' slots alone (a new optional { keep, dryRun } argument).
The calendar engine also had no share guard, unlike mail, CRM and
tracker: a valid but empty VCALENDAR (a provider glitch) marked the
whole calendar deleted. A full round is now held when it saved nothing
at all, or would mark more than half of ten or more stored entries
deleted. The round still ends; the result's held says why and names
sync --allow-deletions <count>, the owner-only flag the other syncs
use, now on calendar sync too.
Cases from the review, now tests:
- a series whose occurrences() throws not_found: the round completes,
the cursor holds no round, the slot stays (src/calendar/sync.test.ts);
- an event that parsed once and later uses TZID=Customized Time Zone
stays live (src/calendar/feeds.test.ts);
- an empty feed marks nothing until --allow-deletions 100
(src/calendar/feeds.test.ts);
- 12 entries, 8 dropped: held, then allowDeletions: 8 marks them
(src/calendar/sync.test.ts).
The calendar sync contract's deletion case keeps a second entry, since a
full list that returns nothing is now held.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ames DEBT-2 from the 1.0 review. Each command guarded its own file inputs: upload and send paths, attachment folders, store backup, document mirrors. A new option that took a path had no guard until someone remembered to add one, and several existing ones (commands' paths, mirror folders, conflict and version paths) had none for agents. Now program.ts runs refuseAgentPaths in preAction for every MCP call (options.agent). It takes each option whose placeholder names a file or folder, and each argument named so, on the command and its parents, resolves it to its real path (so neither a link nor .. gets past), and refuses it with permission_error when refusedPlace says no: a credential folder, a folder of this or another WireCat tool, /proc, /sys, /dev, or the store and its -wal/-shm. Defaults the command chose are not checked, nor "-" or URLs. store backup and store restore may still name the store's own backups folder (inStoreBackups). Inputs named like a path that name no local file (a remote disk path, a chat folder's title, a command path) are declared with notLocalPaths on the command or its group. Serve's relay used its own copy of the path patterns to make paths absolute against the client's folder, and so also rewrote those remote names; it now uses the same declarations. Owner runs from a shell are unchanged, and the commands' own checks stay. An MCP refusal of attachments extract --output-dir or --from-dir now answers permission_error, not validation_error. Tests (src/cli/path-options.test.ts): credential folders by option and argument; a link and ..; own, other-tool, WireCat folder, store, -wal and /proc; defaults, URLs and not-local inputs; the backups allowance, including a link and .. out of it; serve keeps a folder title; the program refuses an agent's store backup into .ssh but not the owner's; and a lint over the command trees that fails on any input named like a path that is neither checked nor declared not local. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The changelog fragment for INT-1, INT-2, INT-3, INT-4, INT-6 and DEBT-2 from the 1.0 review: what may break callers, what is fixed, and the agent path check, worded without the ways around the old checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tside the call A path option's value from an environment variable or a config file is the owner's, not the agent's: an MCP server started with such a variable that points into a WireCat folder would otherwise refuse every call. Only values the call itself named (source cli) are checked, as argv-log already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
crm.unlisted-held and tracker.unlisted-held no longer name --rescan as the way through; the page is generated from src/errors/reasons.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ydisk-cli main adopts the FileConflictCommands.connect change from #3234 (WireCatLabs/ydisk-cli#35): connect runs the body inside the app's run. It now pins cli-core 0.737.0, so the parity job no longer needs to expect it broken. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…1.0) Every base table with an integer id (101 tables) is copied once by drizzle-kit's table rebuild to become AUTOINCREMENT. Each counter starts 1,000 above the largest id the store still knows: the table's rows, foreign keys, pointer pairs, the kept ids.<table>.highest settings, fact_removals and any counter left by a rollback. A new store starts at 1. minCompatible becomes 73 (NEED-2872 A). The runner learns to run a migration that copies tables (src/store/sqlite/rebuild.ts): - foreign keys off before BEGIN, and a refusal if they still read on, since a DROP TABLE with them on deletes the rows pointing at it; - legacy_alter_table only around the copies, as earlier migrations in the same run rely on renames rewriting triggers; - a table holding a column the copy would lose is refused; - every trigger and index of the copied tables, other tools' included, is put back, and foreign_key_check runs on them before COMMIT. Tables cli-core's schema does not own are not touched. CHECK constraints hold only stable rules: valid JSON in JSON columns, whole or empty pointer pairs (not an _id with a foreign key, not links.to), and amounts a validation trigger already keeps non-negative. On upgrade, text that is not JSON is kept whole as a JSON string and reported (store_settings migration:73:repaired); a half pointer or a negative amount refuses the migration, naming the rows. A breaking migration now refuses to run when its rollback copy cannot be written; store migrate --without-rollback-copy (RollbackCopyOptions.withoutCopy) runs it anyway with a warning. A rollback keeps the id counters. taggings gets an index on (taggable_type, taggable_id) (PERF-1). The spec drives it all: scripts/schema/checks.mjs feeds gen-schema and the schema page. Tests that wrote invalid JSON on purpose now use withoutVersion73, which puts back the frozen version 72 tables, as rollBackTo does before its DROP COLUMNs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…--no-backup - scripts/schema/checks.mjs lists the CHECKs per table instead of deriving them from spec notes: SQLite cannot add a table CHECK in place, so a JSON column or pointer pair added later would have made gen-schema ask for a table copy. A later column gets a RAISE(ABORT) trigger (ARCHITECTURE, adding a migration). - A migration that copies tables needs about three times the copied tables' size free: the rollback copy, the write-ahead log and the new pages. 1M messages (216 MB) took a 208 MB log and grew the file by 138 MB. - store migrate takes --no-backup, the vocabulary's flag, instead of --without-rollback-copy, which the command lint refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…new reason plainSetupText arrived on main after the stable set was drawn. No CLI imports it, so it is experimental like the other single-user names. docs/reasons.md gains upload.replace-interrupted from main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Written by cli-base 1.0.0-rc.0's cli-dev api-report. CI checks it with --check, and the changelog guard asks for the heading a change to it needs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- every reusable workflow pinned to v1.0.0-rc.0 by SHA; node-ci now checks api/ - the changelog guard also runs on labeled and unlabeled, so the major label is checked - scripts/changelog-shape.ts reads CHANGELOG_HEADINGS from cli-base instead of a copy Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
package.json names the pre-release and CHANGELOG.md gets its empty section, so bin/release --major collects changes/ into it and publishes on next. Without it, a release from main would step 0.738.0 to 0.739.0 and ship the 1.0 breaks on latest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The agent path check treats every input named like a path as local unless notLocalPaths marks it. cli-core's own commands mark theirs, but no entry point exported the mark, so a CLI with a remote <path> argument had no way to keep it from being made absolute against the client's folder. Experimental until two CLIs use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…al path The agent path check made a remote folder id absolute against the client's folder over MCP, since only <file> was marked. The test that keeps remote inputs off the local list now covers catalog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… cleans up a refused run A copy of a real store (schema 72, 4.4 GB) was refused by version 73: 44 rows in emails and email_recipients already pointed at deleted rows, and the check after the table copies counted them as if the copy had broken them. - rebuild.ts runs foreign_key_check on the tables to copy before the copy as well as after, and refuses only references that are new, by (table, rowid, parent, referring columns). The old ones are kept as they are, named in a warning by table, column and ids, and saved in store_settings as migration:<version>:broken-references. A refusal says the migration would break these references, names them, and says the older tool still opens the store. - migrateLocked deletes the rollback copy its own attempt wrote when the migration is refused or fails; older copies in backups/ stay. Each retry used to leave another 1.6 GB file. - version-73.ts seeds counters from integer ids only. On the same store one email row holds text in account_id and from_identity_id; SQLite sorts text above every number, so max() returned it and the accounts and identities counters were left NULL. - The counters are written as integers: node:sqlite binds a number as a double, and 101 of the 105 seq values on that store were REAL. On a fresh copy of that store the migration now succeeds in 345 s, warns about the 44 rows, and every counter is set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…igration The foreign key check after a table copy looks only at the copied tables' own references. A copy that dropped parent rows would break the references other tables hold to them, and only a whole-file foreign_key_check (minutes on a 4.4 GB store) would see it. beforeRebuild now counts each copied table's rows, and afterRebuild counts them again after the rename, inside the same transaction. Any difference refuses the migration (store.rows-lost), naming the table and both counts, and says the older tool still opens the store. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
store.unknown-columns, store.rows-break-checks, store.foreign-keys and store.rows-lost were raised but missing from REASONS, so docs/reasons.md left them out and callers could not rely on them. They sit in their own file, as the SFTP ones do: reasons.ts is at the file length limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s only A CLI that inferred a type cli-core returns failed declaration emit with TS2883: the .d.ts reach types through modules no export path leads to, such as dist/store/index.js, which was ./store before the stable split. TypeScript names a type only through an entry already in the consumer's program, so exporting each type from ./store/areas fixed nothing for a CLI that imports only ./documents. A probe that calls every exported function of each of the 51 entries, one program per entry, and keeps the result with an inferred type: 127 TS2883 errors before, 0 after. The path has only a types condition, so Node refuses a runtime import of it (ERR_PACKAGE_PATH_NOT_EXPORTED). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both adopted schedule exec leaving MCP on their release/1.0 branches, which parity builds for the 1.0 release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The rebase onto 0.740.0 dropped it. bin/release --major collects changes/ into it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n added Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
amo-cli and bitrix24-cli import them at run time from ./store, which no longer re-exports src/store/sqlite, and ./store/areas had left them out. The changelog no longer says no CLI imports the five cli-base names ./cli dropped: cli-memo imports assertSharedContracts, and takes it from @wirecat/cli-base/commands instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Store version 73 added the option; the manifest check of tg, max and wa refused it as a row the manifest lacks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- rollback copy: a failed migration now deletes the copy it took (bd1aaf9), so the test expects no copy instead of a whole one. - meeting preparation: oversized metadata is valid JSON, since version 73's CHECK refuses text that is not. - connection waits: the store is built before the clock starts. A new store runs all 73 migrations, about 0.5 s more on a CI runner, which is not the close wait the test measures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… copying them A store new in this run reached version 73 with a hundred empty tables and copied each one, and its hundred renames were most of the cost: version 73 took about 580 ms of a new store's migrations on this machine (all 73: 780 to 1030 ms). Each empty table is now dropped and created under its own name; a table with rows (the seeded bots, persons and pipelines) is still copied, and an existing store keeps every copy drizzle-kit wrote. Version 73 now takes about 100 ms, all 73 migrations 360 to 720 ms, measured alternately on the same build at a load average near 20. The new test checks that such a store took the short path and has the schema and rows of one copied from 72. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng an id The comment ships in the .d.ts, where docs:check refuses internal ids since the 1.0 surface work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… CLI file within its line limit Merging --allow-deletions from the 1.0 branch with --embed from main put src/crm/cli/index.ts 3 lines over its 1,010-line exception. The flags get a named type, and signal, rescan and allowDeletions pass as plain optional values (syncCrm reads each as optional), which saves 7 lines. The exception rises by the last 2 to 1,012. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…reasons page lists document.scan-unturned messengerSessionCommands (#3304) landed in ./cli after the stable set was drawn; no CLI imports it yet, so it is experimental like the other new shared commands. docs/reasons.md is regenerated for the reason #3310 added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rebasing 1.0 onto 0.751.0 brought reasons.ts to 1005 lines, over Biome's 1000. The store's open, write and recovery reasons join the migration ones in store-reasons.ts. docs/reasons.md gains the three reasons main added (crm.activities-unlisted-held, identity.not-a-person, tracker.kind-unread). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Asked by tg-cli (#917, cli-core #3333): linking replies to their thread runs once per page with WHERE chat_id = ? AND thread_root_id IS NULL AND thread_external_id IN (...), a scan of the chat without this index. With it, a page saved in 19 to 25 ms up to 40,000 messages in that session's benchmark. It goes inside v73, which no release carries yet, so stores take one migration for 1.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…generator names it schema:check failed on #3288: schema.ts is checked against scripts/schema/spec.mjs, which lacked the index. It is now in the spec, named messages_by_chat_id_thread_external_id as gen-schema names it, and docs/storage/schema.md lists it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leemour
added a commit
that referenced
this pull request
Nov 25, 2026
…tch (#3341) After #3338 (cli-core 1.0) merged, the release PR of 1.0.0-rc.0 (#3340) failed parity: parity builds each CLI's main, which stays on 0.x until cli-core 1.0.0 ships together with all CLIs. The CLIs adopt 1.0 on `release/1.0` in draft PRs (e.g. WireCatLabs/cli-memo#897), and parity against those branches passed on #3338. This lists the 20 CLIs in `scripts/parity/known-broken.json` until 2026-12-02, so main can publish 1.0.0-rc.x on `next`. Remove the entries when the 1.0.0 batch merges. Checked: `pnpm docs:check`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
leemour
added a commit
that referenced
this pull request
Nov 25, 2026
Rebased onto main after #3338 (store version 73, which replaced #3288). Version 74 was regenerated from 73's snapshot. Its new tables use `AUTOINCREMENT`, as 1.0 asks, and `minCompatible` stays 73. `api/store.api.txt` and `docs/reasons.md` were regenerated. `version-73.test.ts` now migrates only up to 73, so a later version does not break it. The changelog entry is under "Changed — experimental": `KindSignal` and the people list are `@experimental`, and the rest only adds things, so no major is needed. ## Task Plan steps 3 and 4 of the contact-kinds plan ([plan #3323](#3323)): bots as their own entity, and the owner's choice to move a sender between a person and a bot. Owner's ruling NEED-109 A. Part of #3314. ## Why A bot was a person with the kind `automated`. Every list, merge scan and tie check had to remember to skip it, and each one that forgot was a bug (#3320 was one). The owner also had no way to say "this is a bot" or "this is a person" in a way that holds. ## What **Schema chosen (store version 74).** Tables, an index and triggers added only. `minCompatible` stays 73. - `sender_bots` (id, `person_id` unique, name, `organization_id`, author `rules` or `owner`, reason, times). `bots` was already taken by agents, and `bot:<n>` refs mean agents, so the table is `sender_bots` and the ref is `sender-bot:<id>`. - **A bot keeps the person row it was sorted from.** Its identities stay in `identity_links` on that row. I chose this over `identity_links.bot_id` or a `bot_identities` table: - `identity_links.person_id` is `NOT NULL`. Making it nullable needs a table rebuild. - About 60 modules join `identity_links`. Taking an identity out of it means ingest creates a new person on the next sync (`ensurePerson`). The emptied person also shows as "added by hand". - Desktop accepts only `person:<uid>` refs (`person_ref` in `people.rs`). `people show person:<uid>` keeps working. - `sender_bot_moves`: one row per identity per move. It holds from (person or bot), to, author `rules` or `owner`, reason, and time. - **No foreign keys** on either table, as `document_changes` does, so an older build can still erase a person or purge an account. Triggers drop the rows with the person or identity, and clear the organization. Other triggers clear the stored kind when a bot or a move is written. - **PERF from #3334:** an expression index `emails_by_list_id` on the exact List-Id expression `sentMailOf` uses. No new column and no backfill: `CREATE INDEX` fills it. A test asserts that `EXPLAIN QUERY PLAN` of the real statement (`LIST_SENDERS`) uses the index. The schema codegen now passes an expression key through. **Rule move** (`people-list.ts`, `KIND_RULES` 7). When kinds are kept, a person moves to a bot when all of these hold: - their kind is `automated` by a program's signal: the platform bot flag, a no-reply or notification address, a signed Auto-Submitted, a null return path, or `bulk_never_replied`; - the owner wrote them nothing: no mail tie and no two-way private chat (the platform flag holds anyway); - no `ALWAYS_SHOWN` reason applies; - every identity is the program's, or they have only one. Other cases: - `automated-name` or a bulk mailbox alone marks a person and moves nothing. A newsletter a human writes stays a person. - A rule's bot goes back to a person when the rules stop holding, for example when the owner writes to it. This is logged. - No person is emptied by a rule move. **Owner's choice.** `store.people.moveToBot(subject, by, { bot?, name?, reason? })` and `moveToPerson(subject, by, { person?, reason? })`. Subject: `person:<uid>`, `sender-bot:<id>` or an `IdentityRef`. Owner only (`identity.owner-only`). - One identity of a person with several gets a person row of its own first (an owner's unlink). - A bot the owner made is `author = 'owner'`. An identity whose latest move is the owner's, to a person, is never moved by a rule. Both survive `KIND_RULES` bumps (tested). **Bots are left out of:** - the matcher (`identity.not-a-person` for email and phone joins too; name scans already skip `automated`); - `tasks.assign` (new reason `sender-bot.assignee`); - `people.similar`; - `people.ties` (empty). **`kind:automated` compatibility.** A bot is still listed as `automated` under its `person:<uid>` ref, with the same counts and paging. The row gains `bot: "sender-bot:<id>" | null` and has empty `ties`. memo's `personRow` and Desktop's `listed()` read named fields only, so both keep working unchanged. **People counts.** `people.list` counts are the only people tallies in cli-core. Bots count under `automated` and never under `person`. **Alias joining the owner later (item 4).** I found no stale kind. `person_kind_email_au` clears the recipients' kinds when `markOwnMail` flips `outgoing`. A new test in `src/mail/own.test.ts` proves it: stranger first, person after the alias joins. No fix was needed. **Not in this PR (memo needs):** `bots list` and a command for the two moves (for example `people bot <ref>` and `people person <ref>`), and a field for the bot ref on `people list` rows. Call that field `sender_bot`, not `bot`: Desktop's `Listed.bot` already means "has the messenger bot signal". Desktop needs a Bots tab (plan step 7). No downstream implements `PeopleStore` (grep of cli-memo, wirecat-desktop, cli-template). **RISK.** The first list after the upgrade creates every bot under the write lock. A synthetic store with 20,000 no-reply senders took 1.4 s for that list, against 0.66 s with nothing to move (load average about 30). The lock part stays under the other writers' 5 s wait. Chunk it if a real store shows more. ## Testing All runs used `--maxWorkers=1`. - New `src/store/sender-bots.test.ts` (8 tests): - a rule move, kept through a sync; - the owner's moves both ways, through a `KIND_RULES` change, refused for an agent and for the owner's own person; - one identity moved to a new bot and into an existing one; - no join by address, and no task assignee; - an upgrade from 73 moves the programs, and `EXPLAIN` shows the index is used; - a rule's bot goes back once the owner writes to it; - a purge and an erase take the bot's rows with them; - no proposal by name. - Existing suites: people-list (19), people-kinds-stored (6), people-matching-rules (23), person-match-scan (34), person-doubts, person-merges, schema, sender-signals, mail/own (8), store, upgrade, rollback-copy, transaction, doctor, store-tables, store-maintenance. - Under load (average 30–45), one people-list test and one people-kinds-stored test passed only when run alone. They were over the time limit, not wrong. - `pnpm typecheck`, `ci:quick`, `schema:check`, `docs:check`, and Biome on the changed files. - Line limits were raised for `spec.mjs` (+2), `schema.ts` (+5) and `reasons.ts` (in the 1010 group), as version 72 did. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task
Land cli-core 1.0 on
mainas1.0.0-rc.0: the stable API, store version 73, the 1.0 fixes and the release rules, in one pull request on top of 0.740.0.Why
cli-core moves to real semver. A stable core is listed in
package.json(wirecat.stable, ten entry points), and the rest is experimental. This needs cli-base 1.0, and it changes the store, so every CLI adopts it on arelease/1.0branch of its own. The work landed onrelease/1.0from several sessions. This branch is that work rebased ontomain, plus the gaps the consumer branches found.Not released yet.
mainnames1.0.0-rc.0with an empty changelog section.bin/release --major --app-ref release/1.0collectschanges/into it and publishes on npm'snexttag. Without the bump, the next release frommainwould publish these breaks as 0.741.0 onlatest.What
From
release/1.0(rebased, one conflict resolved:src/cli/documents/manifest/source.tskeeps main'sisCliErrorand takescodegen/runtime):wirecat.stable,@experimentalinside stable entries,MessageStoreCore/MessageStoreAreas),./storewithout the SQLite implementation,./store/areas;--rescankeeps the mass-deletion guard, and others);--major, thenexttag; every error reason indocs/reasons.md, checked as a contract;Added here:
api/, written by cli-base 1.0.0-rc.0'scli-dev api-report. CI checks it from now on.scripts/changelog-shape.tstakes cli-base'sCHANGELOG_HEADINGS../internal/*: every module's types can be named here, types only.notLocalPaths: exported from./cli(experimental), so a CLI can mark its own remote path inputs.catalog tree [folder]: the folder is the provider's id, not a local path../store/areas: exportscrmSettingKeyandcrmIdentityId, which amo-cli and bitrix24-cli import at run time.docs/reasons.md.plainSetupText(new on main, no importer) is tagged experimental.known-broken.json: max-cli and mail-cli leave it; both adopted the change on theirrelease/1.0branches.Testing
docs:check(reasons included),schema:check,check:dist,check:agent-process,help:examples,api-report --check.app_ref=release/1.0,tests=true, all 19 CLIs).main, which is still on cli-base 0.x and the old store imports; their adoption is onrelease/1.0.--adminonce the dispatched parity run and the rest of CI are green, with a comment saying why.Known follow-up (after rc.0)
About 270 types that stable functions in
./clitake or return are exported from no entry point. With./internal/*they can be named, but they are not under semver, and a change to them does not show in the API report. A later pass decides which of them become stable exports.Downstream
Each CLI moves to cli-base 1.0.0-rc.0 and changes its imports from
./storeto./store/areaswhere it uses them (the list is inchanges/1.0-surface.md). cli-memo importsassertSharedContractsfrom@wirecat/cli-base/commands.🤖 Generated with Claude Code
Replaces #3288 (same commits, from
release/1.0): the PR's parity builds each CLI from its branch of the same name with an open pull request, and the 20 CLIs adopt 1.0 onrelease/1.0(draft PRs, e.g. WireCatLabs/cli-memo#897). The ruleset on main has no bypass, so #3288's parity against the CLIs' main could not be merged past.Labelled
major: 1.0.0 is the first major of cli-core.