{"owner":"webpro-nl","repo":"knip","hasSkills":true,"hasMcp":false,"mcpConfig":null,"found":["AGENTS.md"],"skills":{"AGENTS.md":"# Knip\n\nKnip is a tool to find and fix unused dependencies, exports and files in\nJavaScript and TypeScript projects.\n\n## Project overview\n\n- Monorepo, managed with pnpm\n- Main package is core in `packages/knip` (TypeScript)\n- Language Server in `packages/language-server` (JS + JSDoc for types)\n- VS Code Extension in `packages/vscode-knip` (JS + JSDoc for types)\n- [Documentation][1] content in `packages/docs` (Astro + MD/MDX)\n\n## Code style\n\n- Performance is key, both high level (design) and low level (impl).\n- Avoid redundant code and abstractions; avoid unnecessary complexity and nesting.\n- Concise one-liners are fine, but prioritize clarity over cleverness.\n- Don't add comments to code, unless explicitly asked for.\n- Prefer AST-based tools and codemods (jscodeshift) over manual or regex-based refactors — except for tiny edits.\n- JavaScript\n  - Prefer plain `for..in/of` loops over iterator methods like `map`/`reduce`.\n- TypeScript\n  - Avoid `any` and type casting (`as`).\n  - Avoid runtime overhead just to get the types right.\n- Lint and format from root: `pnpm run ci`\n- Format Markdown/MDX with `pnpm remark` in `packages/docs` (auto-numbers link refs, validates links)\n\n## Domain Knowledge\n\n- Unused file → unused exports/dependencies is a chain, not a bug\n- Non-JS/TS files (.css, .mdx, .vue) enter the graph via (usually plugin-registered) compilers (`registerCompilers`)\n- Library-specific AST patterns are caught by plugin-registered visitors (`registerVisitors`)\n- Use `--performance` or `--performance-fn [name]` to profile (→ [timerify][2])\n- If creating or modifying a plugin, read [PLUGINS.md][3] first.\n- If modifying core module graph, AST traversal, or CLI sequence, read [MODULE-GRAPH.md][4] first.\n- For issues re. exported identifiers (following refs, shadowing, `ignoreExportsUsedInFile`), see [EXPORTS.md][5].\n- Before any significant performance tuning, consult [PERFORMANCE.md][6].\n- For test/fixture structure, conventions, and where a new test goes, see [TESTS.md][7].\n\n## Issues and Pull Requests\n\n- When given a bug report, first confirm the behavior is actually wrong. Reproduce, then check if the reported behavior is correct-by-design before writing any fix.\n- Find repositories/CodeSandbox/StackBlitz source files and local fixtures to actually reproduce the issue at hand.\n- To fetch a stackblitz.com reproduction: `pnpx stackblitz-zip https://stackblitz.com/edit/{name} {filename}.zip`\n\n## Run & Debug\n\nImportant: debug, don't guess.\n\nRun the CLI directly using `node` or `bun`. This document shows `knip` in\ncommands for consistency. Replace it with `node (path/to/)src/cli.ts` or\n`bun (path/to/)src/cli.ts` and keep using what works.\n\n- Run `knip` directly in a fixture or temp directory (over creating test scripts that import the `main` function).\n- Knip requires `package.json` in root dir.\n- Enable [debug & helpers][8] with `--debug` (not `DEBUG=`). Warning: noisy.\n- Use [trace][9] to debug\n  - exported identifiers (`knip --trace-export [name] --trace-file [file]`)\n  - external dependencies (`knip --trace-dependency [name] --workspace [dir]`)\n\n## Test\n\nPrefer TDD: add or update tests (and fixtures) before implementing.\n\nPrefer `bun` over `node` for speed. Don't run all tests at once (slow & noisy).\nStart out with running the relevant test(s) first:\n\n```sh\ncd packages/knip\nbun test test/util/get-inputs-from-scripts.test.ts\nnode --test test/commonjs.test.ts\n```\n\nRun smoke tests with Bun:\n\n```sh\ncd packages/knip\npnpm test --runtime bun --smoke\n```\n\nRun smoke tests with Node.js:\n\n```sh\ncd packages/knip\nnode --test test/commonjs.test.ts\npnpm test --runtime node --smoke\n```\n\nBuild core package and run all tests only if there are changes in auto-fix,\nformatting and reporter related functionality:\n\n```sh\ncd packages/knip\npnpm build\npnpm test\n```\n\nSee [TESTS.md][7] for conventions and placements.\n\n## Fixtures\n\nThere are plenty of directories with fixtures in `packages/knip/fixtures`.\n\n- In general, tests have their own fixture directory.\n- Plugin fixture directories at `packages/knip/fixtures/plugins/[plugin-name]*`.\n- For trivial changes or fixes, extend an existing fixture.\n- Don't use \"foo\" or vague names. One fixture should consist of descriptive file\n  and variable names like `module.ts` and `barrel.ts`, or build upon a \"theme\"\n  such as fruits or animals to indicate relation/hierarchy.\n- Use empty files if sufficient (e.g. to verify import specifier or entry file).\n- For debugging, it might be useful to run Knip from the fixture directory and\n  see output in terminal. Example:\n\n```sh\ncd packages/knip/fixtures/commonjs\nknip\n```\n\n## Build\n\nTo type-check `knip` with `tsc`:\n\n```sh\ncd packages/knip\npnpm build\n```\n\n[1]: https://knip.dev\n[2]: ./packages/knip/src/util/Performance.ts\n[3]: ./.agents/PLUGINS.md\n[4]: ./.agents/MODULE-GRAPH.md\n[5]: ./.agents/EXPORTS.md\n[6]: ./.agents/PERFORMANCE.md\n[7]: ./.agents/TESTS.md\n[8]: ./packages/knip/src/util/debug.ts\n[9]: ./packages/docs/src/content/docs/guides/troubleshooting.md#trace\n"},"files":{"AGENTS.md":"# Knip\n\nKnip is a tool to find and fix unused dependencies, exports and files in\nJavaScript and TypeScript projects.\n\n## Project overview\n\n- Monorepo, managed with pnpm\n- Main package is core in `packages/knip` (TypeScript)\n- Language Server in `packages/language-server` (JS + JSDoc for types)\n- VS Code Extension in `packages/vscode-knip` (JS + JSDoc for types)\n- [Documentation][1] content in `packages/docs` (Astro + MD/MDX)\n\n## Code style\n\n- Performance is key, both high level (design) and low level (impl).\n- Avoid redundant code and abstractions; avoid unnecessary complexity and nesting.\n- Concise one-liners are fine, but prioritize clarity over cleverness.\n- Don't add comments to code, unless explicitly asked for.\n- Prefer AST-based tools and codemods (jscodeshift) over manual or regex-based refactors — except for tiny edits.\n- JavaScript\n  - Prefer plain `for..in/of` loops over iterator methods like `map`/`reduce`.\n- TypeScript\n  - Avoid `any` and type casting (`as`).\n  - Avoid runtime overhead just to get the types right.\n- Lint and format from root: `pnpm run ci`\n- Format Markdown/MDX with `pnpm remark` in `packages/docs` (auto-numbers link refs, validates links)\n\n## Domain Knowledge\n\n- Unused file → unused exports/dependencies is a chain, not a bug\n- Non-JS/TS files (.css, .mdx, .vue) enter the graph via (usually plugin-registered) compilers (`registerCompilers`)\n- Library-specific AST patterns are caught by plugin-registered visitors (`registerVisitors`)\n- Use `--performance` or `--performance-fn [name]` to profile (→ [timerify][2])\n- If creating or modifying a plugin, read [PLUGINS.md][3] first.\n- If modifying core module graph, AST traversal, or CLI sequence, read [MODULE-GRAPH.md][4] first.\n- For issues re. exported identifiers (following refs, shadowing, `ignoreExportsUsedInFile`), see [EXPORTS.md][5].\n- Before any significant performance tuning, consult [PERFORMANCE.md][6].\n- For test/fixture structure, conventions, and where a new test goes, see [TESTS.md][7].\n\n## Issues and Pull Requests\n\n- When given a bug report, first confirm the behavior is actually wrong. Reproduce, then check if the reported behavior is correct-by-design before writing any fix.\n- Find repositories/CodeSandbox/StackBlitz source files and local fixtures to actually reproduce the issue at hand.\n- To fetch a stackblitz.com reproduction: `pnpx stackblitz-zip https://stackblitz.com/edit/{name} {filename}.zip`\n\n## Run & Debug\n\nImportant: debug, don't guess.\n\nRun the CLI directly using `node` or `bun`. This document shows `knip` in\ncommands for consistency. Replace it with `node (path/to/)src/cli.ts` or\n`bun (path/to/)src/cli.ts` and keep using what works.\n\n- Run `knip` directly in a fixture or temp directory (over creating test scripts that import the `main` function).\n- Knip requires `package.json` in root dir.\n- Enable [debug & helpers][8] with `--debug` (not `DEBUG=`). Warning: noisy.\n- Use [trace][9] to debug\n  - exported identifiers (`knip --trace-export [name] --trace-file [file]`)\n  - external dependencies (`knip --trace-dependency [name] --workspace [dir]`)\n\n## Test\n\nPrefer TDD: add or update tests (and fixtures) before implementing.\n\nPrefer `bun` over `node` for speed. Don't run all tests at once (slow & noisy).\nStart out with running the relevant test(s) first:\n\n```sh\ncd packages/knip\nbun test test/util/get-inputs-from-scripts.test.ts\nnode --test test/commonjs.test.ts\n```\n\nRun smoke tests with Bun:\n\n```sh\ncd packages/knip\npnpm test --runtime bun --smoke\n```\n\nRun smoke tests with Node.js:\n\n```sh\ncd packages/knip\nnode --test test/commonjs.test.ts\npnpm test --runtime node --smoke\n```\n\nBuild core package and run all tests only if there are changes in auto-fix,\nformatting and reporter related functionality:\n\n```sh\ncd packages/knip\npnpm build\npnpm test\n```\n\nSee [TESTS.md][7] for conventions and placements.\n\n## Fixtures\n\nThere are plenty of directories with fixtures in `packages/knip/fixtures`.\n\n- In general, tests have their own fixture directory.\n- Plugin fixture directories at `packages/knip/fixtures/plugins/[plugin-name]*`.\n- For trivial changes or fixes, extend an existing fixture.\n- Don't use \"foo\" or vague names. One fixture should consist of descriptive file\n  and variable names like `module.ts` and `barrel.ts`, or build upon a \"theme\"\n  such as fruits or animals to indicate relation/hierarchy.\n- Use empty files if sufficient (e.g. to verify import specifier or entry file).\n- For debugging, it might be useful to run Knip from the fixture directory and\n  see output in terminal. Example:\n\n```sh\ncd packages/knip/fixtures/commonjs\nknip\n```\n\n## Build\n\nTo type-check `knip` with `tsc`:\n\n```sh\ncd packages/knip\npnpm build\n```\n\n[1]: https://knip.dev\n[2]: ./packages/knip/src/util/Performance.ts\n[3]: ./.agents/PLUGINS.md\n[4]: ./.agents/MODULE-GRAPH.md\n[5]: ./.agents/EXPORTS.md\n[6]: ./.agents/PERFORMANCE.md\n[7]: ./.agents/TESTS.md\n[8]: ./packages/knip/src/util/debug.ts\n[9]: ./packages/docs/src/content/docs/guides/troubleshooting.md#trace\n"},"items":[{"name":"AGENTS.md","path":"AGENTS.md","title":"AGENTS.md","content":"# Knip\n\nKnip is a tool to find and fix unused dependencies, exports and files in\nJavaScript and TypeScript projects.\n\n## Project overview\n\n- Monorepo, managed with pnpm\n- Main package is core in `packages/knip` (TypeScript)\n- Language Server in `packages/language-server` (JS + JSDoc for types)\n- VS Code Extension in `packages/vscode-knip` (JS + JSDoc for types)\n- [Documentation][1] content in `packages/docs` (Astro + MD/MDX)\n\n## Code style\n\n- Performance is key, both high level (design) and low level (impl).\n- Avoid redundant code and abstractions; avoid unnecessary complexity and nesting.\n- Concise one-liners are fine, but prioritize clarity over cleverness.\n- Don't add comments to code, unless explicitly asked for.\n- Prefer AST-based tools and codemods (jscodeshift) over manual or regex-based refactors — except for tiny edits.\n- JavaScript\n  - Prefer plain `for..in/of` loops over iterator methods like `map`/`reduce`.\n- TypeScript\n  - Avoid `any` and type casting (`as`).\n  - Avoid runtime overhead just to get the types right.\n- Lint and format from root: `pnpm run ci`\n- Format Markdown/MDX with `pnpm remark` in `packages/docs` (auto-numbers link refs, validates links)\n\n## Domain Knowledge\n\n- Unused file → unused exports/dependencies is a chain, not a bug\n- Non-JS/TS files (.css, .mdx, .vue) enter the graph via (usually plugin-registered) compilers (`registerCompilers`)\n- Library-specific AST patterns are caught by plugin-registered visitors (`registerVisitors`)\n- Use `--performance` or `--performance-fn [name]` to profile (→ [timerify][2])\n- If creating or modifying a plugin, read [PLUGINS.md][3] first.\n- If modifying core module graph, AST traversal, or CLI sequence, read [MODULE-GRAPH.md][4] first.\n- For issues re. exported identifiers (following refs, shadowing, `ignoreExportsUsedInFile`), see [EXPORTS.md][5].\n- Before any significant performance tuning, consult [PERFORMANCE.md][6].\n- For test/fixture structure, conventions, and where a new test goes, see [TESTS.md][7].\n\n## Issues and Pull Requests\n\n- When given a bug report, first confirm the behavior is actually wrong. Reproduce, then check if the reported behavior is correct-by-design before writing any fix.\n- Find repositories/CodeSandbox/StackBlitz source files and local fixtures to actually reproduce the issue at hand.\n- To fetch a stackblitz.com reproduction: `pnpx stackblitz-zip https://stackblitz.com/edit/{name} {filename}.zip`\n\n## Run & Debug\n\nImportant: debug, don't guess.\n\nRun the CLI directly using `node` or `bun`. This document shows `knip` in\ncommands for consistency. Replace it with `node (path/to/)src/cli.ts` or\n`bun (path/to/)src/cli.ts` and keep using what works.\n\n- Run `knip` directly in a fixture or temp directory (over creating test scripts that import the `main` function).\n- Knip requires `package.json` in root dir.\n- Enable [debug & helpers][8] with `--debug` (not `DEBUG=`). Warning: noisy.\n- Use [trace][9] to debug\n  - exported identifiers (`knip --trace-export [name] --trace-file [file]`)\n  - external dependencies (`knip --trace-dependency [name] --workspace [dir]`)\n\n## Test\n\nPrefer TDD: add or update tests (and fixtures) before implementing.\n\nPrefer `bun` over `node` for speed. Don't run all tests at once (slow & noisy).\nStart out with running the relevant test(s) first:\n\n```sh\ncd packages/knip\nbun test test/util/get-inputs-from-scripts.test.ts\nnode --test test/commonjs.test.ts\n```\n\nRun smoke tests with Bun:\n\n```sh\ncd packages/knip\npnpm test --runtime bun --smoke\n```\n\nRun smoke tests with Node.js:\n\n```sh\ncd packages/knip\nnode --test test/commonjs.test.ts\npnpm test --runtime node --smoke\n```\n\nBuild core package and run all tests only if there are changes in auto-fix,\nformatting and reporter related functionality:\n\n```sh\ncd packages/knip\npnpm build\npnpm test\n```\n\nSee [TESTS.md][7] for conventions and placements.\n\n## Fixtures\n\nThere are plenty of directories with fixtures in `packages/knip/fixtures`.\n\n- In general, tests have their own fixture directory.\n- Plugin fixture directories at `packages/knip/fixtures/plugins/[plugin-name]*`.\n- For trivial changes or fixes, extend an existing fixture.\n- Don't use \"foo\" or vague names. One fixture should consist of descriptive file\n  and variable names like `module.ts` and `barrel.ts`, or build upon a \"theme\"\n  such as fruits or animals to indicate relation/hierarchy.\n- Use empty files if sufficient (e.g. to verify import specifier or entry file).\n- For debugging, it might be useful to run Knip from the fixture directory and\n  see output in terminal. Example:\n\n```sh\ncd packages/knip/fixtures/commonjs\nknip\n```\n\n## Build\n\nTo type-check `knip` with `tsc`:\n\n```sh\ncd packages/knip\npnpm build\n```\n\n[1]: https://knip.dev\n[2]: ./packages/knip/src/util/Performance.ts\n[3]: ./.agents/PLUGINS.md\n[4]: ./.agents/MODULE-GRAPH.md\n[5]: ./.agents/EXPORTS.md\n[6]: ./.agents/PERFORMANCE.md\n[7]: ./.agents/TESTS.md\n[8]: ./packages/knip/src/util/debug.ts\n[9]: ./packages/docs/src/content/docs/guides/troubleshooting.md#trace\n","category":"root","tokens":1253}]}