refactor: reduce structural hotspots — split barrels, extract modules, auto-generate registry#116
Merged
refactor: reduce structural hotspots — split barrels, extract modules, auto-generate registry#116
Conversation
…, auto-generate registry
Address all findings from hotspot analysis (co-change, churn, hidden coupling):
Types package (450→95 lines + 5 domain files):
- Split index.ts into result.ts, workflow.ts, skill.ts, ci.ts, roadmap.ts
- Fix circular imports: tracker-sync.ts and orchestrator.ts now import from
domain files directly instead of through index.ts
Learnings module (813→230 lines + 3 leaf modules):
- Extract learnings-content.ts (parsing, hashing, dedup — leaf, no siblings)
- Extract learnings-loader.ts (file loading + mtime cache — leaf, no siblings)
- Extract learnings-lifecycle.ts (prune, archive, promote — imports from leaves)
- Strictly acyclic dependency graph: content ← loader ← {learnings, lifecycle}
CLI command registration (108→14 lines in index.ts):
- Auto-generate _registry.ts via scripts/generate-barrel-exports.mjs
- createProgram() loops over discovered commands instead of 48 manual imports
- Supports both `export function` and `export const` patterns
- `pnpm run generate-barrel-exports --check` for CI freshness validation
Hidden dependency (sync-engine ↔ github-issues):
- Document adapter coupling via comment in sync-engine.ts
Update arch baselines for new module count (+10 files).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
types/src/index.ts(450 lines) into 5 domain files + barrel, fixing circular importslearnings.ts(813 lines) into 4 acyclic leaf modules (content, loader, lifecycle, crud)scripts/generate-barrel-exports.mjs, replacing 48 manual importsRe-opened after reverting PR #115 which contained rogue commits.
Test plan