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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions changes/release-1.0.md
Original file line number Diff line number Diff line change
@@ -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.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
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.
2 changes: 1 addition & 1 deletion contracts/upgrade.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"kind": "json",
"json": {
"item": {
"ref": "note:2"
"text": "second synthetic note"
}
}
}
Expand Down
1 change: 1 addition & 0 deletions contracts/wirecat.json
Original file line number Diff line number Diff line change
Expand Up @@ -4336,6 +4336,7 @@
"kind",
"name",
"scope",
"sector",
"created_at"
]
},
Expand Down
2 changes: 1 addition & 1 deletion docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
},
"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"
Expand Down
32 changes: 16 additions & 16 deletions pnpm-lock.yaml

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

23 changes: 11 additions & 12 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -118,6 +111,14 @@ const targetNames = async (store: MessageStore, actions: readonly ProposedAction
return { names, chats }
}

type StoreSource = Awaited<ReturnType<MessageStore["evidenceFindings"]["sources"]>>[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<CitedSource[]> =>
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.
Expand Down Expand Up @@ -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) } : {}),
}
}),
)
Expand Down
3 changes: 2 additions & 1 deletion src/author.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
3 changes: 2 additions & 1 deletion src/context/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion src/digest/brief.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/digest/digests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
3 changes: 2 additions & 1 deletion src/digest/sources.ts
Original file line number Diff line number Diff line change
@@ -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. */
Expand Down
3 changes: 2 additions & 1 deletion src/digest/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion src/discovery/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
type HelpSection,
inSection,
NO_EFFECTS,
notLocalPaths,
sharedCommandTemplate,
} from "@wirecat/cli-core/cli"
import type { Command } from "commander"
Expand All @@ -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")
Expand Down
3 changes: 2 additions & 1 deletion src/facts/command.ts
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
3 changes: 2 additions & 1 deletion src/facts/fact.ts
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
3 changes: 2 additions & 1 deletion src/finance/contracts-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion src/finance/deals-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion src/finance/finance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 2 additions & 2 deletions src/finance/lines-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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<typeof answers>["run"],
env: NodeJS.ProcessEnv,
): void => {
Expand Down
3 changes: 2 additions & 1 deletion src/finance/orders-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion src/finance/products-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion src/finance/subscriptions-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion src/finance/transactions-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion src/finance/wallets-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading