Skip to content

Add knip library to detect unused dependencies, exports, and files#915

Merged
benbrown merged 8 commits intomainfrom
southworks/add/knip
Feb 17, 2026
Merged

Add knip library to detect unused dependencies, exports, and files#915
benbrown merged 8 commits intomainfrom
southworks/add/knip

Conversation

@sw-joelmut
Copy link
Copy Markdown
Collaborator

Related issue #889

Description

This PR adds the knip library to detect unused dependencies, exports, and files. Also detecting when dependencies are being used across the codebase, but not declared in the package.json.

Note

This library was added to run in the CI workflow and to the recommended extension in vscode.

Why Are We Removing These?

After running knip analysis, each flagged item was manually reviewed and confirmed that:

  1. No impact on public API - None of the removed exports are part of the public API signature
  2. No external dependencies - Removed exports were not needed outside their own file scope
  3. Dead code cleanup (files) - These items represent unnecessary dead code in the repository

Testing

The following image shows the knip tool detection.
imagen

Copy link
Copy Markdown
Contributor

Copilot AI left a 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 integrates the knip library to automatically detect and remove unused dependencies, exports, and files across the monorepo. The changes include adding knip configuration, integrating it into the CI workflow, removing dead code identified by knip analysis, and fixing missing dependency declarations that were being used but not properly declared.

Changes:

  • Added knip library with configuration (knip.jsonc) to detect unused dependencies, exports, and files
  • Removed unused exports and entire unused files (DoOnce export, TaskModuleInvokeNames export, Messages class, TemplateInterface)
  • Added missing dependencies across test-agents and packages that were being used but not declared in package.json
  • Fixed incorrect package name reference in test-agents/copilotstudio-console and corrected bundle script path in test-agents/application-style

Reviewed changes

Copilot reviewed 29 out of 31 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
knip.jsonc Configuration for knip to define workspaces, entry points, and exclusions
.vscode/extensions.json Added knip VS Code extension recommendation
.github/workflows/ci.yml Integrated knip validation into CI pipeline
package.json Added knip dependency, new lint scripts, and @rushstack/terminal peer dependency
package-lock.json Updated lockfile with knip and its dependencies, removed unused global package
packages/agents-hosting-storage-cosmos/src/cosmosDbPartitionedStorage.ts Changed DoOnce class from exported to internal-only
packages/agents-hosting-storage-cosmos/package.json Added missing @microsoft/agents-activity dependency
packages/agents-hosting-storage-blob/package.json Added missing dependencies (@azure/core-auth, @microsoft/agents-activity, zod)
packages/agents-hosting-extensions-teams/src/taskModule/taskModule.ts Changed TaskModuleInvokeNames from exported enum to internal-only
packages/agents-hosting-extensions-teams/src/messages/messages.ts Removed entire unused Messages class file
packages/agents-hosting-extensions-teams/src/messageExtension/messagingExtensionAction.ts Fixed import path to use index barrel export
packages/agents-hosting-extensions-teams/package.json Added missing dependencies (axios, @microsoft/agents-activity, zod)
packages/agents-hosting-dialogs/src/template.ts Removed entire unused TemplateInterface file
packages/agents-hosting-dialogs/src/dialogHelper.ts Changed getActiveDialogContext from exported to internal-only
packages/agents-hosting-dialogs/src/choices/findValues.ts Removed unnecessary @internal comment from exported function
packages/agents-hosting-dialogs/package.json Added missing dependencies (@microsoft/agents-activity, zod)
packages/agents-activity/test/activity/activity.treatment.test.ts Added test to verify ActivityTreatments enum is part of public API
packages/agents-activity/src/entity/productInfo.ts Changed ProductInfo interface from exported to internal-only
packages/agents-activity/src/conversation/membershipTypes.ts Removed unused Zod schema export
packages/agents-activity/src/conversation/membershipSourceTypes.ts Removed unused Zod schema export
packages/agents-activity/src/conversation/membershipSource.ts Removed unused Zod schema exports and imports
packages/agents-activity/src/activityTreatments.ts Removed unused Zod schema export
test-agents/web-chat/package.json Added missing dependencies (@microsoft/agents-activity, axios)
test-agents/state-agent/package.json Added missing @microsoft/agents-hosting dependency
test-agents/root-agent/package.json Added missing dependencies (@microsoft/agents-activity, @microsoft/agents-hosting-storage-blob)
test-agents/multi-turn-prompt/package.json Added missing dependencies (@microsoft/agents-hosting, @microsoft/agents-activity)
test-agents/empty-agent/package.json Added missing @microsoft/agents-hosting dependency
test-agents/custom-dialogs/package.json Added missing dependencies (@microsoft/agents-hosting, @microsoft/agents-activity)
test-agents/copilotstudio-console/package.json Fixed incorrect package name from @microsoft/agents-copilot-studio to @microsoft/agents-copilotstudio-client
test-agents/application-style/package.json Fixed bundle script to point to index.ts instead of index.js, added missing dependencies
test-agents/agentic-ai/package.json Added missing @microsoft/agents-hosting dependency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/agents-hosting-extensions-teams/package.json Outdated
Comment thread test-agents/web-chat/package.json Outdated
Comment thread packages/agents-hosting-storage-blob/package.json Outdated
Comment thread packages/agents-hosting-extensions-teams/package.json Outdated
Comment thread packages/agents-hosting-dialogs/package.json Outdated
sw-joelmut and others added 2 commits February 6, 2026 13:29
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
benbrown
benbrown previously approved these changes Feb 17, 2026
@benbrown benbrown merged commit b026503 into main Feb 17, 2026
7 checks passed
@benbrown benbrown deleted the southworks/add/knip branch February 17, 2026 17:05
Sign up for free to 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.

3 participants