Skip to content

Phase 5 (#234): vscode-free domain + shared/editor adapter #239

Description

@pajoma

Follow-up to #234 (package-by-feature restructure, Phases 1–4 merged via #235#238).

Goal

Make the per-feature domain/ logic VS Code-free: domain returns data/paths, and a single shared/editor/ adapter performs all vscode.TextDocument open/show/save. This is the highest-testability payoff of the restructure and was always slated as its own issue (per the #234 plan + maintainer review).

Why separate

The change in return types (removing vscode.TextDocument from Reader/Writer/Inject) is a semantic shift that deserves its own focus and verification cycle, not bundled into a file move.

Scope

  1. Introduce shared/editor/ — an adapter owning open / show / save of vscode.TextDocument (wraps the bits currently in Dialogues/Writer).
  2. Change features/*/ domain code (reader.ts, writer.ts, inject.ts) to return paths/data instead of vscode.TextDocument; commands call the editor adapter.
  3. Add pure-node unit tests for the domain logic (no Extension Host needed).

Prerequisite — remove remaining cross-feature edges (#234 acceptance #5)

Three edges remain after Phase 4; clean these as part of (or just before) this work:

  • entries → notesLoadNotes dispatch inside loadPageForInput.
  • navigation → entries — prev/next commands extend the shared AbstractLoadEntryForDateCommand (move base command to shared/ or a neutral location).
  • smart-input → entriesDialogues uses ScanEntries (move Dialogues/ScanEntries placement so neither feature imports the other).

Acceptance

  • grep -r "vscode" src/features/*/**/domain* (and the reader/writer/inject files) → no vscode import.
  • All vscode.TextDocument handling flows through shared/editor/.
  • New node-only domain unit tests pass.
  • No cross-feature internal imports remain (grep/lint verifiable).
  • Full suite green.

Also pending from #234

  • Docs pass: AGENTS.md "Architecture" section + docs/PLAN.md still describe the pre-restructure layout. (Tracked separately / may land first.)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions