@cachly-dev/mcp-server 0.5.44 → 0.5.45

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cachly-dev/mcp-server",
3
- "version": "0.5.44",
3
+ "version": "0.5.45",
4
4
  "mcpName": "io.github.cachly-dev/mcp-server",
5
5
  "description": "AI memory brain for Claude Code, Cursor, Copilot & Windsurf — persistent sessions, lessons learned, semantic search, team brain. 51 MCP tools.",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -1846,6 +1846,10 @@ const TOOLS = [
1846
1846
  type: 'string',
1847
1847
  description: 'Current AI provider (e.g. "claude-code", "copilot", "cursor", "windsurf"). Shown in the briefing header and saved so the next provider can see who was last active.',
1848
1848
  },
1849
+ workspace_path: {
1850
+ type: 'string',
1851
+ description: 'Absolute path to the project root. If no session_end was found (e.g. context limit hit), reads git log to reconstruct what happened since last session.',
1852
+ },
1849
1853
  },
1850
1854
  required: ['instance_id'],
1851
1855
  },
@@ -3833,7 +3837,7 @@ async function handleTool(name: string, args: Record<string, unknown>): Promise<
3833
3837
 
3834
3838
  // ── session_start ─────────────────────────────────────────────────────────
3835
3839
  case 'session_start': {
3836
- const { instance_id, focus = '', author = '', provider = '' } = args as { instance_id: string; focus?: string; author?: string; provider?: string };
3840
+ const { instance_id, focus = '', author = '', provider = '', workspace_path = '' } = args as { instance_id: string; focus?: string; author?: string; provider?: string; workspace_path?: string };
3837
3841
  const redis = await getConnection(instance_id);
3838
3842
 
3839
3843
  // 1. Scan all best-solution lessons
@@ -3994,6 +3998,33 @@ async function handleTool(name: string, args: Record<string, unknown>): Promise<
3994
3998
  } catch { /* ignore */ }
3995
3999
  }
3996
4000
 
4001
+ // ── Git reconstruction — when no session_end + workspace_path given ─────
4002
+ if (workspace_path && !lastSession) {
4003
+ try {
4004
+ const { execSync } = await import('node:child_process');
4005
+ const gitLog = execSync(
4006
+ `git -C "${workspace_path}" log --oneline --format="%h %s" -15 2>/dev/null`,
4007
+ { encoding: 'utf-8', timeout: 5000 },
4008
+ ).trim();
4009
+ const gitDiff = execSync(
4010
+ `git -C "${workspace_path}" diff --stat HEAD~3 2>/dev/null || git -C "${workspace_path}" diff --stat 2>/dev/null`,
4011
+ { encoding: 'utf-8', timeout: 5000 },
4012
+ ).trim();
4013
+ if (gitLog) {
4014
+ lines.push(`🔍 **Git reconstruction** (no session_end found — reconstructed from git):`);
4015
+ for (const l of gitLog.split('\n').slice(0, 8)) lines.push(` ${l}`);
4016
+ if (gitDiff) {
4017
+ const diffLines = gitDiff.split('\n').filter(l => l.includes('|') || l.includes('changed'));
4018
+ if (diffLines.length > 0) {
4019
+ lines.push(` **Recent changes:**`);
4020
+ for (const dl of diffLines.slice(0, 5)) lines.push(` ${dl.trim()}`);
4021
+ }
4022
+ }
4023
+ lines.push('');
4024
+ }
4025
+ } catch { /* git not available or no repo — silent */ }
4026
+ }
4027
+
3997
4028
  // Last session
3998
4029
  if (lastSession) {
3999
4030
  const ago = Math.round((Date.now() - new Date(lastSession.ts).getTime()) / 60000);