Skip to content

refactor: package-by-feature layout + events bus (Phase 4, #234) - #238

Merged
pajoma merged 1 commit into
developfrom
refactor/234-phase4-feature-folders
Jun 2, 2026
Merged

refactor: package-by-feature layout + events bus (Phase 4, #234)#238
pajoma merged 1 commit into
developfrom
refactor/234-phase4-feature-folders

Conversation

@pajoma

@pajoma pajoma commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Phase 4 of #234 — physical reorg from package-by-layer to package-by-feature, plus the cross-feature event bus.

Depends on #237 (Phase 3) being merged.

New layout

src/shared/    kernel — model, config, fs, logging, dates, strings,
               templates, paths, events, lang  (no feature dependencies)
src/features/  entries, notes, weekly, tasks, navigation, smart-input, tools
               (commands/ + domain + ui per feature)
src/app/       composition root (Container / register / startup)

~51 files moved (git detects renames). Old top-level dirs (commands/, journal/, model/, ui/, util/, vscode/) are gone.

Events

  • New shared/events/JournalEvents — typed vscode.EventEmitter bus implementing IJournalEvents.
  • The inline weekly daily-link sync in show-entry-for-date now fires an entryOpened event instead of importing the weekly feature. The weekly-sync subscriber is wired in the Container (composition root), so direct-Container tests keep the behavior unchanged.
  • Net: the entries → weekly import edge is removed.

Cross-feature edges (acceptance #5)

Down to 3, each documented for a focused follow-up (they need placement calls heavier than a file move):

  • entries → notesLoadNotes dispatch inside loadPageForInput.
  • navigation → entries — prev/next commands extend the shared AbstractLoadEntryForDateCommand.
  • smart-input → entriesDialogues uses ScanEntries for the quick-pick.

Verification

  • npm run compile-tests (tsc) ✔
  • npm run compile (esbuild) ✔
  • npm run lint
  • Full suite: 238 passing, exit 0

Follow-ups (not in this PR)

  • AGENTS.md "Architecture" section + docs/PLAN.md still describe the old layout — needs a docs pass.
  • Eliminate the 3 remaining cross-feature edges (move Dialogues + base command to shared/, registry-based note dispatch).
  • Phase 5 (vscode-free domain) — separate issue per the spec.

Refs #234.

🤖 Generated with Claude Code

Phase 4 of #234. Physical reorg from package-by-layer to package-by-feature:

  src/shared/   kernel — model, config, fs, logging, dates, strings,
                templates, paths, events, lang (no feature deps)
  src/features/ entries, notes, weekly, tasks, navigation, smart-input,
                tools (commands/ + domain + ui per feature)
  src/app/      composition root (unchanged)

Add shared/events/JournalEvents (typed vscode.EventEmitter). The inline
weekly daily-link sync in show-entry-for-date now fires an 'entryOpened'
event; the weekly sync subscriber is wired in the Container — removing the
entries->weekly import edge. Behavior unchanged (Container owns the
subscription, so direct-Container tests keep it).

Remaining cross-feature edges (documented for follow-up): entries->notes
(LoadNotes dispatch), navigation->entries (shared base command),
smart-input->entries (Dialogues uses ScanEntries).

Refs #234.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@pajoma

pajoma commented Jun 2, 2026

Copy link
Copy Markdown
Owner Author

Brooks-Lint PR Review: Approved

Health Score: 95/100

Phase 4 of #234 is successfully implemented. This PR completes the physical reorganization to a Package-by-Feature layout and introduces a typed event bus for cross-feature communication.

Key Findings:

  • Decoupling: Successfully removed the \entries\ → \weekly\ import edge by using the new \JournalEvents\ bus.
  • Organization: Foundational logic is now isolated in a clean \shared/\ kernel, with features (Notes, Entries, Tasks) having dedicated, cohesive directories.
  • Stability: Full suite of 238 tests passed. Physical renames and import rewiring are verified.
  • Risk: The massive structural churn is the intended fix for the project's historical 'Dependency Disorder' and should be landed immediately.

Recommendation: Merge immediately to stabilize the new architecture and unblock final documentation updates.

@pajoma
pajoma merged commit def4c2a into develop Jun 2, 2026
2 checks passed
@pajoma
pajoma deleted the refactor/234-phase4-feature-folders branch June 2, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant