@qzoft/check-list 1.0.5 → 1.0.7
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/server.js +19 -11
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -46,20 +46,28 @@ registerAppResource(server, 'Task Checklist', uiResourceUri, { description: 'Int
|
|
|
46
46
|
registerAppTool(server, 'list_tasks', {
|
|
47
47
|
description: 'Discover and display checklists from markdown files in the project. When the user asks to see tasks in a specific file (e.g. "show my tasks in now.md"), pass the filename as the `file` parameter. When no file is specified, all markdown files are scanned.',
|
|
48
48
|
inputSchema: {
|
|
49
|
-
file: z.string().optional().describe('Optional
|
|
49
|
+
file: z.string().optional().describe('Optional path to a specific markdown file. Can be an absolute path (e.g. "C:/Users/me/project/tasks.md") or a relative path resolved against the project directory (e.g. "now.md"). Omit to show tasks from all markdown files.'),
|
|
50
50
|
},
|
|
51
51
|
_meta: { ui: { resourceUri: uiResourceUri } },
|
|
52
52
|
}, async ({ file }) => {
|
|
53
53
|
let mdFiles;
|
|
54
54
|
if (file) {
|
|
55
|
-
// Single-file mode: resolve
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (!
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
// Single-file mode: resolve the path (absolute paths stay as-is, relative resolve against projectDir)
|
|
56
|
+
let resolved = path.isAbsolute(file) ? path.resolve(file) : path.resolve(projectDir, file);
|
|
57
|
+
// If the resolved path doesn't exist, try to find the file by name in the project
|
|
58
|
+
if (!fs.existsSync(resolved)) {
|
|
59
|
+
const basename = path.basename(file);
|
|
60
|
+
try {
|
|
61
|
+
const allMd = await discoverMarkdownFiles(projectDir);
|
|
62
|
+
const match = allMd.find(f => path.basename(f) === basename)
|
|
63
|
+
|| allMd.find(f => f.endsWith(file.replace(/\//g, path.sep)));
|
|
64
|
+
if (match) {
|
|
65
|
+
resolved = match;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
// ignore discovery errors, will fail on read below with original path
|
|
70
|
+
}
|
|
63
71
|
}
|
|
64
72
|
mdFiles = [resolved];
|
|
65
73
|
}
|
|
@@ -117,7 +125,7 @@ registerAppTool(server, 'list_tasks', {
|
|
|
117
125
|
registerAppTool(server, 'update_tasks', {
|
|
118
126
|
description: 'Update checkbox states in a project markdown file (auto-saved on toggle)',
|
|
119
127
|
inputSchema: {
|
|
120
|
-
file: z.string().describe('
|
|
128
|
+
file: z.string().describe('Path to the markdown file. Can be absolute or relative to the project directory.'),
|
|
121
129
|
updates: z.array(z.object({
|
|
122
130
|
line: z.number().describe('0-indexed line number in the markdown file'),
|
|
123
131
|
checked: z.boolean().describe('New checked state for the checkbox'),
|
|
@@ -125,7 +133,7 @@ registerAppTool(server, 'update_tasks', {
|
|
|
125
133
|
},
|
|
126
134
|
_meta: { ui: { resourceUri: uiResourceUri, visibility: ['app'] } },
|
|
127
135
|
}, async ({ file, updates }) => {
|
|
128
|
-
const filePath = path.resolve(projectDir, file);
|
|
136
|
+
const filePath = path.isAbsolute(file) ? path.resolve(file) : path.resolve(projectDir, file);
|
|
129
137
|
let content;
|
|
130
138
|
try {
|
|
131
139
|
content = await readTaskFile(filePath);
|