Repository navigation
Refactor: split src/index.ts (4637 lines) into routes, server, and client modules - #39
Merged
Merged
Conversation
- Page head, core helpers, and 10 feature chunks (state, transcript, history, pane, settings-a/b, attachments, agent, tabs) move out of the inline template literal; page() concatenates them with the interpolated gateway consts and serialized helpers - Served HTML is byte-identical (verified by diff); inline-script syntax check, tsc, and all 353 tests pass
There was a problem hiding this comment.
All reported issues were addressed across 22 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
- Move /api/github/branches to github-repos.ts (GitHub API, not just-git) - Rename CORE_A/B to CLIENT_PRELUDE_JS/MARKDOWN_SHIM_JS and document the assembly ordering invariant in page.ts - Correct resolveSid comment: legacy sids resolve directly, callers check the token
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.
Pure move, no behavior change.
src/index.tsgoes from 4637 lines to 53 (Env, AppSession re-export, thin fetch dispatcher).src/server/auth.ts— cookies, session, CORS, gates (requireAccess/requireLogin), turnConflict, resolveAuth/resolveSid, sessionJson, RouteCtxsrc/routes/*.ts(8 files) — each exports onehandle*(req, ctx): Response | null; fetch tries them in order, 404 fallthrough preservedsrc/server/page.ts— appDoc + page() assemblysrc/client/*.ts(11 files) — head, core helpers, and feature chunks (state, transcript, history, pane, settings-a/b, attachments, agent, tabs)Verification:
/HTML is byte-identical before/after (diffed 124,699 bytes)npm run lintclean, 353/353 tests pass,check-inline-jsOK (104,595 chars, 1 block)import typeSummary by cubic
Splits the 4,637-line
src/index.tsinto route, server, and client modules.src/index.tsdrops to 53 lines (Env type, AppSession re-export, thin fetch dispatcher), and behavior is unchanged.Refactors
src/routes/*.ts(8 files) export onehandle*(req, ctx)each; the dispatcher tries them in order, preserving the 404 fallthrough./api/github/brancheslives ingithub-repos.tssince it is a GitHub API call, not a just-git one.src/server/holds auth, session, and page-assembly helpers; the 11src/client/*.tschunks replace the inline template literal, assembled in a documented order bypage.ts./HTML is byte-identical before/after; lint clean, 353/353 tests pass, and no import cycles were introduced.Written for commit 24e0bc6. Summary will update on new commits.