@knip/mcp 0.0.23 → 0.0.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knip/mcp",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "description": "Knip MCP Server",
5
5
  "keywords": [
6
6
  "knip",
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "@modelcontextprotocol/sdk": "^1.27.1",
30
30
  "zod": "^4.1.11",
31
- "knip": "^6.0.0"
31
+ "knip": "^6.0.6"
32
32
  },
33
33
  "engines": {
34
34
  "node": "^20.19.0 || >=22.12.0"
@@ -366,6 +366,6 @@ plugin, this might be the right time to open a pull request!
366
366
  [2]: ../reference/plugins.md
367
367
  [3]: ../explanations/plugins.md#entry-files-from-config-files
368
368
  [4]: https://github.com/webpro-nl/knip/blob/6a6954386b33ee8a2919005230a4bc094e11bc03/knip.json#L12
369
- [5]: ./inputs.md
369
+ [5]: ../writing-a-plugin/inputs.md
370
370
  [6]: ../features/script-parser.md
371
- [7]: ./argument-parsing.md
371
+ [7]: ../writing-a-plugin/argument-parsing.md
package/src/texts.js CHANGED
@@ -56,13 +56,16 @@ export const ERROR_HINT = `For unexpected errors (exit code 2) such as "error lo
56
56
  - If no config file exists, create knip.json in the project root
57
57
  - Run knip again`;
58
58
 
59
+ export const UNCONFIGURED_HINT =
60
+ 'Issues are suppressed because the project is not yet configured. Reported issues might be false positives. Address configuration hints first, then re-run to get the actual issues.';
61
+
59
62
  export const CONFIG_REVIEW_HINT = `Review the existing configuration for potential improvements:
60
63
 
61
- - Never use "ignore" patterns (hides real issues!), always prefer specific solutions, other ignore* options are allowed
62
- - Many unused exported types? Add: ignoreExportsUsedInFile: { interface: true, type: true } (prefer this over other ignore* options)
64
+ - Never use "ignore" patterns (hides real issues!), always prefer specific solutions; other ignore* options are allowed
65
+ - Many unused exported types try ignoreExportsUsedInFile: { interface: true, type: true }
63
66
  - Remove ignore patterns that don't match any files
64
- - Remove redundant ignore patterns: Knip respects .gitignore (node_modules, dist, build, .git)
67
+ - Remove redundant ignore patterns Knip respects .gitignore (node_modules, dist, build, .git)
65
68
  - Remove entry patterns covered by config defaults and auto-detected plugins
66
- - Config files (e.g. vite.config.ts) showing as unused? Enable/disable the plugin explicitly
69
+ - Config files (e.g. vite.config.ts) showing as unused → try enable or disable the plugin explicitly (vite: true)
67
70
  - Dependencies matching Node.js builtins: add to ignoreDependencies (e.g. buffer, process)
68
71
  - Unresolved imports from path aliases: add paths to Knip config (tsconfig.json semantics)`;
package/src/tools.js CHANGED
@@ -3,7 +3,7 @@ import { dirname, join } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import { createOptions, createSession, finalizeConfigurationHints, KNIP_CONFIG_LOCATIONS } from 'knip/session';
5
5
  import { CURATED_RESOURCES } from './curated-resources.js';
6
- import { CONFIG_REVIEW_HINT } from './texts.js';
6
+ import { CONFIG_REVIEW_HINT, UNCONFIGURED_HINT } from './texts.js';
7
7
 
8
8
  export { ERROR_HINT } from './texts.js';
9
9
 
@@ -30,15 +30,30 @@ const docsDir = join(__dirname, './docs');
30
30
  * @param {{ cwd: string, configFilePath: string | undefined }} options
31
31
  */
32
32
  export function buildResults(results, options) {
33
+ const configurationHints = finalizeConfigurationHints(results, options);
34
+
35
+ const isSuppressIssues =
36
+ results.counters.total >= 10 &&
37
+ configurationHints.some(hint => hint.type === 'top-level-unconfigured' || hint.type === 'workspace-unconfigured');
38
+
39
+ const configFile = options.configFilePath
40
+ ? { exists: true, filePath: options.configFilePath }
41
+ : { exists: false, locations: KNIP_CONFIG_LOCATIONS };
42
+
43
+ const reviewHint = isSuppressIssues ? UNCONFIGURED_HINT : options.configFilePath ? CONFIG_REVIEW_HINT : undefined;
44
+ const files = isSuppressIssues ? [] : Array.from(results.issues.files);
45
+ const issues = isSuppressIssues
46
+ ? []
47
+ : Object.fromEntries(Object.entries(results.issues).filter(([key]) => key !== 'files' && key !== '_files'));
48
+
33
49
  return {
34
- configFile: options.configFilePath
35
- ? { exists: true, filePath: options.configFilePath, reviewHint: CONFIG_REVIEW_HINT }
36
- : { exists: false, locations: KNIP_CONFIG_LOCATIONS },
37
- configurationHints: finalizeConfigurationHints(results, options),
50
+ reviewHint,
51
+ configFile,
52
+ configurationHints,
38
53
  counters: results.counters,
39
54
  enabledPlugins: results.enabledPlugins,
40
- files: Array.from(results.issues.files),
41
- issues: Object.fromEntries(Object.entries(results.issues).filter(([key]) => key !== 'files' && key !== '_files')),
55
+ files,
56
+ issues,
42
57
  };
43
58
  }
44
59