···3232- `src/pages/repo/pulls.tsx`: pull list, new pull, pull detail, and patch/diff rendering calls.
3333- `src/pages/repo/pulls-helpers.ts`: pull-specific pure helpers such as state filter parsing.
3434- `src/components/common.tsx`: generic UI primitives such as `Avatar`, `LoadingState`, `StateBadge`, and form/button/card style helpers.
3535-- `src/components/repo.tsx`: repo presentation components such as tabs, file rows, README/comment cards, `CodeView`, `DiffView`, branch pills, and repo skeletons.
3535+- `src/components/repo.tsx`: repo presentation components such as tabs, file rows, README/comment cards, branch pills, and repo skeletons.
3636+- `src/components/code-view.tsx`: code and diff presentation components, highlighting helper functions, `CodeView`, `DiffView`, and `PullDiffView`.
3637- `src/lib/api.ts`: compatibility facade that re-exports domain APIs. Do not add implementation here.
3738- `src/lib/api/constants.ts`: public service URLs and OAuth scope exports.
3839- `src/lib/api/appview.ts`: appview JSON transport, fallback, and appview response types.
···108109109110- Start from the matching upstream template in `../tangled-upstream/appview/pages/templates/...`, then check nearby Go/router files when behavior or icon names are data-driven.
110111- For repo chrome, `templates/layouts/repobase.html` is the main reference. Confirm header grouping, action buttons, tab icons, label spacing, font sizes, and vertical padding against that file before patching `src/pages/repo/shared.tsx`.
111111-- For code/blob views, compare `templates/repo/index.html` and `templates/repo/blob.html` before changing `src/pages/repo/code.tsx`, `src/components/repo.tsx`, or file-view CSS.
112112+- For code/blob views, compare `templates/repo/index.html` and `templates/repo/blob.html` before changing `src/pages/repo/code.tsx`, `src/components/code-view.tsx`, or file-view CSS.
112113- Treat screenshots as prompts to inspect upstream source, not as the only source of truth.
113114- Small differences such as `gap-*`, `py-*`, icon choice, and short-rev styling matter.
114115- Remove or hide upstream controls that are not implemented locally instead of shipping fake UI.
···132133- Preserve the `.untangled-shell` wrapper in `RootShell`; widening pages changes the app layout.
133134- Do not add a footer unless explicitly requested.
134135- File/tree ordering should be folders first, then files alphabetically. This is implemented in `sortedTreeEntries` in `src/lib/repo-utils.ts`.
135135-- File/blob rendering uses `CodeView` in `src/components/repo.tsx`.
136136+- File/blob rendering uses `CodeView` in `src/components/code-view.tsx`.
136137- PR diffs use `DiffView`, which parses unified patches into collapsible per-file panels and reuses `CodeView`.
137138- Repo overview and blob pages should resolve `HEAD` to the default branch for user-facing links when possible.
138139- Keep unimplemented upstream features visually inert rather than adding fake behavior.
···153154- Keep repo-route behavior in `src/pages/repo/*.tsx`.
154155- Keep repo-route pure helpers in nearby `src/pages/repo/*-helpers.ts` files.
155156- Keep generic display components in `src/components/common.tsx`.
156156-- Keep repo-specific display components in `src/components/repo.tsx`.
157157+- Keep repo-specific display components in `src/components/repo.tsx` and `src/components/code-view.tsx`.
157158- Keep shared pure repo helpers in `src/lib/repo-utils.ts`.
158159- Do not add large page logic back into `src/App.tsx`.
159160- Do not remove existing behavior while restructuring.