mattermost-claude-code 0.2.0 → 0.2.1

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/dist/config.js CHANGED
@@ -2,17 +2,23 @@ import { config } from 'dotenv';
2
2
  import { resolve } from 'path';
3
3
  import { existsSync } from 'fs';
4
4
  import { homedir } from 'os';
5
- // Load .env file from multiple locations (in order of priority)
6
- const envPaths = [
7
- resolve(process.cwd(), '.env'), // Current directory
8
- resolve(homedir(), '.config', 'mm-claude', '.env'), // ~/.config/mm-claude/.env
9
- resolve(homedir(), '.mm-claude.env'), // ~/.mm-claude.env
10
- ];
11
- for (const envPath of envPaths) {
12
- if (existsSync(envPath)) {
13
- console.log(`📄 Loading config from: ${envPath}`);
14
- config({ path: envPath });
15
- break;
5
+ let envLoaded = false;
6
+ function loadEnv() {
7
+ if (envLoaded)
8
+ return;
9
+ envLoaded = true;
10
+ // Load .env file from multiple locations (in order of priority)
11
+ const envPaths = [
12
+ resolve(process.cwd(), '.env'), // Current directory
13
+ resolve(homedir(), '.config', 'mm-claude', '.env'), // ~/.config/mm-claude/.env
14
+ resolve(homedir(), '.mm-claude.env'), // ~/.mm-claude.env
15
+ ];
16
+ for (const envPath of envPaths) {
17
+ if (existsSync(envPath)) {
18
+ console.log(`📄 Loading config from: ${envPath}`);
19
+ config({ path: envPath });
20
+ break;
21
+ }
16
22
  }
17
23
  }
18
24
  function requireEnv(name) {
@@ -23,6 +29,7 @@ function requireEnv(name) {
23
29
  return value;
24
30
  }
25
31
  export function loadConfig() {
32
+ loadEnv();
26
33
  return {
27
34
  mattermost: {
28
35
  url: requireEnv('MATTERMOST_URL').replace(/\/$/, ''), // Remove trailing slash
package/dist/index.js CHANGED
@@ -2,9 +2,18 @@
2
2
  import { loadConfig } from './config.js';
3
3
  import { MattermostClient } from './mattermost/client.js';
4
4
  import { SessionManager } from './claude/session.js';
5
+ import { readFileSync } from 'fs';
6
+ import { dirname, resolve } from 'path';
7
+ import { fileURLToPath } from 'url';
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
9
+ const pkg = JSON.parse(readFileSync(resolve(__dirname, '..', 'package.json'), 'utf-8'));
5
10
  async function main() {
11
+ if (process.argv.includes('--version') || process.argv.includes('-v')) {
12
+ console.log(pkg.version);
13
+ process.exit(0);
14
+ }
6
15
  if (process.argv.includes('--help') || process.argv.includes('-h')) {
7
- console.log(`mm-claude - Share Claude Code sessions in Mattermost
16
+ console.log(`mm-claude v${pkg.version} - Share Claude Code sessions in Mattermost
8
17
 
9
18
  Usage: cd /your/project && mm-claude`);
10
19
  process.exit(0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mattermost-claude-code",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
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",
@@ -36,7 +36,8 @@
36
36
  "files": [
37
37
  "dist",
38
38
  "README.md",
39
- "LICENSE"
39
+ "LICENSE",
40
+ "package.json"
40
41
  ],
41
42
  "dependencies": {
42
43
  "@modelcontextprotocol/sdk": "^1.25.1",