Skip to content

feat: chat state commands (archive, pin, mute, mark-read)#46

Open
decodiver22 wants to merge 1 commit intosteipete:mainfrom
decodiver22:feat/archive-chats
Open

feat: chat state commands (archive, pin, mute, mark-read)#46
decodiver22 wants to merge 1 commit intosteipete:mainfrom
decodiver22:feat/archive-chats

Conversation

@decodiver22
Copy link
Copy Markdown

Summary

  • 8 new subcommands: chats archive/unarchive, pin/unpin, mute/unmute (with --duration), mark-read/mark-unread
  • chats list gains filter flags: --archived, --pinned, --muted, --unread (and --no-* negations), plus a FLAGS column and pinned-first sort order
  • chats show displays state fields: Archived, Pinned, Muted, Unread
  • Bidirectional sync: inbound via events.Archive/Pin/Mute/MarkChatAsRead during bootstrap and live follow; outbound via whatsmeow SendAppState + builder functions

Changes

Layer Files What
Store migrations.go, types.go, chats_contacts_groups.go Migration v4 (4 new columns), ChatListFilter struct, ListChats/GetChat extended, 4 setter methods, Muted() helper
WA appstate.go (new) Thin wrappers around whatsmeow appstate builders
App app.go, chat_state.go (new), sync.go, fake_wa_test.go Interface extended, 4 convenience methods, 4 event handler cases, mock updated
CLI chats.go, chats_state.go (new) Filter flags, FLAGS column, DRY command factory for 8 subcommands
Tests store_test.go, sync_test.go State columns, Muted() method, list filters, migration idempotency, sync event handling
Docs spec.md, CHANGELOG.md Schema + CLI docs updated, changelog entries

Test plan

  • go build ./... — compiles
  • go vet ./... — clean
  • go test ./... — all pass (new tests: TestChatStateColumns, TestChatMutedMethod, TestListChatsFilters, TestMigrationIdempotent, TestSyncChatStateEvents)
  • Smoke: chats list --limit 5 — FLAGS column visible
  • Smoke: chats list --json — all 4 fields present
  • Smoke: chats show --jid <jid> — state lines displayed
  • Smoke: all filter flags (--archived, --pinned, --muted, --unread, --no-*)
  • Smoke: mutual exclusion errors (--archived --no-archived)
  • Live: archive → verify in list → confirmed on phone → unarchive
  • Live: pin → pinned-first sort → unpin
  • Live: mute with --duration 1h → mute forever → unmute
  • Live: mark-unread → mark-read
  • Live: combined flags (pin + mute)
  • Live: JSON output on write commands
  • DB migration safe: new binary against existing DB adds columns without data loss

🤖 Generated with Claude Code

Add read + write support for chat-level states: archived, pinned,
muted, and unread. States sync bidirectionally — inbound via WhatsApp
app-state events during bootstrap and live follow, outbound via new
CLI subcommands that send app-state patches through whatsmeow.

Store: migration v4 adds 4 columns to chats table. ListChats gains
filter struct with --archived/--pinned/--muted/--unread flags and
sorts pinned chats first. GetChat/show display all state fields.

Commands: archive/unarchive, pin/unpin, mute/unmute (with optional
--duration), mark-read/mark-unread — all via DRY factory pattern.

Tested against live WhatsApp account with cross-device verification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@steipete steipete requested a review from dinakars777 as a code owner April 21, 2026 03:54
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.

1 participant