|
| 1 | +# Spec: Domain Module Naming (#209) |
| 2 | + |
| 3 | +## Goal |
| 4 | + |
| 5 | +Rename source directories from generic technical labels (`ext`, `actions`, `util`, `provider/*`) to journaling-domain terms that reveal intent at a glance. |
| 6 | + |
| 7 | +## Why Now |
| 8 | + |
| 9 | +Phase 2 DI work (#207, #208) stabilized interfaces and service construction. Renaming now — before the barrel-import removal in Phase 2.3 — means the new paths are the canonical ones when named imports replace `J.*` namespaces. Doing it after 2.3 would require updating hundreds of named imports immediately. |
| 10 | + |
| 11 | +## In Scope |
| 12 | + |
| 13 | +Full directory rename + import path update for all TypeScript source files under `src/`. No logic changes. |
| 14 | + |
| 15 | +### Mapping |
| 16 | + |
| 17 | +| Current path | New path | Reason | |
| 18 | +|---|---|---| |
| 19 | +| `src/ext/` | `src/core/extension/` | VS Code lifecycle/config is extension plumbing, not domain | |
| 20 | +| `src/actions/` | `src/core/journal/` | Core read/write/inject logic _is_ the journal domain | |
| 21 | +| `src/util/` | `src/core/infrastructure/` | Controller, logger, paths, strings — infrastructure, not domain | |
| 22 | +| `src/provider/commands/` | `src/commands/` | Commands are a top-level surface, not a provider sub-concern | |
| 23 | +| `src/provider/codeactions/` | `src/ui/codeactions/` | VS Code UI surface grouped under `ui/` | |
| 24 | +| `src/provider/codelens/` | `src/ui/codelens/` | VS Code UI surface grouped under `ui/` | |
| 25 | +| `src/provider/features/sync-daily-links.ts`<br>`src/provider/features/sync-note-links.ts` | `src/features/sync/` | Sync is a domain feature, distinct from navigation | |
| 26 | +| `src/provider/features/scan-entries.ts`<br>`src/provider/features/load-note.ts`<br>`src/provider/features/show-pick-list.ts`<br>`src/provider/features/weekly-entry-watcher.ts` | `src/features/navigation/` | These power the "find and open" UX flow | |
| 27 | +| `src/provider/features/match-input.ts` | `src/core/journal/match-input.ts` | Smart-input resolver is parser-adjacent core logic | |
| 28 | +| `src/model/` | `src/model/` | Already neutral; no rename | |
| 29 | + |
| 30 | +`src/provider/` disappears entirely once all sub-paths are redistributed. |
| 31 | + |
| 32 | +### Barrel index.ts |
| 33 | + |
| 34 | +`src/index.ts` currently exports namespaces `J.Extension`, `J.Actions`, `J.Model`, `J.Util`, `J.Provider`. Update re-export paths to new locations; **keep namespace keys unchanged** (`J.Util`, `J.Actions`, etc.) to avoid churn in all consumers. Phase 2.3 eliminates the barrel entirely — that is the correct place to update consumer import sites. |
| 35 | + |
| 36 | +`src/provider/index.ts` is deleted (no new top-level `provider/` exists). |
| 37 | + |
| 38 | +## Out of Scope |
| 39 | + |
| 40 | +- Logic changes of any kind |
| 41 | +- Renaming barrel namespace keys (`J.Util` → `J.Infrastructure` etc.) — that belongs in Phase 2.3 alongside consumer migration |
| 42 | +- Renaming individual files (only directories change) |
| 43 | +- `src/model/` (unchanged) |
| 44 | +- `src/test/` (test files update their import paths but directory structure unchanged) |
| 45 | +- `src/extension.ts` entry point (stays at root) |
| 46 | + |
| 47 | +## Acceptance Criteria |
| 48 | + |
| 49 | +1. `src/provider/` directory no longer exists. |
| 50 | +2. New directories match the mapping table exactly. |
| 51 | +3. `npm run compile` succeeds (zero esbuild errors). |
| 52 | +4. `npm run compile-tests` succeeds (zero tsc errors). |
| 53 | +5. `npm test` passes with the same test count as `develop` before the rename. |
| 54 | +6. `AGENTS.md` updated: all path references (`src/ext/`, `src/actions/`, `src/util/`, `src/provider/…`) reflect new locations. |
| 55 | +7. `docs/PLAN.md` updated: path references in open backlog items reflect new locations. |
| 56 | + |
| 57 | +## Entities / Contracts |
| 58 | + |
| 59 | +No type or interface changes. All interfaces in `src/model/interfaces.ts` are unchanged. Barrel namespace keys are unchanged (see above). |
| 60 | + |
| 61 | +## Constraints |
| 62 | + |
| 63 | +- Pure rename: zero diff to `.ts` file bodies except import path strings. |
| 64 | +- Must land on a branch that descends from `develop` after #207 and #208 are merged. |
| 65 | +- `src/index.ts` barrel must remain functional until Phase 2.3. |
| 66 | + |
| 67 | +## Open Questions |
| 68 | + |
| 69 | +None — all ambiguities resolved in session 2026-05-17. |
| 70 | + |
| 71 | +## Related Issues |
| 72 | + |
| 73 | +- Precedes: Phase 2.3 barrel/named-import removal (no issue number yet) |
| 74 | +- Follows: #207 (JournalController interface), #208 (constructor injection) |
0 commit comments