You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2. Run analysis (knip-run) to get configuration hints and issues
11
-
3. Address the hints by adjusting knip.json
12
-
4. Repeat steps 2-3 until hints are gone and false positives are minimized
11
+
2. Run analysis (knip-run): returns configurationHints (decode with configuration-hints) and issues keyed by type (decode with issue-types)
12
+
3. Address the configuration hints by adjusting knip.json
13
+
4. Repeat steps 2-3 until configuration hints are gone and remaining issues are genuine findings
14
+
15
+
You're done when there are no configuration hints and the issues are genuine (or zero). Many projects need NO knip.json: Knip auto-detects plugins, so configFile exists:false with zero hints is a good, complete result. Don't add configuration just to have it.
13
16
14
17
Important notes:
15
18
- For prompts like "run knip" or "clean up codebase" or "no more slop": always run workflow to configure Knip first.
16
19
- If you hit errors (not lint issues), consult: known-issues
17
-
- Before suggesting fixes/solutions, consult: handling-issues and reference/jsdoc-tsdoc-tags
18
-
- For cleanup, consult: features/auto-fix
19
-
- To install Knip and start using it from CLI, consult: getting-started and reference/cli
20
+
- Before suggesting fixes/solutions, consult: handling-issues and jsdoc-tsdoc-tags
21
+
- Prefer specific solutions over "ignore"; to focus or mute issue types, consult: rules-and-filters
22
+
- For cleanup, consult: auto-fix
23
+
- To install Knip and start using it from CLI, consult: getting-started and cli
20
24
- Knip does not remove unused imports/variables inside files (use a linter)
exportconstDOC_TOOL_DESCRIPTION=`Get Knip documentation by topic.
42
-
43
-
If registered resources are unavailable, use this tool.
48
+
exportconstDOC_TOOL_DESCRIPTION=`Fetch a Knip doc by topic id, or by any docs path. Consult it to resolve a finding, hint, or error instead of guessing.
44
49
45
50
Available topics (use these IDs):
46
51
${Object.entries(CURATED_RESOURCES)
47
52
.map(([id,doc])=>`- ${id}: ${doc.description}`)
48
53
.join('\n')}
54
+
}
49
55
50
-
Can also fetch any doc by path (e.g. "reference/cli" or "guides/troubleshooting").
51
-
Use this instead of fetching from https://knip.dev.`;
56
+
Full descriptions are registered as MCP resources; any page is also reachable by path (e.g. "guides/troubleshooting"). Use this instead of fetching from https://knip.dev.`;
@@ -61,15 +66,18 @@ export const ERROR_HINT = `For unexpected errors (exit code 2) such as "Error lo
61
66
- Apply a workaround, then run knip-run again`;
62
67
63
68
exportconstUNCONFIGURED_HINT=
64
-
'Issues are suppressed because the project is not yet configured. Reported issues might be false positives. Address configuration hints first, then re-runto get the actual issues.';
69
+
'Many unused files were found. This often means entry/project patterns are not configured yet (so some results may be false positives), but could mean real dead code. A capped sample of issues is shown — see `counters` for true totals. Address the configurationHints first, then re-run; or scope with `workspace` to analyze one package at a time.';
65
70
66
-
exportconstCONFIG_REVIEW_HINT=`Review the existing configuration for potential improvements:
71
+
exportconstCONFIG_REVIEW_HINT=`Review the configuration for improvements that apply to the issues you see (skip the ones that don't):
67
72
68
-
- Never use "ignore" patterns (hides real issues!), always prefer specific solutions; other ignore* options are allowed
73
+
- Avoid the broad "ignore" option (file globs); it hides real issues, so prefer specific fixes. Targeted ignoreDependencies/ignoreBinaries/ignoreUnresolved are fine for justified, known false positives
- Unresolved imports from path aliases: add paths to Knip config (tsconfig.json semantics)`;
81
+
82
+
exportconstCLEAN_HINT=
83
+
'No issues and no configuration hints: Knip is happy. Many projects need no knip.json (plugins are auto-detected), so this is a complete, successful result with nothing more to configure.';
0 commit comments