Repository navigation
feat: add --yes and --dry-run to deletes, from cli-core's confirmation flow - #205
Conversation
…n flow
Bump @todoist/cli-core to 2.1.0 and move ol document delete, ol
collection delete and ol attachment delete onto its requireConfirmation
and previewUnlessConfirmed, so deletes confirm the same way as in the
other CLIs:
- --yes deletes. Without it a delete previews what it would delete and
exits 0, instead of failing with CONFIRMATION_REQUIRED.
- --dry-run prints the standard [dry-run] preview, or under --json a
{ status: "preview", command, messages } object.
- --json is new on deletes. Without --yes or --dry-run it fails with
CONFIRMATION_REQUIRED before any API call; with --yes it prints
{ id, deleted: true }.
- --confirm keeps working as a hidden alias of --yes.
The old error went through formatError and process.exit, which ignored
--json; the new one is thrown and rendered by the global handler.
doistbot
left a comment
There was a problem hiding this comment.
This PR bumps @todoist/cli-core to 2.1.0 and moves the document, collection and attachment delete commands onto the shared requireConfirmation / previewUnlessConfirmed flow, adding --yes and --dry-run, a consistent --json shape, and keeping the hidden --confirm alias so existing scripts keep working. No inline issues were flagged in the review — reviewers confirmed the confirmation gating happens before any API call, the output and docs (SKILL_CONTENT, README, AGENTS.md, CODEBASE.md, agent checks) match the implementation, and the change introduces no security concerns. Two minor reuse notes surfaced in general review: the new delete output path hand-rolls JSON serialization instead of routing through the shared output helper, and it skips --ndjson support that sibling commands on the same files provide — both worth a look in a follow-up if you want the delete commands fully aligned with the rest of the surface.
I also included a few optional follow-up notes in the details below.
Optional follow-up notes (2)
src/commands/document.ts:304: The dry-run details label
ID: document.urlIdshows the URL slug, but the delete then callsdocuments.deletewithdocument.id(line 310), a different value. The collection delete's dry-run shows the actual ID under the sameID:label, so the label means different things across the two commands. Either printdocument.idhere, or label the rowURL IDso users aren't shown a value underIDthat isn't the one used for the deletion.src/lib/delete-options.ts:29:
printDeletedwrites JSON by hand withJSON.stringify, bypassingoutputItem/formatJsonfromsrc/lib/output.ts, whichAGENTS.mdand.agents/checks/architecture.mdsay all command output goes through. Every delete command will now inherit this, so it's worth routing it through the shared helper — e.g.outputItem({ id, deleted: true }, () => 'Deleted.', ['id', 'deleted'], { json: opts.json })— so--jsonformatting and any future output-mode changes stay in one place.
The document delete dry run printed the URL id under "ID", while the delete itself uses the document id, and collection delete's "ID" row is the real id. Print the real id under "ID" and the URL id under "URL ID". The delete result now goes through outputItem like other command output, rather than serialising JSON by hand.
## [3.2.0](v3.1.8...v3.2.0) (2026-12-03) ### Features * add --yes and --dry-run to deletes, from cli-core's confirmation flow ([#205](#205)) ([5215467](5215467))
The 3.2.0 release failed because publishing ran the agent tooling's tests: `prepublishOnly` runs `npm test`, which included `.agents/scripts/**`, and `lib/patches.test.ts` timed out on the release runner. Publishing should test what it is about to publish, not the tooling that checks our own work. `npm test` (and so `prepublishOnly` and `pre-push`) now covers only `src/`. The agent tooling's tests run with `npm run test:agents` from a new `vitest.agents.config.ts`, as a separate "Run agent tooling tests" step in `test.yml`, which now also runs on every push to `main` and `next`, so both suites run on every pull request and every merge without being on the publish path. `npm run verify` gains a `tests:agents` step that starts after the package tests and has `onlyWhenChanged`: it runs when a path the agent tests read changed since `main` (`.agents/`, `vitest.agents.config.ts`, `package.json`, `package-lock.json`, `.github/workflows/`, `lefthook.yml`, `.claude/`, `.codex/`, `.cursor/`, `.pi/`, the agent docs, `src/_fixtures/`, `.oxfmtrc.json`, `tsconfig.json`, `.gitignore`), when a file was deleted or renamed (the agent docs may name it), and when nothing changed. Otherwise it prints that it skipped them and that CI runs them on every pull request. A skipped step counts as passed, so steps after it still run. A test checks every path in the list exists, apart from `.cursor/`, which must stay free of a hooks file. This releases 3.2.1, which ships the confirmation-flow change from #205.
Bumps
@todoist/cli-coreto 2.1.0 and movesol document delete,ol collection deleteandol attachment deleteonto its shared confirmation flow (requireConfirmationandpreviewUnlessConfirmed, added in todoist/cli-core#198), so deletes confirm the same way as in todoist-cli and the other CLIs.--yesdeletes. Without it, a delete now previews what it would delete (Would delete document: <title> (<urlId>), thenUse --yes to confirm.) and exits 0, where it used to fail withCONFIRMATION_REQUIRED.--dry-runprints the standard[dry-run] Would delete …:rows, or under--jsona{ status: "preview", command, messages }object. Documents and collections are resolved first (a read) so the preview can name them; an attachment is previewed by id.--jsonis new on the deletes. Without--yesor--dry-runit fails withCONFIRMATION_REQUIRED("Pass --yes to execute ol document delete, or --dry-run to preview it.") before any API call. With--yesit prints{ id, deleted: true }, the shape comms-cli and twist-cli use.--confirmstill works as a hidden alias of--yes, so existing scripts keep deleting. That's why this is afeatrather than a breaking change: the error code is the same, and only its message and the human no-flag behaviour change.The old error went through
formatErrorandprocess.exit(1), which ignored--json; the new one is thrown and printed by the global handler, as JSON under--json. The flags live inaddDeleteOptions(src/lib/delete-options.ts).SKILL_CONTENT, the README, AGENTS.md, CODEBASE.md and the agent skills and checks now describe--yesand--dry-runinstead of--confirm.Checked against a real Outline account with read-only previews only:
ol doc delete <urlId>,--dry-runand--dry-run --jsonnamed the document and deleted nothing, andol attachment delete <id> --jsonfailed withCONFIRMATION_REQUIREDand its hint without a request. No real delete was run.