Skip to content

Validation should still happen even with --dry-run #135

@scottlovegrove

Description

@scottlovegrove

Priority: Medium

Context

When providing the dry run flag, validation steps should still happen, we shouldn't just be parroting what the user has inputted.

As an example, the tw thread delete command does validation checks prior to deleting the thread, these checks should still happen even if it's dry run, that's the whole point of a dry run.

Practical example. npm pack --dry-run will build a package, and run as if it's packing the package up, the only thing it won't actually do is create the package, because it's a dry run.


Additional: Improve dry-run output for agent consumption

Based on 7 Principles for Agent-Friendly CLIs, Principle 3 (Fail Fast with Actionable Errors):

Failed commands should teach agents how to succeed on retry.

Problem

Current dry-run messages are vague and don't tell an agent what to do next:

Dry run: would delete thread 123
Dry run: would create thread in channel 456

An agent seeing this doesn't know the exact command to run to execute for real.

Proposed improvement

Dry-run output should include the exact command to execute:

Dry run: would delete thread 123
To execute: tw thread delete 123 --yes
Dry run: would create thread in channel 456
Title: My thread title
To execute: remove --dry-run flag to create

This gives agents (and humans) a clear next step. The "to execute" line acts as a confirmation receipt and a copy-pasteable command.

Scope

All commands with --dry-run support should be updated:

  • thread create, thread reply, thread done, thread delete, thread mute, thread unmute
  • conversation reply, conversation done, conversation mute, conversation unmute
  • msg update, msg delete
  • comment update, comment delete
  • away set, away clear
  • react, unreact

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions