@qzoft/check-list 1.0.6 → 1.0.8

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.
Files changed (2) hide show
  1. package/dist/server.js +36 -3
  2. package/package.json +3 -2
package/dist/server.js CHANGED
@@ -52,8 +52,41 @@ registerAppTool(server, 'list_tasks', {
52
52
  }, async ({ file }) => {
53
53
  let mdFiles;
54
54
  if (file) {
55
- // Single-file mode: resolve the path (absolute paths stay as-is, relative resolve against projectDir)
56
- const resolved = path.isAbsolute(file) ? path.resolve(file) : path.resolve(projectDir, file);
55
+ // Build a list of candidate paths to try, in priority order
56
+ const candidates = [];
57
+ if (path.isAbsolute(file)) {
58
+ candidates.push(path.resolve(file));
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) {
73
+ const basename = path.basename(file);
74
+ const suffix = file.replace(/\//g, path.sep);
75
+ try {
76
+ const allMd = await discoverMarkdownFiles(projectDir);
77
+ resolved = allMd.find(f => f.endsWith(path.sep + suffix))
78
+ || allMd.find(f => path.basename(f) === basename);
79
+ }
80
+ catch {
81
+ // ignore discovery errors
82
+ }
83
+ }
84
+ if (!resolved) {
85
+ return {
86
+ isError: true,
87
+ content: [{ type: 'text', text: `File not found: ${file}\nSearched in: ${candidates.join(', ')}` }],
88
+ };
89
+ }
57
90
  mdFiles = [resolved];
58
91
  }
59
92
  else {
@@ -84,7 +117,7 @@ registerAppTool(server, 'list_tasks', {
84
117
  if (file) {
85
118
  return {
86
119
  isError: true,
87
- content: [{ type: 'text', text: `Could not read file: ${file}\nResolved path: ${filePath}\nProject directory: ${projectDir}` }],
120
+ content: [{ type: 'text', text: `Could not read file: ${filePath}` }],
88
121
  };
89
122
  }
90
123
  continue; // skip files we can't read
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qzoft/check-list",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "MCP App for interactive task management from markdown files",
5
5
  "type": "module",
6
6
  "main": "dist/server.js",
@@ -18,7 +18,8 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@modelcontextprotocol/ext-apps": "^1.2.0",
21
- "@modelcontextprotocol/sdk": "^1.27.1"
21
+ "@modelcontextprotocol/sdk": "^1.27.1",
22
+ "@qzoft/check-list": "^1.0.7"
22
23
  },
23
24
  "devDependencies": {
24
25
  "@types/node": "^22.0.0",