chore(dead-code): remove 26 verified orphan files (~72KB / -2,774 lines)#5
Merged
Conversation
Static analysis (ts-prune + recursive reverse import graph + dynamic import
sweep) identified 28 candidates with zero importers. Two back-compat shims
(components/business/CompositionStudio.tsx + RenderCenter.tsx) are kept
because they are referenced via dynamic import() in 3 page files
(ProjectDetailPage + StepComposition + StepRender).
Deleted categories:
A. 12 back-compat shim files (declared '21+ files import' but 0 actual
references after 8-phase refactor):
- src/components/{index.ts,ui/confirm-dialog.tsx}
- src/context/SettingsContext.tsx
- src/hooks/index.ts
- src/providers/AppProvider.tsx
- src/core/pipeline/step-chain.ts
- src/core/services/{base-ai-service,novel-helpers,
scene-analyzer.service,script-analyzer.service,
video-composition.types}.ts
- src/core/stores/middlewares/persistWithDebounce.ts
B. 14 real orphan source files (0 references anywhere):
- src/core/domains/novel/services/emotion-detector.service.ts
- src/core/validation/schemas.ts
- src/core/services/video/ffmpeg-wasm/ffmpeg-wasm.types.ts
- src/features/editor/components/timeline.types.ts
- src/pages/project-edit/hooks/useProjectEdit.ts (HUGE 569 lines,
Container hook left orphaned after page refactor split)
- src/shared/components/ui/{accordion,async-boundary,breadcrumb,
drawer,form,use-form}.tsx
- src/shared/hooks/use-animation-frame.ts (10.5KB RAF hook lib)
- src/styles/{design-tokens,motion}.ts (only theme.ts is imported)
Verification:
- npm run lint --quiet → 0 errors
- npx tsc --noEmit → 0 errors
- npm test (90 suites) → 1596 pass, 4 skip, 0 fail
- npm run build → OK
Preserved (verified needed):
- src/shared/types/cssmodule.d.ts (ambient *.less/*.css declarations)
- components/business/CompositionStudio.tsx + RenderCenter.tsx
(re-export shims, used by 3 dynamic import() sites)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🐱 Dead Code Cleanup — Phase 1 (conservative, ~72 KB / 26 files)
Summary
Removes 26 verified orphan source files totaling ~72 KB / -2,774 lines identified through:
ts-prunestatic export analysisimport('@/...')string-literal sweep (caught 2 false positives)What's removed
A. 12 back-compat shim files (commented "21+ files import" but verified 0 actual references post v2.x refactor):
src/components/{index.ts, ui/confirm-dialog.tsx}src/context/SettingsContext.tsxsrc/hooks/index.tssrc/providers/AppProvider.tsxsrc/core/pipeline/step-chain.tssrc/core/services/{base-ai-service, novel-helpers, scene-analyzer.service, script-analyzer.service, video-composition.types}.tssrc/core/stores/middlewares/persistWithDebounce.ts(had@deprecatedtag)B. 14 real orphan source files (zero references anywhere in repo):
src/pages/project-edit/hooks/useProjectEdit.ts(569 lines, Container hook left orphaned after page split refactor)src/styles/{design-tokens, motion}.ts(onlytheme.tsis imported;motion.tskeyframes duplicated inglobals.css)src/shared/hooks/use-animation-frame.ts(10.5 KB RAF hook library, unused)src/shared/components/ui/{accordion, async-boundary, breadcrumb, drawer, form, use-form}.tsxsrc/core/validation/schemas.ts(270-line Zod)src/core/domains/novel/services/emotion-detector.service.tssrc/core/services/video/ffmpeg-wasm/ffmpeg-wasm.types.tssrc/features/editor/components/timeline.types.tsPreserved (verified needed)
src/shared/types/cssmodule.d.ts— ambient*.less/*.cssdeclarations, used by 60+ less importssrc/components/business/CompositionStudio.tsx+RenderCenter.tsx— used by 3import()sites inProjectDetailPage+StepComposition+StepRenderVerification
npm run lint --quietnpx tsc --noEmitnpm test --runInBand(90 suites)npm run buildDiff
Out of scope (Phase 2 candidates, ~443 KB remaining)
pages/directories (auto-pipeline/project-detail/project-edit/video-editor, ~256 KB) — needs test import path migrationpackages/common/half (utils/formatters/motion/hooks/domain/components/validation, ~192 KB) — onlyconstantsis used; effectively aborts the monorepo refactorLesson learned (patched into this PR's analysis method)
Dynamic
import('@/components/business/xxx')string-literal calls are invisible to staticimportregex sweeps. Initial candidate list had 2 false positives (CompositionStudio+RenderCentershims);tsc --noEmitcaught them immediately aftergit rm, files were restored viagit restore --staged --worktree. Always runtsc --noEmitafter the first batch of deletions before committing.