Skip to content

refactor: remove unused exports and dead code - #549

Merged
kojiwakayama merged 9 commits into
mainfrom
chore/dead-export-cleanup
Mar 7, 2026
Merged

refactor: remove unused exports and dead code#549
kojiwakayama merged 9 commits into
mainfrom
chore/dead-export-cleanup

Conversation

@kojiwakayama

Copy link
Copy Markdown
Contributor

Summary

  • Removed export keyword from 350 declarations across 180 files that have zero external consumers (not imported by any other file in src/ or tests/)
  • Deleted 2,080 lines of completely dead code (47 functions/classes/constants that were neither exported nor used internally), plus cascading dead infrastructure
  • Zero new lint errors, zero new type errors, no test regressions

Approach

  1. Extracted all ~4,800 non-barrel exports across src/
  2. For each export, checked with rg -w whether any other file references it
  3. Removed export keyword from 350 unused exports
  4. Linter then revealed 47 of those were entirely dead code — deleted them
  5. Cleaned up cascading dead code (e.g., testing/isolation.ts lost ~600 lines of env overlay infrastructure only reachable through the removed installTestIsolation)

Modules affected

Module Exports removed Dead code deleted
transforms 57 ~400 lines
studio 51
server 37 ~50 lines
utils 24 ~220 lines
rendering 24
build 22 ~215 lines
platform 21 ~10 lines
agent 18 ~60 lines
workflow 15 ~195 lines
testing 2 ~600 lines
other (12 modules) 79 ~330 lines

Test plan

  • deno lint src/ — zero errors
  • deno check src/index.ts — no new type errors (3 pre-existing generated file errors unchanged)
  • deno test src/ — no test regressions (299 pass vs 298 on main)

Comment thread src/studio/bridge/bridge-constants.ts Fixed
Comment thread src/studio/bridge/bridge-constants.ts Fixed
Comment thread src/studio/bridge/bridge-markdown-core.ts Fixed
Comment thread src/studio/bridge/bridge-markdown-editor.ts Fixed
Remove `export` keyword from 350 declarations that have no external
consumers (not imported by any other file in src/ or tests/). This
reduces the public API surface, making the codebase easier to navigate
and preventing accidental coupling to internal implementation details.

Modules affected: transforms (57), studio (51), server (37), utils (24),
rendering (24), build (22), platform (21), agent (18), workflow (15),
html (12), react (11), cache (10), routing (9), tool (6), proxy (6),
modules (6), types (4), security (4), skill (3), observability (3),
discovery (3), testing (2), errors (2), integrations (1), embedding (1).
After removing unused exports, the linter revealed 47 functions, classes,
and constants that were completely dead — not used internally either.
Deleted them along with cascading dead code (e.g., testing/isolation.ts
lost ~600 lines of env overlay infrastructure that was only reachable
through the removed installTestIsolation entry point).
- Remove destroyVendorCache no-op stub and its caller in build-cleanup
- Remove unused MAX_KEY_DISPLAY_LENGTH (orphaned after withCacheSpan deletion)
- Remove unused WARMUP_TTL_SECONDS (orphaned after warmupTransformCache deletion)
@kojiwakayama
kojiwakayama force-pushed the chore/dead-export-cleanup branch from 93f13c4 to e720214 Compare March 7, 2026 16:30
- Delete unused DATA_NODE_END_LINE/DATA_NODE_END_COLUMN constants
- Delete unused openMarkdownSourceInStudio function
- Delete unused applyMarkdownHistoryCommand function
- Re-export BorderStyle type from box.ts (used by cli/ui/components/table.ts)
- Remove trailing blank line in vendor-cache.ts (deno fmt)
@kojiwakayama
kojiwakayama merged commit c3afd8b into main Mar 7, 2026
11 checks passed
@kojiwakayama
kojiwakayama deleted the chore/dead-export-cleanup branch March 7, 2026 17:02
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