-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add knip for unused code detection #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Remove internal type aliases that are not used: - RpcActionRequest (kept as internal) - RpcActionResponseData (removed entirely) - RpcClientConfig (kept as internal)
Run knip as part of CI to detect unused code and dependencies
This reverts commit 914a7f9.
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 18 files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces knip for automated detection of unused code and dependencies, resulting in cleaner codebase maintenance. The changes include removing unused utility files, pruning unused exports from various modules, and establishing knip as part of the development workflow.
- Added knip configuration and integrated it into lint/format scripts and CI pipeline
- Removed unused utility files (
file.ts,schema.ts) and dependencies (fs-fixture,nano-spawn) - Converted public exports to internal types/interfaces where they weren't used externally
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| knip.config.ts | New configuration file defining workspaces, entry points, and rules for knip |
| package.json | Added knip scripts to lint/format workflows; removed unused @ai-sdk/openai from root devDependencies |
| lefthook.yaml | Added knip to pre-commit hook for automatic cleanup on staged TypeScript files |
| .github/workflows/lint.yaml | Added separate knip step to CI workflow |
| pnpm-workspace.yaml | Updated catalog to include knip and remove unused dependencies |
| pnpm-lock.yaml | Lockfile updates reflecting new knip dependency and removed packages |
| src/utils/file.ts | Removed unused file utilities module (133 lines) |
| src/utils/schema.ts | Removed unused JSON schema helper functions (39 lines) |
| src/utils/tfidf-index.ts | Changed TfidfDocument and TfidfResult from exported to internal interfaces |
| src/types.ts | Changed Headers, JsonSchemaType, and HttpExecuteParameter from exported to internal types |
| src/toolsets/index.ts | Removed ToolSet from public exports (kept internal for inheritance) |
| src/toolsets/stackone.ts | Changed FetchToolsOptions and WorkflowConfig from exported to internal interfaces |
| src/tool.ts | Changed metaSearchTools and metaExecuteTool from exported to internal functions |
| src/rpc-client.ts | Changed RpcActionRequest and RpcClientConfig to internal types; removed unused RpcActionResponseData export |
| examples/package.json | Removed unused nano-spawn dependency |
| CLAUDE.md | Updated documentation to reflect removal of file utilities |
| .claude/skills/file-operations/SKILL.md | Renamed skill from "File Operations and HTTP Standards" to "HTTP Request Standards" |
| .cursor/rules/file-utils.mdc | Removed entire file utilities documentation (111 lines) |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
lint:knipandformat:knipscripts to package.jsonChanges
src/utils/file.ts,src/utils/schema.tsfs-fixture,nano-spawnCloses #155
Summary by cubic
Add Knip to detect and clean up unused code and dependencies, wired into pre-commit. This keeps the codebase lean and prevents dead code from landing. Closes #155.
New Features
Refactors
Written for commit 1ac40cc. Summary will update automatically on new commits.