@mentagen/mcp 0.8.0 → 0.8.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.
|
@@ -41,6 +41,16 @@ function stripHtml(html) {
|
|
|
41
41
|
.replace(/'/g, "'")
|
|
42
42
|
.trim();
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Format todos as markdown checkboxes.
|
|
46
|
+
*/
|
|
47
|
+
function formatTodos(todos) {
|
|
48
|
+
if (!todos || todos.length === 0)
|
|
49
|
+
return '';
|
|
50
|
+
const sorted = [...todos].sort((a, b) => a.order - b.order);
|
|
51
|
+
const lines = sorted.map(t => `- [${t.completed ? 'x' : ' '}] ${t.text}`);
|
|
52
|
+
return lines.join('\n');
|
|
53
|
+
}
|
|
44
54
|
/**
|
|
45
55
|
* Infer programming language from file extension.
|
|
46
56
|
*/
|
|
@@ -121,6 +131,7 @@ function formatContent(node) {
|
|
|
121
131
|
*/
|
|
122
132
|
function formatNodeSection(node, baseUrl, boardId) {
|
|
123
133
|
const content = formatContent(node);
|
|
134
|
+
const todos = formatTodos(node.todos);
|
|
124
135
|
const link = getNodeUrl(baseUrl, boardId, node._id);
|
|
125
136
|
const lines = [
|
|
126
137
|
`## ${node.name}`,
|
|
@@ -128,6 +139,12 @@ function formatNodeSection(node, baseUrl, boardId) {
|
|
|
128
139
|
'',
|
|
129
140
|
content,
|
|
130
141
|
];
|
|
142
|
+
// Add todos section if present
|
|
143
|
+
if (todos) {
|
|
144
|
+
if (content)
|
|
145
|
+
lines.push('', '### Todos', '');
|
|
146
|
+
lines.push(todos);
|
|
147
|
+
}
|
|
131
148
|
return lines.join('\n');
|
|
132
149
|
}
|
|
133
150
|
export async function handleExtractBoardContent(client, params, baseUrl) {
|
|
@@ -150,12 +167,13 @@ export async function handleExtractBoardContent(client, params, baseUrl) {
|
|
|
150
167
|
],
|
|
151
168
|
};
|
|
152
169
|
}
|
|
153
|
-
// Filter nodes based on content
|
|
170
|
+
// Filter nodes based on content or todos
|
|
154
171
|
const nodesWithContent = params.includeEmpty
|
|
155
172
|
? nodes
|
|
156
173
|
: nodes.filter(n => {
|
|
157
174
|
const content = getNodeContent(n);
|
|
158
|
-
|
|
175
|
+
const hasTodos = n.todos && n.todos.length > 0;
|
|
176
|
+
return (content && content.trim().length > 0) || hasTodos;
|
|
159
177
|
});
|
|
160
178
|
if (nodesWithContent.length === 0) {
|
|
161
179
|
return {
|
package/dist/tools/list-nodes.js
CHANGED
|
@@ -23,6 +23,13 @@ function truncateContent(content, maxLength) {
|
|
|
23
23
|
return ((lastSpace > maxLength * 0.7 ? truncated.slice(0, lastSpace) : truncated) +
|
|
24
24
|
'...');
|
|
25
25
|
}
|
|
26
|
+
/** Format todos as "completed/total" or empty string if no todos. */
|
|
27
|
+
function formatTodoCounts(todos) {
|
|
28
|
+
if (!todos || todos.length === 0)
|
|
29
|
+
return '';
|
|
30
|
+
const completed = todos.filter(t => t.completed).length;
|
|
31
|
+
return `${completed}/${todos.length}`;
|
|
32
|
+
}
|
|
26
33
|
function formatNodesTsv(nodes) {
|
|
27
34
|
const rows = nodes.map(n => ({
|
|
28
35
|
id: n._id,
|
|
@@ -33,6 +40,7 @@ function formatNodesTsv(nodes) {
|
|
|
33
40
|
width: pixelsToUnits(n.width),
|
|
34
41
|
height: pixelsToUnits(n.height),
|
|
35
42
|
content: truncateContent(n.content ?? null, MAX_CONTENT_LENGTH),
|
|
43
|
+
todos: formatTodoCounts(n.todos),
|
|
36
44
|
updatedAt: formatDate(n.updatedAt),
|
|
37
45
|
link: n.link,
|
|
38
46
|
}));
|
|
@@ -49,6 +57,7 @@ function formatNodesTsv(nodes) {
|
|
|
49
57
|
'width',
|
|
50
58
|
'height',
|
|
51
59
|
'content',
|
|
60
|
+
'todos',
|
|
52
61
|
'updatedAt',
|
|
53
62
|
'link',
|
|
54
63
|
],
|