mattermost-claude-code 0.10.4 → 0.10.6

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,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.10.6] - 2025-12-28
11
+
12
+ ### Fixed
13
+ - **Fixed diff display** - Removed misleading line numbers and noise from diffs
14
+ - No more fake `@@ -1,1 +1,1 @@` headers (we don't have real line numbers)
15
+ - No more `` noise
16
+ - Uses `diffLines()` for proper line-by-line change detection
17
+ - Shows context lines (unchanged parts) naturally
18
+
19
+ ## [0.10.5] - 2025-12-28
20
+
21
+ ### Changed
22
+ - **Improved diff display** - Edit operations now show unified diffs with context
23
+ - Uses standard unified diff format (like `git diff`)
24
+ - Shows 3 lines of context around changes
25
+ - More compact: changed lines shown once, not duplicated
26
+ - Line numbers in `@@ -X,Y +X,Y @@` format
27
+
10
28
  ## [0.10.4] - 2025-12-28
11
29
 
12
30
  ### 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,44 @@ 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();
854
+ const oldStr = (input.old_string || '');
855
+ const newStr = (input.new_string || '');
855
856
  // Show 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);
860
- let diff = `✏️ **Edit** \`${filePath}\`\n\`\`\`diff\n`;
861
- for (const line of oldLines) {
862
- diff += `- ${line}\n`;
858
+ // Use diff library to compute actual line-by-line changes
859
+ const changes = Diff.diffLines(oldStr, newStr);
860
+ const maxLines = 20;
861
+ let lineCount = 0;
862
+ const diffLines = [];
863
+ for (const change of changes) {
864
+ const lines = change.value.replace(/\n$/, '').split('\n');
865
+ for (const line of lines) {
866
+ if (lineCount >= maxLines)
867
+ break;
868
+ if (change.added) {
869
+ diffLines.push(`+ ${line}`);
870
+ lineCount++;
871
+ }
872
+ else if (change.removed) {
873
+ diffLines.push(`- ${line}`);
874
+ lineCount++;
875
+ }
876
+ else {
877
+ // Context line (unchanged)
878
+ diffLines.push(` ${line}`);
879
+ lineCount++;
880
+ }
881
+ }
882
+ if (lineCount >= maxLines)
883
+ break;
863
884
  }
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`;
885
+ const totalLines = changes.reduce((sum, c) => sum + c.value.split('\n').length - 1, 0);
886
+ let diff = `✏️ **Edit** \`${filePath}\`\n\`\`\`diff\n`;
887
+ diff += diffLines.join('\n');
888
+ if (totalLines > maxLines) {
889
+ diff += `\n... (+${totalLines - maxLines} more lines)`;
868
890
  }
869
- if (newStr.split('\n').length > maxLines)
870
- diff += `+ ... (${newStr.split('\n').length - maxLines} more lines)\n`;
871
- diff += '```';
891
+ diff += '\n```';
872
892
  return diff;
873
893
  }
874
894
  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.6",
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",