Skip to content

refactor: split Configuration god-class (Phase 3, #234) - #237

Merged
pajoma merged 1 commit into
developfrom
refactor/234-phase3-split-config
Jun 2, 2026
Merged

refactor: split Configuration god-class (Phase 3, #234)#237
pajoma merged 1 commit into
developfrom
refactor/234-phase3-split-config

Conversation

@pajoma

@pajoma pajoma commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Phase 3 of #234 — split the 700-line Configuration god-class into focused collaborators.

Depends on #236 (Phase 2) being merged.

Changes

vscode/conf.ts is now a thin IConfiguration facade (~105 lines) that composes three collaborators in vscode/config/:

File Lines Responsibility
config/settings-reader.ts 323 scalar journal.* settings, base paths, scope + inline-template definitions, windows-path normalization
config/path-resolver.ts 248 entry / note / weekly path & file pattern reads + resolution
config/template-provider.ts 119 header / inline / time template resolution
config/patterns.ts 55 PatternDefinition / ScopeDefinition types + defaults
  • The prior resolver TemplateService is split into PathResolver + TemplateProvider. Both are pure (no vscode import) and receive settings through the small IJournalSettings seam — sets up Phase 5 (vscode-free domain).
  • Behavior unchanged: method bodies were relocated, not rewritten.

Verification

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

Acceptance (#234)

  • Configuration split into 3 focused classes (+ a small types module).
  • Facade keeps IConfiguration so call sites are untouched.
  • Note: settings-reader.ts is 323 lines incl. the 17-line GPL header (~290 effective) — right at the ~300 target; the base-path block is the bulk and is cohesive. Can split further on request.

Refs #234.

🤖 Generated with Claude Code

Phase 3 of #234. The 700-line Configuration god-class is now a thin
IConfiguration facade (~105 lines) composing:
  - SettingsReader   — scalar settings, base paths, scope/template defs
  - PathResolver     — entry/note/weekly path & file pattern resolution
  - TemplateProvider — header/inline/time template resolution

Pattern types + defaults moved to config/patterns.ts. TemplateService
(the prior resolver) is split into PathResolver + TemplateProvider, both
pure (no vscode) and fed settings via the IJournalSettings seam. Behavior
unchanged — method bodies relocated, not rewritten.

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: 96/100

Phase 3 of #234 is successfully implemented. This PR decomposes the 700-line \Configuration\ god-class into focused, decoupled collaborators.

Key Findings:

  • Decoupling: \PathResolver\ and \TemplateProvider\ are now VS Code-free, enabling pure unit testing of path and template logic.
  • Maintainability: High-cohesion classes (\SettingsReader, \PathResolver, \TemplateProvider) replace the previous monolithic structure.
  • Stability: The transitional facade ensures zero impact on existing call sites.
  • Verification: 238 tests passed; zero behavior regressions.

Recommendation: Merge immediately to unblock Phase 4 (Package-by-Feature).

@pajoma
pajoma merged commit bf78814 into develop Jun 2, 2026
2 checks passed
@pajoma
pajoma deleted the refactor/234-phase3-split-config branch June 2, 2026 20:36
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