mirror of
https://github.com/aaronsb/obsidian-mcp-plugin.git
synced 2026-07-22 16:40:32 +00:00
router.ts was a 2,228-line monolith (~2.8x the 800-line threshold). Extract the largest unit — executeVaultOperation + its helpers — into src/semantic/operations/vault.ts behind a RouterContext interface. - operations/router-context.ts: RouterContext (api/app/fragmentRetriever/ validator); SemanticRouter implements it and passes itself, so shared state propagates with no indirection - operations/shared.ts: Params, SearchResultItem, paramStr/Num/Bool (router-private → shared by all handlers) - operations/vault.ts: executeVaultOperation + splitContent/sortFiles/ copyFile/copyDirectoryRecursive; mechanical this.→ctx. (tsc is the safety net — a missed rewrite fails compile) - router fields api/app/fragmentRetriever/validator → public readonly - removed a fully unreachable pre-existing dead subtree (combineSearchResults, isDirectory, performFileBasedSearch, indexVaultFiles, getSearchWorkflowHints, extractContext, getFileType — zero call sites anywhere; eslint doesn't flag unused class methods, which hid them). ~290 dead lines gone. router.ts 2228→988; vault.ts 948. Behaviour-preserving: tsc clean, lint at the exact pre-existing baseline (0 errors, 5 unrelated warnings), 235/235 tests unchanged. Staged per the issue's "extract vault first in isolation" guidance: #199 stays open for the remaining handlers (edit/view/graph/system/bases → router thin dispatcher <300 lines). ADR-202. |
||
|---|---|---|
| .. | ||
| adr | ||
| architecture | ||
| scripts | ||
| tools | ||
| bases-implementation-fixes.md | ||
| bases-implementation-status.md | ||
| bases-implementation.md | ||
| bases-mcp-reference.md | ||
| graph-traversal.md | ||
| Plugin_UI_July_2025.png | ||
| PROJECT_STRUCTURE.md | ||
| SECURITY-IMPLEMENTATION.md | ||
| troubleshooting.md | ||