Skip to content

refactor(domain): the shared types where MAX says the same thing - #254

Merged
leemour merged 1 commit into
mainfrom
refactor/shared-domain
Sep 30, 2026
Merged

leemour merged 1 commit into
mainfrom
refactor/shared-domain

Conversation

@leemour

@leemour leemour commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Task

Step 4 of the layer design, first half (the plan in the private repository): one domain model for max and tg.

Why

max-cli kept a copy of cli-messaging's domain types, and copies drift. Every type that says the same thing now comes from one place. That is the ground the move onto the shared services (T6) stands on.

What

  • src/domain/models.ts re-exports 17 types from @leemour/cli-messaging (0.49.0, the pinned version): Id, Chat, ChatKind, Contact, Member, Page, ChatCard, PersonCard, ChatEvent, ChatEvents, AccountSession, AttachmentLink, Pin, Deletion, ReadMark, Reactions, Profile. It declares only what MAX says differently or alone (380 → about 250 lines).
  • These stay MAX's own until T6:
    • Attachment: its fileId, videoId, event, userIds and poll would move under providerRef, and that changes max … --json.
    • Message, and every type built on it.
    • Poll, GroupMember, Inbox, Review.
  • The MAX facts that were measured and written on the removed declarations stay as notes beside the re-export: download links need no token, MAX gives a session no id, which event names were seen, and the contact's last-messaged time.

Testing

pnpm lint && pnpm typecheck && pnpm test && pnpm docs:check: 1190 tests pass, and no test was edited. The change is types only, so nothing max prints can change.

🤖 Generated with Claude Code

Step 4 of the layer design, first half. src/domain/models.ts re-exports 17
types from @leemour/cli-messaging (Id, Chat, ChatKind, Contact, Member,
Page, ChatCard, PersonCard, ChatEvent(s), AccountSession, …) and declares
only what MAX says differently or alone. Types only: nothing max prints
changes, and every test passes unedited.

Kept as MAX's own until T6: Attachment (fileId, videoId, event, userIds,
poll), Message and every type built on it, Poll, GroupMember, Inbox,
Review. Moving the attachment fields would change max's --json. The MAX
facts measured on the shared types stay as notes beside the re-export.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@leemour
leemour merged commit a472d03 into main Sep 30, 2026
4 checks passed
@leemour leemour mentioned this pull request Sep 30, 2026
@leemour
leemour deleted the refactor/shared-domain branch October 1, 2026 11:22
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