mattermost-claude-code 0.10.4 → 0.10.5

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/CHANGELOG.md CHANGED
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.10.5] - 2025-12-28
11
+
12
+ ### Changed
13
+ - **Improved diff display** - Edit operations now show unified diffs with context
14
+ - Uses standard unified diff format (like `git diff`)
15
+ - Shows 3 lines of context around changes
16
+ - More compact: changed lines shown once, not duplicated
17
+ - Line numbers in `@@ -X,Y +X,Y @@` format
18
+
10
19
  ## [0.10.4] - 2025-12-28
11
20
 
12
21
  ### Added
@@ -7,6 +7,7 @@ import { randomUUID } from 'crypto';
7
7
  import { readFileSync } from 'fs';
8
8
  import { dirname, resolve } from 'path';
9
9
  import { fileURLToPath } from 'url';
10
+ import * as Diff from 'diff';
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 REACTION_EMOJIS = ['one', 'two', 'three', 'four'];
@@ -850,25 +851,21 @@ export class SessionManager {
850
851
  case 'Read': return `📄 **Read** \`${short(input.file_path)}\``;
851
852
  case 'Edit': {
852
853
  const filePath = short(input.file_path);
853
- const oldStr = (input.old_string || '').trim();
854
- const newStr = (input.new_string || '').trim();
855
- // Show diff if we have old/new strings
854
+ const oldStr = (input.old_string || '');
855
+ const newStr = (input.new_string || '');
856
+ // Show unified diff if we have old/new strings
856
857
  if (oldStr || newStr) {
857
- const maxLines = 8;
858
- const oldLines = oldStr.split('\n').slice(0, maxLines);
859
- const newLines = newStr.split('\n').slice(0, maxLines);
858
+ // Generate unified diff with 3 lines of context
859
+ const patch = Diff.createPatch(filePath, oldStr, newStr, '', '', { context: 3 });
860
+ // Remove the header lines (first 4 lines: ---, +++, and two index lines)
861
+ const patchLines = patch.split('\n').slice(4);
862
+ const maxLines = 25;
860
863
  let diff = `✏️ **Edit** \`${filePath}\`\n\`\`\`diff\n`;
861
- for (const line of oldLines) {
862
- diff += `- ${line}\n`;
864
+ diff += patchLines.slice(0, maxLines).join('\n');
865
+ if (patchLines.length > maxLines) {
866
+ diff += `\n... (+${patchLines.length - maxLines} more lines)`;
863
867
  }
864
- if (oldStr.split('\n').length > maxLines)
865
- diff += `- ... (${oldStr.split('\n').length - maxLines} more lines)\n`;
866
- for (const line of newLines) {
867
- diff += `+ ${line}\n`;
868
- }
869
- if (newStr.split('\n').length > maxLines)
870
- diff += `+ ... (${newStr.split('\n').length - maxLines} more lines)\n`;
871
- diff += '```';
868
+ diff += '\n```';
872
869
  return diff;
873
870
  }
874
871
  return `✏️ **Edit** \`${filePath}\``;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mattermost-claude-code",
3
- "version": "0.10.4",
3
+ "version": "0.10.5",
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",
@@ -43,6 +43,7 @@
43
43
  "dependencies": {
44
44
  "@modelcontextprotocol/sdk": "^1.25.1",
45
45
  "commander": "^14.0.2",
46
+ "diff": "^8.0.2",
46
47
  "dotenv": "^16.4.7",
47
48
  "prompts": "^2.4.2",
48
49
  "update-notifier": "^7.3.1",
@@ -50,6 +51,7 @@
50
51
  "zod": "^4.2.1"
51
52
  },
52
53
  "devDependencies": {
54
+ "@types/diff": "^7.0.2",
53
55
  "@types/node": "^22.10.2",
54
56
  "@types/prompts": "^2.4.9",
55
57
  "@types/update-notifier": "^6.0.8",