agents icon indicating copy to clipboard operation
agents copied to clipboard

@inkeep/agents-manage-ui: remove unused exports

Open dimaMachina opened this issue 2 months ago • 3 comments

dimaMachina avatar Nov 05 '25 16:11 dimaMachina

🦋 Changeset detected

Latest commit: 62bdd5e334bc23c37748ebb1e6106de537dd26e1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@inkeep/agents-manage-ui Patch
@inkeep/agents-manage-api Patch
@inkeep/agents-run-api Patch
@inkeep/agents-cli Patch
@inkeep/agents-core Patch
@inkeep/agents-sdk Patch
@inkeep/ai-sdk-provider Patch
@inkeep/create-agents Patch
test-agents Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Nov 05 '25 16:11 changeset-bot[bot]

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
agents-docs Ready Ready Preview Comment Nov 6, 2025 6:02pm
agents-manage-api Ready Ready Preview Comment Nov 6, 2025 6:02pm
agents-manage-ui Ready Ready Preview Comment Nov 6, 2025 6:02pm
agents-run-api Ready Ready Preview Comment Nov 6, 2025 6:02pm

vercel[bot] avatar Nov 05 '25 16:11 vercel[bot]

Claude finished @dimaMachina's task —— View job


Code Review: Remove Unused Exports PR

I've completed a comprehensive review of this PR that systematically removes unused exports across the codebase using Knip.

Overview

This PR introduces automated tooling to detect and remove unused exports, focusing primarily on the @inkeep/agents-manage-ui package. The changes span 43 files with +409/-76 lines, affecting 9 packages via changesets.


Strengths & Positive Aspects

1. Tooling Integration

  • Smart Configuration: Added knip.config.ts with tags: ['-lintignore'] - respects existing manual annotations
  • Automation: Added pnpm knip --fix-type exports script for automated cleanup
  • Systematic Approach: 25+ commits show methodical, incremental cleanup

2. Strategic Preservation

  • UI Component Libraries: Correctly preserves complete API surface for reusable components (Card*, DropdownMenu*, Table*)
  • Public APIs: Maintains external-facing exports that may be consumed by other packages
  • Selective Cleanup: Uses /** @lintignore */ comments to mark intentionally exported but currently unused items

🚨 Critical Issues Requiring Attention

1. Changeset Quality Control

HIGH PRIORITY: The changeset .changeset/fine-dots-live.md contains only "dd" as description:

---
"@inkeep/agents-manage-ui": patch
---

dd

Action Required: Replace with proper description like:

---
"@inkeep/agents-manage-ui": patch
---

Remove unused exports using Knip automation tool

2. Breaking Change Risk Assessment

MEDIUM-HIGH PRIORITY: While this targets internal unused exports, consider:

  • Internal Consumers: Other packages in the monorepo may import these exports
  • Dynamic Imports: Runtime require()/import() calls won't be detected by static analysis
  • External Integration: If these packages are consumed externally, this could be breaking

Recommendations:

  1. Run full test suite across all packages: pnpm test
  2. Build all packages: turbo build
  3. Consider gradual rollout if external consumers exist

3. Potential Over-Automation

MEDIUM PRIORITY: Some preserved exports might actually be unused:

In agents-manage-ui/src/lib/types/agent-full.ts:29, several types are imported but potentially unused:

import {
  // ... many imports that might not be used anywhere
  type ExternalAgentApiInsert,
  type FunctionApiInsert,
  // etc.
} from '@inkeep/agents-core/client-exports';

Recommendation: Verify these type imports are actually needed or if they're legacy remnants.


🔍 System Architecture Considerations

1. Maintenance Strategy

  • CI Integration: Consider adding pnpm knip --no-fix-type to CI to catch unused exports early
  • Documentation: Add guidelines to AGENTS.md about when to use @lintignore

2. API Design Patterns

The PR shows good judgment in preserving complete component APIs:

// Good: Preserves complete Card component API
export {
  Card,
  CardHeader,
  CardFooter,
  CardTitle,
  /** @lintignore */
  CardAction,      // May be used by consumers later
  CardDescription,
  CardContent,
};

3. Bundle Size Impact

POSITIVE: This cleanup should improve tree-shaking and reduce bundle sizes, especially for selective imports.


📋 Minor Quality Issues

4. Code Consistency

  • Pattern Variation: Some files use @lintignore more liberally than others - consider establishing clearer guidelines
  • Import Organization: Some files could benefit from import cleanup alongside export cleanup

5. File-Specific Notes

  • UI Components: Good preservation of Radix UI wrapper APIs that follow established patterns
  • Server Actions: Nango integration functions appropriately preserve server-side API surface
  • Type Definitions: Agent type exports maintain necessary type contracts

🎯 Recommendations

Immediate Actions (Before Merge)

  1. Fix changeset description (Critical)
  2. Run comprehensive tests across all packages
  3. Verify build success for all affected packages

Follow-up Actions

  1. CI Integration: Add knip check to prevent unused export accumulation
  2. Documentation: Update development guidelines with knip usage patterns
  3. Monitoring: Track bundle size improvements from this cleanup

Architecture Evolution

  1. API Boundaries: Consider formalizing which packages export public APIs vs internal utilities
  2. Export Strategies: Establish patterns for when to use barrel exports vs direct exports

🔐 Security & Safety Assessment

  • No Security Concerns: Changes are purely structural, removing unused code paths
  • Type Safety: TypeScript will catch any missed dependencies at compile time
  • Runtime Safety: No runtime behavior changes, only build-time optimizations

Final Verdict

This PR demonstrates excellent engineering hygiene and systematic technical debt reduction. The automated approach using Knip is well-implemented with appropriate safeguards.

Approval Contingent On: Fixing the changeset description and confirming all tests/builds pass.

The strategic use of @lintignore shows thoughtful consideration of API design and future extensibility, while the systematic cleanup improves codebase maintainability and bundle efficiency.


claude[bot] avatar Nov 05 '25 16:11 claude[bot]

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs.

If this PR is still relevant:

  • Rebase it on the latest main branch
  • Add a comment explaining its current status
  • Request a review if it's ready

Thank you for your contributions!

github-actions[bot] avatar Dec 13 '25 00:12 github-actions[bot]