mindpm 1.2.34 → 1.2.35
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/index.js +14 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1109,15 +1109,16 @@ function registerTaskTools(server2) {
|
|
|
1109
1109
|
status: z2.enum(["todo", "in_progress", "blocked", "in_review", "done", "cancelled"]).optional().describe("Filter by status"),
|
|
1110
1110
|
priority: z2.enum(["critical", "high", "medium", "low"]).optional().describe("Filter by priority"),
|
|
1111
1111
|
tag: z2.string().optional().describe("Filter by tag"),
|
|
1112
|
-
include_done: z2.boolean().optional().describe("Include completed tasks (default: false)")
|
|
1112
|
+
include_done: z2.boolean().optional().describe("Include completed tasks (default: false)"),
|
|
1113
|
+
limit: z2.number().int().min(1).max(200).optional().describe("Max tasks to return (default: 50)"),
|
|
1114
|
+
offset: z2.number().int().min(0).optional().describe("Number of tasks to skip for pagination (default: 0)")
|
|
1113
1115
|
}
|
|
1114
1116
|
},
|
|
1115
|
-
async ({ project, status, priority, tag, include_done }) => {
|
|
1117
|
+
async ({ project, status, priority, tag, include_done, limit = 50, offset = 0 }) => {
|
|
1116
1118
|
const resolved = resolveProjectOrDefault(project);
|
|
1117
1119
|
if (!resolved) {
|
|
1118
1120
|
return { content: [{ type: "text", text: project ? `Project "${project}" not found.` : "No active projects found." }], isError: true };
|
|
1119
1121
|
}
|
|
1120
|
-
const sessionPreamble = maybeAutoSession(resolved.id);
|
|
1121
1122
|
const db2 = getDb();
|
|
1122
1123
|
const conditions = ["t.project_id = @projectId"];
|
|
1123
1124
|
const params = { projectId: resolved.id };
|
|
@@ -1135,15 +1136,18 @@ function registerTaskTools(server2) {
|
|
|
1135
1136
|
conditions.push("t.tags LIKE '%' || @tag || '%'");
|
|
1136
1137
|
params.tag = `"${tag}"`;
|
|
1137
1138
|
}
|
|
1138
|
-
const
|
|
1139
|
+
const whereClause = conditions.join(" AND ");
|
|
1140
|
+
const orderClause = `ORDER BY CASE t.priority WHEN 'critical' THEN 0 WHEN 'high' THEN 1 WHEN 'medium' THEN 2 WHEN 'low' THEN 3 END, t.created_at DESC`;
|
|
1141
|
+
const total = db2.prepare(`SELECT COUNT(*) as n FROM tasks t WHERE ${whereClause}`).get(params).n;
|
|
1142
|
+
const sql = `SELECT t.id, t.seq, t.title, t.status, t.priority, t.tags, t.parent_task_id, t.blocked_by, t.created_at, p.slug || '-' || t.seq AS short_id FROM tasks t JOIN projects p ON t.project_id = p.id WHERE ${whereClause} ${orderClause} LIMIT ${limit} OFFSET ${offset}`;
|
|
1139
1143
|
const rows = db2.prepare(sql).all(params);
|
|
1140
|
-
const
|
|
1144
|
+
const tasks = rows.map((row) => Object.fromEntries(Object.entries(row).filter(([, v]) => v != null)));
|
|
1145
|
+
const hasMore = offset + tasks.length < total;
|
|
1146
|
+
const header = hasMore ? `Showing ${offset + 1}\u2013${offset + tasks.length} of ${total} tasks. Use limit/offset or filters to paginate.
|
|
1147
|
+
` : "";
|
|
1148
|
+
const resultText = header + JSON.stringify({ project: resolved.name, total, limit, offset, tasks });
|
|
1141
1149
|
return {
|
|
1142
|
-
content: [{ type: "text", text:
|
|
1143
|
-
|
|
1144
|
-
---
|
|
1145
|
-
|
|
1146
|
-
${resultText}` : resultText }]
|
|
1150
|
+
content: [{ type: "text", text: resultText }]
|
|
1147
1151
|
};
|
|
1148
1152
|
}
|
|
1149
1153
|
);
|