refactor(structure): split pure parsers into obsidian-markdown/ and MCP wiring into mcp-core/#168
Conversation
…CP wiring into mcp-core/ Make the parser/IO layering physical with zero behavior change. Pure git mv + import-specifier rewrites: - Pure Obsidian/Markdown parsers -> src/vault-mcp/obsidian-markdown/ (frontmatter, callouts [was callout-parser], headings [was heading-parser], links). No fs/db/MCP deps. - MCP protocol surface -> src/vault-mcp/mcp-core/ (mcp-router, tool-definitions, prompt-definitions). - Tests move with their sources (co-located __tests__/). - Top-level rule: folders are domains; only the entry point (server.ts) and its config.ts stay loose. Also updates the AGENTS.md structure tree and two stale comment cross-references to the renamed files. No config changes needed (all build/test tooling uses src/** globs). 898 tests pass, build + lint green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
✅ Action performedReview finished.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (22)
📝 WalkthroughWalkthroughA new Changesobsidian-markdown module extraction and import rewiring
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ort conventions (#172) ## What Capstone to the parser/IO restructure (#168, #169, #171). Adds a **Module layering** section to `AGENTS.md` so the structure those PRs built is durable and enforceable — recorded as rules, not just implied by the file tree. Also lands the structure-polish follow-ups (folder rename + boundary clarifications) agreed during review. It documents: - **What each folder is for** (`obsidian-markdown/` · `vault-operations/` · `mcp-core/` · `search/` · `oauth/` · `utils/`), and that a module's folder follows **what it depends on**, not just its topic. - **Dependency direction** — `obsidian-markdown/` and `utils/` are leaves; `vault-operations/` and `search/` build on them; `mcp-core/` and the wiring depend on everything — plus the "top level is wiring only" rule. - **The `vault-filesystem.ts` ↔ `utils/fs.ts` boundary** — **policy vs. adapter**: `utils/fs.ts` holds only policy-free `node:fs` wrappers, while the atomic-write strategy, path-safety, and the `vaultFs` data API stay in `vault-filesystem.ts`. "Mechanically generic" isn't enough to demote load-bearing vault-I/O policy. - **`utils/` admission** — generic with zero domain knowledge, clearing one of two bars: it consolidates real duplication (multi-consumer), or it is a self-contained, general-purpose primitive (`mapWithConcurrency`). - **Export style by module kind** — service/data-layer modules export a single namespace object (or a factory-closure when stateful: `createSearchIndex`/`createMemoryStore`); pure parsers/helpers use named exports; `links.ts` is the deliberate namespace exception (its `/g` `lastIndex` footgun). ### Structure polish (also in this PR) - Renamed `vault-mcp/auth/` → `vault-mcp/oauth/` so it no longer collides conceptually with the top-level `src/auth.ts` token utilities. Docs + a folder rename — no behavior change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <noreply@anthropic.com>
What
Makes the parser / vault-IO / protocol layering physical, with zero behavior change — pure
git mvplus import-specifier rewrites.src/vault-mcp/obsidian-markdown/(new) — the pure Obsidian/Markdown parsers, none of which touch the filesystem:frontmatter,callouts(wascallout-parser),headings(washeading-parser), andlinks(promoted from thevault-mcp/root).src/vault-mcp/mcp-core/(new) — the MCP protocol surface:mcp-router,tool-definitions,prompt-definitions.vault-operations/keeps the filesystem I/O + use-cases (vault-filesystem,vault-patcher,note-mover,memory-store,daily-notes).Top-level rule going forward: folders are domains; the only loose files are the entry point (
server.ts) and itsconfig.ts.Why
The pure parsers were already pure (no
fsimports) but scattered — some buried undervault-operations/,links.tsloose at the root — andsearch-index.tsreached intovault-operations/just to grab a pure parser (a backwards dependency). This isolates the parsing layer so both the indexer andvault-operationsconsume it as a shared peer — the same treatmentlinks.tsgot in #165.Scope
Structure only — no logic, no new modules. Deliberate follow-ups (a new
lines.tsconsolidating the currently-duplicated fence state machines, memoryparseSections→ the shared headings parser, andutils/extraction ofdescribeError+ the ENOENT fs helpers) land in separate PRs.Notes
__tests__/); the two renamed parsers' tests are renamed to match.src/**.Verification
npm run build(tsc, server + cli) ✅npm test— 898 passed ✅npm run lint✅git diffconfirms renames + import lines only; no function bodies touched.🤖 Generated with Claude Code
Summary by CodeRabbit