mcp-context-sync 1.0.5 → 1.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-context-sync",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "MCP server for synchronizing work context between AI coding agents (Claude Code, Codex, Gemini, Cursor)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -14,7 +14,8 @@
14
14
  "LICENSE"
15
15
  ],
16
16
  "scripts": {
17
- "build": "tsc",
17
+ "clean": "node -e \"const fs=require('fs');fs.rmSync('dist',{recursive:true,force:true})\"",
18
+ "build": "npm run clean && tsc",
18
19
  "start": "node dist/index.js",
19
20
  "dev": "tsx src/index.ts",
20
21
  "cli": "tsx src/cli.ts",
@@ -1,3 +0,0 @@
1
- import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import type Database from 'better-sqlite3';
3
- export declare function registerAutoResumePrompt(server: McpServer, db: Database.Database): void;
@@ -1,70 +0,0 @@
1
- import { z } from 'zod';
2
- import { projectIdFromPath, displayNameFromPath } from '../lib/project-id.js';
3
- import { getProject, getLatestSnapshot, listProjects } from '../db/queries.js';
4
- export function registerAutoResumePrompt(server, db) {
5
- server.registerPrompt('auto-resume', {
6
- title: 'Auto-Resume Context',
7
- description: 'Check for existing context when opening a project. ' +
8
- 'Returns a concise summary or confirms fresh start.',
9
- argsSchema: {
10
- projectDir: z.string().describe('Absolute path to the project root directory'),
11
- agent: z.string().describe('Current agent name (e.g., "claude-code", "codex", "gemini-cli")'),
12
- },
13
- }, ({ projectDir, agent }) => {
14
- const projectId = projectIdFromPath(projectDir);
15
- const displayName = displayNameFromPath(projectDir);
16
- const project = getProject(db, projectId);
17
- // No previous context
18
- if (!project) {
19
- const otherCount = listProjects(db).length;
20
- const note = otherCount > 0
21
- ? `\n\n${otherCount} other project(s) have synced context. Use \`list-projects\` to see them.`
22
- : '';
23
- return {
24
- messages: [
25
- { role: 'user', content: { type: 'text', text: `Starting work on \`${projectDir}\`.` } },
26
- { role: 'assistant', content: { type: 'text', text: `**Fresh start** — no previous context for "${displayName}".${note}\n\n` +
27
- `When done, use the \`sync\` tool to save progress for future sessions.`, } },
28
- ],
29
- };
30
- }
31
- const snapshot = getLatestSnapshot(db, projectId);
32
- if (!snapshot) {
33
- return {
34
- messages: [
35
- { role: 'user', content: { type: 'text', text: `Starting work on "${displayName}".` } },
36
- { role: 'assistant', content: { type: 'text', text: `Project "${displayName}" exists but has no snapshots. Use \`sync\` to create one.`, } },
37
- ],
38
- };
39
- }
40
- // Build concise summary
41
- const remaining = JSON.parse(snapshot.tasks_remaining);
42
- const decisions = JSON.parse(snapshot.decisions);
43
- const lines = [
44
- `**Resuming: ${displayName}**`,
45
- '',
46
- `Last session by **${snapshot.agent}** on ${snapshot.created_at.slice(0, 10)}` +
47
- ` (snapshot #${snapshot.sequence_number}, ${project.handoff_count} handoffs)`,
48
- '',
49
- `> ${snapshot.summary}`,
50
- ];
51
- if (remaining.length > 0) {
52
- lines.push('', `**Pending (${remaining.length}):**`);
53
- for (const t of remaining.slice(0, 4))
54
- lines.push(`- ${t}`);
55
- if (remaining.length > 4)
56
- lines.push(`- ...and ${remaining.length - 4} more`);
57
- }
58
- if (decisions.length > 0) {
59
- lines.push('', `**Last decision:** ${decisions[decisions.length - 1].decision}`);
60
- }
61
- lines.push('', `Use \`resume\` with \`projectDir: "${projectDir}"\` and \`agent: "${agent}"\` to load the full snapshot and register the handoff.`);
62
- return {
63
- messages: [
64
- { role: 'user', content: { type: 'text', text: `Continuing work on \`${projectDir}\`. Load previous context.` } },
65
- { role: 'assistant', content: { type: 'text', text: lines.join('\n') } },
66
- ],
67
- };
68
- });
69
- }
70
- //# sourceMappingURL=auto-resume.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-resume.js","sourceRoot":"","sources":["../../src/prompts/auto-resume.ts"],"names":[],"mappings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AAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC5D,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;gBAAE,KAAK,CAAC,IAAI,CAAC,YAAY,SAAS,CAAC,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC;QAChF,CAAC;QAED,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzB,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,sBAAsB,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QACnF,CAAC;QAED,KAAK,CAAC,IAAI,CACR,EAAE,EACF,sCAAsC,UAAU,qBAAqB,KAAK,yDAAyD,CACpI,CAAC;QAEF,OAAO;YACL,QAAQ,EAAE;gBACR,EAAE,IAAI,EAAE,MAAe,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,wBAAwB,UAAU,4BAA4B,EAAE,EAAE;gBACnI,EAAE,IAAI,EAAE,WAAoB,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE;aAC3F;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- export declare function registerResumeWorkPrompt(server: McpServer): void;
@@ -1,29 +0,0 @@
1
- import { z } from 'zod';
2
- export function registerResumeWorkPrompt(server) {
3
- server.registerPrompt('resume-work', {
4
- title: 'Resume Previous Work',
5
- description: 'Load the latest snapshot and orient for continuing work on a project.',
6
- argsSchema: {
7
- projectDir: z.string().describe('Project root directory'),
8
- agent: z.string().describe('Current agent name'),
9
- },
10
- }, ({ projectDir, agent }) => ({
11
- messages: [
12
- {
13
- role: 'user',
14
- content: {
15
- type: 'text',
16
- text: `I'm switching to you (${agent}) to continue work on "${projectDir}".
17
-
18
- Please call the "resume" tool to load the latest context snapshot, then:
19
- 1. Read the snapshot carefully
20
- 2. Summarize what the previous agent accomplished
21
- 3. Note any key decisions and blockers
22
- 4. Confirm the next steps
23
- 5. Ask me if I want to proceed with the suggested next steps or do something different`,
24
- },
25
- },
26
- ],
27
- }));
28
- }
29
- //# sourceMappingURL=resume-work.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resume-work.js","sourceRoot":"","sources":["../../src/prompts/resume-work.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,UAAU,wBAAwB,CAAC,MAAiB;IACxD,MAAM,CAAC,cAAc,CACnB,aAAa,EACb;QACE,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EACT,uEAAuE;QACzE,UAAU,EAAE;YACV,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;YACzD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;SACjD;KACF,EACD,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;QAC1B,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAe;gBACrB,OAAO,EAAE;oBACP,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,yBAAyB,KAAK,0BAA0B,UAAU;;;;;;;uFAOG;iBAC5E;aACF;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- export declare function registerSyncSessionPrompt(server: McpServer): void;
@@ -1,33 +0,0 @@
1
- import { z } from 'zod';
2
- export function registerSyncSessionPrompt(server) {
3
- server.registerPrompt('sync-session', {
4
- title: 'Sync Current Session',
5
- description: 'Guided prompt to capture a complete context snapshot for handoff to another agent.',
6
- argsSchema: {
7
- projectDir: z.string().describe('Project root directory'),
8
- agent: z.string().describe('Current agent name'),
9
- },
10
- }, ({ projectDir, agent }) => ({
11
- messages: [
12
- {
13
- role: 'user',
14
- content: {
15
- type: 'text',
16
- text: `You are about to sync your work session on project at "${projectDir}" as agent "${agent}".
17
-
18
- Please call the "sync" tool with a structured snapshot of your current session. Include:
19
- 1. A concise summary of what you accomplished
20
- 2. All tasks you completed (be specific)
21
- 3. All tasks still remaining or blocked
22
- 4. Any key decisions you made and WHY
23
- 5. Files you created or modified
24
- 6. Any blockers another agent should know about
25
- 7. Specific, actionable next steps -- what should the next agent do FIRST?
26
-
27
- Be concrete and specific. The next agent has NO context about your conversation -- they will only see this snapshot.`,
28
- },
29
- },
30
- ],
31
- }));
32
- }
33
- //# sourceMappingURL=sync-session.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sync-session.js","sourceRoot":"","sources":["../../src/prompts/sync-session.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IACzD,MAAM,CAAC,cAAc,CACnB,cAAc,EACd;QACE,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EACT,oFAAoF;QACtF,UAAU,EAAE;YACV,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;YACzD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;SACjD;KACF,EACD,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;QAC1B,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAe;gBACrB,OAAO,EAAE;oBACP,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,0DAA0D,UAAU,eAAe,KAAK;;;;;;;;;;;qHAWW;iBAC1G;aACF;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}