From 26a54c3d5d1a0a3a684d8f7a9126208cf7f26cca Mon Sep 17 00:00:00 2001 From: leemour Date: Tue, 24 Nov 2026 03:07:38 +0100 Subject: [PATCH 1/4] feat(core): build on cli-core 1.0 and cli-base 1.0 - Import the 68 store area names (Note, Project, Memory, Task types and the rest) from @wirecat/cli-core/store/areas; the store entry no longer re-exports them. - Name the types the store entry no longer reaches through an export: CitedSource for an evidence batch's sources, ReturnType annotations on countTasks, moveTask and commentTask, and LINE_PARENTS stays inside its module. - assertSharedContracts comes from @wirecat/cli-base/commands, since cli-core's ./cli dropped the re-export. - Mark the inputs that name no local file with notLocalPaths, so serve passes them as written and the MCP path guard skips them: commands , folders remove , sync --folder and --ignore, tags add|remove --folder and --subfolder. - Changelog fragment changes/release-1.0.md. Co-Authored-By: Claude Opus 5.5 --- changes/release-1.0.md | 23 ++++++++++++++++++++ src/actions/actions.ts | 23 ++++++++++---------- src/author.ts | 3 ++- src/context/context.ts | 3 ++- src/digest/brief.ts | 3 ++- src/digest/digests.ts | 2 +- src/digest/sources.ts | 3 ++- src/digest/tasks.ts | 3 ++- src/discovery/command.ts | 3 ++- src/facts/command.ts | 3 ++- src/facts/fact.ts | 3 ++- src/finance/contracts-command.ts | 3 ++- src/finance/deals-command.ts | 3 ++- src/finance/finance.ts | 3 ++- src/finance/lines-command.ts | 4 ++-- src/finance/orders-command.ts | 3 ++- src/finance/products-command.ts | 3 ++- src/finance/subscriptions-command.ts | 3 ++- src/finance/transactions-command.ts | 3 ++- src/finance/wallets-command.ts | 3 ++- src/knowledge/command.ts | 12 +++++----- src/knowledge/key-documents.ts | 11 ++-------- src/knowledge/organization-delete-command.ts | 2 +- src/knowledge/project-actions.ts | 3 ++- src/knowledge/project-findings.test.ts | 3 ++- src/knowledge/project-findings.ts | 3 ++- src/knowledge/relationships-scan.ts | 3 ++- src/mail/pipeline.test.ts | 3 ++- src/memories/command.ts | 3 ++- src/memories/memories.ts | 3 ++- src/memories/memory.ts | 3 ++- src/memories/sources.ts | 3 ++- src/mentions/command.ts | 3 ++- src/notes/about.ts | 3 ++- src/notes/command.ts | 3 ++- src/notes/folders-command.ts | 13 ++++++----- src/notes/import.ts | 3 ++- src/notes/internal.ts | 3 ++- src/notes/links.ts | 2 +- src/notes/list.ts | 3 ++- src/people/command.ts | 9 ++------ src/people/delete-command.ts | 2 +- src/people/doubts-command.ts | 2 +- src/people/identities-command.ts | 3 ++- src/people/review-context.ts | 3 ++- src/program.ts | 3 +-- src/records/record-commands.ts | 3 ++- src/records/sources.ts | 3 ++- src/run/import.ts | 4 ++-- src/search/search.ts | 3 ++- src/sources/command.ts | 3 ++- src/sources/mentions.ts | 3 ++- src/sources/read.ts | 2 +- src/sources/suggest.ts | 3 ++- src/store/crm-viewer.ts | 3 ++- src/store/scope.ts | 3 ++- src/store/source-target.ts | 3 ++- src/tags/command.ts | 7 +++--- src/tasks/command.ts | 4 +--- src/tasks/list.ts | 15 +++++-------- src/tasks/relations-command.ts | 3 ++- src/tasks/tasks.ts | 22 ++++++++----------- src/vocabulary/command.ts | 3 ++- src/vocabulary/list.ts | 2 +- 64 files changed, 173 insertions(+), 123 deletions(-) create mode 100644 changes/release-1.0.md diff --git a/changes/release-1.0.md b/changes/release-1.0.md new file mode 100644 index 00000000..84b04fc8 --- /dev/null +++ b/changes/release-1.0.md @@ -0,0 +1,23 @@ +### Changed — may break callers + +- **memo runs on cli-core 1.0 and cli-base 1.0** (cli-core 1.0.0, was 0.736.0; cli-base 1.0.0-rc.0, was 0.132.0). + cli-core 1.0 moves the message store to version 73 the first time it opens it: an id is never handed out twice, + and a JSON column holds valid JSON. After that, only tools on cli-core 1.0 open the store. Watch for: upgrade every + installed WireCat CLI to its 1.0 release first, and stop `serve`, `mcp` and every sync while memo migrates; the + migration writes a rollback copy first and refuses to run without one. See + [cli-core's changelog](https://github.com/WireCatLabs/cli-core/blob/main/CHANGELOG.md). + +### Fixed + +- **Over MCP, an input that names no local file is passed as the agent wrote it.** A folder id or path in + `memo folders remove`, `memo sync --folder`, `memo tags add|remove --folder`, a subfolder in `--subfolder`, a name + or glob in `memo sync --ignore`, and a command path in `memo commands` were made absolute against the client's + folder, so `--ignore Psychology` named a folder that does not exist. + +### Security + +- **An MCP call cannot name a credential folder, a WireCat tool's folder or the message store.** Every option and + argument that takes a local file or folder (`memo notes export --output-dir`, `memo notes add --text-file`, + `memo projects annotations export --output` and the rest) is checked by its real path before the call runs, so + neither a link nor `..` gets past. A refused call answers `permission_error` (`access.denied`) with the option in + `param`. A run in a terminal is unchanged. diff --git a/src/actions/actions.ts b/src/actions/actions.ts index 5f40b4d9..9279aa6a 100644 --- a/src/actions/actions.ts +++ b/src/actions/actions.ts @@ -4,15 +4,8 @@ import { parseLocator } from "@wirecat/cli-core" import { queryTerms, termField, typedQuery } from "@wirecat/cli-core/cli" import { MEETING_FINDINGS_KIND } from "@wirecat/cli-core/meetings" import { proposalRegistry } from "@wirecat/cli-core/services" -import { - type Author, - type Decider, - EVIDENCE_FINDINGS_KIND, - MAIL_FINDINGS_KIND, - type MessageStore, - PROPOSAL_STATUSES, - type ProposedAction, -} from "@wirecat/cli-core/store" +import { type Decider, EVIDENCE_FINDINGS_KIND, MAIL_FINDINGS_KIND, type MessageStore } from "@wirecat/cli-core/store" +import { type Author, PROPOSAL_STATUSES, type ProposedAction } from "@wirecat/cli-core/store/areas" import { pageOf } from "../page.js" import { decisionOf } from "../review/review.js" import { type AccountScope, selectAccount } from "../store/scope.js" @@ -118,6 +111,14 @@ const targetNames = async (store: MessageStore, actions: readonly ProposedAction return { names, chats } } +type StoreSource = Awaited>[number] + +/** A source a finding cites, read back; cli-core's store entry exports no name for it, and memo's answers need one. */ +export interface CitedSource extends StoreSource {} + +const citedSources = (store: MessageStore, id: string): Promise => + store.evidenceFindings.sources(id).catch(() => []) + /** * An action as memo answers it: what it would do in a sentence, the project it is about with its name, and for a * findings batch the fingerprint a decision needs and, unless brief, each cited source read back. @@ -149,9 +150,7 @@ export const actionItems = async ( ...(batch === undefined ? {} : { fingerprint: batch.fingerprint, subject: action.target, subjectName: targetName }), - ...(action.kind === EVIDENCE_FINDINGS_KIND && !brief - ? { sources: await store.evidenceFindings.sources(action.id).catch(() => []) } - : {}), + ...(action.kind === EVIDENCE_FINDINGS_KIND && !brief ? { sources: await citedSources(store, action.id) } : {}), } }), ) diff --git a/src/author.ts b/src/author.ts index 8e7d06c4..89bd2fae 100644 --- a/src/author.ts +++ b/src/author.ts @@ -3,7 +3,8 @@ import { createInterface } from "node:readline" import { ReadStream } from "node:tty" import { CliError } from "@wirecat/cli-base" import { environmentOf } from "@wirecat/cli-core/cli" -import type { Author, Decider } from "@wirecat/cli-core/store" +import type { Decider } from "@wirecat/cli-core/store" +import type { Author } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { terminalOf } from "./terminal.js" diff --git a/src/context/context.ts b/src/context/context.ts index ffab15e6..5920c6a7 100644 --- a/src/context/context.ts +++ b/src/context/context.ts @@ -15,7 +15,8 @@ import { personContext, personHistory, } from "@wirecat/cli-core/services" -import type { AccountKey, Link, MessageStore, Note, PersonRecord, RelationListItem } from "@wirecat/cli-core/store" +import type { AccountKey, MessageStore, PersonRecord } from "@wirecat/cli-core/store" +import type { Link, Note, RelationListItem } from "@wirecat/cli-core/store/areas" import { holdsFolder, type NotesAbout, notesAbout } from "../notes/about.js" import { withOwner } from "../people/owner.js" import { crmViewersAll, crmViewingAll } from "../store/crm-viewer.js" diff --git a/src/digest/brief.ts b/src/digest/brief.ts index 6b1e54d0..8fc5e7b5 100644 --- a/src/digest/brief.ts +++ b/src/digest/brief.ts @@ -5,7 +5,8 @@ import { join } from "node:path" import { CliError } from "@wirecat/cli-base" import { annotate } from "@wirecat/cli-base/commands" import { type Body, grantsAuthority, LOCAL_READ, LOCAL_WRITE, readSchedule } from "@wirecat/cli-core/cli" -import { type MessageStore, storePath, type TemplateAddress } from "@wirecat/cli-core/store" +import { type MessageStore, storePath } from "@wirecat/cli-core/store" +import type { TemplateAddress } from "@wirecat/cli-core/store/areas" import { Command, Option } from "commander" import { itemAnswer, withStore } from "../answer.js" import { authorOf } from "../author.js" diff --git a/src/digest/digests.ts b/src/digest/digests.ts index 2127ff01..0ab3fe24 100644 --- a/src/digest/digests.ts +++ b/src/digest/digests.ts @@ -19,7 +19,7 @@ import { type Weekday, type When, } from "@wirecat/cli-core/cli" -import type { TemplateAddress } from "@wirecat/cli-core/store" +import type { TemplateAddress } from "@wirecat/cli-core/store/areas" import { APP } from "../app.js" /** The digest memo had before digests had names; its files and brief keep their old places. */ diff --git a/src/digest/sources.ts b/src/digest/sources.ts index e5a091e5..87378d92 100644 --- a/src/digest/sources.ts +++ b/src/digest/sources.ts @@ -1,7 +1,8 @@ import { isFolderProvider, kindIn } from "@wirecat/cli-core" import { eventChange } from "@wirecat/cli-core/meetings" import { searchNotesQuery } from "@wirecat/cli-core/services" -import type { AccountKey, CrmChange, CrmChangeKind, MessageStore } from "@wirecat/cli-core/store" +import type { AccountKey, MessageStore } from "@wirecat/cli-core/store" +import type { CrmChange, CrmChangeKind } from "@wirecat/cli-core/store/areas" import { crmViewing } from "../store/crm-viewer.js" /** A part of the agenda read from the store alone: items newest first, cut by the agenda's section limit. */ diff --git a/src/digest/tasks.ts b/src/digest/tasks.ts index d7b7be01..4a8b6326 100644 --- a/src/digest/tasks.ts +++ b/src/digest/tasks.ts @@ -3,7 +3,8 @@ import { join } from "node:path" import { resolvePaths } from "@wirecat/cli-base" import { timezoneOf } from "@wirecat/cli-base/query" import { listQuery, typedQuery } from "@wirecat/cli-core/cli" -import type { AccountKey, MessageStore, TaskDetails } from "@wirecat/cli-core/store" +import type { AccountKey, MessageStore } from "@wirecat/cli-core/store" +import type { TaskDetails } from "@wirecat/cli-core/store/areas" import { APP } from "../app.js" import { TASKS_LIST_QUERY } from "../tasks/list.js" import { isDigest, MORNING_DIGEST, runningDigest } from "./digests.js" diff --git a/src/discovery/command.ts b/src/discovery/command.ts index c15e4000..78d7b1b7 100644 --- a/src/discovery/command.ts +++ b/src/discovery/command.ts @@ -15,6 +15,7 @@ import { type HelpSection, inSection, NO_EFFECTS, + notLocalPaths, sharedCommandTemplate, } from "@wirecat/cli-core/cli" import type { Command } from "commander" @@ -26,7 +27,7 @@ import { VERSION } from "../version.js" export const CONTRACT = 4 const commandsCommandDefinition = (program: Command, streams: Streams): void => { - annotate(program.command("commands"), { effects: NO_EFFECTS }) + notLocalPaths(annotate(program.command("commands"), { effects: NO_EFFECTS }), "path") .argument("[path...]", "one command, such as tags add") .description(DISCOVERY_DESCRIPTIONS.commands) .option("--json", "print JSON; --json=id,title keeps only those fields") diff --git a/src/facts/command.ts b/src/facts/command.ts index b1484f51..e9a38d3b 100644 --- a/src/facts/command.ts +++ b/src/facts/command.ts @@ -1,7 +1,8 @@ import type { Streams } from "@wirecat/cli-base" import { annotate } from "@wirecat/cli-base/commands" import { LOCAL_READ, LOCAL_WRITE, withQuery } from "@wirecat/cli-core/cli" -import { type Decider, FACT_TYPES, type Fact, MEMORY_SCOPES, type MessageStore } from "@wirecat/cli-core/store" +import { type Decider, FACT_TYPES, MEMORY_SCOPES, type MessageStore } from "@wirecat/cli-core/store" +import type { Fact } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { answers, itemAnswer } from "../answer.js" import { byOption, deciderOf, reasonOption, whoRuns } from "../author.js" diff --git a/src/facts/fact.ts b/src/facts/fact.ts index 1199cc11..619eeb6e 100644 --- a/src/facts/fact.ts +++ b/src/facts/fact.ts @@ -1,6 +1,7 @@ import type { QueryRegistry } from "@wirecat/cli-base/query" import { queryTerms, termField, typedQuery } from "@wirecat/cli-core/cli" -import { FACT_STATUSES, FACT_TYPES, type Fact, type MessageStore } from "@wirecat/cli-core/store" +import { FACT_STATUSES, FACT_TYPES, type MessageStore } from "@wirecat/cli-core/store" +import type { Fact } from "@wirecat/cli-core/store/areas" import { pageOf } from "../page.js" import { canonicalProject } from "../vocabulary/project.js" diff --git a/src/finance/contracts-command.ts b/src/finance/contracts-command.ts index 816b51a1..3d8e6352 100644 --- a/src/finance/contracts-command.ts +++ b/src/finance/contracts-command.ts @@ -3,7 +3,8 @@ import { annotate } from "@wirecat/cli-base/commands" import type { QueryRegistry } from "@wirecat/cli-base/query" import { CONTRACT_KINDS, CONTRACT_STATUSES, FINANCE_REVIEWS } from "@wirecat/cli-core" import { LOCAL_READ, LOCAL_WRITE, queryTerms, termField, withQuery } from "@wirecat/cli-core/cli" -import type { ContractFilter, MessageStore } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import type { ContractFilter } from "@wirecat/cli-core/store/areas" import { type Command, InvalidArgumentError } from "commander" import { answers, itemAnswer } from "../answer.js" import { byOption, whoRuns } from "../author.js" diff --git a/src/finance/deals-command.ts b/src/finance/deals-command.ts index 0b03ff0f..350e7297 100644 --- a/src/finance/deals-command.ts +++ b/src/finance/deals-command.ts @@ -13,7 +13,8 @@ import { writesWithOf, } from "@wirecat/cli-core/cli" import { dealBrief, dealContext } from "@wirecat/cli-core/services" -import type { AccountKey, DealFilter, MessageStore, Pipeline, PipelineReport } from "@wirecat/cli-core/store" +import type { AccountKey, MessageStore } from "@wirecat/cli-core/store" +import type { DealFilter, Pipeline, PipelineReport } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { answers, itemAnswer, openMemoStore, shortenedBy, wholeList, withStore } from "../answer.js" import { APP } from "../app.js" diff --git a/src/finance/finance.ts b/src/finance/finance.ts index 489e5a6d..8c8a43ee 100644 --- a/src/finance/finance.ts +++ b/src/finance/finance.ts @@ -9,7 +9,8 @@ import { moneyOf, } from "@wirecat/cli-core" import { queryTerms, termField } from "@wirecat/cli-core/cli" -import type { FinancePayment, Invoice, MessageStore } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import type { FinancePayment, Invoice } from "@wirecat/cli-core/store/areas" import { pageOf } from "../page.js" import { canonicalProject } from "../vocabulary/project.js" diff --git a/src/finance/lines-command.ts b/src/finance/lines-command.ts index a5850642..a89dbc46 100644 --- a/src/finance/lines-command.ts +++ b/src/finance/lines-command.ts @@ -18,7 +18,7 @@ interface LineInput { } /** The two parents with lines; each keeps its own store calls and the words its help names it by. */ -export const LINE_PARENTS = { +const LINE_PARENTS = { order: { has: "an order that has a currency (orders add with an amount)", shown: "orders show", @@ -38,7 +38,7 @@ export const LINE_PARENTS = { /** `memo orders lines` and `memo invoices lines`: what it is made of; its total is then their sum. */ export const lineCommands = ( parent: Command, - kind: keyof typeof LINE_PARENTS, + kind: "order" | "invoice", run: ReturnType["run"], env: NodeJS.ProcessEnv, ): void => { diff --git a/src/finance/orders-command.ts b/src/finance/orders-command.ts index ea0d744b..d1da658c 100644 --- a/src/finance/orders-command.ts +++ b/src/finance/orders-command.ts @@ -3,7 +3,8 @@ import { annotate } from "@wirecat/cli-base/commands" import type { QueryRegistry } from "@wirecat/cli-base/query" import { FINANCE_REVIEWS, ORDER_PURPOSES, ORDER_STATUSES } from "@wirecat/cli-core" import { LOCAL_READ, LOCAL_WRITE, queryTerms, termField, withQuery } from "@wirecat/cli-core/cli" -import type { MessageStore, OrderFilter } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import type { OrderFilter } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { answers, itemAnswer } from "../answer.js" import { byOption, whoRuns } from "../author.js" diff --git a/src/finance/products-command.ts b/src/finance/products-command.ts index 881862ba..7c04e3a2 100644 --- a/src/finance/products-command.ts +++ b/src/finance/products-command.ts @@ -3,7 +3,8 @@ import { annotate } from "@wirecat/cli-base/commands" import type { QueryRegistry } from "@wirecat/cli-base/query" import { CATALOG_KINDS } from "@wirecat/cli-core" import { LOCAL_READ, LOCAL_WRITE, queryTerms, termField, withQuery } from "@wirecat/cli-core/cli" -import type { MessageStore, ProductFilter } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import type { ProductFilter } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { answers, itemAnswer } from "../answer.js" import { authorOf } from "../author.js" diff --git a/src/finance/subscriptions-command.ts b/src/finance/subscriptions-command.ts index d36dbb2d..b1372844 100644 --- a/src/finance/subscriptions-command.ts +++ b/src/finance/subscriptions-command.ts @@ -3,7 +3,8 @@ import { annotate } from "@wirecat/cli-base/commands" import type { QueryRegistry } from "@wirecat/cli-base/query" import { FINANCE_REVIEWS, INVOICE_DIRECTIONS, SUBSCRIPTION_STATUSES } from "@wirecat/cli-core" import { LOCAL_READ, LOCAL_WRITE, queryTerms, termField, withQuery } from "@wirecat/cli-core/cli" -import type { MessageStore, SubscriptionFilter } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import type { SubscriptionFilter } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { answers, itemAnswer } from "../answer.js" import { byOption, whoRuns } from "../author.js" diff --git a/src/finance/transactions-command.ts b/src/finance/transactions-command.ts index 718c1587..ac2425d9 100644 --- a/src/finance/transactions-command.ts +++ b/src/finance/transactions-command.ts @@ -3,7 +3,8 @@ import { annotate } from "@wirecat/cli-base/commands" import type { QueryRegistry } from "@wirecat/cli-base/query" import { FINANCE_REVIEWS, MONEY_DIRECTIONS, TRANSACTION_STATUSES } from "@wirecat/cli-core" import { LOCAL_READ, LOCAL_WRITE, queryTerms, termField, withQuery } from "@wirecat/cli-core/cli" -import type { MessageStore, TransactionFilter } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import type { TransactionFilter } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { answers, itemAnswer } from "../answer.js" import { byOption, whoRuns } from "../author.js" diff --git a/src/finance/wallets-command.ts b/src/finance/wallets-command.ts index 7835f017..4e6eb5e9 100644 --- a/src/finance/wallets-command.ts +++ b/src/finance/wallets-command.ts @@ -3,7 +3,8 @@ import { annotate } from "@wirecat/cli-base/commands" import type { QueryRegistry } from "@wirecat/cli-base/query" import { WALLET_KINDS } from "@wirecat/cli-core" import { LOCAL_READ, LOCAL_WRITE, queryTerms, termField, withQuery } from "@wirecat/cli-core/cli" -import type { MessageStore, Wallet, WalletFilter } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import type { Wallet, WalletFilter } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { answers, itemAnswer } from "../answer.js" import { authorOf, byOption, whoRuns } from "../author.js" diff --git a/src/knowledge/command.ts b/src/knowledge/command.ts index 4cd82bae..6a9bc575 100644 --- a/src/knowledge/command.ts +++ b/src/knowledge/command.ts @@ -30,17 +30,19 @@ import { } from "@wirecat/cli-core/services" import { type AccountKey, - type KnowledgeRelation, type MessageStore, - ORGANIZATION_KINDS, ORGANIZATIONS_QUERY, + PROJECTS_QUERY, + REMINDERS_QUERY, +} from "@wirecat/cli-core/store" +import { + type KnowledgeRelation, + ORGANIZATION_KINDS, type Organization, PROJECT_TYPES, - PROJECTS_QUERY, type Project, - REMINDERS_QUERY, SCOPES, -} from "@wirecat/cli-core/store" +} from "@wirecat/cli-core/store/areas" import { type Command, InvalidArgumentError } from "commander" import { answers, itemAnswer, listAnswer, shortenedBy, wholeList, withStore } from "../answer.js" import { byOption, deciderOf, reasonOption, whoRuns } from "../author.js" diff --git a/src/knowledge/key-documents.ts b/src/knowledge/key-documents.ts index f4e69835..0cd40a0e 100644 --- a/src/knowledge/key-documents.ts +++ b/src/knowledge/key-documents.ts @@ -1,15 +1,8 @@ import { CliError } from "@wirecat/cli-base" import { parseLucene, validateQuery } from "@wirecat/cli-base/query" import { parseLocator } from "@wirecat/cli-core" -import { - type Author, - type Decider, - type Link, - type LinkListFilter, - type MessageStore, - PROJECTS_QUERY, - type Project, -} from "@wirecat/cli-core/store" +import { type Decider, type MessageStore, PROJECTS_QUERY } from "@wirecat/cli-core/store" +import type { Author, Link, LinkListFilter, Project } from "@wirecat/cli-core/store/areas" import { refuseBareNumber } from "../refs.js" import { heldMessage } from "../store/held.js" import { canonicalProject } from "../vocabulary/project.js" diff --git a/src/knowledge/organization-delete-command.ts b/src/knowledge/organization-delete-command.ts index 5f9fc0a9..a8821399 100644 --- a/src/knowledge/organization-delete-command.ts +++ b/src/knowledge/organization-delete-command.ts @@ -1,7 +1,7 @@ import { CliError, type Streams } from "@wirecat/cli-base" import { annotate } from "@wirecat/cli-base/commands" import { LOCAL_WRITE } from "@wirecat/cli-core/cli" -import type { OrganizationErasure } from "@wirecat/cli-core/store" +import type { OrganizationErasure } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { answers, itemAnswer, withStore } from "../answer.js" import { byOption } from "../author.js" diff --git a/src/knowledge/project-actions.ts b/src/knowledge/project-actions.ts index 0fd7c342..6ca10951 100644 --- a/src/knowledge/project-actions.ts +++ b/src/knowledge/project-actions.ts @@ -7,7 +7,8 @@ import { proposalRegistry, storedNeighbours, } from "@wirecat/cli-core/services" -import type { Decider, EvidenceFindingsBatch, MessageStore, Project } from "@wirecat/cli-core/store" +import type { Decider, EvidenceFindingsBatch, MessageStore } from "@wirecat/cli-core/store" +import type { Project } from "@wirecat/cli-core/store/areas" import { decideBatch } from "../actions/actions.js" import { decideOne, decisionOf } from "../review/review.js" diff --git a/src/knowledge/project-findings.test.ts b/src/knowledge/project-findings.test.ts index 3628e843..cb791d61 100644 --- a/src/knowledge/project-findings.test.ts +++ b/src/knowledge/project-findings.test.ts @@ -1,4 +1,5 @@ -import type { Link, MessageStore } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import type { Link } from "@wirecat/cli-core/store/areas" import { expect, it, vi } from "vitest" import { projectFindings } from "./project-findings.js" diff --git a/src/knowledge/project-findings.ts b/src/knowledge/project-findings.ts index 28736995..510cc29c 100644 --- a/src/knowledge/project-findings.ts +++ b/src/knowledge/project-findings.ts @@ -1,5 +1,6 @@ import { parseMeetingReference } from "@wirecat/cli-core/meetings" -import type { Link, MessageStore } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import type { Link } from "@wirecat/cli-core/store/areas" export const projectFindings = async (store: MessageStore, project: string, links: Link[]) => { const ids = new Set() diff --git a/src/knowledge/relationships-scan.ts b/src/knowledge/relationships-scan.ts index 0acba32d..f9d946b1 100644 --- a/src/knowledge/relationships-scan.ts +++ b/src/knowledge/relationships-scan.ts @@ -3,7 +3,8 @@ import { annotate } from "@wirecat/cli-base/commands" import { type NextStep, type StepDefinition, stepOf } from "@wirecat/cli-base/standards" import { type Body, LOCAL_WRITE, projectWindowOf } from "@wirecat/cli-core/cli" import { type LinkScanResult, scanProjectLinks } from "@wirecat/cli-core/services" -import type { MessageStore, Project } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import type { Project } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { itemAnswer, withStore } from "../answer.js" import { positive } from "../options.js" diff --git a/src/mail/pipeline.test.ts b/src/mail/pipeline.test.ts index 4c262e51..424d6263 100644 --- a/src/mail/pipeline.test.ts +++ b/src/mail/pipeline.test.ts @@ -2,7 +2,8 @@ import { mkdtempSync, writeFileSync } from "node:fs" import { tmpdir } from "node:os" import { join } from "node:path" import { captureStreams } from "@wirecat/cli-base" -import { type EmailInput, type MailboxInput, openStore } from "@wirecat/cli-core/store" +import { openStore } from "@wirecat/cli-core/store" +import type { EmailInput, MailboxInput } from "@wirecat/cli-core/store/areas" import { afterEach, expect, it } from "vitest" import { envelopeOf } from "../../test/answer.js" import { createProgram } from "../program.js" diff --git a/src/memories/command.ts b/src/memories/command.ts index a4eabd4a..3cf2eecc 100644 --- a/src/memories/command.ts +++ b/src/memories/command.ts @@ -1,7 +1,8 @@ import type { Streams } from "@wirecat/cli-base" import { annotate } from "@wirecat/cli-base/commands" import { LOCAL_READ, LOCAL_WRITE, withQuery } from "@wirecat/cli-core/cli" -import { type Decider, MEMORY_KINDS, MEMORY_SCOPES, type Memory, type MessageStore } from "@wirecat/cli-core/store" +import { type Decider, MEMORY_KINDS, MEMORY_SCOPES, type MessageStore } from "@wirecat/cli-core/store" +import type { Memory } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { answers, itemAnswer } from "../answer.js" import { byOption, deciderOf, reasonOption, whoRuns } from "../author.js" diff --git a/src/memories/memories.ts b/src/memories/memories.ts index ba0c48a0..31c1e4a0 100644 --- a/src/memories/memories.ts +++ b/src/memories/memories.ts @@ -1,4 +1,5 @@ -import type { Author, EvidenceInput, Memory, MessageStore } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import type { Author, EvidenceInput, Memory } from "@wirecat/cli-core/store/areas" import { canonicalProject } from "../vocabulary/project.js" export interface NewMemory { diff --git a/src/memories/memory.ts b/src/memories/memory.ts index 01497b12..e5414f2b 100644 --- a/src/memories/memory.ts +++ b/src/memories/memory.ts @@ -1,7 +1,8 @@ import { type Predicate, parseLucene, type QueryRegistry, queryError } from "@wirecat/cli-base/query" import { LIST_QUERY_GUIDE, queryTerms, termField, typedQuery } from "@wirecat/cli-core/cli" import { plainQuery } from "@wirecat/cli-core/services" -import { MEMORY_KINDS, MEMORY_SCOPES, MEMORY_STATUSES, type Memory, type MessageStore } from "@wirecat/cli-core/store" +import { MEMORY_KINDS, MEMORY_SCOPES, MEMORY_STATUSES, type MessageStore } from "@wirecat/cli-core/store" +import type { Memory } from "@wirecat/cli-core/store/areas" import { pageOf } from "../page.js" import { canonicalProject } from "../vocabulary/project.js" diff --git a/src/memories/sources.ts b/src/memories/sources.ts index 1cc15bae..c0d6d143 100644 --- a/src/memories/sources.ts +++ b/src/memories/sources.ts @@ -1,7 +1,8 @@ import { CliError, isCliError, type Streams } from "@wirecat/cli-base" import { annotate } from "@wirecat/cli-base/commands" import { answerEntity, LOCAL_WRITE } from "@wirecat/cli-core/cli" -import type { EvidenceInput, MessageStore, SourceCheck } from "@wirecat/cli-core/store" +import type { MessageStore, SourceCheck } from "@wirecat/cli-core/store" +import type { EvidenceInput } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import * as v from "valibot" import { answers, itemAnswer, withStore } from "../answer.js" diff --git a/src/mentions/command.ts b/src/mentions/command.ts index e6581808..f7e7f806 100644 --- a/src/mentions/command.ts +++ b/src/mentions/command.ts @@ -2,7 +2,8 @@ import { CliError, type Streams } from "@wirecat/cli-base" import { annotate } from "@wirecat/cli-base/commands" import { parseLucene, validateQuery } from "@wirecat/cli-base/query" import { LOCAL_READ, LOCAL_WRITE, queryHelp } from "@wirecat/cli-core/cli" -import { MENTION_QUERY, type MessageStore } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import { MENTION_QUERY } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { answers, itemAnswer, listAnswer, withStore } from "../answer.js" import { byOption, whoRuns } from "../author.js" diff --git a/src/notes/about.ts b/src/notes/about.ts index 3b434c7b..511987f5 100644 --- a/src/notes/about.ts +++ b/src/notes/about.ts @@ -1,5 +1,6 @@ import { formatReference } from "@wirecat/cli-core" -import type { AccountKey, Link, MessageStore, Note } from "@wirecat/cli-core/store" +import type { AccountKey, MessageStore } from "@wirecat/cli-core/store" +import type { Link, Note } from "@wirecat/cli-core/store/areas" import type { Subject } from "../people/subject.js" /** A file in a notes folder is a `document:`, a written note a `note:`. */ diff --git a/src/notes/command.ts b/src/notes/command.ts index 79d3ce05..dafeb0ae 100644 --- a/src/notes/command.ts +++ b/src/notes/command.ts @@ -4,7 +4,8 @@ import { annotate, customizeSharedCommand } from "@wirecat/cli-base/commands" import type { QueryRegistry } from "@wirecat/cli-base/query" import { LOCAL_READ, LOCAL_WRITE, queryTerms, sharedCommandTemplate, termField, withQuery } from "@wirecat/cli-core/cli" import { contextEvidenceFingerprint } from "@wirecat/cli-core/services" -import type { MessageStore, Note } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import type { Note } from "@wirecat/cli-core/store/areas" import { type Command, InvalidArgumentError } from "commander" import { answers, itemAnswer, listAnswer, withStore } from "../answer.js" import { APP } from "../app.js" diff --git a/src/notes/folders-command.ts b/src/notes/folders-command.ts index e309ad6f..b1b8d6c9 100644 --- a/src/notes/folders-command.ts +++ b/src/notes/folders-command.ts @@ -3,7 +3,7 @@ import { basename, resolve } from "node:path" import { CliError, type Streams } from "@wirecat/cli-base" import { annotate } from "@wirecat/cli-base/commands" import type { QueryRegistry } from "@wirecat/cli-base/query" -import { grantsAuthority, LOCAL_READ, LOCAL_WRITE, queryTerms, withQuery } from "@wirecat/cli-core/cli" +import { grantsAuthority, LOCAL_READ, LOCAL_WRITE, notLocalPaths, queryTerms, withQuery } from "@wirecat/cli-core/cli" import type { MessageStore } from "@wirecat/cli-core/store" import { type Command, InvalidArgumentError } from "commander" import { answers, itemAnswer, wholeList, withStore } from "../answer.js" @@ -146,10 +146,13 @@ export const foldersCommand = (program: Command, streams: Streams, env: NodeJS.P }) grantsAuthority( - annotate(folders.command("remove"), { - effects: LOCAL_WRITE, - examples: ["memo folders remove ~/notes", "memo folders remove 3 --allow-delete --yes --json"], - }), + notLocalPaths( + annotate(folders.command("remove"), { + effects: LOCAL_WRITE, + examples: ["memo folders remove ~/notes", "memo folders remove 3 --allow-delete --yes --json"], + }), + "folder", + ), ) .description("stop reading a notes folder here; its notes stay unless --allow-delete") .argument("", "the folder's id or its path, as memo folders list prints them") diff --git a/src/notes/import.ts b/src/notes/import.ts index 73fbf2da..0c559fad 100644 --- a/src/notes/import.ts +++ b/src/notes/import.ts @@ -4,7 +4,8 @@ import { basename, extname, relative, sep } from "node:path" import { CliError } from "@wirecat/cli-base" import { normalizeTag } from "@wirecat/cli-core" import { extractText, importEngine, type LoadEngine, MAX_FILE_BYTES } from "@wirecat/cli-core/documents" -import type { MessageStore, Note } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import type { Note } from "@wirecat/cli-core/store/areas" import type { BoundFolder } from "./bound.js" import { noteFileTime } from "./dates.js" import { dialectOf, type ParsedNote } from "./dialects/index.js" diff --git a/src/notes/internal.ts b/src/notes/internal.ts index 81ed957f..8f801d15 100644 --- a/src/notes/internal.ts +++ b/src/notes/internal.ts @@ -1,6 +1,7 @@ import { resolve } from "node:path" import { CliError } from "@wirecat/cli-base" -import type { MessageStore, Note } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import type { Note } from "@wirecat/cli-core/store/areas" import type { Config } from "../config.js" import { type DialectName, dialectOf } from "./dialects/index.js" import { type ExportedNote, type ExportResult, exportNotes } from "./export.js" diff --git a/src/notes/links.ts b/src/notes/links.ts index fae65f0f..c55d6e47 100644 --- a/src/notes/links.ts +++ b/src/notes/links.ts @@ -1,5 +1,5 @@ import { posix } from "node:path" -import type { LinkInput, Note } from "@wirecat/cli-core/store" +import type { LinkInput, Note } from "@wirecat/cli-core/store/areas" import { isReference } from "./dialects/common.js" import type { NoteLink } from "./dialects/index.js" diff --git a/src/notes/list.ts b/src/notes/list.ts index 6aa26bd0..17096cd8 100644 --- a/src/notes/list.ts +++ b/src/notes/list.ts @@ -1,4 +1,5 @@ -import type { MessageStore, Note } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import type { Note } from "@wirecat/cli-core/store/areas" import type { Subject } from "../people/subject.js" import { notesReaching, type Via } from "./about.js" diff --git a/src/people/command.ts b/src/people/command.ts index 123adcc8..c9028f99 100644 --- a/src/people/command.ts +++ b/src/people/command.ts @@ -4,13 +4,8 @@ import { annotate } from "@wirecat/cli-base/commands" import type { QueryRegistry } from "@wirecat/cli-base/query" import type { NextStep } from "@wirecat/cli-base/standards" import { LOCAL_READ, LOCAL_WRITE, queryTerms, termField, withQuery } from "@wirecat/cli-core/cli" -import { - type ListedPerson, - PEOPLE_SORTS, - PERSON_KINDS, - type PeopleSort, - type PersonKind, -} from "@wirecat/cli-core/store" +import { PERSON_KINDS, type PersonKind } from "@wirecat/cli-core/store" +import { type ListedPerson, PEOPLE_SORTS, type PeopleSort } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { answers, itemAnswer, listAnswer, wholeList, withStore } from "../answer.js" import { deciderOf, fromAppOption } from "../author.js" diff --git a/src/people/delete-command.ts b/src/people/delete-command.ts index 684d4b91..74e1f96b 100644 --- a/src/people/delete-command.ts +++ b/src/people/delete-command.ts @@ -1,7 +1,7 @@ import { CliError, type Streams } from "@wirecat/cli-base" import { annotate } from "@wirecat/cli-base/commands" import { LOCAL_WRITE } from "@wirecat/cli-core/cli" -import type { PersonErasure } from "@wirecat/cli-core/store" +import type { PersonErasure } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { answers, itemAnswer, withStore } from "../answer.js" import { byOption } from "../author.js" diff --git a/src/people/doubts-command.ts b/src/people/doubts-command.ts index 179809ea..9c7ab187 100644 --- a/src/people/doubts-command.ts +++ b/src/people/doubts-command.ts @@ -1,7 +1,7 @@ import { CliError, type Streams } from "@wirecat/cli-base" import { annotate } from "@wirecat/cli-base/commands" import { LOCAL_READ, LOCAL_WRITE } from "@wirecat/cli-core/cli" -import type { PersonDoubt } from "@wirecat/cli-core/store" +import type { PersonDoubt } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { answers, itemAnswer, listAnswer, withStore } from "../answer.js" import { byOption } from "../author.js" diff --git a/src/people/identities-command.ts b/src/people/identities-command.ts index baff778f..fbd69ef0 100644 --- a/src/people/identities-command.ts +++ b/src/people/identities-command.ts @@ -1,7 +1,8 @@ import { CliError, type Streams } from "@wirecat/cli-base" import { annotate } from "@wirecat/cli-base/commands" import { commandRunId, currentRun, LOCAL_READ, LOCAL_WRITE } from "@wirecat/cli-core/cli" -import { type IdentityRef, type MessageStore, type PersonRecord, parseMergeId } from "@wirecat/cli-core/store" +import type { IdentityRef, MessageStore, PersonRecord } from "@wirecat/cli-core/store" +import { parseMergeId } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { answers, itemAnswer, withStore } from "../answer.js" import { byOption, reasonOption, UNATTENDED, whoRuns } from "../author.js" diff --git a/src/people/review-context.ts b/src/people/review-context.ts index db40ebc6..81591f7a 100644 --- a/src/people/review-context.ts +++ b/src/people/review-context.ts @@ -1,6 +1,7 @@ import type { DealKind } from "@wirecat/cli-core" import { canonicalPersonContext } from "@wirecat/cli-core/services" -import type { LinkEvidence, MessageStore, PersonMerge } from "@wirecat/cli-core/store" +import type { LinkEvidence, MessageStore } from "@wirecat/cli-core/store" +import type { PersonMerge } from "@wirecat/cli-core/store/areas" import { crmViewingAll } from "../store/crm-viewer.js" import { groupScopeOf } from "../store/group.js" diff --git a/src/program.ts b/src/program.ts index 04a5363d..91e29974 100644 --- a/src/program.ts +++ b/src/program.ts @@ -1,12 +1,11 @@ import { fileURLToPath } from "node:url" import { CliError, createRenderer, type KeyringStore, processStreams, type Streams } from "@wirecat/cli-base" -import { customizeSharedCommand } from "@wirecat/cli-base/commands" +import { assertSharedContracts, customizeSharedCommand } from "@wirecat/cli-base/commands" import { skillCommand } from "@wirecat/cli-base/skill" import { REF_KINDS } from "@wirecat/cli-core" import type { ServerSystem } from "@wirecat/cli-core/background" import { addContractInfo, - assertSharedContracts, commandWords, entityFields, environmentOf, diff --git a/src/records/record-commands.ts b/src/records/record-commands.ts index 4fa60762..b43649a6 100644 --- a/src/records/record-commands.ts +++ b/src/records/record-commands.ts @@ -3,7 +3,8 @@ import { annotate } from "@wirecat/cli-base/commands" import { CORE_REASONS, providerNamed, RECORDS_SCHEMA_VERSION } from "@wirecat/cli-core" import { LOCAL_READ, LOCAL_WRITE } from "@wirecat/cli-core/cli" import { ingest } from "@wirecat/cli-core/services" -import type { MatchRun, MessageStore } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import type { MatchRun } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { type answers, itemAnswer } from "../answer.js" import { jsonOption } from "../options.js" diff --git a/src/records/sources.ts b/src/records/sources.ts index 9cf1a353..17043c69 100644 --- a/src/records/sources.ts +++ b/src/records/sources.ts @@ -1,4 +1,5 @@ -import type { AccountKey, MessageStore, RecordKey } from "@wirecat/cli-core/store" +import type { AccountKey, MessageStore } from "@wirecat/cli-core/store" +import type { RecordKey } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { grantedLevel } from "../mcp/granted.js" import { readableDeal, readablePipeline } from "../store/crm-viewer.js" diff --git a/src/run/import.ts b/src/run/import.ts index 1c388781..b23e59d7 100644 --- a/src/run/import.ts +++ b/src/run/import.ts @@ -7,7 +7,7 @@ import { type Streams, } from "@wirecat/cli-base" import { annotate } from "@wirecat/cli-base/commands" -import { FETCH, parseDuration } from "@wirecat/cli-core/cli" +import { FETCH, notLocalPaths, parseDuration } from "@wirecat/cli-core/cli" import { markStoreDamaged, openStore, type SourceCheck, storePath } from "@wirecat/cli-core/store" import { type Command, InvalidArgumentError, Option } from "commander" import { answers, itemAnswer } from "../answer.js" @@ -180,7 +180,7 @@ export const syncCommand = ( keyring?: KeyringStore, ): void => { const { print } = answers(program, streams, env) - annotate(program.command("sync"), { effects: FETCH }) + notLocalPaths(annotate(program.command("sync"), { effects: FETCH }), "folder", "ignore") .summary("sync notes, make stored mail searchable by meaning, and match people") .description( "bring notes up to date in the store, only what changed, embed the mail already stored for search by " + diff --git a/src/search/search.ts b/src/search/search.ts index 9c5dd9cc..bd9009de 100644 --- a/src/search/search.ts +++ b/src/search/search.ts @@ -15,7 +15,8 @@ import { searchNotesQuery, searchStore, } from "@wirecat/cli-core/services" -import type { AccountKey, MessageStore, Note } from "@wirecat/cli-core/store" +import type { AccountKey, MessageStore } from "@wirecat/cli-core/store" +import type { Note } from "@wirecat/cli-core/store/areas" import { APP } from "../app.js" import { keyDocuments, keyFirst, projectOf } from "../knowledge/key-documents.js" import { crmViewers as viewersOf } from "../store/crm-viewer.js" diff --git a/src/sources/command.ts b/src/sources/command.ts index 87997d95..e3c7a12d 100644 --- a/src/sources/command.ts +++ b/src/sources/command.ts @@ -3,7 +3,8 @@ import { CliError, type Streams } from "@wirecat/cli-base" import { annotate } from "@wirecat/cli-base/commands" import { environmentOf, FETCH, LOCAL_READ, LOCAL_WRITE, REMOTE_READ } from "@wirecat/cli-core/cli" import { agentPictureReader, aiImageReader, type FetchPageOptions, MAX_TEXT_CHARS } from "@wirecat/cli-core/documents" -import { type AddedSourceContent, addedSourceKeyOf, type Decider, type MessageStore } from "@wirecat/cli-core/store" +import type { Decider, MessageStore } from "@wirecat/cli-core/store" +import { type AddedSourceContent, addedSourceKeyOf } from "@wirecat/cli-core/store/areas" import { type Command, InvalidArgumentError } from "commander" import { answers, itemAnswer, listAnswer, withStore } from "../answer.js" import { APP } from "../app.js" diff --git a/src/sources/mentions.ts b/src/sources/mentions.ts index 0cba62c2..842b6634 100644 --- a/src/sources/mentions.ts +++ b/src/sources/mentions.ts @@ -1,4 +1,5 @@ -import type { MessageStore, Note } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import type { Note } from "@wirecat/cli-core/store/areas" export interface NamedInSource { ref: string diff --git a/src/sources/read.ts b/src/sources/read.ts index 0604eb69..bfc00795 100644 --- a/src/sources/read.ts +++ b/src/sources/read.ts @@ -14,7 +14,7 @@ import { ocrImage, type Section, } from "@wirecat/cli-core/documents" -import type { AddedSourceInput } from "@wirecat/cli-core/store" +import type { AddedSourceInput } from "@wirecat/cli-core/store/areas" import { transcriptText } from "./transcript.js" /** What memo's folder import keeps of a file's text; `--max-chars` may raise it to the store's own limit. */ diff --git a/src/sources/suggest.ts b/src/sources/suggest.ts index 446bae80..0dd85eae 100644 --- a/src/sources/suggest.ts +++ b/src/sources/suggest.ts @@ -1,7 +1,8 @@ import { createHash, randomUUID } from "node:crypto" import { CliError } from "@wirecat/cli-base" import { FACT_TYPES, type FindingsInput } from "@wirecat/cli-core/meetings" -import { type CitableRecord, type MessageStore, QUOTE_LIMIT, quoteKept } from "@wirecat/cli-core/store" +import type { CitableRecord, MessageStore } from "@wirecat/cli-core/store" +import { QUOTE_LIMIT, quoteKept } from "@wirecat/cli-core/store/areas" import type { Reader, ReaderContext } from "./readers/index.js" /** Changing the prompt changes this, so a source read with the old prompt is read again. */ diff --git a/src/store/crm-viewer.ts b/src/store/crm-viewer.ts index 568f3c77..63faa400 100644 --- a/src/store/crm-viewer.ts +++ b/src/store/crm-viewer.ts @@ -1,7 +1,8 @@ import { CliError } from "@wirecat/cli-base" import { type DealKind, kindIn } from "@wirecat/cli-core" import { type CrmViewing, crmViewerOf } from "@wirecat/cli-core/crm" -import type { AccountKey, Deal, MessageStore, Pipeline, PipelineReport } from "@wirecat/cli-core/store" +import type { AccountKey, MessageStore } from "@wirecat/cli-core/store" +import type { Deal, Pipeline, PipelineReport } from "@wirecat/cli-core/store/areas" type CopyViewer = NonNullable type PipelineOptions = NonNullable[1]> diff --git a/src/store/scope.ts b/src/store/scope.ts index 4af7eb3d..2b7d5116 100644 --- a/src/store/scope.ts +++ b/src/store/scope.ts @@ -1,6 +1,7 @@ import { CliError } from "@wirecat/cli-base" import { parseLocator } from "@wirecat/cli-core" -import type { AccountKey, KnowledgeTarget, MessageStore } from "@wirecat/cli-core/store" +import type { AccountKey, MessageStore } from "@wirecat/cli-core/store" +import type { KnowledgeTarget } from "@wirecat/cli-core/store/areas" import { scopedAccounts } from "./group.js" import { oneAccountOf, type WriteOptions, writeAccountOf } from "./source-list.js" diff --git a/src/store/source-target.ts b/src/store/source-target.ts index 328bef02..1a8609b7 100644 --- a/src/store/source-target.ts +++ b/src/store/source-target.ts @@ -1,6 +1,7 @@ import { CliError } from "@wirecat/cli-base" import { formatLocator, parseLocator } from "@wirecat/cli-core" -import type { AccountKey, TagTarget } from "@wirecat/cli-core/store" +import type { AccountKey } from "@wirecat/cli-core/store" +import type { TagTarget } from "@wirecat/cli-core/store/areas" export interface SourceScope { provider?: string diff --git a/src/tags/command.ts b/src/tags/command.ts index 7056f9b2..68d5079d 100644 --- a/src/tags/command.ts +++ b/src/tags/command.ts @@ -2,8 +2,9 @@ import { CliError, type Streams } from "@wirecat/cli-base" import { annotate } from "@wirecat/cli-base/commands" import type { QueryRegistry } from "@wirecat/cli-base/query" import { formatReference, normalizeTag } from "@wirecat/cli-core" -import { LOCAL_READ, LOCAL_WRITE, queryTerms, termField, withQuery } from "@wirecat/cli-core/cli" -import type { AccountKey, MessageStore, StoredTag } from "@wirecat/cli-core/store" +import { LOCAL_READ, LOCAL_WRITE, notLocalPaths, queryTerms, termField, withQuery } from "@wirecat/cli-core/cli" +import type { AccountKey, MessageStore } from "@wirecat/cli-core/store" +import type { StoredTag } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { answers, itemAnswer, listAnswer, withStore } from "../answer.js" import { folderIds } from "../notes/bound.js" @@ -57,7 +58,7 @@ const reference = ({ provider, account }: SourceScope, chat: string) => const targetOptions = (command: Command) => writeOptions( - command + notLocalPaths(command, "folder", "subfolder") .argument("", "one or more tags: 1–32 letters a–z, digits or hyphens; case is ignored") .option("--message ", "a stored email or message's full msg: locator") .option("--note ", "a note: note:, a file in a notes folder: document:; a bare id is a note") diff --git a/src/tasks/command.ts b/src/tasks/command.ts index 4f9cd386..953f7458 100644 --- a/src/tasks/command.ts +++ b/src/tasks/command.ts @@ -14,14 +14,12 @@ import { closedStateOf } from "@wirecat/cli-core/services" import { PRIORITY_LABELS, priorityOf, - TASK_ROLES, - TASK_SORTS, TASK_STATES, TASK_TYPES, - type TaskRole, type TaskState, WORK_TASK_TYPES, } from "@wirecat/cli-core/store" +import { TASK_ROLES, TASK_SORTS, type TaskRole } from "@wirecat/cli-core/store/areas" import { type Command, InvalidArgumentError } from "commander" import { answers, itemAnswer, wholeList, withStore } from "../answer.js" import { oneOf, positive, readScope, writeScope } from "../options.js" diff --git a/src/tasks/list.ts b/src/tasks/list.ts index 2f7c2963..a044d1b6 100644 --- a/src/tasks/list.ts +++ b/src/tasks/list.ts @@ -3,14 +3,8 @@ import { CliError } from "@wirecat/cli-base" import { type QueryAst, type QueryRegistry, timezoneOf, walkQuery } from "@wirecat/cli-base/query" import { formatReference } from "@wirecat/cli-core" import { listQuery, type QueryWords, typedQuery } from "@wirecat/cli-core/cli" -import { - type AccountKey, - isClosedState, - type MessageStore, - PROJECT_TASK_FIELDS, - type TaskDetails, - type TaskSort, -} from "@wirecat/cli-core/store" +import { type AccountKey, isClosedState, type MessageStore } from "@wirecat/cli-core/store" +import { PROJECT_TASK_FIELDS, type TaskDetails, type TaskSort } from "@wirecat/cli-core/store/areas" import { listAnswer } from "../answer.js" import { accountName } from "../store/source-list.js" import { canonicalProject } from "../vocabulary/project.js" @@ -240,7 +234,10 @@ export const listTasks = async ( } /** The board's pickers: every task, found ones too, when the query names no project:. */ -export const countTasks = async (store: MessageStore, words: QueryWords) => { +export const countTasks = async ( + store: MessageStore, + words: QueryWords, +): ReturnType => { const query = listQuery(typedQuery(words), TASKS_LIST_QUERY, "tasks counts", { defaultField: "text" }) if (query && walkQuery(query.root).some(({ field }) => field === "source")) throw new CliError("validation_error", "source: narrows an account's tasks; tasks counts counts project tasks") diff --git a/src/tasks/relations-command.ts b/src/tasks/relations-command.ts index 1d7a79c7..890841cd 100644 --- a/src/tasks/relations-command.ts +++ b/src/tasks/relations-command.ts @@ -1,7 +1,8 @@ import type { Streams } from "@wirecat/cli-base" import { annotate } from "@wirecat/cli-base/commands" import { LOCAL_READ, LOCAL_WRITE } from "@wirecat/cli-core/cli" -import { type MessageStore, TASK_RELATION_KINDS, type TaskRelationKind } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import { TASK_RELATION_KINDS, type TaskRelationKind } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { answers, itemAnswer, wholeList } from "../answer.js" import { oneOf } from "../options.js" diff --git a/src/tasks/tasks.ts b/src/tasks/tasks.ts index f62c2f92..1201cb93 100644 --- a/src/tasks/tasks.ts +++ b/src/tasks/tasks.ts @@ -7,16 +7,8 @@ import { type TasksService, tasksService, } from "@wirecat/cli-core/services" -import { - type AccountKey, - type MessageStore, - type TaskFields, - type TaskRole, - type TaskState, - type TaskType, - WORK_TASK_TYPES, - type WorkTaskType, -} from "@wirecat/cli-core/store" +import { type AccountKey, type MessageStore, type TaskState, WORK_TASK_TYPES } from "@wirecat/cli-core/store" +import type { TaskFields, TaskRole, TaskType, WorkTaskType } from "@wirecat/cli-core/store/areas" import { APP } from "../app.js" import { authorOf } from "../author.js" import { isNoteReference } from "../notes/about.js" @@ -315,14 +307,18 @@ export const moveTask = ( env: NodeJS.ProcessEnv, id: string, options: { status?: TaskState; before?: string; after?: string; revision?: number }, -) => { +): ReturnType => { const { revision, ...move } = options return store.tasks.move(id, move, authorOf(env), checkOf(revision)) } /** Who changed what and when, oldest first; `by` names the person or agent as the store knows it now. */ -export const commentTask = (store: MessageStore, env: NodeJS.ProcessEnv, id: string, text: string) => - store.tasks.comment(id, text, authorOf(env)) +export const commentTask = ( + store: MessageStore, + env: NodeJS.ProcessEnv, + id: string, + text: string, +): ReturnType => store.tasks.comment(id, text, authorOf(env)) export const taskHistory = async (store: MessageStore, id: string) => { const owner = (await store.people.owner())?.uid diff --git a/src/vocabulary/command.ts b/src/vocabulary/command.ts index 040b73df..569e2589 100644 --- a/src/vocabulary/command.ts +++ b/src/vocabulary/command.ts @@ -1,7 +1,8 @@ import { CliError, type Streams } from "@wirecat/cli-base" import { annotate } from "@wirecat/cli-base/commands" import { LOCAL_READ, LOCAL_WRITE, withQuery } from "@wirecat/cli-core/cli" -import type { MessageStore, VocabularyKind, VocabularyOptions, VocabularyTarget } from "@wirecat/cli-core/store" +import type { MessageStore } from "@wirecat/cli-core/store" +import type { VocabularyKind, VocabularyOptions, VocabularyTarget } from "@wirecat/cli-core/store/areas" import type { Command } from "commander" import { answers, itemAnswer } from "../answer.js" import { oneOf, positive } from "../options.js" diff --git a/src/vocabulary/list.ts b/src/vocabulary/list.ts index ec31a703..19e15bf6 100644 --- a/src/vocabulary/list.ts +++ b/src/vocabulary/list.ts @@ -1,6 +1,6 @@ import type { QueryRegistry } from "@wirecat/cli-base/query" import { queryTerms, termField } from "@wirecat/cli-core/cli" -import type { VocabularyOptions } from "@wirecat/cli-core/store" +import type { VocabularyOptions } from "@wirecat/cli-core/store/areas" export const VOCABULARY_QUERY = { entity: "vocabulary", From a711c8d42a39fac05eb2de309ab1c752d4fc9fb5 Mon Sep 17 00:00:00 2001 From: leemour Date: Wed, 25 Nov 2026 04:34:57 +0100 Subject: [PATCH 2/4] chore(deps): move to the published cli-core 1.0.0-rc.0 and cli-base 1.0.0-rc.1 release/1.0 built against a packed cli-core 1.0 tarball, while package.json still named cli-core 0.736.0 and cli-base 1.0.0-rc.0, so the branch's own CI was red. Both release candidates are now on npm under the next tag, so the pins point at them and the lockfile follows. The changelog fragment changes/release-1.0.md now names the versions memo builds on. memo does not pass coreImport to the code generator, so cli-base rc.1's new default does not touch it. Co-Authored-By: Claude Opus 5.5 --- changes/release-1.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes/release-1.0.md b/changes/release-1.0.md index 84b04fc8..dda045f2 100644 --- a/changes/release-1.0.md +++ b/changes/release-1.0.md @@ -1,6 +1,6 @@ ### Changed — may break callers -- **memo runs on cli-core 1.0 and cli-base 1.0** (cli-core 1.0.0, was 0.736.0; cli-base 1.0.0-rc.0, was 0.132.0). +- **memo runs on cli-core 1.0 and cli-base 1.0** (cli-core 1.0.0-rc.0, was 0.736.0; cli-base 1.0.0-rc.1, was 0.132.0). cli-core 1.0 moves the message store to version 73 the first time it opens it: an id is never handed out twice, and a JSON column holds valid JSON. After that, only tools on cli-core 1.0 open the store. Watch for: upgrade every installed WireCat CLI to its 1.0 release first, and stop `serve`, `mcp` and every sync while memo migrates; the From 6baca946213f7cda04ab9dd82e77e29c2564796e Mon Sep 17 00:00:00 2001 From: leemour Date: Wed, 25 Nov 2026 04:57:58 +0100 Subject: [PATCH 3/4] test(contracts): check the note written after the upgrade by its text contracts/upgrade.json: after the move to store version 73, cli-core 1.0 hands out ids past a gap so an id is never reused, and the second note is note:1002, not note:2. The case now checks the new note by its text, so it proves the write without pinning cli-core's id gap. Co-Authored-By: Claude Opus 5.5 --- contracts/upgrade.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/upgrade.json b/contracts/upgrade.json index b4d58068..ccc0ddd8 100644 --- a/contracts/upgrade.json +++ b/contracts/upgrade.json @@ -43,7 +43,7 @@ "kind": "json", "json": { "item": { - "ref": "note:2" + "text": "second synthetic note" } } } From 4257c8a7de92d9d0c80b4b7e14409217247b57d0 Mon Sep 17 00:00:00 2001 From: leemour Date: Wed, 25 Nov 2026 12:05:29 +0100 Subject: [PATCH 4/4] feat!: build on cli-core 1.0.0 and cli-base 1.0.0 Moves the pins from the release candidates (cli-core 1.0.0-rc.0, cli-base 1.0.0-rc.1) to the final 1.0.0 of both, after rebasing release/1.0 onto main. The lockfile follows. pnpm generate rewrote the command reference and contracts/wirecat.json: cli-core 1.0.0 adds the sector field to organizations list's entity. The changelog fragment names 1.0.0 and the version it replaces (0.749.0, main's pin). Co-Authored-By: Claude Opus 5.5 --- changes/release-1.0.md | 2 +- contracts/wirecat.json | 1 + docs/commands.md | 2 +- package.json | 4 ++-- pnpm-lock.yaml | 32 ++++++++++++++++---------------- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/changes/release-1.0.md b/changes/release-1.0.md index dda045f2..656ed69f 100644 --- a/changes/release-1.0.md +++ b/changes/release-1.0.md @@ -1,6 +1,6 @@ ### Changed — may break callers -- **memo runs on cli-core 1.0 and cli-base 1.0** (cli-core 1.0.0-rc.0, was 0.736.0; cli-base 1.0.0-rc.1, was 0.132.0). +- **memo runs on cli-core 1.0 and cli-base 1.0** (cli-core 1.0.0, was 0.749.0; cli-base 1.0.0, was 0.132.0). cli-core 1.0 moves the message store to version 73 the first time it opens it: an id is never handed out twice, and a JSON column holds valid JSON. After that, only tools on cli-core 1.0 open the store. Watch for: upgrade every installed WireCat CLI to its 1.0 release first, and stop `serve`, `mcp` and every sync while memo migrates; the diff --git a/contracts/wirecat.json b/contracts/wirecat.json index aaa96e4a..b8fe0e49 100644 --- a/contracts/wirecat.json +++ b/contracts/wirecat.json @@ -4336,6 +4336,7 @@ "kind", "name", "scope", + "sector", "created_at" ] }, diff --git a/docs/commands.md b/docs/commands.md index 64f5565f..49229dd9 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -1787,7 +1787,7 @@ memo organizations list [query] [options] |---|---| | `--json` | print JSON; --json=id,title keeps only those fields. | -**Returns:** organization — id, ref, kind, name, scope, created_at; every field: memo commands info organizations list +**Returns:** organization — id, ref, kind, name, scope, sector, created_at; every field: memo commands info organizations list **Example:** `memo organizations list name:*harbour*`, `memo organizations list category:client`, `memo organizations list --json` diff --git a/package.json b/package.json index 144394f5..4e83142d 100644 --- a/package.json +++ b/package.json @@ -62,8 +62,8 @@ }, "dependencies": { "@modelcontextprotocol/server": "2.4.0", - "@wirecat/cli-base": "0.132.0", - "@wirecat/cli-core": "0.749.0", + "@wirecat/cli-base": "1.0.0", + "@wirecat/cli-core": "1.0.0", "commander": "15.0.0", "valibot": "1.5.0", "yaml": "2.9.1" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 818cf350..7a556f29 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,11 +16,11 @@ importers: specifier: 2.4.0 version: 2.4.0 '@wirecat/cli-base': - specifier: 0.132.0 - version: 0.132.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-core': - specifier: 0.749.0 - version: 0.749.0(@wirecat/cli-base@0.132.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 @@ -1129,16 +1129,16 @@ packages: '@wasm-audio-decoders/opus-ml@0.0.3': resolution: {integrity: sha512-SEeTmk0eb3q5etJA/NHCRWW6BivTx9tqvNTmG0kg2ynuATEQRUZnwQE6Ibvl1BBvqIGHqI57+qyJMWmJBwb5XQ==} - '@wirecat/cli-base@0.132.0': - resolution: {integrity: sha512-y43hIGVFDUgVFTksTFnlK0KdLuROBDcv0smqme4/WSjkUS3PaGQnuAvu09G2VvW0zmvM2+OHFuQaZEN3Hir8nQ==} - 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 @@ -1157,14 +1157,14 @@ packages: '@wirecat/cli-core-sqlite@1.1.0': resolution: {integrity: sha512-GpGlh/dAIX/nblBYCdT6DfWSLFxav9mxxeELQAfEuw+QZdT9unKxbi5xa02s/s4JS1P7n0PQx2sCABj4FlMRNw==} - '@wirecat/cli-core@0.749.0': - resolution: {integrity: sha512-yJCRLB4q1urInfWQHrDuPApibEJe7Lr08NGrEoal/YsCa4qfYOI34DWQvhS/zNLIYMqCdYh87a5As4WrOuCdtQ==} + '@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 @@ -3246,7 +3246,7 @@ snapshots: dependencies: '@wasm-audio-decoders/common': 9.0.7 - '@wirecat/cli-base@0.132.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 @@ -3267,7 +3267,7 @@ snapshots: '@wirecat/cli-core-sqlite@1.1.0': {} - '@wirecat/cli-core@0.749.0(@wirecat/cli-base@0.132.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) @@ -3277,7 +3277,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.132.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