feat: Add Knip for unused code analysis with CI reporting#1954
feat: Add Knip for unused code analysis with CI reporting#1954kodiakhq[bot] merged 4 commits intomainfrom
Conversation
Add Knip to detect unused files, dependencies, and exports across the monorepo. Includes a GitHub Action that compares results against main and posts a summary comment on PRs to prevent regressions.
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Knip - Unused Code Analysis🔴 +240 change in total issues (0 on main → 240 on PR)
What is this?Knip finds unused files, dependencies, and exports in your codebase. Run |
PR Review
✅ Security looks fine — action versions are pinned with commit SHAs, permissions are minimal ( |
- Redirect stderr to /dev/null instead of into the JSON file to prevent corrupted output from silently zeroing out issue counts - Remove namespaceMembers from counted categories since it has no corresponding row in the display table - Pin action versions to commit SHAs to prevent supply-chain attacks via compromised tags
E2E Test Results✅ All tests passed • 92 passed • 3 skipped • 974s
Tests ran across 4 shards in parallel. |
## Summary Adds [Knip](https://knip.dev) to the monorepo to detect unused files, dependencies, and exports. The goal is to reduce dead code over time and prevent new unused code from accumulating. **What's included:** - Root-level `knip.json` configured for all three workspaces (`packages/app`, `packages/api`, `packages/common-utils`) - `yarn knip` and `yarn knip:ci` scripts for local and CI usage - GitHub Action (`.github/workflows/knip.yml`) that runs on every PR to `main`, compares results against the base branch, and posts a summary comment showing any increase or decrease in unused code - Removed the previous app-only `packages/app/knip.json` in favor of the monorepo-wide config **How the CI workflow works:** 1. Runs Knip on the PR branch 2. Checks out `main` and runs Knip there 3. Compares issue counts per category and posts/updates a PR comment with a diff table This is additive — Knip runs as an informational check and does not block PRs.
## Summary Adds [Knip](https://knip.dev) to the monorepo to detect unused files, dependencies, and exports. The goal is to reduce dead code over time and prevent new unused code from accumulating. **What's included:** - Root-level `knip.json` configured for all three workspaces (`packages/app`, `packages/api`, `packages/common-utils`) - `yarn knip` and `yarn knip:ci` scripts for local and CI usage - GitHub Action (`.github/workflows/knip.yml`) that runs on every PR to `main`, compares results against the base branch, and posts a summary comment showing any increase or decrease in unused code - Removed the previous app-only `packages/app/knip.json` in favor of the monorepo-wide config **How the CI workflow works:** 1. Runs Knip on the PR branch 2. Checks out `main` and runs Knip there 3. Compares issue counts per category and posts/updates a PR comment with a diff table This is additive — Knip runs as an informational check and does not block PRs. Co-authored-by: peter-leonov-ch <209667683+peter-leonov-ch@users.noreply.github.com>
Summary
Adds Knip to the monorepo to detect unused files, dependencies, and exports. The goal is to reduce dead code over time and prevent new unused code from accumulating.
What's included:
knip.jsonconfigured for all three workspaces (packages/app,packages/api,packages/common-utils)yarn knipandyarn knip:ciscripts for local and CI usage.github/workflows/knip.yml) that runs on every PR tomain, compares results against the base branch, and posts a summary comment showing any increase or decrease in unused codepackages/app/knip.jsonin favor of the monorepo-wide configHow the CI workflow works:
mainand runs Knip thereThis is additive — Knip runs as an informational check and does not block PRs.