Skip to content

feat: add knip for unused code detection - #174

Merged
ryoppippi merged 5 commits into
mainfrom
feat/add-knip
Dec 9, 2025
Merged

feat: add knip for unused code detection#174
ryoppippi merged 5 commits into
mainfrom
feat/add-knip

Conversation

@ryoppippi

@ryoppippiryoppippi commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

Summary

  • Add knip to detect and remove unused code and dependencies
  • Add lint:knip and format:knip scripts to package.json
  • Add knip to lefthook pre-commit hook
  • Add knip to CI lint workflow

Changes

  • Removed unused files: src/utils/file.ts, src/utils/schema.ts
  • Removed unused dependencies: fs-fixture, nano-spawn
  • Removed unused exports and types from various files
  • Updated documentation to reflect removed file utilities

Closes#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

    • Add knip.config.ts with workspace entries and ignores.
    • Add scripts: lint:knip, format:knip; aggregate lint/format include Knip.
    • Run Knip in lefthook pre-commit.
  • Refactors

    • Remove unused modules and related docs/rules: src/utils/file.ts, src/utils/schema.ts, .cursor rule; trim file-operations skill to HTTP-only.
    • Remove unused deps (fs-fixture, nano-spawn); add knip; update workspace and lockfile.
    • Make unused exports internal across the codebase (rpc-client, tool, stackone, types, tfidf-index) and drop the ToolSet re-export.

Written for commit 1ac40cc. Summary will update automatically on new commits.

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
CopilotAI review requested due to automatic review settings December 9, 2025 12:36
@ryoppippi
ryoppippi requested a review from a team as a code ownerDecember 9, 2025 12:36
@pkg-pr-new

pkg-pr-newBot commented Dec 9, 2025

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/StackOneHQ/stackone-ai-node/@stackone/ai@174

commit: 1ac40cc

@ryoppippi
ryoppippi enabled auto-merge (squash) December 9, 2025 12:40

@cubic-dev-aicubic-dev-aiBot left a comment

Copy link
Copy Markdown
Contributor

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

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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
FileDescription
knip.config.tsNew configuration file defining workspaces, entry points, and rules for knip
package.jsonAdded knip scripts to lint/format workflows; removed unused @ai-sdk/openai from root devDependencies
lefthook.yamlAdded knip to pre-commit hook for automatic cleanup on staged TypeScript files
.github/workflows/lint.yamlAdded separate knip step to CI workflow
pnpm-workspace.yamlUpdated catalog to include knip and remove unused dependencies
pnpm-lock.yamlLockfile updates reflecting new knip dependency and removed packages
src/utils/file.tsRemoved unused file utilities module (133 lines)
src/utils/schema.tsRemoved unused JSON schema helper functions (39 lines)
src/utils/tfidf-index.tsChanged TfidfDocument and TfidfResult from exported to internal interfaces
src/types.tsChanged Headers, JsonSchemaType, and HttpExecuteParameter from exported to internal types
src/toolsets/index.tsRemoved ToolSet from public exports (kept internal for inheritance)
src/toolsets/stackone.tsChanged FetchToolsOptions and WorkflowConfig from exported to internal interfaces
src/tool.tsChanged metaSearchTools and metaExecuteTool from exported to internal functions
src/rpc-client.tsChanged RpcActionRequest and RpcClientConfig to internal types; removed unused RpcActionResponseData export
examples/package.jsonRemoved unused nano-spawn dependency
CLAUDE.mdUpdated documentation to reflect removal of file utilities
.claude/skills/file-operations/SKILL.mdRenamed skill from "File Operations and HTTP Standards" to "HTTP Request Standards"
.cursor/rules/file-utils.mdcRemoved 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.

@ryoppippi
ryoppippi merged commit 9df963d into mainDec 9, 2025
9 checks passed
@ryoppippi
ryoppippi deleted the feat/add-knip branch December 9, 2025 13:39
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add knip

3 participants

@ryoppippi@NicolasBelissent