Skip to content

feat(gmail): add messages modify command for single-message label changes#281

Merged
steipete merged 2 commits intoopenclaw:mainfrom
zerone0x:fix/issue-277-messages-modify
Mar 8, 2026
Merged

feat(gmail): add messages modify command for single-message label changes#281
steipete merged 2 commits intoopenclaw:mainfrom
zerone0x:fix/issue-277-messages-modify

Conversation

@zerone0x
Copy link
Copy Markdown
Contributor

Summary

Fixes #277

Adds gog gmail messages modify <messageId> --add <labels> --remove <labels> so users can add/remove labels on individual messages, not just threads.

Changes

  • Add GmailMessagesModifyCmd to the messages subcommand group, mirroring the existing thread modify pattern
  • Uses Gmail API Users.Messages.Modify for single-message label operations
  • Supports --add and --remove flags with comma-separated label names or IDs
  • Supports --dry-run, --json, and label name-to-ID resolution (consistent with existing commands)
  • Add test covering JSON output, label resolution, and plain text output

Usage

# Trash a single message (without affecting other messages in the thread)
gog gmail messages modify <messageId> --add TRASH --remove INBOX

# Apply a custom label
gog gmail messages modify <messageId> --add "my-label"

# Dry run
gog gmail messages modify <messageId> --add STARRED --dry-run

Note

main currently has a pre-existing build error in contacts_crud.go (parameter type grouping bug). This PR does not touch that file. Tests will pass once that is resolved separately.


🤖 Generated with Claude Code

zerone0x and others added 2 commits March 8, 2026 01:06
…nges

Adds `gog gmail messages modify <messageId> --add <labels> --remove <labels>`
so users can add/remove labels on individual messages, not just threads.

Previously only `gmail thread modify` (all messages in a thread) and
`gmail batch modify` (multiple message IDs) were available. This fills the
gap for single-message label operations like trash, archive, or custom
label assignment.

Fixes openclaw#277

Co-Authored-By: Claude <noreply@anthropic.com>
@steipete steipete force-pushed the fix/issue-277-messages-modify branch from d96893b to d195e1d Compare March 8, 2026 01:07
@steipete steipete merged commit d448264 into openclaw:main Mar 8, 2026
2 of 5 checks passed
@steipete
Copy link
Copy Markdown
Collaborator

steipete commented Mar 8, 2026

Landed via temp rebase onto main.

  • Gate: go test ./internal/cmd -run 'TestGmailMessagesModifyCmd_' -count=1, make ci
  • Land commit: d195e1d
  • Merge commit: d448264a27734e08ce9e666c8a20392911b4ee61

Fixups included:

  • changelog entry
  • shared label-ID resolution helper reused by message/thread/batch modify flows
  • extra regression coverage for custom label name resolution and empty message IDs

Thanks @zerone0x!

klodr pushed a commit to klodr/gogcli that referenced this pull request Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gmail Doesn't support modifying labels on a message (only on a thread)

2 participants