context-mcp-server 1.0.7 → 1.0.8
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/README.md +10 -11
- package/package.json +2 -2
- package/pyproject.toml +1 -1
- package/src/cli.js +64 -52
- package/src/db.js +946 -805
- package/src/guard.js +9 -3
- package/src/migrator.js +124 -0
- package/src/server.js +7 -6
- package/src/templates/AGENTS.md +6 -13
- package/src/templates/CLAUDE.md +6 -12
- package/src/templates/GEMINI.md +6 -13
- package/src/templates/commands/context-resume.md +1 -1
- package/src/templates/commands/save-context.md +1 -1
- package/src/templates/cursor-rules.mdc +3 -3
- package/src/templates/skills/SKILL.md +7 -13
- package/src/templates/windsurf-rules.md +3 -3
- package/src/tools/context.js +3 -5
- package/src/tools/gitTools.js +1 -3
- package/src/tools/plan.js +130 -0
- package/uv.lock +1 -1
- package/src/tools/discussion.js +0 -123
package/src/tools/discussion.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
saveDiscussion, getDiscussion, listDiscussions, deleteDiscussion,
|
|
3
|
-
updateDiscussion, updateDiscussionStep, clearDiscussionLink,
|
|
4
|
-
} from '../db.js';
|
|
5
|
-
|
|
6
|
-
export const definition = {
|
|
7
|
-
name: 'discussion',
|
|
8
|
-
description:
|
|
9
|
-
`Forward-looking thinking space — plans, research, ideas, design.\n` +
|
|
10
|
-
`• "save" — Create or update a discussion.\n` +
|
|
11
|
-
`• "update" — Patch specific fields without touching the rest.\n` +
|
|
12
|
-
`• "get" — Retrieve by name or id (full content + steps).\n` +
|
|
13
|
-
`• "list" — List discussions (filterable). Header + stepsSummary only.\n` +
|
|
14
|
-
`• "delete" — Remove by name or id.\n` +
|
|
15
|
-
`• "update_step" — Mark a step done/in-progress. Auto-closes when all done.`,
|
|
16
|
-
inputSchema: {
|
|
17
|
-
type: 'object',
|
|
18
|
-
properties: {
|
|
19
|
-
action: { type: 'string', enum: ['save', 'get', 'list', 'delete', 'update', 'update_step'] },
|
|
20
|
-
name: { type: 'string' },
|
|
21
|
-
id: { type: 'string' },
|
|
22
|
-
project: { type: 'string' },
|
|
23
|
-
title: { type: 'string' },
|
|
24
|
-
description: { type: 'string' },
|
|
25
|
-
content: { type: 'string' },
|
|
26
|
-
type: { type: 'string', enum: ['plan', 'research', 'idea', 'design', 'implementation', 'review', 'thread'] },
|
|
27
|
-
status: { type: 'string', enum: ['active', 'done'] },
|
|
28
|
-
tags: { type: 'array', items: { type: 'string' } },
|
|
29
|
-
parentId: { type: 'string' },
|
|
30
|
-
linkedContextIds: { type: 'array', items: { type: 'string' } },
|
|
31
|
-
steps: { type: 'array', items: { type: 'object' } },
|
|
32
|
-
stepId: { type: 'string' },
|
|
33
|
-
stepStatus: { type: 'string', enum: ['pending', 'in-progress', 'done', 'skipped'] },
|
|
34
|
-
linkedContextId: { type: 'string' },
|
|
35
|
-
filterStatus: { type: 'string' },
|
|
36
|
-
filterType: { type: 'string' },
|
|
37
|
-
},
|
|
38
|
-
required: ['action'],
|
|
39
|
-
},
|
|
40
|
-
outputSchema: {
|
|
41
|
-
type: 'object',
|
|
42
|
-
properties: {
|
|
43
|
-
success: { type: 'boolean' },
|
|
44
|
-
id: { type: 'string' },
|
|
45
|
-
name: { type: 'string' },
|
|
46
|
-
discussion: { type: 'object' },
|
|
47
|
-
discussions: { type: 'array' },
|
|
48
|
-
step: { type: 'object' },
|
|
49
|
-
message: { type: 'string' },
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export async function handle(args, state) {
|
|
55
|
-
switch (args.action) {
|
|
56
|
-
case 'save': {
|
|
57
|
-
if (!args.name) throw new Error('name is required for save');
|
|
58
|
-
const disc = saveDiscussion({ ...args, sessionId: args.sessionId || state.sessionId });
|
|
59
|
-
if (disc.status === 'active') state.discussionId = disc.id;
|
|
60
|
-
else if (state.discussionId === disc.id) state.discussionId = null;
|
|
61
|
-
return { success: true, id: disc.id, name: disc.name,
|
|
62
|
-
message: `Discussion "${disc.name}" saved (${disc.type}, ${disc.status}).` };
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
case 'get': {
|
|
66
|
-
if (!args.name && !args.id) throw new Error('name or id is required for get');
|
|
67
|
-
const disc = getDiscussion({ name: args.name, id: args.id, project: args.project });
|
|
68
|
-
return disc
|
|
69
|
-
? { discussion: disc }
|
|
70
|
-
: { discussion: null, message: `No discussion found for "${args.name || args.id}".` };
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
case 'update': {
|
|
74
|
-
if (!args.name && !args.id) throw new Error('name or id is required for update');
|
|
75
|
-
const updated = updateDiscussion({ ...args });
|
|
76
|
-
if (!updated) throw new Error(`No discussion found for "${args.name || args.id}".`);
|
|
77
|
-
if (updated.status !== 'active' && state.discussionId === updated.id) state.discussionId = null;
|
|
78
|
-
if (updated.status === 'active') state.discussionId = updated.id;
|
|
79
|
-
return { success: true, id: updated.id, name: updated.name, status: updated.status,
|
|
80
|
-
message: `Discussion "${updated.name}" updated (${updated.status}).` };
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
case 'list': {
|
|
84
|
-
return { discussions: listDiscussions({ project: args.project, status: args.filterStatus, type: args.filterType }) };
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
case 'delete': {
|
|
88
|
-
if (!args.name && !args.id) throw new Error('name or id is required for delete');
|
|
89
|
-
const toDelete = getDiscussion({ name: args.name, id: args.id });
|
|
90
|
-
if (toDelete) {
|
|
91
|
-
for (const ctxId of (toDelete.linkedContextIds || [])) clearDiscussionLink(ctxId);
|
|
92
|
-
}
|
|
93
|
-
const del = deleteDiscussion({ name: args.name, id: args.id });
|
|
94
|
-
if (state.discussionId) {
|
|
95
|
-
const matchById = args.id && args.id === state.discussionId;
|
|
96
|
-
const matchByName = args.name && del.deleted > 0;
|
|
97
|
-
if (matchById || matchByName) state.discussionId = null;
|
|
98
|
-
}
|
|
99
|
-
return { ...del, message: `Deleted ${del.deleted} discussion(s).` };
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
case 'update_step': {
|
|
103
|
-
if (!args.name && !args.id) throw new Error('name or id is required for update_step');
|
|
104
|
-
if (!args.stepId) throw new Error('stepId is required for update_step');
|
|
105
|
-
const updated = updateDiscussionStep({
|
|
106
|
-
discussionName: args.name,
|
|
107
|
-
discussionId: args.id,
|
|
108
|
-
stepId: args.stepId,
|
|
109
|
-
status: args.stepStatus,
|
|
110
|
-
linkedContextId: args.linkedContextId,
|
|
111
|
-
});
|
|
112
|
-
if (!updated) throw new Error('Discussion or step not found.');
|
|
113
|
-
if (updated.discussion.status === 'done' && state.discussionId === updated.discussion.id) {
|
|
114
|
-
state.discussionId = null;
|
|
115
|
-
}
|
|
116
|
-
return { success: true, step: updated.step, discussionStatus: updated.discussion.status,
|
|
117
|
-
message: `Step updated. Discussion "${updated.discussion.name}" is now "${updated.discussion.status}".` };
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
default:
|
|
121
|
-
throw new Error(`Unknown discussion action: ${args.action}`);
|
|
122
|
-
}
|
|
123
|
-
}
|