mattermost-claude-code 0.5.6 → 0.5.8

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.
Files changed (3) hide show
  1. package/README.md +13 -11
  2. package/dist/index.js +18 -16
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -111,15 +111,17 @@ CLI options override environment variables.
111
111
 
112
112
  ## Session Commands
113
113
 
114
- Type `/help` in any session thread to see available commands:
114
+ Type `!help` in any session thread to see available commands:
115
115
 
116
116
  | Command | Description |
117
117
  |:--------|:------------|
118
- | `/help` | Show available commands |
119
- | `/invite @user` | Invite a user to this session |
120
- | `/kick @user` | Remove an invited user |
121
- | `/permissions interactive` | Enable interactive permissions |
122
- | `/stop` | Stop this session |
118
+ | `!help` | Show available commands |
119
+ | `!invite @user` | Invite a user to this session |
120
+ | `!kick @user` | Remove an invited user |
121
+ | `!permissions interactive` | Enable interactive permissions |
122
+ | `!stop` | Stop this session |
123
+
124
+ > **Note:** Commands use `!` prefix instead of `/` to avoid conflicts with Mattermost's slash commands.
123
125
 
124
126
  ## Session Collaboration
125
127
 
@@ -128,7 +130,7 @@ Type `/help` in any session thread to see available commands:
128
130
  Session owners can temporarily allow others to participate:
129
131
 
130
132
  ```
131
- /invite @colleague
133
+ !invite @colleague
132
134
  ```
133
135
 
134
136
  The colleague can now send messages in this session thread.
@@ -138,7 +140,7 @@ The colleague can now send messages in this session thread.
138
140
  Remove an invited user from the session:
139
141
 
140
142
  ```
141
- /kick @colleague
143
+ !kick @colleague
142
144
  ```
143
145
 
144
146
  ### Message Approval
@@ -161,7 +163,7 @@ Messages starting with `@someone-else` are ignored by the bot, allowing side con
161
163
  If the bot is running with `--skip-permissions` (auto mode), you can enable interactive permissions for a specific session:
162
164
 
163
165
  ```
164
- /permissions interactive
166
+ !permissions interactive
165
167
  ```
166
168
 
167
169
  This allows collaboration by requiring approval for Claude's actions. Note: you can only downgrade (auto → interactive), not upgrade - this ensures security.
@@ -222,7 +224,7 @@ The session start message shows current status and updates when participants cha
222
224
 
223
225
  Stop a running session:
224
226
 
225
- - Type `/stop` or `/cancel` in the thread
227
+ - Type `!stop` or `!cancel` in the thread
226
228
  - React with ❌ or 🛑 to any message in the thread
227
229
 
228
230
  ## Access Control
@@ -235,7 +237,7 @@ ALLOWED_USERS=alice,bob,carol
235
237
 
236
238
  - Only listed users can start sessions
237
239
  - Only listed users can approve permissions
238
- - Session owners can `/invite` others temporarily
240
+ - Session owners can `!invite` others temporarily
239
241
  - Empty = anyone can use (be careful!)
240
242
 
241
243
  ## Environment Variables
package/dist/index.js CHANGED
@@ -74,7 +74,8 @@ async function main() {
74
74
  // Follow-up in active thread
75
75
  if (session.isInSessionThread(threadRoot)) {
76
76
  // If message starts with @mention to someone else, ignore it (side conversation)
77
- const mentionMatch = message.trim().match(/^@(\w+)/);
77
+ // Note: Mattermost usernames can contain letters, numbers, hyphens, periods, and underscores
78
+ const mentionMatch = message.trim().match(/^@([\w.-]+)/);
78
79
  if (mentionMatch && mentionMatch[1].toLowerCase() !== mattermost.getBotName().toLowerCase()) {
79
80
  return; // Side conversation, don't interrupt
80
81
  }
@@ -83,42 +84,43 @@ async function main() {
83
84
  : message.trim();
84
85
  const lowerContent = content.toLowerCase();
85
86
  // Check for stop/cancel commands (only from allowed users)
86
- if (lowerContent === '/stop' || lowerContent === 'stop' ||
87
- lowerContent === '/cancel' || lowerContent === 'cancel') {
87
+ // Note: Using ! prefix instead of / to avoid Mattermost slash command interception
88
+ if (lowerContent === '!stop' || lowerContent === 'stop' ||
89
+ lowerContent === '!cancel' || lowerContent === 'cancel') {
88
90
  if (session.isUserAllowedInSession(threadRoot, username)) {
89
91
  await session.cancelSession(threadRoot, username);
90
92
  }
91
93
  return;
92
94
  }
93
- // Check for /help command
94
- if (lowerContent === '/help' || lowerContent === 'help') {
95
+ // Check for !help command
96
+ if (lowerContent === '!help' || lowerContent === 'help') {
95
97
  await mattermost.createPost(`**Available commands:**\n\n` +
96
98
  `| Command | Description |\n` +
97
99
  `|:--------|:------------|\n` +
98
- `| \`/help\` | Show this help message |\n` +
99
- `| \`/invite @user\` | Invite a user to this session |\n` +
100
- `| \`/kick @user\` | Remove an invited user |\n` +
101
- `| \`/permissions interactive\` | Enable interactive permissions |\n` +
102
- `| \`/stop\` | Stop this session |\n\n` +
100
+ `| \`!help\` | Show this help message |\n` +
101
+ `| \`!invite @user\` | Invite a user to this session |\n` +
102
+ `| \`!kick @user\` | Remove an invited user |\n` +
103
+ `| \`!permissions interactive\` | Enable interactive permissions |\n` +
104
+ `| \`!stop\` | Stop this session |\n\n` +
103
105
  `**Reactions:**\n` +
104
106
  `- 👍 Approve action · ✅ Approve all · 👎 Deny\n` +
105
107
  `- ❌ or 🛑 on any message to stop session`, threadRoot);
106
108
  return;
107
109
  }
108
- // Check for /invite command
109
- const inviteMatch = content.match(/^\/invite\s+@?(\w+)/i);
110
+ // Check for !invite command
111
+ const inviteMatch = content.match(/^!invite\s+@?([\w.-]+)/i);
110
112
  if (inviteMatch) {
111
113
  await session.inviteUser(threadRoot, inviteMatch[1], username);
112
114
  return;
113
115
  }
114
- // Check for /kick command
115
- const kickMatch = content.match(/^\/kick\s+@?(\w+)/i);
116
+ // Check for !kick command
117
+ const kickMatch = content.match(/^!kick\s+@?([\w.-]+)/i);
116
118
  if (kickMatch) {
117
119
  await session.kickUser(threadRoot, kickMatch[1], username);
118
120
  return;
119
121
  }
120
- // Check for /permissions command
121
- const permMatch = content.match(/^\/permissions?\s+(interactive|auto)/i);
122
+ // Check for !permissions command
123
+ const permMatch = content.match(/^!permissions?\s+(interactive|auto)/i);
122
124
  if (permMatch) {
123
125
  const mode = permMatch[1].toLowerCase();
124
126
  if (mode === 'interactive') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mattermost-claude-code",
3
- "version": "0.5.6",
3
+ "version": "0.5.8",
4
4
  "description": "Share Claude Code sessions live in a Mattermost channel with interactive features",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",