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
22 changes: 22 additions & 0 deletions changes/release-1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
### Changed — may break callers

- **mail builds on cli-core 1.0.0 and cli-base 1.0.0.** The store moves to version 73 on its first open: an id is never
handed out twice, and only tools on cli-core 1.0 open the store after that. Upgrade every installed WireCat CLI
before you run this version. The migration writes a rollback copy first and refuses to run without one.
- **An MCP call that names a refused place answers `permission_error`**, not `validation_error`. Before any MCP call
runs, each option and argument that takes a local file or folder is checked by its real path: a call cannot name a
credential folder, a folder of a WireCat tool or the message store. A shell run is unchanged.
- **`schedule exec` is no longer offered over MCP.** It runs only a schedule file in the tool's own schedules folder.
An agent runs a saved schedule with `schedule run <name>`.
- **An unreadable config file now answers `config.unreadable`**, not `mail.config-unreadable`: the one name the
WireCat family uses for it.

### Fixed

- **A sync no longer marks mail deleted that the server's search found and its listing left out.** When a folder's
listing returns fewer messages than its search, the run skips the deletion check and says why in
`deletionsSkipped`.
- **A mailbox folder named over MCP stays the server's name.** `--folder` of `sync`, `session start`,
`account inspect`, `messages move`, `messages copy` and `messages export`, and the folder of `folders create`,
`folders rename` and `folders delete`, name a folder on the mail server, not on this computer, so `serve` passes
them on as given.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
"docs:spell": "cspell lint --config cspell.json --no-progress --no-summary README.md SECURITY.md CHANGELOG.md AGENTS.md CLAUDE.md 'docs/*.md' 'skills/**/*.md'"
},
"dependencies": {
"@wirecat/cli-base": "0.125.1",
"@wirecat/cli-core": "0.753.0",
"@wirecat/cli-base": "1.0.0",
"@wirecat/cli-core": "1.0.0",
"commander": "15.0.0",
"imapflow": "2.9.1",
"nodemailer": "10.1.7",
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.

2 changes: 1 addition & 1 deletion src/commands/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from "@wirecat/cli-core/cli"
import { type Quick, searchMail } from "@wirecat/cli-core/mail"
import { refusedPlace } from "@wirecat/cli-core/sends"
import type { FolderEmail } from "@wirecat/cli-core/store"
import type { FolderEmail } from "@wirecat/cli-core/store/areas"
import { Command, Option } from "commander"
import * as v from "valibot"
import { configuration } from "../config.js"
Expand Down
6 changes: 3 additions & 3 deletions src/commands/messages.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CliError } from "@wirecat/cli-base"
import { annotate } from "@wirecat/cli-base/commands"
import { timezoneOf, zonedMoment } from "@wirecat/cli-base/query"
import { answerEntity, envName, REMOTE_WRITE } from "@wirecat/cli-core/cli"
import { answerEntity, envName, notLocalPaths, REMOTE_WRITE } from "@wirecat/cli-core/cli"
import { decide, factsOf, listedOf, type MailRule, storedMailRules } from "@wirecat/cli-core/mail"
import { Command } from "commander"
import { IDENTITY } from "../identity.js"
Expand Down Expand Up @@ -332,8 +332,8 @@ export const messageWrites = (): Command[] => [
flagCommand("star", "star messages (the \\Flagged flag)", { add: ["\\Flagged"], remove: [] }, REF),
flagCommand("unstar", "take the star away", { add: [], remove: ["\\Flagged"] }, REF),
updateCommand(),
moveCommand("move"),
moveCommand("copy"),
notLocalPaths(moveCommand("move"), "folder"),
notLocalPaths(moveCommand("copy"), "folder"),
deleteCommand(),
restoreCommand(),
]
4 changes: 2 additions & 2 deletions src/commands/read.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { existsSync } from "node:fs"
import { CliError } from "@wirecat/cli-base"
import { baseContext } from "@wirecat/cli-core/cli"
import { baseContext, notLocalPaths } from "@wirecat/cli-core/cli"
import { mailAccountKey, readEmailWhole } from "@wirecat/cli-core/mail"
import { type MailReads, mailInboxCommand, mailReadCommands } from "@wirecat/cli-core/mail/cli"
import { storePath } from "@wirecat/cli-core/store"
Expand Down Expand Up @@ -70,7 +70,7 @@ export const readCommands = () => {
const commands = mailReadCommands(reads)
commands
.find((command) => command.name() === "messages")
?.addCommand(exportLeaf())
?.addCommand(notLocalPaths(exportLeaf(), "folder"))
.addCommand(importLeaf())
// mail has no `models` group: the AI model is chosen with memo or WireCat Desktop.
return [...commands, mailInboxCommand(reads, { modelsCommand: "memo" })]
Expand Down
3 changes: 2 additions & 1 deletion src/commands/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
LOCAL_WRITE,
listOf,
logsInOrOut,
notLocalPaths,
outputFor,
profileFree,
profilesHere,
Expand Down Expand Up @@ -227,7 +228,7 @@ const listCommand = () =>
export const sessionCommand = (): Command =>
annotate(new Command("session"), { effects: LOCAL_READ })
.description("keep this profile's app password in the OS keyring")
.addCommand(sessionStartCommand())
.addCommand(notLocalPaths(sessionStartCommand(), "folder"))
.addCommand(statusCommand())
.addCommand(endCommand())
.addCommand(listCommand())
3 changes: 2 additions & 1 deletion src/commands/tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import {
termField,
withQuery,
} from "@wirecat/cli-core/cli"
import type { AccountKey, MessageStore, TagTarget } from "@wirecat/cli-core/store"
import type { AccountKey, MessageStore } from "@wirecat/cli-core/store"
import type { TagTarget } from "@wirecat/cli-core/store/areas"
import { Command } from "commander"
import * as v from "valibot"
import { IDENTITY } from "../identity.js"
Expand Down
2 changes: 1 addition & 1 deletion src/commands/words.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const WORDS: Record<string, (message: string, profile: string, error: CliError)
"mail.others-for-agent": (message, profile) =>
`${message}; to let an agent mail others: ${IDENTITY.command} ${profile} config set permissions.${SEND_OTHERS_KEY} allow`,
"mail.no-submission": (message, profile) => `${message} with ${run(profile, "config set")}`,
"mail.config-unreadable": (message) => `${message}; run \`${IDENTITY.command} doctor\``,
"config.unreadable": (message) => `${message}; run \`${IDENTITY.command} doctor\``,
"mail.profile-exists": (message) => `${message}; pass --replace to overwrite it`,
"download.exists": (message) => `${message}; pass --replace to overwrite it`,
"mail.server-unknown": (message) =>
Expand Down
2 changes: 1 addition & 1 deletion src/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const writeProfile = (
const path = configPath(env)
const read = readConfigFile(path)
if ("issue" in read)
throw new CliError("configuration_error", `${path} cannot be read`, { reason: "mail.config-unreadable" })
throw new CliError("configuration_error", `${path} cannot be read`, { reason: "config.unreadable" })
const config = isRecord(read.raw) ? read.raw : {}
const profiles = isRecord(config.profiles) ? config.profiles : {}
const existed = name in profiles
Expand Down
7 changes: 4 additions & 3 deletions src/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
createProgram as createSharedProgram,
environmentOf,
type GlobalFlags,
notLocalPaths,
outputFor,
type ProgramDefinition,
type ProgramOptions,
Expand Down Expand Up @@ -64,9 +65,9 @@ export const definition = (): ProgramDefinition => ({
commands: () => [
commandsCommand(IDENTITY),
sessionCommand(),
accountCommand(),
foldersCommand(),
syncCommand(),
notLocalPaths(accountCommand(), "folder"),
notLocalPaths(foldersCommand(), "folder"),
notLocalPaths(syncCommand(), "folder"),
rulesCommand(),
statusCommand(),
...withWrites(readCommands()),
Expand Down
1 change: 0 additions & 1 deletion src/reasons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const ENTRIES: [reason: string, code: string, message: string][] = [
["mail.original-gone", "not_found", "the message is not where the store last saw it on the server"],
["mail.others-for-agent", "permission_error", "over MCP the profile mails only its owner"],
["mail.no-submission", "configuration_error", "the profile names no submission server"],
["mail.config-unreadable", "configuration_error", "the config file cannot be read"],
["mail.profile-exists", "validation_error", "a profile of this name already exists"],
["mail.server-unknown", "not_found", "no mail server was found for the address's domain"],
["mail.export-other", "validation_error", "the export folder holds an export of another format or mailbox"],
Expand Down
3 changes: 2 additions & 1 deletion src/send.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,8 @@ describe("sending over MCP", { timeout: 20_000 }, () => {
)
const refused = await send({ file: key })
expect(refused.isError).toBe(true)
expect(JSON.stringify(refused.content)).toContain("--allow-any-file")
expect(JSON.stringify(refused.content)).toContain("permission_error")
expect(JSON.stringify(refused.content)).toContain("access.denied")
expect((await send({ file: key, allow_any_file: true })).isError).toBe(true)
} finally {
expect(await close()).toBe(0)
Expand Down
Loading