@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/dist/index.js CHANGED
@@ -1715,6 +1715,10 @@ const TOOLS = [
1715
1715
  type: 'string',
1716
1716
  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.',
1717
1717
  },
1718
+ workspace_path: {
1719
+ type: 'string',
1720
+ 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.',
1721
+ },
1718
1722
  },
1719
1723
  required: ['instance_id'],
1720
1724
  },
@@ -3450,7 +3454,7 @@ async function handleTool(name, args) {
3450
3454
  }
3451
3455
  // ── session_start ─────────────────────────────────────────────────────────
3452
3456
  case 'session_start': {
3453
- const { instance_id, focus = '', author = '', provider = '' } = args;
3457
+ const { instance_id, focus = '', author = '', provider = '', workspace_path = '' } = args;
3454
3458
  const redis = await getConnection(instance_id);
3455
3459
  // 1. Scan all best-solution lessons
3456
3460
  const lessonKeys = [];
@@ -3604,6 +3608,29 @@ async function handleTool(name, args) {
3604
3608
  }
3605
3609
  catch { /* ignore */ }
3606
3610
  }
3611
+ // ── Git reconstruction — when no session_end + workspace_path given ─────
3612
+ if (workspace_path && !lastSession) {
3613
+ try {
3614
+ const { execSync } = await import('node:child_process');
3615
+ const gitLog = execSync(`git -C "${workspace_path}" log --oneline --format="%h %s" -15 2>/dev/null`, { encoding: 'utf-8', timeout: 5000 }).trim();
3616
+ const gitDiff = execSync(`git -C "${workspace_path}" diff --stat HEAD~3 2>/dev/null || git -C "${workspace_path}" diff --stat 2>/dev/null`, { encoding: 'utf-8', timeout: 5000 }).trim();
3617
+ if (gitLog) {
3618
+ lines.push(`🔍 **Git reconstruction** (no session_end found — reconstructed from git):`);
3619
+ for (const l of gitLog.split('\n').slice(0, 8))
3620
+ lines.push(` ${l}`);
3621
+ if (gitDiff) {
3622
+ const diffLines = gitDiff.split('\n').filter(l => l.includes('|') || l.includes('changed'));
3623
+ if (diffLines.length > 0) {
3624
+ lines.push(` **Recent changes:**`);
3625
+ for (const dl of diffLines.slice(0, 5))
3626
+ lines.push(` ${dl.trim()}`);
3627
+ }
3628
+ }
3629
+ lines.push('');
3630
+ }
3631
+ }
3632
+ catch { /* git not available or no repo — silent */ }
3633
+ }
3607
3634
  // Last session
3608
3635
  if (lastSession) {
3609
3636
  const ago = Math.round((Date.now() - new Date(lastSession.ts).getTime()) / 60000);