Skip to content

feat: add --json support to mutating commands#84

Merged
scottlovegrove merged 2 commits intomainfrom
scottl/json
Mar 14, 2026
Merged

feat: add --json support to mutating commands#84
scottlovegrove merged 2 commits intomainfrom
scottl/json

Conversation

@scottlovegrove
Copy link
Collaborator

Summary

  • Adds --json (and --full where applicable) to all mutating commands: thread reply, thread done, conversation reply, conversation done, msg update, msg delete
  • Object-returning mutations (create/update) output the full entity via formatJson(); void mutations (archive/delete) output a minimal status object (e.g. { id, deleted: true })
  • Extends MutationOptions in src/lib/options.ts with json and full fields so future commands get the pattern for free
  • Documents the convention in AGENTS.md so future contributors follow the same approach

Test plan

  • tw thread reply <ref> "test" --json returns comment object with id, content, threadId, etc.
  • tw thread reply <ref> "test" --json --full returns all comment fields
  • tw thread done <ref> --json returns { "id": ..., "isArchived": true }
  • tw conversation reply <ref> "test" --json returns message object
  • tw conversation done <ref> --json returns { "id": ..., "archived": true }
  • tw msg update <ref> "test" --json returns updated message object
  • tw msg delete <ref> --json returns { "id": ..., "deleted": true }
  • All commands still work without --json (text output unchanged)

🤖 Generated with Claude Code

Add --json (and --full where applicable) to thread reply/done,
conversation reply/done, msg update/delete. Object-returning mutations
(reply, update) output the full entity via formatJson(); void mutations
(done, delete) output a minimal status object for scripting consumers.

Extends MutationOptions with json/full fields and documents the pattern
in AGENTS.md so future commands follow the same convention.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@doistbot doistbot requested a review from gnapse March 14, 2026 11:22
Copy link

@doist-bot doist-bot bot left a comment

Choose a reason for hiding this comment

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

This PR introduces valuable machine-readable output by adding --json and --full flags to mutating commands and establishing a consistent pattern via MutationOptions. These enhancements will greatly improve the CLI's programmatic usability for future integrations. However, there is a minor omission in the skill source of truth (SKILL_CONTENT), which currently only documents the --json option and might cause agents to overlook the extended payload capabilities provided by the --full flag.

Share FeedbackReview Logs

Follow-up to PR review: add --full examples to thread reply,
conversation reply, and msg update in SKILL_CONTENT so agents
know the extended payload form is available.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@scottlovegrove scottlovegrove merged commit 738ecf2 into main Mar 14, 2026
2 checks passed
@scottlovegrove scottlovegrove deleted the scottl/json branch March 14, 2026 11:36
github-actions bot pushed a commit that referenced this pull request Mar 14, 2026
# [2.12.0](v2.11.0...v2.12.0) (2026-03-14)

### Features

* add --json support to mutating commands ([#84](#84)) ([738ecf2](738ecf2))
@github-actions
Copy link

🎉 This PR is included in version 2.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

1 participant