mattermost-claude-code 0.5.9 → 0.6.0
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.
- package/README.md +16 -0
- package/dist/claude/session.js +7 -1
- package/dist/index.js +3 -0
- package/dist/update-notifier.d.ts +3 -0
- package/dist/update-notifier.js +31 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -252,6 +252,7 @@ ALLOWED_USERS=alice,bob,carol
|
|
|
252
252
|
| `SKIP_PERMISSIONS` | `true` to auto-approve actions |
|
|
253
253
|
| `MAX_SESSIONS` | Max concurrent sessions (default: `5`) |
|
|
254
254
|
| `SESSION_TIMEOUT_MS` | Idle timeout in ms (default: `1800000` = 30 min) |
|
|
255
|
+
| `NO_UPDATE_NOTIFIER` | Set to `1` to disable update checks |
|
|
255
256
|
|
|
256
257
|
Config file locations (in priority order):
|
|
257
258
|
1. `./.env` (current directory)
|
|
@@ -266,6 +267,21 @@ Config file locations (in priority order):
|
|
|
266
267
|
- **Read**: Shows file path being read
|
|
267
268
|
- **MCP tools**: Shows tool name and server
|
|
268
269
|
|
|
270
|
+
## Auto-Updates
|
|
271
|
+
|
|
272
|
+
mm-claude checks for updates every 30 minutes and notifies you when a new version is available:
|
|
273
|
+
|
|
274
|
+
- **CLI**: Shows a notification box on startup
|
|
275
|
+
- **Mattermost**: Shows a warning in session headers
|
|
276
|
+
|
|
277
|
+
To update:
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
npm install -g mattermost-claude-code
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
To disable update checks, set `NO_UPDATE_NOTIFIER=1`.
|
|
284
|
+
|
|
269
285
|
## For Mattermost Admins
|
|
270
286
|
|
|
271
287
|
To set up a bot account:
|
package/dist/claude/session.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ClaudeCli } from './cli.js';
|
|
2
|
+
import { getUpdateInfo } from '../update-notifier.js';
|
|
2
3
|
import { readFileSync } from 'fs';
|
|
3
4
|
import { dirname, resolve } from 'path';
|
|
4
5
|
import { fileURLToPath } from 'url';
|
|
@@ -878,9 +879,14 @@ export class SessionManager {
|
|
|
878
879
|
}
|
|
879
880
|
rows.push(`| 🔢 **Session** | #${session.sessionNumber} of ${MAX_SESSIONS} max |`);
|
|
880
881
|
rows.push(`| ${permMode.split(' ')[0]} **Permissions** | ${permMode.split(' ')[1]} |`);
|
|
882
|
+
// Check for available updates
|
|
883
|
+
const updateInfo = getUpdateInfo();
|
|
884
|
+
const updateNotice = updateInfo
|
|
885
|
+
? `\n> ⚠️ **Update available:** v${updateInfo.current} → v${updateInfo.latest} - Run \`npm install -g mattermost-claude-code\`\n`
|
|
886
|
+
: '';
|
|
881
887
|
const msg = [
|
|
882
888
|
`### 🤖 mm-claude \`v${pkg.version}\``,
|
|
883
|
-
|
|
889
|
+
updateNotice,
|
|
884
890
|
`| | |`,
|
|
885
891
|
`|:--|:--|`,
|
|
886
892
|
...rows,
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import { SessionManager } from './claude/session.js';
|
|
|
7
7
|
import { readFileSync } from 'fs';
|
|
8
8
|
import { dirname, resolve } from 'path';
|
|
9
9
|
import { fileURLToPath } from 'url';
|
|
10
|
+
import { checkForUpdates } from './update-notifier.js';
|
|
10
11
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
12
|
const pkg = JSON.parse(readFileSync(resolve(__dirname, '..', 'package.json'), 'utf-8'));
|
|
12
13
|
const dim = (s) => `\x1b[2m${s}\x1b[0m`;
|
|
@@ -32,6 +33,8 @@ function hasRequiredCliArgs(args) {
|
|
|
32
33
|
return !!(args.url && args.token && args.channel);
|
|
33
34
|
}
|
|
34
35
|
async function main() {
|
|
36
|
+
// Check for updates (non-blocking, shows notification if available)
|
|
37
|
+
checkForUpdates();
|
|
35
38
|
// Set debug mode from CLI flag
|
|
36
39
|
if (opts.debug) {
|
|
37
40
|
process.env.DEBUG = '1';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import updateNotifier from 'update-notifier';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
import { resolve } from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
6
|
+
let cachedUpdateInfo;
|
|
7
|
+
export function checkForUpdates() {
|
|
8
|
+
if (process.env.NO_UPDATE_NOTIFIER)
|
|
9
|
+
return;
|
|
10
|
+
try {
|
|
11
|
+
const pkg = JSON.parse(readFileSync(resolve(__dirname, '..', 'package.json'), 'utf-8'));
|
|
12
|
+
const notifier = updateNotifier({
|
|
13
|
+
pkg,
|
|
14
|
+
updateCheckInterval: 1000 * 60 * 30, // Check every 30 minutes
|
|
15
|
+
});
|
|
16
|
+
// Cache for Mattermost notifications
|
|
17
|
+
cachedUpdateInfo = notifier.update;
|
|
18
|
+
// Show CLI notification
|
|
19
|
+
notifier.notify({
|
|
20
|
+
message: `Update available: {currentVersion} → {latestVersion}
|
|
21
|
+
Run: npm install -g mattermost-claude-code`,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// Silently fail - update checking is not critical
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// Returns update info if available, for posting to Mattermost
|
|
29
|
+
export function getUpdateInfo() {
|
|
30
|
+
return cachedUpdateInfo;
|
|
31
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mattermost-claude-code",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
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",
|
|
@@ -44,12 +44,14 @@
|
|
|
44
44
|
"commander": "^14.0.2",
|
|
45
45
|
"dotenv": "^16.4.7",
|
|
46
46
|
"prompts": "^2.4.2",
|
|
47
|
+
"update-notifier": "^7.3.1",
|
|
47
48
|
"ws": "^8.18.0",
|
|
48
49
|
"zod": "^4.2.1"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@types/node": "^22.10.2",
|
|
52
53
|
"@types/prompts": "^2.4.9",
|
|
54
|
+
"@types/update-notifier": "^6.0.8",
|
|
53
55
|
"@types/ws": "^8.5.13",
|
|
54
56
|
"tsx": "^4.19.2",
|
|
55
57
|
"typescript": "^5.7.2"
|