Skip to content

feat: require --yes on msg/comment delete and thread/conversation done#9

Merged
scottlovegrove merged 2 commits into
mainfrom
feat/yes-flag-msg-comment-done
May 28, 2026
Merged

feat: require --yes on msg/comment delete and thread/conversation done#9
scottlovegrove merged 2 commits into
mainfrom
feat/yes-flag-msg-comment-done

Conversation

@scottlovegrove
Copy link
Copy Markdown
Collaborator

@scottlovegrove scottlovegrove commented May 28, 2026

Summary

Ports Doist/twist-cli#190. Extends the existing tdc thread delete --yes confirmation pattern to the remaining destructive/state-changing commands: tdc msg delete, tdc comment delete, tdc thread done, and tdc conversation done.

  • Without --yes: prints a preview (Would delete message 42 / Would archive: …) and exits without mutating.
  • --json without --yes: throws MISSING_YES_FLAG — matches thread delete.
  • --dry-run still short-circuits before the --yes gate (validation pre-checks continue to run, consistent with existing dry-run behavior).
  • No shared helper introduced — the gate is inlined per-command to match the existing thread/delete.ts style.

Why

Agents replay/retry commands more freely than humans; idempotent archive operations produce no error signal on repeat, and deletes can silently run twice. Requiring --yes makes the mutation intent explicit. See Principle 4 of the 7 Principles for Agent-Friendly CLIs.

Test plan

  • npm test — 684/684 pass (added preview, --json --yes success, and --jsonMISSING_YES_FLAG cases to each command's test file)
  • npm run type-check — clean
  • npm run lint:check — clean
  • node scripts/check-skill-sync.js — skill in sync
  • Manual smoke on a scratch thread/conversation/message the session user owns:
    • tdc msg delete <id> → preview; --yes → deletes; --json alone → errors.
    • tdc comment delete <id> → preview; --yes → deletes; --json alone → errors.
    • tdc thread done <id> → preview; --yes → archives; --json alone → errors; --dry-run alone → preview (no --yes needed).
    • tdc conversation done <id> → same as above.
    • Regression: tdc thread delete behavior unchanged.

🤖 Generated with Claude Code

…versation done

Ports Doist/twist-cli#190. Extends the existing `tdc thread delete` `--yes`
confirmation pattern to the remaining destructive/state-changing commands:
`tdc msg delete`, `tdc comment delete`, `tdc thread done`, and
`tdc conversation done`.

Without `--yes`, each command prints a preview and exits without mutating.
With `--json` and no `--yes`, it rejects with `MISSING_YES_FLAG`. `--dry-run`
still short-circuits before the `--yes` gate.

Motivation: agents replay/retry commands more freely than humans;
idempotent archive operations produce no error signal on repeat, and deletes
can silently run twice. Requiring `--yes` makes mutation intent explicit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@scottlovegrove scottlovegrove self-assigned this May 28, 2026
@doistbot doistbot requested a review from rfgamaral May 28, 2026 09:54
Copy link
Copy Markdown
Member

@doistbot doistbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks scottlovegrove for your contribution 😎 👊. This is a clean port of the --yes confirmation pattern that keeps the tests and skill documentation perfectly in sync.

Few things worth tightening:

  • Adjust the placement of the --yes check in conversation done (after lookup to avoid masking invalid refs) and comment delete (before remote checks to save unnecessary API calls during previews).
  • Move the yes?: boolean property into a shared mutation options type in src/lib/options.ts instead of redefining it locally in each command handler.

Share FeedbackReview Logs

Comment thread src/commands/conversation/done.ts
Comment thread src/commands/conversation/helpers.ts Outdated
Comment thread src/commands/comment/delete.ts Outdated
- Move `yes?: boolean` into the shared `MutationOptions` type so each
  destructive command no longer redefines it locally.
- Reorder `conversation done` to fetch the conversation before the gate
  so invalid refs surface a proper error instead of `MISSING_YES_FLAG`.
- Move the `comment delete` and `msg delete` gates to the very top
  (before any remote calls) so previews don't trigger fetches or
  validation API calls.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@scottlovegrove scottlovegrove merged commit 2e82d30 into main May 28, 2026
6 checks passed
@scottlovegrove scottlovegrove deleted the feat/yes-flag-msg-comment-done branch May 28, 2026 10:24
doist-release-bot Bot added a commit that referenced this pull request May 28, 2026
## [1.3.0](v1.2.0...v1.3.0) (2026-05-28)

### Features

* require --yes on msg/comment delete and thread/conversation done ([#9](#9)) ([2e82d30](2e82d30))
@doist-release-bot
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link
Copy Markdown
Member

@rfgamaral rfgamaral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants