@ppdocs/mcp 3.2.25 → 3.2.26
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/tools/flowchart.js +52 -16
- package/package.json +1 -1
package/dist/tools/flowchart.js
CHANGED
|
@@ -49,10 +49,15 @@ export function registerFlowchartTools(server, ctx) {
|
|
|
49
49
|
domain: z.string().optional().describe('update_node: 新领域'),
|
|
50
50
|
input: z.array(z.string()).optional().describe('update_node: 新输入 / bind的源代码文件'),
|
|
51
51
|
output: z.array(z.string()).optional().describe('update_node: 新输出'),
|
|
52
|
-
subFlowchart: z.string().optional().describe('update_node:
|
|
53
|
-
title: z.string().optional().describe('create_chart:
|
|
54
|
-
parentChart: z.string().optional().describe('create_chart:
|
|
55
|
-
parentNode: z.string().optional().describe('create_chart:
|
|
52
|
+
subFlowchart: z.string().optional().describe('update_node: bind sub-chart ID / auto-set on create_chart'),
|
|
53
|
+
title: z.string().optional().describe('create_chart: sub-chart title'),
|
|
54
|
+
parentChart: z.string().optional().describe('create_chart: parent chart ID (default main)'),
|
|
55
|
+
parentNode: z.string().optional().describe('create_chart: mount to parent node ID'),
|
|
56
|
+
// update_node: append doc entry
|
|
57
|
+
docSummary: z.string().optional().describe('update_node: doc summary (one-line)'),
|
|
58
|
+
docContent: z.string().optional().describe('update_node: doc content (full markdown)'),
|
|
59
|
+
// get_node: doc display control
|
|
60
|
+
fullDoc: z.boolean().optional().describe('get_node: show ALL doc entries in full (default false, only latest full)'),
|
|
56
61
|
// bind/unbind
|
|
57
62
|
files: z.array(z.string()).optional()
|
|
58
63
|
.describe('源代码文件路径 (bind/unbind)'),
|
|
@@ -132,15 +137,21 @@ export function registerFlowchartTools(server, ctx) {
|
|
|
132
137
|
if (target.lastUpdated)
|
|
133
138
|
lines.push(`🕐 最后更新: ${target.lastUpdated}`);
|
|
134
139
|
lines.push('');
|
|
135
|
-
// ========
|
|
136
|
-
if (showDoc && target.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
140
|
+
// ======== node doc entries ========
|
|
141
|
+
if (showDoc && target.docEntries?.length) {
|
|
142
|
+
const entries = target.docEntries;
|
|
143
|
+
const showFullAll = decoded.fullDoc === true;
|
|
144
|
+
lines.push(`### 📖 Node Documentation (${entries.length} entries)`);
|
|
145
|
+
for (let i = 0; i < entries.length; i++) {
|
|
146
|
+
const e = entries[i];
|
|
147
|
+
const isLatest = i === entries.length - 1;
|
|
148
|
+
if (isLatest || showFullAll) {
|
|
149
|
+
lines.push(`\n**${e.version}** (${e.date})${isLatest ? ' ★LATEST' : ''}`);
|
|
150
|
+
lines.push(`> ${e.summary}`);
|
|
151
|
+
lines.push(e.content);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
lines.push(` ${e.version} (${e.date}): ${e.summary}`);
|
|
144
155
|
}
|
|
145
156
|
}
|
|
146
157
|
lines.push('');
|
|
@@ -289,6 +300,29 @@ export function registerFlowchartTools(server, ctx) {
|
|
|
289
300
|
node.subFlowchart = decoded.subFlowchart;
|
|
290
301
|
changes.push('subFlowchart');
|
|
291
302
|
}
|
|
303
|
+
// append doc entry
|
|
304
|
+
if (decoded.docSummary || decoded.docContent) {
|
|
305
|
+
if (!decoded.docSummary || !decoded.docContent) {
|
|
306
|
+
return wrap('\u274c update_node: docSummary and docContent must both be provided');
|
|
307
|
+
}
|
|
308
|
+
const docEntries = node.docEntries || [];
|
|
309
|
+
// auto-increment version: v0.1, v0.2, ...
|
|
310
|
+
let nextVer = 0.1;
|
|
311
|
+
if (docEntries.length > 0) {
|
|
312
|
+
const lastVer = docEntries[docEntries.length - 1].version;
|
|
313
|
+
const num = parseFloat(lastVer.replace('v', ''));
|
|
314
|
+
if (!isNaN(num))
|
|
315
|
+
nextVer = Math.round((num + 0.1) * 10) / 10;
|
|
316
|
+
}
|
|
317
|
+
docEntries.push({
|
|
318
|
+
version: `v${nextVer.toFixed(1)}`,
|
|
319
|
+
date: new Date().toISOString(),
|
|
320
|
+
summary: decoded.docSummary,
|
|
321
|
+
content: decoded.docContent,
|
|
322
|
+
});
|
|
323
|
+
node.docEntries = docEntries;
|
|
324
|
+
changes.push(`docEntries(v${nextVer.toFixed(1)})`);
|
|
325
|
+
}
|
|
292
326
|
if (changes.length === 0)
|
|
293
327
|
return wrap('ℹ️ 无变更 — 请提供要更新的字段');
|
|
294
328
|
node.lastUpdated = new Date().toISOString();
|
|
@@ -324,8 +358,8 @@ export function registerFlowchartTools(server, ctx) {
|
|
|
324
358
|
boundTasks: [],
|
|
325
359
|
subFlowchart: n.subFlowchart || null,
|
|
326
360
|
position: null,
|
|
327
|
-
versions: [],
|
|
328
|
-
lastUpdated:
|
|
361
|
+
versions: [{ version: 'v1.0', date: new Date().toISOString(), changes: 'initial' }],
|
|
362
|
+
lastUpdated: new Date().toISOString(),
|
|
329
363
|
lastQueried: '',
|
|
330
364
|
}));
|
|
331
365
|
const fullEdges = (decoded.edges || []).map((e) => ({
|
|
@@ -516,7 +550,9 @@ export function registerFlowchartTools(server, ctx) {
|
|
|
516
550
|
input: n.input || [], output: n.output || [],
|
|
517
551
|
description: n.description || '', affiliation: n.affiliation || 'root',
|
|
518
552
|
boundDocs: [], boundFiles: [], boundDirs: [], boundTasks: [],
|
|
519
|
-
subFlowchart: null, position: null,
|
|
553
|
+
subFlowchart: null, position: null,
|
|
554
|
+
versions: [{ version: 'v1.0', date: new Date().toISOString(), changes: 'initial' }],
|
|
555
|
+
lastUpdated: new Date().toISOString(), lastQueried: '',
|
|
520
556
|
}));
|
|
521
557
|
}
|
|
522
558
|
if (decoded.edges && decoded.edges.length > 0) {
|