OctoNext is split into small, single-purpose modules. Each source file stays under ~130 lines; when something grows past that it is split into a new file or folder. There are no documentation comments — names and types carry the intent.
scripts/build.ts bundles three entry points with Bun and emits a loadable
extension into dist/:
| Output | Entry | Format | Role |
|---|---|---|---|
content.js |
src/content/index.ts |
IIFE | Injected on GitHub pages |
background.js |
src/background/index.ts |
IIFE | Service worker / event page |
options/* |
src/options/* |
ESM | Settings page + live preview |
content.css |
src/styles/ + themes/ |
— | Concatenated sidebar styles |
options/themes.css |
src/styles/themes/ |
— | Theme bundle for the preview |
manifest.json |
src/manifest.config.ts |
— | Generated per target |
Styles are concatenated by scripts/styles.ts: a fixed core order followed by
every file in src/styles/themes/ (one file per theme, scoped by
[data-octonext-theme]). Assets are copied by scripts/assets.ts: Material icon
SVGs + a trimmed manifest.json lookup, the bundled fonts, and PNG action icons
rendered from public/icon.svg via scripts/render-icons.ts (resvg-wasm).
scripts/package.ts zips Chrome and Firefox builds into release/ and signs a
CRX3 with the key from keys/ or the CRX_PRIVATE_KEY environment variable. CI
runs in .github/workflows/ (verify on push/PR, package on v* tags).
src/
shared/ storage, settings, theme, fonts, messaging, dom, browser, logger
core/ framework-free domain logic
adapters/ URL → repo context; host adapter
github/ client, endpoints, ref resolution, pull data + mapping, auth
icons/ material icon manifest + filename → icon resolution
bookmarks.ts local bookmark store
search.ts tree filtering
ui/ framework-free view layer
sidebar/ shell: header, tabs, resizer, draggable toggle
tree/ tree view, rows, node icons, search results
panels/ files, bookmarks, and the PR panel (summary, searchable
paginated file list with highlighting, review comments)
components/ spinner, message, icon button
icons.ts Font Awesome icon registry
content/ content-script entry, app orchestrator, appearance, render helpers
background/ service worker: context menu, dynamic scripts, permissions
options/ settings page, searchable selects, and a live theme/font preview
- The content script boots
OctoNextApp, which injects fonts and builds the sidebar. observeNavigationreports every SPA URL change.GitHubAdapterturns the URL into aRepoContext. For tree views,resolveRefusesgit/matching-refs/heads/{prefix}so branch names with slashes resolve correctly even in very large repositories.tree-builderconverts the flat API response into aTreeNodehierarchy;TreeViewrenders it lazily with batched DOM fragments.- Pull request pages load full PR detail (state, author, branches, totals, labels, reviewers), all changed files (paged from the API), and review comments — rendered without leaving the page. The file list filters and highlights in memory, so searching never re-fetches.
- Preferences live in
chrome.storage.sync; bookmarks inchrome.storage.local.
Implement the Adapter interface in src/core/adapters/. An adapter maps a URL
to a RepoContext, loads a RepoTree and PullData, and builds navigation
URLs for nodes. The rest of the UI is host-agnostic.