mattermost-cli 0.0.1__tar.gz → 0.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mattermost_cli-0.0.3/.github/workflows/docs.yml +20 -0
- {mattermost_cli-0.0.1 → mattermost_cli-0.0.3}/.gitignore +0 -1
- {mattermost_cli-0.0.1 → mattermost_cli-0.0.3}/PKG-INFO +5 -4
- {mattermost_cli-0.0.1 → mattermost_cli-0.0.3}/README.md +4 -3
- mattermost_cli-0.0.3/docs/01-guide/01-commands.md +147 -0
- mattermost_cli-0.0.3/docs/01-guide/02-json-output.md +135 -0
- mattermost_cli-0.0.3/docs/01-guide/03-authentication.md +99 -0
- mattermost_cli-0.0.3/docs/01-guide/04-tips.md +135 -0
- mattermost_cli-0.0.3/docs/config.toml +14 -0
- mattermost_cli-0.0.3/docs/index.md +72 -0
- mattermost_cli-0.0.3/docs/quickstart.md +117 -0
- mattermost_cli-0.0.3/mmchat/__init__.py +7 -0
- mattermost_cli-0.0.3/mmchat/cli.py +56 -0
- mattermost_cli-0.0.3/mmchat/commands/__init__.py +1 -0
- mattermost_cli-0.0.3/mmchat/commands/auth.py +168 -0
- mattermost_cli-0.0.3/mmchat/commands/channels.py +156 -0
- mattermost_cli-0.0.3/mmchat/commands/messages.py +174 -0
- mattermost_cli-0.0.3/mmchat/commands/overview.py +139 -0
- mattermost_cli-0.0.3/mmchat/commands/people.py +171 -0
- mattermost_cli-0.0.3/mmchat/commands/search.py +134 -0
- {mattermost_cli-0.0.1 → mattermost_cli-0.0.3}/mmchat/formatters.py +97 -44
- mattermost_cli-0.0.3/mmchat/helpers.py +197 -0
- {mattermost_cli-0.0.1 → mattermost_cli-0.0.3}/pyproject.toml +4 -2
- mattermost_cli-0.0.3/skills/mattermost/SKILL.md +128 -0
- mattermost_cli-0.0.3/skills/mattermost/references/commands.md +149 -0
- mattermost_cli-0.0.3/skills/mattermost/references/scenarios.md +161 -0
- mattermost_cli-0.0.3/skills/mattermost/references/setup.md +121 -0
- mattermost_cli-0.0.3/skills/mattermost/references/workflows.md +141 -0
- mattermost_cli-0.0.1/mmchat/__init__.py +0 -6
- mattermost_cli-0.0.1/mmchat/_version.py +0 -34
- mattermost_cli-0.0.1/mmchat/cli.py +0 -673
- {mattermost_cli-0.0.1 → mattermost_cli-0.0.3}/.github/workflows/publish.yml +0 -0
- {mattermost_cli-0.0.1 → mattermost_cli-0.0.3}/AGENTS.md +0 -0
- {mattermost_cli-0.0.1 → mattermost_cli-0.0.3}/LICENSE +0 -0
- {mattermost_cli-0.0.1 → mattermost_cli-0.0.3}/mmchat/client.py +0 -0
- {mattermost_cli-0.0.1 → mattermost_cli-0.0.3}/mmchat/config.py +0 -0
- {mattermost_cli-0.0.1 → mattermost_cli-0.0.3}/mmchat/resolve.py +0 -0
- {mattermost_cli-0.0.1 → mattermost_cli-0.0.3}/mmchat/time_utils.py +0 -0
- {mattermost_cli-0.0.1 → mattermost_cli-0.0.3}/tests/__init__.py +0 -0
- {mattermost_cli-0.0.1 → mattermost_cli-0.0.3}/tests/test_client.py +0 -0
- {mattermost_cli-0.0.1 → mattermost_cli-0.0.3}/tests/test_config.py +0 -0
- {mattermost_cli-0.0.1 → mattermost_cli-0.0.3}/tests/test_time_utils.py +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: Deploy docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
paths:
|
|
7
|
+
- 'docs/**'
|
|
8
|
+
- '.github/workflows/docs.yml'
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
pages: write
|
|
14
|
+
id-token: write
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
docs:
|
|
18
|
+
uses: oddship/moat/.github/workflows/build-docs.yml@main
|
|
19
|
+
with:
|
|
20
|
+
docs_dir: docs
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mattermost-cli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: Mattermost CLI for humans and agents
|
|
5
5
|
Project-URL: Homepage, https://github.com/rhnvrm/mattermost-cli
|
|
6
6
|
Project-URL: Repository, https://github.com/rhnvrm/mattermost-cli
|
|
@@ -34,11 +34,12 @@ Mattermost CLI for humans and agents.
|
|
|
34
34
|
## Install
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
#
|
|
38
|
-
uvx mattermost-cli --help
|
|
37
|
+
# Run directly (no install)
|
|
38
|
+
uvx --from mattermost-cli mm --help
|
|
39
39
|
|
|
40
|
-
#
|
|
40
|
+
# Or install globally
|
|
41
41
|
pip install mattermost-cli
|
|
42
|
+
mm --help
|
|
42
43
|
```
|
|
43
44
|
|
|
44
45
|
## Setup
|
|
@@ -5,11 +5,12 @@ Mattermost CLI for humans and agents.
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
#
|
|
9
|
-
uvx mattermost-cli --help
|
|
8
|
+
# Run directly (no install)
|
|
9
|
+
uvx --from mattermost-cli mm --help
|
|
10
10
|
|
|
11
|
-
#
|
|
11
|
+
# Or install globally
|
|
12
12
|
pip install mattermost-cli
|
|
13
|
+
mm --help
|
|
13
14
|
```
|
|
14
15
|
|
|
15
16
|
## Setup
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Commands
|
|
3
|
+
description: Complete command reference
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Commands
|
|
7
|
+
|
|
8
|
+
All commands output JSON by default. Add `--human` before any command for markdown output. Add `--team <name>` to filter to a specific team.
|
|
9
|
+
|
|
10
|
+
## mm login
|
|
11
|
+
|
|
12
|
+
Authenticate with your Mattermost server.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
mm login # Interactive: password + MFA
|
|
16
|
+
mm login --token <pat> # Personal Access Token
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Password login prompts for server URL, username, password, and (if enabled) MFA token. The session token is stored -- your password is never written to disk.
|
|
20
|
+
|
|
21
|
+
When the session expires, run `mm login` again.
|
|
22
|
+
|
|
23
|
+
## mm logout
|
|
24
|
+
|
|
25
|
+
Revoke the current session and clear stored credentials.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
mm logout
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## mm whoami
|
|
32
|
+
|
|
33
|
+
Show current user info and validate that auth is working.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
mm whoami
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Returns your user ID, username, display name, email, and list of teams.
|
|
40
|
+
|
|
41
|
+
## mm unread
|
|
42
|
+
|
|
43
|
+
Show channels with unread messages.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
mm unread
|
|
47
|
+
mm unread --team Engineering
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Returns channels sorted by mention count (descending), then unread count.
|
|
51
|
+
|
|
52
|
+
Each entry includes:
|
|
53
|
+
|
|
54
|
+
| Field | Description |
|
|
55
|
+
|-------|-------------|
|
|
56
|
+
| `channel_id` | Internal channel ID |
|
|
57
|
+
| `channel` | Display name |
|
|
58
|
+
| `ref` | Use this with `mm messages <ref>` |
|
|
59
|
+
| `type` | Public, Private, DM, or Group DM |
|
|
60
|
+
| `unread` | Number of unread messages |
|
|
61
|
+
| `mentions` | Number of @mentions |
|
|
62
|
+
| `team` | Team name |
|
|
63
|
+
| `last_post_at` | Timestamp of last post |
|
|
64
|
+
|
|
65
|
+
The `ref` field is important: for named channels it's the channel name (e.g. `general`), for DMs and group DMs it's the channel ID (since their display names aren't addressable). Always use `ref` when passing a channel to other commands.
|
|
66
|
+
|
|
67
|
+
## mm mentions
|
|
68
|
+
|
|
69
|
+
Show posts that @mention you.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
mm mentions # Last 24 hours (default)
|
|
73
|
+
mm mentions --since 2h # Last 2 hours
|
|
74
|
+
mm mentions --since 0 # All time
|
|
75
|
+
mm mentions --limit 10 # Max 10 results
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Results are grouped by channel in `--human` mode.
|
|
79
|
+
|
|
80
|
+
## mm messages
|
|
81
|
+
|
|
82
|
+
Read messages from a channel.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
mm messages general # By channel name
|
|
86
|
+
mm messages @alice # DM with a user
|
|
87
|
+
mm messages abc123def456... # By channel ID (for group DMs)
|
|
88
|
+
mm messages general --limit 10 # Last 10 messages
|
|
89
|
+
mm messages general --since 2h # Messages from last 2 hours
|
|
90
|
+
mm messages general --since today # Messages from today
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
For group DMs, use the `ref` field from `mm unread` or `mm channels` since group DM display names (e.g. "alice, bob, carol") aren't addressable.
|
|
94
|
+
|
|
95
|
+
## mm thread
|
|
96
|
+
|
|
97
|
+
Read a thread by any post ID in that thread.
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
mm thread abc123def456... # Root + last 9 replies (default)
|
|
101
|
+
mm thread abc123def456... --limit 0 # Full thread
|
|
102
|
+
mm thread abc123def456... --limit 5 # Root + last 4 replies
|
|
103
|
+
mm thread abc123def456... --since 1h # Root + replies from last hour
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The root message is always included regardless of `--limit` or `--since` so you have context.
|
|
107
|
+
|
|
108
|
+
The post ID can be any post in the thread -- root or reply. The CLI resolves it to the full thread automatically.
|
|
109
|
+
|
|
110
|
+
## mm search
|
|
111
|
+
|
|
112
|
+
Search messages across all teams.
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
mm search "deployment issue"
|
|
116
|
+
mm search "deployment issue" --limit 10
|
|
117
|
+
mm search "from:alice" # Mattermost search modifiers
|
|
118
|
+
mm search "in:engineering deployment" # Search in a specific channel
|
|
119
|
+
mm search "before:2026-03-01 incident" # Date filters
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Supports all [Mattermost search modifiers](https://docs.mattermost.com/collaborate/search-for-messages.html): `from:`, `in:`, `before:`, `after:`, `on:`, etc.
|
|
123
|
+
|
|
124
|
+
## mm channels
|
|
125
|
+
|
|
126
|
+
List all channels you belong to.
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
mm channels # All channels
|
|
130
|
+
mm channels --type public # Only public channels
|
|
131
|
+
mm channels --type dm # Only DMs
|
|
132
|
+
mm channels --type group # Only group DMs
|
|
133
|
+
mm channels --type private # Only private channels
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Each entry includes a `ref` field for use with `mm messages`.
|
|
137
|
+
|
|
138
|
+
## Global options
|
|
139
|
+
|
|
140
|
+
These go before the command name:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
mm --human mentions # Markdown output
|
|
144
|
+
mm --team Engineering unread # Filter to one team
|
|
145
|
+
mm --debug messages general # Debug logging
|
|
146
|
+
mm --version # Show version
|
|
147
|
+
```
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: JSON Output
|
|
3
|
+
description: Output format reference for programmatic use
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# JSON Output
|
|
7
|
+
|
|
8
|
+
All commands output JSON by default. This page documents the shape of each output.
|
|
9
|
+
|
|
10
|
+
## Posts (messages, mentions, thread, search)
|
|
11
|
+
|
|
12
|
+
Every post has these fields:
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
{
|
|
16
|
+
"id": "ixtrtzkhk7fs9cayrz44uq5bgy",
|
|
17
|
+
"thread_id": "ixtrtzkhk7fs9cayrz44uq5bgy",
|
|
18
|
+
"is_reply": false,
|
|
19
|
+
"author": "@alice",
|
|
20
|
+
"message": "Can you check the deployment config?",
|
|
21
|
+
"created_at": "2026-03-05T06:52:30Z",
|
|
22
|
+
"channel": "engineering",
|
|
23
|
+
"channel_id": "eqdx3n8zo3yqzyf46sobm14uwa",
|
|
24
|
+
"team": "Engineering",
|
|
25
|
+
"file_count": 1
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
| Field | Type | Description |
|
|
30
|
+
|-------|------|-------------|
|
|
31
|
+
| `id` | string | Post ID |
|
|
32
|
+
| `thread_id` | string | Root post ID if this is a reply, own ID if this is a root post |
|
|
33
|
+
| `is_reply` | boolean | Whether this post is a reply in a thread |
|
|
34
|
+
| `author` | string | @username of the author |
|
|
35
|
+
| `message` | string | Post text content |
|
|
36
|
+
| `created_at` | string | ISO 8601 timestamp (UTC) |
|
|
37
|
+
| `channel` | string | Channel display name |
|
|
38
|
+
| `channel_id` | string | Channel ID |
|
|
39
|
+
| `team` | string | Team display name |
|
|
40
|
+
| `file_count` | integer | Number of file attachments |
|
|
41
|
+
|
|
42
|
+
### Conditional fields
|
|
43
|
+
|
|
44
|
+
These appear only when relevant:
|
|
45
|
+
|
|
46
|
+
| Field | When | Description |
|
|
47
|
+
|-------|------|-------------|
|
|
48
|
+
| `reply_count` | Root posts with replies | Number of replies in the thread |
|
|
49
|
+
| `files` | Posts with file metadata | Array of `{"name": "...", "size": 12345}` |
|
|
50
|
+
|
|
51
|
+
The `reply_count` field is useful for deciding whether to fetch a thread. A thread with 3 replies is worth fetching in full; one with 141 replies should use `--limit`.
|
|
52
|
+
|
|
53
|
+
## Channels (channels command)
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"id": "eqdx3n8zo3yqzyf46sobm14uwa",
|
|
58
|
+
"name": "engineering",
|
|
59
|
+
"ref": "engineering",
|
|
60
|
+
"type": "Public",
|
|
61
|
+
"team": "Engineering",
|
|
62
|
+
"purpose": "Engineering discussion",
|
|
63
|
+
"header": "On-call: @alice"
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
| Field | Type | Description |
|
|
68
|
+
|-------|------|-------------|
|
|
69
|
+
| `id` | string | Channel ID |
|
|
70
|
+
| `name` | string | Display name |
|
|
71
|
+
| `ref` | string | Argument to pass to `mm messages` |
|
|
72
|
+
| `type` | string | `Public`, `Private`, `DM`, or `Group DM` |
|
|
73
|
+
| `team` | string | Team display name |
|
|
74
|
+
| `purpose` | string | Channel purpose (if set) |
|
|
75
|
+
| `header` | string | Channel header (if set) |
|
|
76
|
+
|
|
77
|
+
## Unread (unread command)
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"channel_id": "km4f6k31ibbpteg9875fpxb5gw",
|
|
82
|
+
"channel": "alice, bob, carol",
|
|
83
|
+
"ref": "km4f6k31ibbpteg9875fpxb5gw",
|
|
84
|
+
"type": "Group DM",
|
|
85
|
+
"unread": 5,
|
|
86
|
+
"mentions": 3,
|
|
87
|
+
"team": "Engineering",
|
|
88
|
+
"last_post_at": "2026-03-05T06:52:30Z"
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
| Field | Type | Description |
|
|
93
|
+
|-------|------|-------------|
|
|
94
|
+
| `channel_id` | string | Channel ID |
|
|
95
|
+
| `channel` | string | Display name |
|
|
96
|
+
| `ref` | string | Argument to pass to `mm messages` |
|
|
97
|
+
| `type` | string | `Public`, `Private`, `DM`, or `Group DM` |
|
|
98
|
+
| `unread` | integer | Unread message count |
|
|
99
|
+
| `mentions` | integer | @mention count |
|
|
100
|
+
| `team` | string | Team display name |
|
|
101
|
+
| `last_post_at` | string | ISO 8601 timestamp of last post |
|
|
102
|
+
|
|
103
|
+
## The ref field
|
|
104
|
+
|
|
105
|
+
The `ref` field appears in both `channels` and `unread` output. It's the exact string to pass to `mm messages`:
|
|
106
|
+
|
|
107
|
+
- For named channels: the channel name (e.g. `general`, `gtt`)
|
|
108
|
+
- For DMs: the channel ID (since DM "names" like `alice, bob, carol` aren't addressable)
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# From unread output: {"channel": "alice, bob", "ref": "km4f6k31ibb..."}
|
|
112
|
+
mm messages km4f6k31ibb... # Works (using ref)
|
|
113
|
+
mm messages "alice, bob" # Fails (display name not addressable)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Timestamps
|
|
117
|
+
|
|
118
|
+
All timestamps are ISO 8601 in UTC:
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
2026-03-05T06:52:30Z
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The Mattermost API returns epoch milliseconds internally. The CLI converts these for readability.
|
|
125
|
+
|
|
126
|
+
## Type labels
|
|
127
|
+
|
|
128
|
+
Channel types from the API are single letters (`O`, `P`, `D`, `G`). The CLI maps them to readable labels:
|
|
129
|
+
|
|
130
|
+
| API | Label |
|
|
131
|
+
|-----|-------|
|
|
132
|
+
| `O` | Public |
|
|
133
|
+
| `P` | Private |
|
|
134
|
+
| `D` | DM |
|
|
135
|
+
| `G` | Group DM |
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Authentication
|
|
3
|
+
description: Login methods and token storage
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Authentication
|
|
7
|
+
|
|
8
|
+
## Methods
|
|
9
|
+
|
|
10
|
+
### Password + MFA
|
|
11
|
+
|
|
12
|
+
The most common method. Works with SSO servers that accept password login.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
mm login
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Prompts for:
|
|
19
|
+
1. **Server URL** -- e.g. `https://chat.example.com`
|
|
20
|
+
2. **Username** -- your Mattermost username
|
|
21
|
+
3. **Password** -- your password
|
|
22
|
+
4. **MFA token** -- if MFA is enabled on your account
|
|
23
|
+
|
|
24
|
+
On success, a session token is created and stored locally. Your password is never written to disk.
|
|
25
|
+
|
|
26
|
+
Session tokens expire based on server configuration (typically 30 days of inactivity). When it expires, run `mm login` again.
|
|
27
|
+
|
|
28
|
+
### Personal Access Token
|
|
29
|
+
|
|
30
|
+
If your Mattermost admin has enabled personal access tokens:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
mm login --token mmtok_abc123...
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Prompts for the server URL only. The token is stored and used directly.
|
|
37
|
+
|
|
38
|
+
PATs don't expire unless revoked, making them better for automated use.
|
|
39
|
+
|
|
40
|
+
## Token storage
|
|
41
|
+
|
|
42
|
+
Credentials are stored at:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
~/.config/mm/config.json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The directory is created with 0700 permissions, the file with 0600.
|
|
49
|
+
|
|
50
|
+
Contents:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"url": "https://chat.example.com",
|
|
55
|
+
"auth_method": "password",
|
|
56
|
+
"token": "session-token-here"
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Only the session token is stored. For PAT auth, `auth_method` is `"token"`.
|
|
61
|
+
|
|
62
|
+
## Environment variables
|
|
63
|
+
|
|
64
|
+
Environment variables override the config file. Useful for CI, containers, or agent environments.
|
|
65
|
+
|
|
66
|
+
| Variable | Description |
|
|
67
|
+
|----------|-------------|
|
|
68
|
+
| `MATTERMOST_URL` | Server URL (overrides config) |
|
|
69
|
+
| `MATTERMOST_TOKEN` | Auth token (overrides config) |
|
|
70
|
+
| `MATTERMOST_TEAM` | Filter to one team (like `--team`) |
|
|
71
|
+
| `MM_CONFIG_PATH` | Custom config file path |
|
|
72
|
+
|
|
73
|
+
Example:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
export MATTERMOST_URL=https://chat.example.com
|
|
77
|
+
export MATTERMOST_TOKEN=mmtok_abc123...
|
|
78
|
+
mm whoami
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Verify authentication
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
mm whoami
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
If auth is valid, returns your user info and teams. If the token has expired:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
Error: Session expired. Run 'mm login' to re-authenticate.
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Logout
|
|
94
|
+
|
|
95
|
+
Revoke the session and clear stored credentials:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
mm logout
|
|
99
|
+
```
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Tips
|
|
3
|
+
description: Practical patterns for daily use
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Tips
|
|
7
|
+
|
|
8
|
+
## The --since flag
|
|
9
|
+
|
|
10
|
+
Most commands accept `--since` for time-based filtering. Supported formats:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
mm mentions --since 30m # Last 30 minutes
|
|
14
|
+
mm mentions --since 2h # Last 2 hours
|
|
15
|
+
mm mentions --since 1d # Last 24 hours (default for mentions)
|
|
16
|
+
mm messages general --since 3d # Last 3 days
|
|
17
|
+
mm messages general --since today # Since midnight
|
|
18
|
+
mm thread abc... --since 1h # Root + replies from last hour
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Use `--since 0` to disable the time filter (all results).
|
|
22
|
+
|
|
23
|
+
## Morning triage workflow
|
|
24
|
+
|
|
25
|
+
A quick way to catch up:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# 1. What needs attention?
|
|
29
|
+
mm mentions
|
|
30
|
+
|
|
31
|
+
# 2. Check thread sizes before diving in
|
|
32
|
+
# (look at reply_count to decide if you need --limit)
|
|
33
|
+
|
|
34
|
+
# 3. Read threads that matter
|
|
35
|
+
mm thread <thread_id>
|
|
36
|
+
mm thread <thread_id> --limit 5 # Big thread? Just the recent end
|
|
37
|
+
|
|
38
|
+
# 4. Scan unread channels
|
|
39
|
+
mm unread
|
|
40
|
+
|
|
41
|
+
# 5. Read messages in busy channels
|
|
42
|
+
mm messages <ref> --since today
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Piping with jq
|
|
46
|
+
|
|
47
|
+
Since output is JSON, you can use `jq` to filter and transform:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Channels with mentions
|
|
51
|
+
mm unread | jq '[.[] | select(.mentions > 0)]'
|
|
52
|
+
|
|
53
|
+
# Just channel names and mention counts
|
|
54
|
+
mm unread | jq '.[] | {channel, mentions}'
|
|
55
|
+
|
|
56
|
+
# Messages from a specific author
|
|
57
|
+
mm messages general | jq '[.[] | select(.author == "@alice")]'
|
|
58
|
+
|
|
59
|
+
# Thread IDs from mentions for batch processing
|
|
60
|
+
mm mentions | jq -r '.[].thread_id' | sort -u
|
|
61
|
+
|
|
62
|
+
# Posts with attachments
|
|
63
|
+
mm messages general | jq '[.[] | select(.file_count > 0)]'
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Searching effectively
|
|
67
|
+
|
|
68
|
+
Mattermost search supports modifiers:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
mm search "from:alice deployment" # Posts by alice about deployment
|
|
72
|
+
mm search "in:engineering before:2026-03-01" # Channel + date filter
|
|
73
|
+
mm search "from:alice from:bob" # Posts from alice OR bob
|
|
74
|
+
mm search '"exact phrase"' # Exact match (quote inside quotes)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
See the [Mattermost search documentation](https://docs.mattermost.com/collaborate/search-for-messages.html) for the full modifier list.
|
|
78
|
+
|
|
79
|
+
## Working with DMs
|
|
80
|
+
|
|
81
|
+
Direct messages use `@username`:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
mm messages @alice # 1:1 DM
|
|
85
|
+
mm messages @alice --limit 5 # Last 5 messages
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Group DMs can't be addressed by name. Use the `ref` field from `mm unread` or `mm channels`:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Find the group DM
|
|
92
|
+
mm unread | jq '.[] | select(.type == "Group DM")'
|
|
93
|
+
|
|
94
|
+
# Use the ref field
|
|
95
|
+
mm messages km4f6k31ibb...
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Thread navigation
|
|
99
|
+
|
|
100
|
+
Every post has a `thread_id`. For root posts, it equals the post `id`. For replies, it points to the root.
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Get mentions
|
|
104
|
+
mm mentions
|
|
105
|
+
# Output: {"thread_id": "abc123...", "is_reply": true, ...}
|
|
106
|
+
|
|
107
|
+
# Fetch that thread
|
|
108
|
+
mm thread abc123...
|
|
109
|
+
# Output: root post + replies, chronologically
|
|
110
|
+
|
|
111
|
+
# Big thread? Check reply_count first, then limit
|
|
112
|
+
mm thread abc123... --limit 5
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Human-readable output
|
|
116
|
+
|
|
117
|
+
The `--human` flag outputs markdown instead of JSON:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
mm --human mentions
|
|
121
|
+
mm --human thread abc123...
|
|
122
|
+
mm --human messages general --since today
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Human output includes annotations like `[12 replies, files: report.pdf]` on posts that have them.
|
|
126
|
+
|
|
127
|
+
## Cross-team by default
|
|
128
|
+
|
|
129
|
+
All commands search across all your teams and deduplicate results. Use `--team` to narrow:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
mm unread --team Engineering
|
|
133
|
+
mm search "deployment" --team Engineering
|
|
134
|
+
mm channels --team Engineering
|
|
135
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
site_name = "mattermost-cli"
|
|
2
|
+
base_path = "/mattermost-cli"
|
|
3
|
+
|
|
4
|
+
[highlight]
|
|
5
|
+
light = "github"
|
|
6
|
+
dark = "github-dark"
|
|
7
|
+
|
|
8
|
+
[[links]]
|
|
9
|
+
title = "GitHub"
|
|
10
|
+
url = "https://github.com/rhnvrm/mattermost-cli"
|
|
11
|
+
|
|
12
|
+
[[links]]
|
|
13
|
+
title = "PyPI"
|
|
14
|
+
url = "https://pypi.org/project/mattermost-cli/"
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: mattermost-cli
|
|
3
|
+
description: Mattermost CLI for humans and agents
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# mattermost-cli
|
|
7
|
+
|
|
8
|
+
A CLI for Mattermost that outputs JSON by default, designed for both human use and agent automation. Runs against any Mattermost server with personal access tokens or password+MFA auth.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Run directly (no install)
|
|
14
|
+
uvx --from mattermost-cli mm --help
|
|
15
|
+
|
|
16
|
+
# Or install globally
|
|
17
|
+
pip install mattermost-cli
|
|
18
|
+
mm --help
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## What it does
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
mm login # Authenticate (password+MFA or token)
|
|
25
|
+
mm unread # Channels with unread messages
|
|
26
|
+
mm mentions # Posts that @mention you (last 24h)
|
|
27
|
+
mm messages general # Read channel messages
|
|
28
|
+
mm messages @knadh # Read DMs with a user
|
|
29
|
+
mm thread abc123def456... # Read a thread by post ID
|
|
30
|
+
mm search "deployment issue" # Search across all teams
|
|
31
|
+
mm channels # List all your channels
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Every command outputs JSON by default. Add `--human` for markdown.
|
|
35
|
+
|
|
36
|
+
## JSON-first
|
|
37
|
+
|
|
38
|
+
Default output is structured JSON with fields designed for programmatic consumption:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"id": "abc123...",
|
|
43
|
+
"thread_id": "def456...",
|
|
44
|
+
"is_reply": true,
|
|
45
|
+
"author": "@alice",
|
|
46
|
+
"message": "Can you check this?",
|
|
47
|
+
"created_at": "2026-03-05T06:52:30Z",
|
|
48
|
+
"channel": "engineering",
|
|
49
|
+
"reply_count": 12,
|
|
50
|
+
"file_count": 1,
|
|
51
|
+
"files": [{"name": "screenshot.png", "size": 66657}]
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
ISO 8601 timestamps, human-readable type labels, thread IDs on every post, file metadata included.
|
|
56
|
+
|
|
57
|
+
## Agent-tuned defaults
|
|
58
|
+
|
|
59
|
+
Commands are tuned for running without flags first, then refining with `--help`:
|
|
60
|
+
|
|
61
|
+
- `mm mentions` defaults to last 24 hours (not all time)
|
|
62
|
+
- `mm thread` returns root + last 9 replies (not the entire thread)
|
|
63
|
+
- `mm unread` includes a `ref` field you can pass directly to `mm messages`
|
|
64
|
+
|
|
65
|
+
## Learn more
|
|
66
|
+
|
|
67
|
+
- [Quickstart](quickstart/) -- Install, authenticate, first commands
|
|
68
|
+
- **Guide**
|
|
69
|
+
- [Commands](guide/commands/) -- All commands with examples
|
|
70
|
+
- [JSON Output](guide/json-output/) -- Output format reference
|
|
71
|
+
- [Authentication](guide/authentication/) -- Login methods and token storage
|
|
72
|
+
- [Tips](guide/tips/) -- Filtering, searching, and workflow patterns
|