@j0hanz/filesystem-mcp 1.7.2 → 1.8.0

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 (44) hide show
  1. package/dist/lib/file-operations/common.d.ts +42 -0
  2. package/dist/lib/file-operations/common.js +87 -0
  3. package/dist/lib/file-operations/file-info.js +13 -19
  4. package/dist/lib/file-operations/glob-engine.d.ts +1 -6
  5. package/dist/lib/file-operations/glob-engine.js +0 -9
  6. package/dist/lib/file-operations/glob-helpers.d.ts +18 -0
  7. package/dist/lib/file-operations/glob-helpers.js +23 -0
  8. package/dist/lib/file-operations/list-directory.js +22 -46
  9. package/dist/lib/file-operations/read-multiple-files.js +11 -19
  10. package/dist/lib/file-operations/search-content.d.ts +1 -8
  11. package/dist/lib/file-operations/search-content.js +126 -204
  12. package/dist/lib/file-operations/search-files.js +48 -94
  13. package/dist/lib/file-operations/search-matcher.d.ts +10 -0
  14. package/dist/lib/file-operations/search-matcher.js +72 -0
  15. package/dist/lib/file-operations/search-worker.js +3 -1
  16. package/dist/lib/file-operations/tree.d.ts +2 -2
  17. package/dist/lib/file-operations/tree.js +26 -42
  18. package/dist/lib/fs-helpers.d.ts +1 -0
  19. package/dist/lib/fs-helpers.js +9 -0
  20. package/dist/lib/option-utils.d.ts +3 -0
  21. package/dist/lib/option-utils.js +15 -0
  22. package/dist/lib/path-validation.d.ts +1 -0
  23. package/dist/lib/path-validation.js +7 -0
  24. package/dist/lib/progress-reporting.d.ts +11 -0
  25. package/dist/lib/progress-reporting.js +13 -0
  26. package/dist/prompts.js +3 -3
  27. package/dist/resources/generated-instructions.js +14 -14
  28. package/dist/resources/tool-catalog.js +9 -9
  29. package/dist/resources/tool-info.js +5 -5
  30. package/dist/resources/workflows.js +17 -17
  31. package/dist/schemas.js +21 -90
  32. package/dist/server/bootstrap.js +2 -2
  33. package/dist/tools/apply-patch.js +3 -0
  34. package/dist/tools/calculate-hash.js +12 -12
  35. package/dist/tools/delete-file.js +5 -2
  36. package/dist/tools/list-directory.js +3 -21
  37. package/dist/tools/read-multiple.js +11 -21
  38. package/dist/tools/replace-in-files.js +10 -11
  39. package/dist/tools/search-content.js +2 -2
  40. package/dist/tools/search-files.js +3 -21
  41. package/dist/tools/shared.d.ts +19 -0
  42. package/dist/tools/shared.js +64 -18
  43. package/dist/tools/stat-many.js +11 -22
  44. package/package.json +6 -2
@@ -1,10 +1,9 @@
1
- import * as path from 'node:path';
2
1
  import { formatBytes, joinLines } from '../config.js';
3
2
  import { DEFAULT_SEARCH_TIMEOUT_MS } from '../lib/constants.js';
4
3
  import { ErrorCode } from '../lib/errors.js';
5
4
  import { getMultipleFileInfo } from '../lib/file-operations/file-info.js';
6
5
  import { GetMultipleFileInfoInputSchema, GetMultipleFileInfoOutputSchema, } from '../schemas.js';
7
- import { buildFileInfoPayload, buildToolErrorResponse, buildToolResponse, createToolProgressSession, executeToolWithDiagnostics, READ_ONLY_TOOL_ANNOTATIONS, withDefaultIcons, withValidatedArgs, wrapToolHandler, } from './shared.js';
6
+ import { buildBatchCompletionSuffix, buildBatchPathContext, buildFileInfoPayload, buildToolErrorResponse, buildToolResponse, createBatchProgressCallbacks, executeToolWithDiagnostics, READ_ONLY_TOOL_ANNOTATIONS, resolveFinalProgressCurrent, withDefaultIcons, withValidatedArgs, wrapToolHandler, } from './shared.js';
8
7
  import { registerToolTaskIfAvailable } from './task-support.js';
9
8
  export const GET_MULTIPLE_FILE_INFO_TOOL = {
10
9
  name: 'stat_many',
@@ -74,29 +73,19 @@ export function registerGetMultipleFileInfoTool(server, options = {}) {
74
73
  timedSignal: { timeoutMs: DEFAULT_SEARCH_TIMEOUT_MS },
75
74
  context: { path: primaryPath },
76
75
  run: async (signal) => {
77
- const first = path.basename(args.paths[0] ?? '');
78
- const extraPaths = args.paths.length > 1
79
- ? `, ${path.basename(args.paths[1] ?? '')}${args.paths.length > 2 ? '…' : ''}`
80
- : '';
81
- const context = `${args.paths.length} paths [${first}${extraPaths}]`;
82
- const progress = createToolProgressSession(extra, `🕮 stat_many: ${context}`);
83
- const onProgress = () => {
84
- progress.increment((current) => `🕮 stat_many: ${context} [${current}/${args.paths.length} scanned]`);
85
- };
76
+ const context = buildBatchPathContext(args.paths);
77
+ const { progress, onItemComplete } = createBatchProgressCallbacks(extra, {
78
+ toolLabel: '🕮 stat_many',
79
+ context,
80
+ totalItems: args.paths.length,
81
+ itemVerb: 'scanned',
82
+ });
86
83
  try {
87
- const result = await handleGetMultipleFileInfo(args, signal, onProgress);
84
+ const result = await handleGetMultipleFileInfo(args, signal, onItemComplete);
88
85
  const sc = result.structuredContent;
86
+ const suffix = buildBatchCompletionSuffix(sc.summary, 'OK');
89
87
  const total = sc.summary?.total ?? 0;
90
- const failed = sc.summary?.failed ?? 0;
91
- const succeeded = sc.summary?.succeeded ?? 0;
92
- let suffix;
93
- if (failed) {
94
- suffix = `${succeeded}/${total} OK, ${failed} failed`;
95
- }
96
- else {
97
- suffix = `${total} OK`;
98
- }
99
- const finalCurrent = Math.max(total, progress.getCurrent() + 1);
88
+ const finalCurrent = resolveFinalProgressCurrent(progress, total);
100
89
  progress.complete(`🕮 stat_many: ${context} • ${suffix}`, finalCurrent);
101
90
  return result;
102
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@j0hanz/filesystem-mcp",
3
- "version": "1.7.2",
3
+ "version": "1.8.0",
4
4
  "mcpName": "io.github.j0hanz/filesystem-mcp",
5
5
  "description": "MCP Server that enables LLMs to interact with the local filesystem.",
6
6
  "type": "module",
@@ -35,8 +35,11 @@
35
35
  "type-check:diagnostics": "tsc --noEmit --extendedDiagnostics",
36
36
  "type-check:trace": "node -e \"require('fs').rmSync('.ts-trace',{recursive:true,force:true})\" && tsc --noEmit --generateTrace .ts-trace",
37
37
  "lint": "eslint .",
38
+ "lint:tests": "eslint src/__tests__",
38
39
  "lint:fix": "eslint . --fix",
39
40
  "test": "node scripts/tasks.mjs test",
41
+ "test:fast": "node --test --import tsx/esm src/__tests__/**/*.test.ts node-tests/**/*.test.ts",
42
+ "test:coverage": "node scripts/tasks.mjs test --coverage",
40
43
  "knip": "knip",
41
44
  "knip:fix": "knip --fix",
42
45
  "inspector": "npm run build && npx -y @modelcontextprotocol/inspector node dist/index.js ${workspaceFolder}",
@@ -71,12 +74,13 @@
71
74
  },
72
75
  "devDependencies": {
73
76
  "@eslint/js": "^10.0.1",
74
- "eslint": "^10.0.2",
75
77
  "@trivago/prettier-plugin-sort-imports": "^6.0.2",
76
78
  "@types/node": "^24",
79
+ "eslint": "^10.0.2",
77
80
  "eslint-config-prettier": "^10.1.8",
78
81
  "eslint-plugin-de-morgan": "^2.0.0",
79
82
  "eslint-plugin-depend": "^1.4.0",
83
+ "eslint-plugin-sonarjs": "^4.0.0",
80
84
  "eslint-plugin-unused-imports": "^4.4.1",
81
85
  "jscpd": "^4.0.8",
82
86
  "knip": "^5.85.0",