Skip to content

CLI: Add --dry-run flag for mutating commands #160

@titouanmathis

Description

@titouanmathis

Context

Following agent-friendly CLI best practices, agents should be able to preview what a command would do before committing. This is especially important for destructive actions.

Proposal

Add --dry-run support to all mutating commands:

  • Create: time add, tasks add, comments add, deals add, bookings add, pages add, discussions add, companies add
  • Update: all update subcommands
  • Delete: time delete, pages delete, discussions delete, attachments delete

Behavior

$ productive time add --service 123 --time 480 --note "Dev work" --dry-run
Would create time entry:
  service: 123
  time: 480 (8h 0m)
  date: 2026-03-24
  note: Dev work
No changes made.

$ productive time delete 12345 --dry-run
Would delete time entry 12345
No changes made.

With --format json:

{"dry_run": true, "action": "create", "resource": "time_entries", "payload": {...}}

Implementation

  • Validate all inputs as normal (fail fast on missing required fields)
  • Build the request payload but skip the API call
  • Display what would happen
  • Exit with code 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions