Skip to content

Group src modules into folders - #4

Merged
nhyiramante1 merged 4 commits into
mainfrom
refactor/src-folders
Oct 4, 2026
Merged

nhyiramante1 merged 4 commits into
mainfrom
refactor/src-folders

Conversation

@nhyiramante1

Copy link
Copy Markdown
Contributor

Summary

src/ was one flat list of 41 modules and their tests. This groups them by responsibility. It is a move-only change: no file renames, no code, export or regex changes; only import paths are updated.

Folder Responsibility
src/ entry point and shared definitions (main.tsx, types.ts, config.ts, assistance-contract.ts)
src/coach/ one model turn: prompt, transport, response parsing, turn loop
src/grounding/ code checks on AI output (validator, normalize, action gateway)
src/map/ map, Source Bank, proposal state, provenance
src/session/ persistence, logging, diagnostics
src/platform/ Writing Tools sign-in
src/ui/ React components, UI copy, DOM helpers
src/i18n/ translation dictionaries (unchanged)

The full spec, including placement for every file, is in docs/src-folder-refactor-pass.md. README.md gets a short "Source layout" section.

What changes besides import paths

  • main.tsx loads ./platform/platform.css.
  • ui/ui-strings.ts loads dictionaries from "../i18n/*.json". The regex that reads the language code from each path is unchanged and still matches.
  • ui/ui-locale.test.ts reads ../platform/PlatformBootstrap.tsx and ../i18n/source.json at their new paths.
  • New guard test: every translation file in src/i18n loads as a dictionary. Before, only Chinese was checked, and a broken glob would have silently shown English everywhere.
  • Three docs now point at the new paths.

Testing

  • Rename detection shows all 68 moved files as renames (83–99% similarity). After stripping import paths, the removed and added lines differ only by the guard test and one comment path.
  • npm test: 37 files and 394 tests (393 before, plus the guard test).
  • npx tsc --noEmit, npm run eval:typecheck, npm run build:pages and npm run verify:pages pass.
  • Playwright smoke (npx playwright test): 4/4.
  • Dependency graph: same 41 modules and 140 imports. The only import cycle is still types.ts ↔ assistance-contract.ts, kept together at the root.

Suggest squash-merging.

🤖 Generated with Claude Code

@nhyiramante1
nhyiramante1 merged commit 74aadfd into main Oct 4, 2026
2 checks passed
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