@ppdocs/mcp 3.12.0 → 3.13.1

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.
Files changed (51) hide show
  1. package/README.md +18 -15
  2. package/dist/cli.js +56 -41
  3. package/dist/config.d.ts +23 -3
  4. package/dist/config.js +94 -36
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.js +45 -17
  7. package/dist/retainedCoreMatrix.d.ts +19 -0
  8. package/dist/retainedCoreMatrix.js +40 -0
  9. package/dist/storage/httpClient.d.ts +6 -75
  10. package/dist/storage/httpClient.js +5 -177
  11. package/dist/storage/types.d.ts +0 -35
  12. package/dist/tools/analyzer.d.ts +1 -4
  13. package/dist/tools/analyzer.js +4 -7
  14. package/dist/tools/flowchart.js +1 -4
  15. package/dist/tools/index.d.ts +8 -10
  16. package/dist/tools/index.js +8 -32
  17. package/dist/tools/kg_status.d.ts +1 -1
  18. package/dist/tools/kg_status.js +4 -6
  19. package/dist/tools/refs.js +38 -172
  20. package/dist/tools/shared.d.ts +2 -2
  21. package/dist/tools/shared.js +1 -1
  22. package/dist/tools/tasks.d.ts +1 -2
  23. package/dist/tools/tasks.js +32 -47
  24. package/dist/tools/workflow.js +2 -3
  25. package/package.json +1 -1
  26. package/templates/AGENT.md +2 -5
  27. package/templates/README.md +0 -0
  28. package/templates/commands/init.md +0 -0
  29. package/templates/commands/pp/Zero_Defec_Genesis.md +0 -0
  30. package/templates/commands/pp/diagnose.md +0 -0
  31. package/templates/commands/pp/init.md +2 -1
  32. package/templates/commands/pp/review.md +0 -0
  33. package/templates/commands/pp/sync.md +2 -1
  34. package/templates/cursorrules.md +2 -5
  35. package/templates/hooks/SystemPrompt.md +1 -1
  36. package/templates/hooks/hook.py +0 -0
  37. package/templates/kiro-rules/ppdocs.md +2 -5
  38. package/dist/tools/discussion.d.ts +0 -15
  39. package/dist/tools/discussion.js +0 -264
  40. package/dist/tools/doc_query.d.ts +0 -10
  41. package/dist/tools/doc_query.js +0 -185
  42. package/dist/tools/files.d.ts +0 -6
  43. package/dist/tools/files.js +0 -107
  44. package/dist/tools/init.d.ts +0 -12
  45. package/dist/tools/init.js +0 -89
  46. package/dist/tools/meeting.d.ts +0 -7
  47. package/dist/tools/meeting.js +0 -97
  48. package/dist/tools/pitfalls.d.ts +0 -6
  49. package/dist/tools/pitfalls.js +0 -190
  50. package/dist/tools/projects.d.ts +0 -7
  51. package/dist/tools/projects.js +0 -19
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * API URL 格式: http://localhost:20099/api/:projectId/:password/...
6
6
  */
7
- import type { Task, TaskSummary, TaskLogType, TaskExperience, FileInfo, WorkflowSummary, WorkflowDoc, WorkflowSelector, Reference, FetchResult, FileImportResult, Pitfall, PitfallSummary } from './types.js';
7
+ import type { Task, TaskSummary, TaskLogType, TaskExperience, FileInfo, WorkflowSummary, WorkflowDoc, WorkflowSelector, Reference, FetchResult } from './types.js';
8
8
  export declare class PpdocsApiClient {
9
9
  private baseUrl;
10
10
  private serverUrl;
@@ -26,32 +26,9 @@ export declare class PpdocsApiClient {
26
26
  deleteWorkflow(workflowId: string, scope: 'global' | 'project'): Promise<boolean>;
27
27
  listReferences(): Promise<Reference[]>;
28
28
  getReference(refId: string): Promise<Reference | null>;
29
- saveReference(reference: Reference): Promise<boolean>;
30
29
  deleteReference(refId: string): Promise<boolean>;
31
- readReferenceFile(path: string): Promise<string>;
32
- /** 复制本地文件到参考文件库, 返回相对路径列表 */
33
- copyReferenceFiles(paths: string[], targetDir?: string): Promise<string[]>;
34
30
  /** 从 URL 拉取文档内容并保存为参考 */
35
31
  fetchRefUrl(url: string, refId?: string): Promise<FetchResult>;
36
- /** 导入本地文件内容到参考系统 */
37
- importLocalFile(refId: string, sourcePath: string): Promise<FileImportResult>;
38
- listPitfalls(): Promise<PitfallSummary[]>;
39
- getPitfall(pitfallId: string): Promise<Pitfall | null>;
40
- createPitfall(input: {
41
- title: string;
42
- category?: string;
43
- symptom?: string;
44
- root_cause?: string;
45
- solution?: string;
46
- prevention?: string;
47
- severity?: string;
48
- related_nodes?: string[];
49
- source_task?: string;
50
- tags?: string[];
51
- }): Promise<Pitfall>;
52
- savePitfall(pitfall: Pitfall): Promise<boolean>;
53
- deletePitfall(pitfallId: string): Promise<boolean>;
54
- searchPitfalls(query: string, status?: string, category?: string): Promise<PitfallSummary[]>;
55
32
  listTasks(status?: 'active' | 'archived'): Promise<TaskSummary[]>;
56
33
  getTask(taskId: string, mode?: 'smart' | 'full'): Promise<Task | null>;
57
34
  createTask(task: {
@@ -74,31 +51,6 @@ export declare class PpdocsApiClient {
74
51
  deleteFlowchart(chartId: string): Promise<unknown>;
75
52
  getFlowchartOrphans(): Promise<unknown[]>;
76
53
  getFlowchartHealth(): Promise<unknown[]>;
77
- /** 列出所有可访问的项目 */
78
- crossListProjects(): Promise<{
79
- id: string;
80
- name: string;
81
- description: string;
82
- updatedAt: string;
83
- }[]>;
84
- /** 列出项目文件 */
85
- listFiles(dir?: string): Promise<FileInfo[]>;
86
- /** 读取项目文件 */
87
- readFile(filePath: string): Promise<string>;
88
- /** 下载项目文件或目录 (zip) → 自动解压到指定目录或 temp 目录 */
89
- download(remotePath: string, localPath?: string): Promise<{
90
- localPath: string;
91
- fileCount: number;
92
- }>;
93
- /** 跨项目: 列出文件 */
94
- crossListFiles(target: string, dir?: string): Promise<FileInfo[]>;
95
- /** 跨项目: 读取文件 */
96
- crossReadFile(target: string, filePath: string): Promise<string>;
97
- /** 跨项目: 下载文件或目录 */
98
- crossDownload(target: string, remotePath: string, localPath?: string): Promise<{
99
- localPath: string;
100
- fileCount: number;
101
- }>;
102
54
  /** 扫描项目代码, 构建/更新索引 */
103
55
  analyzerScan(projectPath: string, force?: boolean): Promise<unknown>;
104
56
  /** 智能上下文: 代码+文档+规则+任务全关联 */
@@ -106,26 +58,6 @@ export declare class PpdocsApiClient {
106
58
  /** 全关联路径: 两个符号之间的代码+文档路径 */
107
59
  analyzerFullPath(projectPath: string, symbolA: string, symbolB: string, maxDepth?: number): Promise<unknown>;
108
60
  private publicRequest;
109
- /** 列出活跃讨论 (公开路由) */
110
- discussionList(): Promise<unknown>;
111
- /** 创建讨论 (公开路由) */
112
- discussionCreate(title: string, initiator: string, participants: string[], content: string, msgSummary?: string): Promise<{
113
- id: string;
114
- }>;
115
- /** 批量读取讨论 (公开路由, 支持已读追踪) */
116
- discussionReadByIds(ids: string[], reader?: string, mode?: string): Promise<unknown>;
117
- /** 列出所有讨论 (含历史, 按参与方筛选) */
118
- discussionListAll(participant?: string): Promise<unknown>;
119
- /** 回复讨论 (公开路由) */
120
- discussionReply(id: string, sender: string, content: string, msgSummary?: string, newSummary?: string): Promise<boolean>;
121
- /** 完成讨论 (公开路由, 标记为 completed) */
122
- discussionComplete(id: string): Promise<boolean>;
123
- /** 归档关闭讨论 (需项目认证) */
124
- discussionClose(id: string, conclusion: string): Promise<{
125
- archived_path?: string;
126
- }>;
127
- /** 删除讨论 (公开路由) */
128
- discussionDelete(id: string): Promise<boolean>;
129
61
  /** 列出公共文件 */
130
62
  publicFilesList(dir?: string): Promise<FileInfo[]>;
131
63
  /** 读取公共文件 (文本) */
@@ -141,12 +73,11 @@ export declare class PpdocsApiClient {
141
73
  localPath: string;
142
74
  fileCount: number;
143
75
  }>;
144
- meetingJoin(agentId: string, agentType: string): Promise<unknown>;
145
- meetingLeave(agentId: string): Promise<unknown>;
146
- meetingPost(agentId: string, content: string, msgType?: string): Promise<unknown>;
147
- meetingClaim(agentId: string, filePath: string): Promise<unknown>;
148
- meetingRelease(agentId: string, filePath: string): Promise<unknown>;
149
- meetingStatus(): Promise<unknown>;
76
+ crossListFiles(targetProjectId: string): Promise<FileInfo[]>;
77
+ crossDownload(targetProjectId: string, remotePath: string, localPath?: string): Promise<{
78
+ localPath: string;
79
+ fileCount: number;
80
+ }>;
150
81
  }
151
82
  export declare function initClient(apiUrl: string): void;
152
83
  export declare function getClient(): PpdocsApiClient;
@@ -146,28 +146,11 @@ export class PpdocsApiClient {
146
146
  return null;
147
147
  }
148
148
  }
149
- async saveReference(reference) {
150
- await this.request(`/refs/${encodeURIComponent(reference.id)}`, {
151
- method: 'PUT',
152
- body: JSON.stringify(reference),
153
- });
154
- return true;
155
- }
156
149
  async deleteReference(refId) {
157
150
  return this.request(`/refs/${encodeURIComponent(refId)}`, {
158
151
  method: 'DELETE',
159
152
  });
160
153
  }
161
- async readReferenceFile(path) {
162
- return this.request(`/refs/files/${cleanPath(path)}`);
163
- }
164
- /** 复制本地文件到参考文件库, 返回相对路径列表 */
165
- async copyReferenceFiles(paths, targetDir = '.') {
166
- return this.request('/refs/copy-in', {
167
- method: 'POST',
168
- body: JSON.stringify({ paths, target_dir: targetDir }),
169
- });
170
- }
171
154
  /** 从 URL 拉取文档内容并保存为参考 */
172
155
  async fetchRefUrl(url, refId) {
173
156
  return this.request('/refs/fetch-url', {
@@ -175,49 +158,6 @@ export class PpdocsApiClient {
175
158
  body: JSON.stringify({ url, ref_id: refId }),
176
159
  });
177
160
  }
178
- /** 导入本地文件内容到参考系统 */
179
- async importLocalFile(refId, sourcePath) {
180
- return this.request('/refs/import-file', {
181
- method: 'POST',
182
- body: JSON.stringify({ ref_id: refId, source_path: sourcePath }),
183
- });
184
- }
185
- // ============ 踩坑经验 API ============
186
- async listPitfalls() {
187
- return this.request('/pitfalls');
188
- }
189
- async getPitfall(pitfallId) {
190
- try {
191
- return await this.request(`/pitfalls/${encodeURIComponent(pitfallId)}`);
192
- }
193
- catch {
194
- return null;
195
- }
196
- }
197
- async createPitfall(input) {
198
- return this.request('/pitfalls', {
199
- method: 'POST',
200
- body: JSON.stringify(input),
201
- });
202
- }
203
- async savePitfall(pitfall) {
204
- await this.request(`/pitfalls/${encodeURIComponent(pitfall.id)}`, {
205
- method: 'PUT',
206
- body: JSON.stringify(pitfall),
207
- });
208
- return true;
209
- }
210
- async deletePitfall(pitfallId) {
211
- return this.request(`/pitfalls/${encodeURIComponent(pitfallId)}`, {
212
- method: 'DELETE',
213
- });
214
- }
215
- async searchPitfalls(query, status, category) {
216
- return this.request('/pitfalls/search', {
217
- method: 'POST',
218
- body: JSON.stringify({ query, status, category }),
219
- });
220
- }
221
161
  // ============ 任务管理 ============
222
162
  async listTasks(status) {
223
163
  const query = status ? `?status=${status}` : '';
@@ -330,39 +270,6 @@ export class PpdocsApiClient {
330
270
  async getFlowchartHealth() {
331
271
  return this.request('/flowcharts/health');
332
272
  }
333
- // ============ 跨项目只读访问 ============
334
- /** 列出所有可访问的项目 */
335
- async crossListProjects() {
336
- return this.request('/cross/projects');
337
- }
338
- // ============ 项目文件访问 ============
339
- /** 列出项目文件 */
340
- async listFiles(dir) {
341
- const query = dir ? `?dir=${encodeURIComponent(dir)}` : '';
342
- return this.request(`/files${query}`);
343
- }
344
- /** 读取项目文件 */
345
- async readFile(filePath) {
346
- return this.request(`/files/${cleanPath(filePath)}`);
347
- }
348
- /** 下载项目文件或目录 (zip) → 自动解压到指定目录或 temp 目录 */
349
- async download(remotePath, localPath) {
350
- return fetchAndExtractZip(`${this.baseUrl}/files-download/${cleanPath(remotePath)}`, localPath);
351
- }
352
- // ============ 跨项目文件访问 (只读) ============
353
- /** 跨项目: 列出文件 */
354
- async crossListFiles(target, dir) {
355
- const query = dir ? `?dir=${encodeURIComponent(dir)}` : '';
356
- return this.request(`/cross/${encodeURIComponent(target)}/files${query}`);
357
- }
358
- /** 跨项目: 读取文件 */
359
- async crossReadFile(target, filePath) {
360
- return this.request(`/cross/${encodeURIComponent(target)}/files/${cleanPath(filePath)}`);
361
- }
362
- /** 跨项目: 下载文件或目录 */
363
- async crossDownload(target, remotePath, localPath) {
364
- return fetchAndExtractZip(`${this.baseUrl}/cross/${encodeURIComponent(target)}/files-download/${cleanPath(remotePath)}`, localPath);
365
- }
366
273
  // ============ 代码分析引擎 ============
367
274
  /** 扫描项目代码, 构建/更新索引 */
368
275
  async analyzerScan(projectPath, force = false) {
@@ -400,58 +307,6 @@ export class PpdocsApiClient {
400
307
  throw new Error(json.error || 'Unknown error');
401
308
  return json.data;
402
309
  }
403
- // ============ 讨论系统 ============
404
- /** 列出活跃讨论 (公开路由) */
405
- async discussionList() {
406
- return this.publicRequest('/api/discussions');
407
- }
408
- /** 创建讨论 (公开路由) */
409
- async discussionCreate(title, initiator, participants, content, msgSummary) {
410
- return this.publicRequest('/api/discussions', {
411
- method: 'POST',
412
- body: JSON.stringify({ title, initiator, participants, content, msg_summary: msgSummary }),
413
- });
414
- }
415
- /** 批量读取讨论 (公开路由, 支持已读追踪) */
416
- async discussionReadByIds(ids, reader, mode) {
417
- return this.publicRequest('/api/discussions/read', {
418
- method: 'POST',
419
- body: JSON.stringify({ ids, reader, mode }),
420
- });
421
- }
422
- /** 列出所有讨论 (含历史, 按参与方筛选) */
423
- async discussionListAll(participant) {
424
- return this.publicRequest('/api/discussions/all', {
425
- method: 'POST',
426
- body: JSON.stringify({ participant }),
427
- });
428
- }
429
- /** 回复讨论 (公开路由) */
430
- async discussionReply(id, sender, content, msgSummary, newSummary) {
431
- return this.publicRequest(`/api/discussions/${encodeURIComponent(id)}/reply`, {
432
- method: 'POST',
433
- body: JSON.stringify({ sender, content, msg_summary: msgSummary, new_summary: newSummary }),
434
- });
435
- }
436
- /** 完成讨论 (公开路由, 标记为 completed) */
437
- async discussionComplete(id) {
438
- return this.publicRequest(`/api/discussions/${encodeURIComponent(id)}/complete`, {
439
- method: 'POST',
440
- });
441
- }
442
- /** 归档关闭讨论 (需项目认证) */
443
- async discussionClose(id, conclusion) {
444
- return this.request(`/discussions/${encodeURIComponent(id)}/close`, {
445
- method: 'POST',
446
- body: JSON.stringify({ conclusion }),
447
- });
448
- }
449
- /** 删除讨论 (公开路由) */
450
- async discussionDelete(id) {
451
- return this.publicRequest(`/api/discussions/${encodeURIComponent(id)}`, {
452
- method: 'DELETE',
453
- });
454
- }
455
310
  // ============ 公共文件池 ============
456
311
  /** 列出公共文件 */
457
312
  async publicFilesList(dir) {
@@ -486,39 +341,12 @@ export class PpdocsApiClient {
486
341
  async publicFilesDownload(remotePath, localPath) {
487
342
  return fetchAndExtractZip(`${this.serverUrl}/api/public-files/download/${cleanPath(remotePath)}`, localPath);
488
343
  }
489
- // ============ 多AI协作会议 ============
490
- async meetingJoin(agentId, agentType) {
491
- return this.request('/meeting/join', {
492
- method: 'POST',
493
- body: JSON.stringify({ agent_id: agentId, agent_type: agentType }),
494
- });
495
- }
496
- async meetingLeave(agentId) {
497
- return this.request('/meeting/leave', {
498
- method: 'POST',
499
- body: JSON.stringify({ agent_id: agentId }),
500
- });
501
- }
502
- async meetingPost(agentId, content, msgType = 'status') {
503
- return this.request('/meeting/post', {
504
- method: 'POST',
505
- body: JSON.stringify({ agent_id: agentId, content, msg_type: msgType }),
506
- });
507
- }
508
- async meetingClaim(agentId, filePath) {
509
- return this.request('/meeting/claim', {
510
- method: 'POST',
511
- body: JSON.stringify({ agent_id: agentId, file_path: filePath }),
512
- });
513
- }
514
- async meetingRelease(agentId, filePath) {
515
- return this.request('/meeting/release', {
516
- method: 'POST',
517
- body: JSON.stringify({ agent_id: agentId, file_path: filePath }),
518
- });
344
+ // ============ 跨项目文件 (CLI 模板拉取保留能力) ============
345
+ async crossListFiles(targetProjectId) {
346
+ return this.request(`/cross/${encodeURIComponent(targetProjectId)}/files`);
519
347
  }
520
- async meetingStatus() {
521
- return this.request('/meeting/status');
348
+ async crossDownload(targetProjectId, remotePath, localPath) {
349
+ return fetchAndExtractZip(`${this.baseUrl}/cross/${encodeURIComponent(targetProjectId)}/files-download/${cleanPath(remotePath)}`, localPath);
522
350
  }
523
351
  }
524
352
  // ============ 模块级 API ============
@@ -73,14 +73,6 @@ export interface FileImportRecord {
73
73
  contentPreview: string;
74
74
  fileType: string;
75
75
  }
76
- export interface FileImportResult {
77
- refId: string;
78
- sourcePath: string;
79
- storedFile: string;
80
- contentLength: number;
81
- contentPreview: string;
82
- importCount: number;
83
- }
84
76
  export interface FileInfo {
85
77
  name: string;
86
78
  path: string;
@@ -130,30 +122,3 @@ export interface TaskSummary {
130
122
  updated_at: string;
131
123
  last_log?: string;
132
124
  }
133
- export interface Pitfall {
134
- id: string;
135
- title: string;
136
- category: string;
137
- symptom: string;
138
- root_cause: string;
139
- solution: string;
140
- prevention: string;
141
- related_nodes: string[];
142
- source_task?: string;
143
- severity: string;
144
- status: string;
145
- tags: string[];
146
- created_at: string;
147
- updated_at: string;
148
- resolved_at?: string;
149
- }
150
- export interface PitfallSummary {
151
- id: string;
152
- title: string;
153
- category: string;
154
- severity: string;
155
- status: string;
156
- tags: string[];
157
- created_at: string;
158
- updated_at: string;
159
- }
@@ -1,9 +1,6 @@
1
1
  /**
2
- * 代码分析引擎工具 (3个)
2
+ * 代码分析引擎工具
3
3
  * code_scan, code_smart_context, code_full_path
4
- *
5
- * code_smart_context: 代码+KG文档/工作流全关联 (含影响范围)
6
- * code_full_path: 两点间代码链路+共享KG文档
7
4
  */
8
5
  import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
9
6
  import { type McpContext } from './shared.js';
@@ -1,9 +1,6 @@
1
1
  /**
2
- * 代码分析引擎工具 (3个)
2
+ * 代码分析引擎工具
3
3
  * code_scan, code_smart_context, code_full_path
4
- *
5
- * code_smart_context: 代码+KG文档/工作流全关联 (含影响范围)
6
- * code_full_path: 两点间代码链路+共享KG文档
7
4
  */
8
5
  import { z } from 'zod';
9
6
  import { getClient } from '../storage/httpClient.js';
@@ -17,7 +14,7 @@ const SYMBOL_ICONS = {
17
14
  export function registerAnalyzerTools(server, ctx) {
18
15
  const client = () => getClient();
19
16
  // ===== code_scan: 扫描项目代码 =====
20
- server.tool('code_scan', '📡 扫描项目代码, 构建索引。返回文件数、符号数、语言统计。★首次使用 code_smart_context/code_full_path 前必须先执行★', {
17
+ server.tool('code_scan', '扫描项目代码并构建索引。返回文件数、符号数、语言统计。首次使用 code_smart_context/code_full_path 前需先执行', {
21
18
  projectPath: z.string().optional().describe('项目源码的绝对路径(如"D:/projects/myapp")。不传则自动从Beacon同步目录或项目配置解析'),
22
19
  force: z.boolean().optional().describe('是否强制全量重建(默认false, 增量更新)'),
23
20
  }, async (args) => safeTool(async () => {
@@ -33,7 +30,7 @@ export function registerAnalyzerTools(server, ctx) {
33
30
  ].join('\n'));
34
31
  }));
35
32
  // ===== code_smart_context: 代码+文档全关联上下文 =====
36
- server.tool('code_smart_context', '🔍 代码+文档全关联上下文 — 输入一个函数名,一次调用返回:代码依赖、关联文档、匹配工作流、活跃任务、影响范围摘要。需先运行 code_scan', {
33
+ server.tool('code_smart_context', '代码+文档全关联上下文。输入函数名,返回代码依赖、关联文档、匹配工作流、活跃任务、影响范围。需先运行 code_scan', {
37
34
  projectPath: z.string().optional().describe('项目源码的绝对路径(不传则自动解析)'),
38
35
  symbolName: z.string().describe('要查询的符号名称(如"handleLogin", "AuthService")'),
39
36
  }, async (args) => safeTool(async () => {
@@ -94,7 +91,7 @@ export function registerAnalyzerTools(server, ctx) {
94
91
  return wrap(lines.join('\n'));
95
92
  }));
96
93
  // ===== code_full_path: 全关联路径 =====
97
- server.tool('code_full_path', '🔗 全关联路径 — 两个符号之间不仅返回代码引用链路,还返回共享的KG文档、共同导入、祖先模块。需先运行 code_scan', {
94
+ server.tool('code_full_path', '全关联路径。查找两个符号之间的代码引用链路、共享KG文档、共同导入。需先运行 code_scan', {
98
95
  projectPath: z.string().optional().describe('项目源码的绝对路径(不传则自动解析)'),
99
96
  symbolA: z.string().describe('起点符号名(如 "handleLogin")'),
100
97
  symbolB: z.string().describe('终点符号名(如 "AuthService")'),
@@ -317,10 +317,7 @@ function findDirectedPath(chart, fromId, toId) {
317
317
  }
318
318
  export function registerFlowchartTools(server, _ctx) {
319
319
  const client = () => getClient();
320
- server.tool('kg_flowchart', '🔀 逻辑流程图 — 项目知识图谱的核心。每个节点代表一个模块/函数/概念,节点可绑定文件、内嵌版本化文档。\n' +
321
- '★★ 编码前必须先设计:用 batch_add/update_node 在流程图中设计逻辑并验证每个节点正确后才能编码。执行 kg_workflow(id:"design-first") 查看完整工作流 ★★\n' +
322
- '⚡ 开始任何任务前必须先查图谱:search 搜关键词 → get_node 看详情 → 有 subFlowchart 则递归下探。\n' +
323
- '📝 完成修改后必须回写:bind 绑定文件 → update_node 更新描述和文档 → 新模块用 batch_add。\n' +
320
+ server.tool('kg_flowchart', '知识图谱核心。查询/更新流程图节点、关系、绑定文件和内嵌文档。' +
324
321
  'actions: list|get|search|get_relations|find_path|get_node|update_node|delete_node|batch_add|bind|unbind|orphans|health|create_chart|delete_chart', {
325
322
  action: z
326
323
  .enum(['list', 'get', 'search', 'get_relations', 'find_path', 'get_node', 'update_node', 'delete_node', 'batch_add', 'bind', 'unbind', 'orphans', 'health', 'create_chart', 'delete_chart'])
@@ -1,15 +1,13 @@
1
1
  /**
2
2
  * MCP 工具注册入口
3
- * 15 个工具, 9 个子模块
3
+ * 保留工具注册入口
4
4
  *
5
- * 🔗 初始化: kg_init (1个)
6
- * 📊 导航: kg_status (1个)
7
- * 📚 知识: kg_projects, kg_workflow (2个)
8
- * 📝 工作流: kg_task(任务记录), kg_files, kg_discuss(讨论区), kg_ref, kg_pitfall (5个)
9
- * 🔀 关系核心: kg_flowchart(逻辑流程图 — 关系型知识锚点) (1个)
10
- * 📘 文档查询: kg_doc(节点文档搜索/阅读/历史) (1个)
11
- * 🔬 代码分析: code_scan, code_smart_context, code_full_path (3个)
12
- * 🏛️ 协作: kg_meeting (1个)
5
+ * kg_status — 仪表盘
6
+ * kg_flowchart — 知识图谱核心
7
+ * kg_workflow — AI 工作流
8
+ * kg_task 任务管理
9
+ * kg_ref — 外部参考 (fetch/list/get/delete)
10
+ * code_scan/code_smart_context/code_full_path 代码分析 (可选)
13
11
  */
14
12
  import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
15
- export declare function registerTools(server: McpServer, projectId: string, user: string, agentId: string, onProjectChange?: (newProjectId: string, newApiUrl: string) => void): void;
13
+ export declare function registerTools(server: McpServer, projectId: string, user: string, agentId: string): void;
@@ -1,51 +1,27 @@
1
1
  /**
2
2
  * MCP 工具注册入口
3
- * 15 个工具, 9 个子模块
3
+ * 保留工具注册入口
4
4
  *
5
- * 🔗 初始化: kg_init (1个)
6
- * 📊 导航: kg_status (1个)
7
- * 📚 知识: kg_projects, kg_workflow (2个)
8
- * 📝 工作流: kg_task(任务记录), kg_files, kg_discuss(讨论区), kg_ref, kg_pitfall (5个)
9
- * 🔀 关系核心: kg_flowchart(逻辑流程图 — 关系型知识锚点) (1个)
10
- * 📘 文档查询: kg_doc(节点文档搜索/阅读/历史) (1个)
11
- * 🔬 代码分析: code_scan, code_smart_context, code_full_path (3个)
12
- * 🏛️ 协作: kg_meeting (1个)
5
+ * kg_status — 仪表盘
6
+ * kg_flowchart — 知识图谱核心
7
+ * kg_workflow — AI 工作流
8
+ * kg_task 任务管理
9
+ * kg_ref — 外部参考 (fetch/list/get/delete)
10
+ * code_scan/code_smart_context/code_full_path 代码分析 (可选)
13
11
  */
14
12
  import { createContext } from './shared.js';
15
- import { registerInitTool } from './init.js';
16
13
  import { registerStatusTool } from './kg_status.js';
17
- import { registerProjectTools } from './projects.js';
18
14
  import { registerWorkflowTools } from './workflow.js';
19
15
  import { registerTaskTools } from './tasks.js';
20
- import { registerFileTools } from './files.js';
21
- import { registerDiscussionTools } from './discussion.js';
22
16
  import { registerReferenceTools } from './refs.js';
23
- import { registerPitfallTools } from './pitfalls.js';
24
17
  import { registerAnalyzerTools } from './analyzer.js';
25
- import { registerMeetingTools } from './meeting.js';
26
18
  import { registerFlowchartTools } from './flowchart.js';
27
- import { registerDocQueryTools } from './doc_query.js';
28
- export function registerTools(server, projectId, user, agentId, onProjectChange) {
19
+ export function registerTools(server, projectId, user, agentId) {
29
20
  const ctx = createContext(projectId, user, agentId);
30
- // 🔗 初始化
31
- registerInitTool(server, ctx, onProjectChange || (() => { }));
32
- // 📊 导航
33
21
  registerStatusTool(server, ctx);
34
- // 📚 知识
35
- registerProjectTools(server, ctx);
36
22
  registerWorkflowTools(server, ctx);
37
- // 📝 工作流
38
23
  registerTaskTools(server, ctx);
39
- registerFileTools(server);
40
- registerDiscussionTools(server, ctx);
41
24
  registerReferenceTools(server);
42
- registerPitfallTools(server);
43
- // 🔬 代码分析
44
25
  registerAnalyzerTools(server, ctx);
45
- // 🏛️ 多AI协作
46
- registerMeetingTools(server, ctx);
47
- // 🔀 流程图
48
26
  registerFlowchartTools(server, ctx);
49
- // 📘 文档查询
50
- registerDocQueryTools(server, ctx);
51
27
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 📊 kg_status — 项目速览仪表盘
2
+ * kg_status — 项目速览仪表盘
3
3
  * 一次调用返回项目全貌:摘要、核心模块、活跃任务、快速导航
4
4
  */
5
5
  import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
@@ -1,20 +1,18 @@
1
1
  /**
2
- * 📊 kg_status — 项目速览仪表盘
2
+ * kg_status — 项目速览仪表盘
3
3
  * 一次调用返回项目全貌:摘要、核心模块、活跃任务、快速导航
4
4
  */
5
5
  import { getClient } from '../storage/httpClient.js';
6
6
  import { wrap, safeTool } from './shared.js';
7
7
  export function registerStatusTool(server, ctx) {
8
8
  const client = () => getClient();
9
- server.tool('kg_status', '📊 项目速览仪表盘 — 一键了解项目健康。返回: 流程图节点数、活跃任务数、最近变更。每次对话开始建议首先调用', {}, async () => safeTool(async () => {
10
- const [charts, activeTasks, discussions, mainChart] = await Promise.all([
9
+ server.tool('kg_status', '项目速览仪表盘。返回流程图节点数、活跃任务数、最近变更。每次对话开始建议首先调用', {}, async () => safeTool(async () => {
10
+ const [charts, activeTasks, mainChart] = await Promise.all([
11
11
  client().listFlowcharts(),
12
12
  client().listTasks('active'),
13
- client().discussionList().catch(() => []),
14
13
  client().getFlowchart('main').catch(() => null),
15
14
  ]);
16
15
  const nodeCount = charts.reduce((sum, c) => sum + (c.nodeCount || 0), 0);
17
- const activeDiscussions = discussions.filter((d) => d.status === 'active');
18
16
  const lines = [
19
17
  `# 项目速览 [${ctx.projectId}]`,
20
18
  `身份: ${ctx.user}:${ctx.agentId}`,
@@ -42,7 +40,7 @@ export function registerStatusTool(server, ctx) {
42
40
  }
43
41
  }
44
42
  // --- 当前状态 ---
45
- lines.push('', '## 当前状态', `- 流程图: ${charts.length} 张 | 节点: ${nodeCount} 个`, `- 活跃任务: ${activeTasks.length} 个`, `- 活跃讨论: ${activeDiscussions.length} 个`);
43
+ lines.push('', '## 当前状态', `- 流程图: ${charts.length} 张 | 节点: ${nodeCount} 个`, `- 活跃任务: ${activeTasks.length} 个`);
46
44
  if (activeTasks.length > 0) {
47
45
  lines.push('', '### 进行中的任务');
48
46
  for (const t of activeTasks.slice(0, 5)) {