Functional Sub-Spec: Message CRUD & Export Engine

Requirements Traceability

  • [FUNC-003]: Message CRUD Operations

  • [FUNC-006]: Message Export Engine

Detailed Functional Descriptions

[FUNC-003] Message CRUD Operations

The system must support full CRUD management for messages in chats and forum topics:

  1. Create/Send Message & Attachments:

    • grm msg send [-a|–attach <file>] [-m|–media] [-C|–caption “<text>”] [-t|–topic <id>] <chat_id> [“<message>”]: Send text message or upload single/multi-file document/media attachments.

  2. Read/List/Search/Info:

    • grm msg ls [-t|–topic <id>] [-n|–limit <N>] <chat_id>: List recent messages from chat or topic.

    • grm msg info <chat_id> <message_id>: View detailed metadata for a single message (ID, Sender, Timestamp, Edit State, Views/Reactions).

    • grm msg search [-t|–topic <id>] [-q|–query “<pattern>”] [-n|–limit <N>] <chat_id>: Search message stream using query regex pattern filter.

  3. Update/Edit Message:

    • grm msg edit <chat_id> <message_id> “<new_text>”: Edit existing text content of a sent message.

  4. Delete Message:

    • grm msg delete [–for-everyone] <chat_id> <message_ids…>: Delete one or multiple messages by ID (for self or for all chat members).

  5. Forward Message:

    • grm msg forward [–from <source_chat_id>] [-t|–topic <id>] [-c|–copy] [–remove-caption] <source_chat_id> <target_chat_id> <message_ids…>: Forward single or multiple messages (text, photos, videos, documents, audio, albums) across chats or forum topics, supporting –copy (omit forward header attribution) and –remove-caption.

[FUNC-006] Message Export Engine

The system must export chat and topic histories to structured files:

  1. grm msg export [-f|–format csv|json] [-o|–output <file>] [-t|–topic <id>] [-n|–limit <N>] <chat_id>: Extract up to N messages and write to JSON or CSV file.