Skip to content

Remove unused code, dead exports, and unneeded dependencies#11

Merged
akemmanuel merged 1 commit intomasterfrom
cleanup/remove-unused-code
Mar 4, 2026
Merged

Remove unused code, dead exports, and unneeded dependencies#11
akemmanuel merged 1 commit intomasterfrom
cleanup/remove-unused-code

Conversation

@akemmanuel
Copy link
Owner

Summary

Comprehensive cleanup of unused code, dead exports, and unnecessary dependencies across the codebase. Typecheck and lint pass with zero errors/warnings.

Deleted files

  • OPENGUI.png, white.txt, whitespaces.txt - unrelated/unused root files
  • src/components/ui/collapsible.tsx, toggle.tsx, textarea.tsx - never-imported UI components

Removed dependencies

  • amadeus - never imported in src/
  • @radix-ui/react-slot - superseded by the unified radix-ui package

Dead code removed

  • Legacy useOpenCode() hook, OpenCodeContext, OpenCodeContextValue interface, and combined value memo in the provider - all components use the split hooks instead
  • setVariant from ActionsContextValue - never called by any consumer
  • Redundant export default App from App.tsx
  • Deprecated projectName wrapper in AppSidebar.tsx (6 call sites migrated to direct getProjectName())
  • Unused disconnect destructuring and hasAnyConnection import in ConnectionPanel.tsx

Exports narrowed

  • Context value interfaces (SessionContextValue, ModelContextValue, ConnectionContextValue, ActionsContextValue) no longer exported
  • cycleVariantSelection no longer exported from use-variant.ts
  • QueueItem, MergeDialogProps, SESSION_COLORS no longer exported
  • ProviderIconProps, resolveProviderIcon no longer exported
  • Provider-icons barrel exports pruned

Dead shadcn/UI components and exports removed

  • card.tsx: CardDescription, CardFooter
  • sheet.tsx: SheetTrigger, SheetClose, SheetFooter
  • dialog.tsx: DialogClose, DialogPortal, DialogOverlay
  • sidebar.tsx: 9 unused components + unused Input, Separator, Skeleton imports
  • badge.tsx: badgeVariants export
  • button.tsx: buttonVariants export

Net result: -552 lines deleted, 23 files changed

- Remove unused deps: amadeus, @radix-ui/react-slot
- Delete unused files: OPENGUI.png, white.txt, whitespaces.txt
- Delete unused UI components: collapsible.tsx, toggle.tsx, textarea.tsx
- Remove legacy useOpenCode() hook, OpenCodeContext, and provider wiring
- Remove unused setVariant from ActionsContextValue
- Replace deprecated projectName wrapper with direct getProjectName calls
- Remove redundant export default from App.tsx
- Narrow exports in shadcn components (card, sheet, dialog, sidebar, badge, button)
- Remove dead function definitions for unexported shadcn components
- Clean up unused imports in ConnectionPanel and sidebar
@akemmanuel
Copy link
Owner Author

Code Review Summary

Confidence Score: 4/5

The PR is well-executed with proper cleanup. One minor issue detected.


Issues Found

1. Minor Behavioral Difference in getProjectName Migration (Low Severity)

Location: src/components/AppSidebar.tsx:394, 547, 682, 702, 740, 950

The deprecated projectName wrapper was:

const projectName = (directory: string) => getProjectName(directory, directory);

Now replaced with direct calls:

getProjectName(directory)

Difference: The old wrapper passed directory as the fallback parameter, while the new calls use the default fallback "repo".

Impact: Minimal. This only affects edge cases where the directory path is empty or contains only slashes. All current call sites pass valid paths, so this is unlikely to cause visible issues.


Verified Correct

  • useOpenCode hook removed - no remaining usages found
  • setVariant removed from context - still used internally in use-variant.ts
  • ✅ Removed exports (cycleVariantSelection, SESSION_COLORS, QueueItem, MergeDialogProps, ProviderIconProps, resolveProviderIcon) - no remaining imports found
  • ✅ UI component cleanup (card, dialog, sheet, sidebar, badge, button) - all remaining exports are still imported correctly
  • ✅ Deleted files (collapsible.tsx, toggle.tsx, textarea.tsx) - no remaining imports
  • ✅ Dependency removals (amadeus, @radix-ui/react-slot) - not imported anywhere
  • ✅ Timeout cleanup added in AppSidebar.tsx - proper cleanup on unmount

Summary

A thorough cleanup PR. The only issue is a very minor behavioral change getProjectName in the migration that won't affect typical usage. TypeScript would catch any broken imports at compile time, and the changes pass the PR's own claim of "Typecheck and lint pass with zero errors/warnings."

New%20session%20-%202026-03-04T14%3A14%3A44.133Z
opencode session  |  github run

@akemmanuel akemmanuel merged commit e6330db into master Mar 4, 2026
2 of 5 checks passed
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.

1 participant