@sanqianx/project-knowledge 5.0.35 → 5.1.0
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/.claude-plugin/marketplace.json +1 -1
- package/_site/_test/chat-claudecodeui-match-test.js +1 -1
- package/_site/_test/integration-runtime-binding-test.js +1 -1
- package/_site/_test/mcp-server-test.js +149 -149
- package/_site/_test/packaged-ui-smoke-test.js +1 -1
- package/_site/_test/parallel-nav-theme-test.js +5 -4
- package/_site/_test/parallel-nav-viewport-test.js +4 -2
- package/_site/_test/product-empty-state-test.js +2 -2
- package/_site/_test/product-navigation-test.js +2 -2
- package/_site/_test/workflow-module-wiring-test.js +102 -0
- package/_site/_test/workflow-tools-test.js +97 -0
- package/_site/_test/workspace-ui-contract-test.js +16 -3
- package/_site/lib/integration-installer.js +3 -1
- package/_site/lib/module-bridge.js +42 -4
- package/_site/lib/server-app.js +12 -0
- package/_site/lib/workflow-tool-runtime.js +209 -0
- package/bin/project-knowledge-mcp.js +282 -201
- package/module-runtime-manifest.json +5 -5
- package/package.json +1 -1
- package/plugins/project-knowledge/.claude-plugin/plugin.json +1 -1
- package/plugins/project-knowledge/.codex-plugin/plugin.json +1 -1
- package/plugins/project-knowledge/.mcp.json +1 -1
- package/plugins/project-knowledge/skills/pk-team/SKILL.md +35 -0
- package/ui/index.html +6 -0
- package/ui/product.js +81 -11
|
@@ -1,201 +1,282 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const packageInfo = require('../package.json');
|
|
4
|
-
const { Server } = require('@modelcontextprotocol/sdk/server/index.js');
|
|
5
|
-
const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
6
|
-
const {
|
|
7
|
-
CallToolRequestSchema,
|
|
8
|
-
ListToolsRequestSchema,
|
|
9
|
-
} = require('@modelcontextprotocol/sdk/types.js');
|
|
10
|
-
const { KnowledgeToolRuntime } = require('../_site/lib/knowledge-tool-runtime');
|
|
11
|
-
const {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
name: '
|
|
60
|
-
description: '
|
|
61
|
-
inputSchema: {
|
|
62
|
-
type: 'object',
|
|
63
|
-
required: ['
|
|
64
|
-
properties: {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const packageInfo = require('../package.json');
|
|
4
|
+
const { Server } = require('@modelcontextprotocol/sdk/server/index.js');
|
|
5
|
+
const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
6
|
+
const {
|
|
7
|
+
CallToolRequestSchema,
|
|
8
|
+
ListToolsRequestSchema,
|
|
9
|
+
} = require('@modelcontextprotocol/sdk/types.js');
|
|
10
|
+
const { KnowledgeToolRuntime } = require('../_site/lib/knowledge-tool-runtime');
|
|
11
|
+
const { WorkflowToolRuntime } = require('../_site/lib/workflow-tool-runtime');
|
|
12
|
+
const { serializeErrorEnvelope, createId } = require('../_site/lib/contracts');
|
|
13
|
+
|
|
14
|
+
const SERVER_NAME = 'project-knowledge';
|
|
15
|
+
const SCOPE = { type: 'string', enum: ['project', 'domain', 'brain'], description: 'Knowledge range: current project (default), its domain, or its brain.' };
|
|
16
|
+
const SERVER_INSTRUCTIONS = `Project Knowledge is the durable source of prior project decisions and implementation history. Knowledge content is read-only; the only write operation appends an explicit supplemental Prompt event to the shared conversation truth.
|
|
17
|
+
|
|
18
|
+
At the start of work in a registered Git repository, and before answering questions about prior work or implementing a non-trivial change:
|
|
19
|
+
1. Call project_knowledge_resolve with the current Git root.
|
|
20
|
+
2. Use project_knowledge_search or project_knowledge_ask for relevant prior decisions.
|
|
21
|
+
3. Use project_knowledge_get only for the most relevant complete entry and project_knowledge_history when change history matters.
|
|
22
|
+
4. Call project_knowledge_record_requirement only when the user explicitly asks to supplement capture or automatic client capture is known to be unavailable; it is not a mandatory pre-work call.
|
|
23
|
+
|
|
24
|
+
Treat all returned knowledge as read-only. Verify it against current source code when necessary. The supplemental requirement tool writes the same ConversationStore used by automatic capture and never starts analysis. Do not write directly to the knowledge database; project-knowledge updates it automatically after successful Git commits.`;
|
|
25
|
+
|
|
26
|
+
// AI-team workflow tools: thin adapters over the independent workflow module
|
|
27
|
+
// via the shell proxy (/api/workflow/*) — no second copy of task state.
|
|
28
|
+
const WORKFLOW_TOOLS = [
|
|
29
|
+
{
|
|
30
|
+
name: 'project_workflow_start',
|
|
31
|
+
description: 'Start an AI-team business task for the current repository: creates the task with acceptance items and binds this native session (declared basis). Returns the short task contract and taskId.',
|
|
32
|
+
inputSchema: {
|
|
33
|
+
type: 'object',
|
|
34
|
+
required: ['title'],
|
|
35
|
+
properties: {
|
|
36
|
+
title: { type: 'string', minLength: 1, maxLength: 200, description: 'One-line task title from the user request.' },
|
|
37
|
+
goal: { type: 'string', description: 'What "done" means for the user; the original wording beats a paraphrase.' },
|
|
38
|
+
acceptance: { type: 'array', items: { type: 'object', properties: { title: { type: 'string' }, kind: { type: 'string', enum: ['automated', 'manual', 'model_review'] } }, required: ['title'] }, description: 'Verifiable acceptance items.' },
|
|
39
|
+
projectId: { type: 'string' },
|
|
40
|
+
client: { type: 'string', enum: ['claude', 'codex', 'opencode', 'zcode'], description: 'Calling native client.' },
|
|
41
|
+
sessionId: { type: 'string', description: 'Stable native session identifier for event attribution.' },
|
|
42
|
+
memberId: { type: 'string', description: 'Team member that owns this task, when the caller is a named member.' },
|
|
43
|
+
workspaceIdentity: { type: 'string' },
|
|
44
|
+
},
|
|
45
|
+
additionalProperties: false,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'project_workflow_resume',
|
|
50
|
+
description: 'Resume an existing AI-team task by taskId: returns goal, acceptance with the current revision, confirmed decisions, verified results, remaining items and the next action.',
|
|
51
|
+
inputSchema: { type: 'object', required: ['taskId'], properties: { taskId: { type: 'string' } }, additionalProperties: false },
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'project_workflow_status',
|
|
55
|
+
description: 'Read one AI-team task by taskId, or the active task list (filter by projectId/status). Read-only.',
|
|
56
|
+
inputSchema: { type: 'object', properties: { taskId: { type: 'string' }, projectId: { type: 'string' }, status: { type: 'string' } }, additionalProperties: false },
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'project_workflow_checkpoint',
|
|
60
|
+
description: 'Record a checkpoint on an AI-team task. kind="fact" is a verified fact (updates nextAction); kind="candidate" is an inference kept separate.',
|
|
61
|
+
inputSchema: {
|
|
62
|
+
type: 'object',
|
|
63
|
+
required: ['taskId'],
|
|
64
|
+
properties: {
|
|
65
|
+
taskId: { type: 'string' },
|
|
66
|
+
kind: { type: 'string', enum: ['fact', 'candidate'] },
|
|
67
|
+
summary: { type: 'string' },
|
|
68
|
+
decided: { type: 'array', items: { type: 'string' } },
|
|
69
|
+
verifiedResults: { type: 'array', items: { type: 'string' } },
|
|
70
|
+
remaining: { type: 'array', items: { type: 'string' } },
|
|
71
|
+
nextAction: { type: 'string' },
|
|
72
|
+
},
|
|
73
|
+
additionalProperties: false,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'project_workflow_request_review',
|
|
78
|
+
description: 'Submit the current task snapshot for the delivery check/review pipeline.',
|
|
79
|
+
inputSchema: { type: 'object', required: ['taskId'], properties: { taskId: { type: 'string' }, note: { type: 'string' } }, additionalProperties: false },
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'project_workflow_review_result',
|
|
83
|
+
description: 'Fetch the review/verification results for a task once a review has run.',
|
|
84
|
+
inputSchema: { type: 'object', required: ['taskId'], properties: { taskId: { type: 'string' } }, additionalProperties: false },
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
const TOOLS = [
|
|
89
|
+
{
|
|
90
|
+
name: 'project_knowledge_resolve',
|
|
91
|
+
description: 'Resolve the registered Project Knowledge project for a Git repository. Call this first before using other knowledge tools.',
|
|
92
|
+
inputSchema: {
|
|
93
|
+
type: 'object',
|
|
94
|
+
properties: {
|
|
95
|
+
repoPath: { type: 'string', description: 'Current Git repository root or any path inside it. Defaults to the MCP process working directory.' },
|
|
96
|
+
projectId: { type: 'string', description: 'Stable projectId when it is already known.' },
|
|
97
|
+
project: { type: 'string', description: 'Optional registered project slug when it is already known.' },
|
|
98
|
+
},
|
|
99
|
+
additionalProperties: false,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'project_knowledge_record_requirement',
|
|
104
|
+
description: 'Explicitly supplement automatic capture with one project-scoped user Prompt event. This is the only write-capable tool; it never starts analysis or writes knowledge Markdown.',
|
|
105
|
+
inputSchema: {
|
|
106
|
+
type: 'object',
|
|
107
|
+
required: ['text', 'client', 'sessionId'],
|
|
108
|
+
properties: {
|
|
109
|
+
text: { type: 'string', minLength: 1, maxLength: 131072, description: 'The user request exactly as received; do not include system prompts or tool transcripts.' },
|
|
110
|
+
client: { type: 'string', enum: ['claude', 'codex', 'opencode'] },
|
|
111
|
+
sessionId: { type: 'string', minLength: 1, maxLength: 512, description: 'Stable identifier for the current client session.' },
|
|
112
|
+
conversationId: { type: 'string', minLength: 1, maxLength: 512 },
|
|
113
|
+
projectId: { type: 'string', description: 'Stable projectId returned by project_knowledge_resolve.' },
|
|
114
|
+
repoPath: { type: 'string', description: 'Current Git root. Used for exact project resolution when projectId is omitted.' },
|
|
115
|
+
explicitCommit: { type: 'string', description: 'Optional Git commit explicitly associated with this requirement.' },
|
|
116
|
+
},
|
|
117
|
+
anyOf: [{ required: ['projectId'] }, { required: ['repoPath'] }],
|
|
118
|
+
additionalProperties: false,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: 'project_knowledge_search',
|
|
123
|
+
description: 'Search the same durable knowledge and commit citations as the product UI, within the selected project, domain or brain. This tool is read-only.',
|
|
124
|
+
inputSchema: {
|
|
125
|
+
type: 'object',
|
|
126
|
+
required: ['query'],
|
|
127
|
+
properties: {
|
|
128
|
+
query: { type: 'string', minLength: 1 },
|
|
129
|
+
repoPath: { type: 'string', description: 'Current Git repository root or a path inside it.' },
|
|
130
|
+
projectId: { type: 'string', description: 'Stable projectId returned by project_knowledge_resolve.' },
|
|
131
|
+
project: { type: 'string', description: 'Optional registered project slug.' },
|
|
132
|
+
limit: { type: 'integer', minimum: 1, maximum: 30, default: 8 },
|
|
133
|
+
scope: SCOPE,
|
|
134
|
+
},
|
|
135
|
+
additionalProperties: false,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: 'project_knowledge_ask',
|
|
140
|
+
description: 'Return a compact answer with citations from durable project knowledge. This tool is read-only.',
|
|
141
|
+
inputSchema: {
|
|
142
|
+
type: 'object',
|
|
143
|
+
required: ['query'],
|
|
144
|
+
properties: {
|
|
145
|
+
query: { type: 'string', minLength: 1 },
|
|
146
|
+
repoPath: { type: 'string' },
|
|
147
|
+
projectId: { type: 'string' },
|
|
148
|
+
project: { type: 'string' },
|
|
149
|
+
limit: { type: 'integer', minimum: 1, maximum: 30, default: 8 },
|
|
150
|
+
scope: SCOPE,
|
|
151
|
+
},
|
|
152
|
+
additionalProperties: false,
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: 'project_knowledge_get',
|
|
157
|
+
description: 'Read one complete knowledge entry selected from search results. This tool is read-only and scope checked.',
|
|
158
|
+
inputSchema: {
|
|
159
|
+
type: 'object',
|
|
160
|
+
required: ['entry'],
|
|
161
|
+
properties: {
|
|
162
|
+
entry: { type: 'string', minLength: 1, description: 'Entry identifier returned by search.' },
|
|
163
|
+
space: { type: 'string', description: 'Optional scoped knowledge space identifier.' },
|
|
164
|
+
spaceId: { type: 'string', description: 'Knowledge space identifier returned by a citation; alias of space.' },
|
|
165
|
+
scope: SCOPE,
|
|
166
|
+
repoPath: { type: 'string' },
|
|
167
|
+
projectId: { type: 'string' },
|
|
168
|
+
project: { type: 'string' },
|
|
169
|
+
},
|
|
170
|
+
additionalProperties: false,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: 'project_knowledge_history',
|
|
175
|
+
description: 'Read recent durable change history for the current project and its allowed scope. This tool is read-only.',
|
|
176
|
+
inputSchema: {
|
|
177
|
+
type: 'object',
|
|
178
|
+
properties: {
|
|
179
|
+
repoPath: { type: 'string' },
|
|
180
|
+
projectId: { type: 'string' },
|
|
181
|
+
project: { type: 'string' },
|
|
182
|
+
limit: { type: 'integer', minimum: 1, maximum: 100, default: 20 },
|
|
183
|
+
scope: SCOPE,
|
|
184
|
+
},
|
|
185
|
+
additionalProperties: false,
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
...WORKFLOW_TOOLS,
|
|
189
|
+
];
|
|
190
|
+
|
|
191
|
+
function toolContent(result) {
|
|
192
|
+
return {
|
|
193
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
194
|
+
structuredContent: result,
|
|
195
|
+
isError: false,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function callTool(runtime, workflowRuntimeOrName, nameOrArgs, maybeArgs) {
|
|
200
|
+
// Accept both the internal signature (runtime, workflowRuntime, name, args)
|
|
201
|
+
// and the exported legacy signature (runtime, name, args) used by tests.
|
|
202
|
+
let workflowRuntime = workflowRuntimeOrName;
|
|
203
|
+
let name = nameOrArgs;
|
|
204
|
+
let args = maybeArgs;
|
|
205
|
+
if (typeof workflowRuntimeOrName === 'string') {
|
|
206
|
+
name = workflowRuntimeOrName;
|
|
207
|
+
args = nameOrArgs;
|
|
208
|
+
workflowRuntime = null;
|
|
209
|
+
}
|
|
210
|
+
if (name === 'project_knowledge_resolve') return runtime.resolveProject(args);
|
|
211
|
+
if (name === 'project_knowledge_record_requirement') return runtime.recordRequirement(args);
|
|
212
|
+
if (name === 'project_knowledge_search') return runtime.search(args);
|
|
213
|
+
if (name === 'project_knowledge_ask') return runtime.ask(args);
|
|
214
|
+
if (name === 'project_knowledge_get') return runtime.get(args);
|
|
215
|
+
if (name === 'project_knowledge_history') return runtime.history(args);
|
|
216
|
+
if (name === 'project_workflow_start') return workflowRuntime.start(args);
|
|
217
|
+
if (name === 'project_workflow_resume') return workflowRuntime.resume(args);
|
|
218
|
+
if (name === 'project_workflow_status') return workflowRuntime.status(args);
|
|
219
|
+
if (name === 'project_workflow_checkpoint') return workflowRuntime.checkpoint(args);
|
|
220
|
+
if (name === 'project_workflow_request_review') return workflowRuntime.requestReview(args);
|
|
221
|
+
if (name === 'project_workflow_review_result') return workflowRuntime.reviewResult(args);
|
|
222
|
+
throw new Error(`unknown tool: ${name}`);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function createServer(options = {}) {
|
|
226
|
+
const runtime = options.runtime || new KnowledgeToolRuntime();
|
|
227
|
+
const workflowRuntime = options.workflowRuntime || new WorkflowToolRuntime();
|
|
228
|
+
const server = new Server(
|
|
229
|
+
{ name: SERVER_NAME, version: packageInfo.version },
|
|
230
|
+
{
|
|
231
|
+
capabilities: { tools: { listChanged: false } },
|
|
232
|
+
instructions: SERVER_INSTRUCTIONS,
|
|
233
|
+
},
|
|
234
|
+
);
|
|
235
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
|
|
236
|
+
server.setRequestHandler(CallToolRequestSchema, async request => {
|
|
237
|
+
const name = String(request.params?.name || '');
|
|
238
|
+
const args = request.params?.arguments && typeof request.params.arguments === 'object'
|
|
239
|
+
? request.params.arguments
|
|
240
|
+
: {};
|
|
241
|
+
try {
|
|
242
|
+
return toolContent(await callTool(runtime, workflowRuntime, name, args));
|
|
243
|
+
} catch (error) {
|
|
244
|
+
const operationId = createId('op');
|
|
245
|
+
return {
|
|
246
|
+
content: [{ type: 'text', text: JSON.stringify(serializeErrorEnvelope(error, operationId)) }],
|
|
247
|
+
isError: true,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
return { server, runtime, workflowRuntime };
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
async function main() {
|
|
255
|
+
const { server, runtime } = createServer();
|
|
256
|
+
const transport = new StdioServerTransport();
|
|
257
|
+
let closing = false;
|
|
258
|
+
const close = async () => {
|
|
259
|
+
if (closing) return;
|
|
260
|
+
closing = true;
|
|
261
|
+
await runtime.close();
|
|
262
|
+
await server.close();
|
|
263
|
+
};
|
|
264
|
+
process.once('SIGINT', () => close().finally(() => process.exit(0)));
|
|
265
|
+
process.once('SIGTERM', () => close().finally(() => process.exit(0)));
|
|
266
|
+
await server.connect(transport);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (require.main === module) {
|
|
270
|
+
main().catch(error => {
|
|
271
|
+
process.stderr.write(`[project-knowledge-mcp] ${JSON.stringify(serializeErrorEnvelope(error, createId('op')))}\n`);
|
|
272
|
+
process.exit(1);
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
module.exports = {
|
|
277
|
+
callTool,
|
|
278
|
+
createServer,
|
|
279
|
+
SERVER_INSTRUCTIONS,
|
|
280
|
+
SERVER_NAME,
|
|
281
|
+
TOOLS,
|
|
282
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "project-knowledge/module-content/v1",
|
|
3
3
|
"productFiles": {
|
|
4
|
-
"ui/index.html": "
|
|
4
|
+
"ui/index.html": "55cbc1c20b5f88c7c21b50bc1b68d52ce3c94280f001567513e304d33c6933e1",
|
|
5
5
|
"ui/knowledge-panel.html": "dfd85f15759472252d797853263e9da0054b251c56bb9ccdc8a75e6301334ca8",
|
|
6
|
-
"ui/product.js": "
|
|
6
|
+
"ui/product.js": "85a025627a81e190466d5817ff488ac372008bb8760308e656cf95e10f617ac3",
|
|
7
7
|
"ui/live-client.js": "0d81fa894c629bb839e1931fc3c5ebad4d831aae8232d6ce8c0f542e9e3559e8",
|
|
8
8
|
"ui/product.css": "b7e2e6b1c1429078109e7742111f03a01a61f54895cf8ac733b83672cf31dca7",
|
|
9
9
|
"ui/favicon.svg": "c48be946b224112ebb0238b44263f7a61bda31e531afa895c2e9801c0ff24f32",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"plugins/project-knowledge/hooks/codex.json": "216e03c07295606ef6ebb2c4f669ad0d790b5e7c4f3f34600488033db75e4239",
|
|
12
12
|
"plugins/project-knowledge/scripts/context-hook.cjs": "ddc1f6f5638c662adbbf4391557bbeb7196af2fb869e7ecfeefba76b9bab5760",
|
|
13
13
|
"plugins/project-knowledge/scripts/mcp-launcher.cjs": "7c68830b5c73eb53ef030756a4de33987f7eab6b1a6cc15602835aac3f954893",
|
|
14
|
-
"plugins/project-knowledge/.claude-plugin/plugin.json": "
|
|
15
|
-
"plugins/project-knowledge/.codex-plugin/plugin.json": "
|
|
16
|
-
"plugins/project-knowledge/.mcp.json": "
|
|
14
|
+
"plugins/project-knowledge/.claude-plugin/plugin.json": "982786f8fe14161844baf1106a129700e092e9e7a6a8d59daeaccdddf048ce71",
|
|
15
|
+
"plugins/project-knowledge/.codex-plugin/plugin.json": "ecc7305a79ed5122dbe1cf9677c9ef4f38e3e5548a9b7888d56e3be9960af8cc",
|
|
16
|
+
"plugins/project-knowledge/.mcp.json": "0ee61566bee3ca420bfa61125adf23eca6779fd228d9f374994beaa8f9df9e15",
|
|
17
17
|
"ui/version-info.js": "01a82217b031de54b80d6c7974da9c70888c4c90a046bd4248a808f7989ddce7",
|
|
18
18
|
"ui/version-info.css": "209fad8e42b661f72d2aba3280e1ca47768b5cefb776fe5459538d34fbad120f"
|
|
19
19
|
},
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
|
|
3
3
|
"name": "project-knowledge",
|
|
4
4
|
"hooks": "./hooks/claude.json",
|
|
5
|
-
"version": "5.0
|
|
5
|
+
"version": "5.1.0",
|
|
6
6
|
"description": "Read durable project decisions and implementation history from Project Knowledge.",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "SanQianX",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"const fs=require('fs'),path=require('path'),os=require('os');const PKG='@sanqianx/project-knowledge',SC='project-knowledge/integration-runtime/v1';let f='';const root=process.env.CLAUDE_PLUGIN_ROOT||process.env.PLUGIN_ROOT;if(root){f=path.join(root,'scripts','mcp-launcher.cjs');if(!fs.existsSync(f))f=''}if(!f){const dd=process.env.KB_DATA_DIR||path.join(os.homedir(),'.project-knowledge-v5');try{const bp=path.join(dd,'integration-runtime.json');const st=fs.statSync(bp);if(st.isFile()&&st.size<=32768){const b=JSON.parse(fs.readFileSync(bp,'utf8'));if(b&&b.schema===SC&&b.packageName===PKG&&typeof b.packageRoot==='string'&&path.isAbsolute(b.packageRoot)){const c=path.join(b.packageRoot,'plugins','project-knowledge','scripts','mcp-launcher.cjs');const rr=fs.realpathSync(b.packageRoot),cr=fs.realpathSync(c);const rel=path.relative(rr,cr);if(rel&&rel!=='..'&&!rel.startsWith('..'+path.sep)&&!path.isAbsolute(rel)&&fs.statSync(cr).isFile())f=cr}}}catch(e){}}if(!f){console.error('[project-knowledge-mcp] 未能通过受信任插件根或已验证的安装绑定定位启动器,已停止;不访问网络,也不加载工作目录源码。');process.exit(127)}require(f);"
|
|
9
9
|
],
|
|
10
10
|
"env": {
|
|
11
|
-
"KB_PLUGIN_VERSION": "5.0
|
|
11
|
+
"KB_PLUGIN_VERSION": "5.1.0"
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pk-team
|
|
3
|
+
description: Work with the AI-team task board. Use when the user asks to start, resume, check or hand off a development task ("开始任务", "继续任务", "任务状态", "提交审查"), or when beginning substantial implementation work that should be tracked with acceptance items.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# PK Team — AI 团队任务
|
|
7
|
+
|
|
8
|
+
独立工作流模块通过 MCP 工具管理跨项目业务任务。任务有验收项与固定工作流(目标 → 实现 → 程序检查 → 适用 Review → 整改 → 交付);`done` 由服务端依据有效证据裁决,任何一方(包括你)说"完成了"都不算。
|
|
9
|
+
|
|
10
|
+
## 何时建任务
|
|
11
|
+
|
|
12
|
+
- 用户明确要求开始/跟踪一项开发工作 → `project_workflow_start`。
|
|
13
|
+
- 用户在页面上建了任务并让你接续 → `project_workflow_resume <taskId>`。
|
|
14
|
+
- 普通问答、小改动、无验收诉求的对话 → 不建任务,不要把闲聊升级为正式任务。
|
|
15
|
+
|
|
16
|
+
## 工具
|
|
17
|
+
|
|
18
|
+
1. `project_workflow_start`(title 必填;goal 用用户原话;acceptance 给出可验证条目;传 client 与当前会话的 sessionId 建立会话绑定)
|
|
19
|
+
→ 返回短任务合同(taskId、验收、下一步)。开始编码前把它读给用户确认验收。
|
|
20
|
+
2. `project_workflow_resume {taskId}` → 目标、已确认决策、已验证结果、剩余项、下一步;沿用任务,不重复建卡。
|
|
21
|
+
3. `project_workflow_status`(可按 projectId/status 过滤)→ 只读状态。
|
|
22
|
+
4. `project_workflow_checkpoint {taskId, kind, summary, decided, verifiedResults, remaining, nextAction}` → 记录进展。只有 `kind:"fact"` 才更新下一步;推断用 `kind:"candidate"`,不要把猜测写成事实。
|
|
23
|
+
5. `project_workflow_request_review {taskId}` → 准备交付时提交审查(检查/审查管线接入前的版本会如实返回"未交付",此时继续用 checkpoint 记录验证事实)。
|
|
24
|
+
6. `project_workflow_review_result {taskId}` → 读取审查与验证证据。
|
|
25
|
+
|
|
26
|
+
## 会话归属
|
|
27
|
+
|
|
28
|
+
- start 时传入真实的 client 会话 ID:事件观察按采集到的会话归因。同一原生会话切换任务必须重新 start/resume 绑定——不要把一个会话的事件永久算给第一个任务。
|
|
29
|
+
- 你自称完成不构成验收;程序检查、Review 与人工确认项由服务端裁决(人工项必须由用户确认)。
|
|
30
|
+
|
|
31
|
+
## 边界
|
|
32
|
+
|
|
33
|
+
- 任务/团队数据只在独立工作流模块;不要在仓库里另建任务文件,也不要修改知识库的记忆正文。
|
|
34
|
+
- 工作流服务不可达时继续正常开发(工具会返回结构化降级提示),恢复后补 checkpoint。
|
|
35
|
+
- 与知识工具的关系:先 `project_knowledge_resolve/search` 拿上下文,再 start 任务;两者互补,不互相替代。
|
package/ui/index.html
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
<div id="brainLabel" class="brain-label">我的智脑</div>
|
|
12
12
|
<nav aria-label="主要导航">
|
|
13
13
|
<button data-view="home"><svg viewBox="0 0 24 24"><path d="m3 11 9-7 9 7M5 10v10h14V10"/></svg>首页<span class="count" id="homeCount" hidden></span></button>
|
|
14
|
+
<button data-view="team"><svg viewBox="0 0 24 24"><circle cx="9" cy="9" r="3"/><path d="M3.5 19a5.5 5.5 0 0 1 11 0"/><circle cx="17" cy="10" r="2.5"/><path d="M14.5 19a4.5 4.5 0 0 1 7 0"/></svg>AI 团队</button>
|
|
14
15
|
<button data-view="memory"><svg viewBox="0 0 24 24"><path d="M6 4h12v16H6zM9 8h6M9 12h6"/></svg>长期记忆<span class="count" id="memoryCount" hidden></span></button>
|
|
15
16
|
<button data-view="projects"><svg viewBox="0 0 24 24"><path d="M4 7h6l2 2h8v11H4z"/></svg>项目</button>
|
|
16
17
|
<button data-view="search"><svg viewBox="0 0 24 24"><circle cx="10.5" cy="10.5" r="6.5"/><path d="m16 16 5 5"/></svg>知识检索</button>
|
|
@@ -22,6 +23,11 @@
|
|
|
22
23
|
<header class="topbar"><div><small id="breadcrumb">我的智脑</small><h1 id="pageTitle">智脑首页</h1></div><div class="spacer"></div><select id="projectSelect" aria-label="当前项目" disabled><option value="">尚未导入项目</option></select><button id="themeToggle" class="icon-button" title="切换浅色或深色主题" aria-label="切换主题"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="4"/><path d="M12 2v3M12 19v3M2 12h3M19 12h3"/></svg></button></header>
|
|
23
24
|
<div class="content">
|
|
24
25
|
<section class="view" id="view-home"><div class="welcome"><div><small>工作概览</small><h2 id="homeTitle">我的智脑</h2><p>需要处理的事项、待确认记忆和记忆组合,集中在一页。你的长期偏好,只在确认后使用。</p></div><div class="actions"><button data-action="import">导入项目</button></div></div><div id="homeContent"></div></section>
|
|
26
|
+
<!-- AI 团队页由独立工作流模块拥有;壳只做同源页面代理(/workflow-ui/)。
|
|
27
|
+
模块未安装时 iframe 显示模块自身的不可达说明,导航与其余页面不受影响。
|
|
28
|
+
(不加 hidden 属性:全局样式表有 [hidden]{display:none!important},
|
|
29
|
+
会压过 .module-view.active;默认隐藏由 .view{display:none} 承担。) -->
|
|
30
|
+
<section class="view module-view" id="view-team"><div class="frame-container"><iframe id="workflowFrame" title="AI 团队" referrerpolicy="same-origin"></iframe></div></section>
|
|
25
31
|
<!-- The workbench frame survives as a hidden service mount: provider
|
|
26
32
|
management and maintenance-model config still postMessage into it
|
|
27
33
|
from the system drawer, but it is no longer a navigation page. -->
|