@qzoft/check-list 1.0.9 → 1.0.10
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/parser.d.ts +1 -0
- package/dist/server.js +34 -39
- package/package.json +1 -1
- package/ui/task-checklist.html +1 -1
package/dist/parser.d.ts
CHANGED
package/dist/server.js
CHANGED
|
@@ -44,55 +44,51 @@ registerAppResource(server, 'Task Checklist', uiResourceUri, { description: 'Int
|
|
|
44
44
|
}],
|
|
45
45
|
}));
|
|
46
46
|
registerAppTool(server, 'list_tasks', {
|
|
47
|
-
description: 'Discover and display checklists from markdown files
|
|
47
|
+
description: 'Discover and display checklists from markdown files. IMPORTANT: Always pass the `cwd` parameter with the absolute path of the current workspace folder so the tool knows where to look for files. When the user asks to see tasks in a specific file, also pass its ABSOLUTE file path as the `file` parameter.',
|
|
48
48
|
inputSchema: {
|
|
49
|
-
|
|
49
|
+
cwd: z.string().describe('REQUIRED. The absolute path to the current workspace/project folder (e.g. "C:\\\\Users\\\\me\\\\projects\\\\my-app" or "/home/me/projects/my-app"). This tells the tool where to scan for markdown files.'),
|
|
50
|
+
file: z.string().optional().describe('Optional ABSOLUTE path to a specific markdown file. Omit to scan all markdown files in the workspace folder.'),
|
|
50
51
|
},
|
|
51
52
|
_meta: { ui: { resourceUri: uiResourceUri } },
|
|
52
|
-
}, async ({ file }) => {
|
|
53
|
+
}, async ({ cwd, file }) => {
|
|
54
|
+
// Use the provided cwd, fall back to env/config projectDir
|
|
55
|
+
const effectiveDir = cwd ? path.resolve(cwd) : projectDir;
|
|
53
56
|
let mdFiles;
|
|
54
57
|
if (file) {
|
|
55
|
-
//
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
// 1. Relative to projectDir
|
|
62
|
-
candidates.push(path.resolve(projectDir, file));
|
|
63
|
-
// 2. Relative to cwd (if different from projectDir)
|
|
64
|
-
const cwd = process.cwd();
|
|
65
|
-
if (cwd !== projectDir) {
|
|
66
|
-
candidates.push(path.resolve(cwd, file));
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
// Find the first candidate that exists on disk
|
|
70
|
-
let resolved = candidates.find(c => fs.existsSync(c));
|
|
71
|
-
// If none found, search by filename/suffix in projectDir
|
|
72
|
-
if (!resolved) {
|
|
58
|
+
// Single-file mode
|
|
59
|
+
const resolved = path.isAbsolute(file) ? path.resolve(file) : path.resolve(effectiveDir, file);
|
|
60
|
+
if (!fs.existsSync(resolved)) {
|
|
61
|
+
// Try to find by filename in the workspace
|
|
73
62
|
const basename = path.basename(file);
|
|
74
|
-
const suffix = file.replace(/\//g, path.sep);
|
|
75
63
|
try {
|
|
76
|
-
const allMd = await discoverMarkdownFiles(
|
|
77
|
-
|
|
64
|
+
const allMd = await discoverMarkdownFiles(effectiveDir);
|
|
65
|
+
const match = allMd.find(f => f.endsWith(path.sep + file.replace(/\//g, path.sep)))
|
|
78
66
|
|| allMd.find(f => path.basename(f) === basename);
|
|
67
|
+
if (match) {
|
|
68
|
+
mdFiles = [match];
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
return {
|
|
72
|
+
isError: true,
|
|
73
|
+
content: [{ type: 'text', text: `File not found: ${file}` }],
|
|
74
|
+
};
|
|
75
|
+
}
|
|
79
76
|
}
|
|
80
77
|
catch {
|
|
81
|
-
|
|
78
|
+
return {
|
|
79
|
+
isError: true,
|
|
80
|
+
content: [{ type: 'text', text: `File not found: ${file}` }],
|
|
81
|
+
};
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
isError: true,
|
|
87
|
-
content: [{ type: 'text', text: `File not found: ${file}\nSearched in: ${candidates.join(', ')}` }],
|
|
88
|
-
};
|
|
84
|
+
else {
|
|
85
|
+
mdFiles = [resolved];
|
|
89
86
|
}
|
|
90
|
-
mdFiles = [resolved];
|
|
91
87
|
}
|
|
92
88
|
else {
|
|
93
|
-
// All-files mode: discover every markdown file in the
|
|
89
|
+
// All-files mode: discover every markdown file in the workspace
|
|
94
90
|
try {
|
|
95
|
-
mdFiles = await discoverMarkdownFiles(
|
|
91
|
+
mdFiles = await discoverMarkdownFiles(effectiveDir);
|
|
96
92
|
}
|
|
97
93
|
catch (err) {
|
|
98
94
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -101,7 +97,7 @@ registerAppTool(server, 'list_tasks', {
|
|
|
101
97
|
content: [
|
|
102
98
|
{
|
|
103
99
|
type: 'text',
|
|
104
|
-
text: `Error scanning
|
|
100
|
+
text: `Error scanning directory ${effectiveDir}: ${message}`,
|
|
105
101
|
},
|
|
106
102
|
],
|
|
107
103
|
};
|
|
@@ -126,9 +122,8 @@ registerAppTool(server, 'list_tasks', {
|
|
|
126
122
|
const hasTasks = sections.some((s) => s.tasks.length > 0);
|
|
127
123
|
if (!hasTasks)
|
|
128
124
|
continue;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
fileGroups.push({ file: relPath, sections });
|
|
125
|
+
const relPath = path.relative(effectiveDir, filePath);
|
|
126
|
+
fileGroups.push({ file: relPath, absolutePath: filePath, sections });
|
|
132
127
|
}
|
|
133
128
|
return {
|
|
134
129
|
content: [
|
|
@@ -141,9 +136,9 @@ registerAppTool(server, 'list_tasks', {
|
|
|
141
136
|
};
|
|
142
137
|
});
|
|
143
138
|
registerAppTool(server, 'update_tasks', {
|
|
144
|
-
description: 'Update checkbox states in a
|
|
139
|
+
description: 'Update checkbox states in a markdown file (auto-saved on toggle)',
|
|
145
140
|
inputSchema: {
|
|
146
|
-
file: z.string().describe('ABSOLUTE path to the markdown file
|
|
141
|
+
file: z.string().describe('ABSOLUTE path to the markdown file.'),
|
|
147
142
|
updates: z.array(z.object({
|
|
148
143
|
line: z.number().describe('0-indexed line number in the markdown file'),
|
|
149
144
|
checked: z.boolean().describe('New checked state for the checkbox'),
|
package/package.json
CHANGED
package/ui/task-checklist.html
CHANGED
|
@@ -362,7 +362,7 @@
|
|
|
362
362
|
checkboxEl.addEventListener('change', () => {
|
|
363
363
|
const newChecked = checkboxEl.checked;
|
|
364
364
|
labelEl.className = 'task-label' + (newChecked ? ' done' : '');
|
|
365
|
-
autoSave(fg.file, task.line, newChecked, checkboxEl, labelEl);
|
|
365
|
+
autoSave(fg.absolutePath || fg.file, task.line, newChecked, checkboxEl, labelEl);
|
|
366
366
|
});
|
|
367
367
|
|
|
368
368
|
itemEl.appendChild(checkboxEl);
|