Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors GitHub PR context/PR drawer and GitHub API calls into smaller modules, while extending workspace context persistence to retain PR context state/number across reloads.
Changes:
- Split monolithic
github-api.jsinto focused modules undersrc/modules/github/api/and updated imports throughout. - Rebuilt PR drawer into modular controller/utility files under
src/modules/github/pr/drawer/, including persisted PR context state (active/inactive/disconnected/closed). - Extended workspace snapshot plumbing to persist PR context state/number and updated Playwright tests + added storage matrix docs.
Reviewed changes
Copilot reviewed 39 out of 41 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/modules/github/token-store.js | New localStorage-backed GitHub PAT load/save/mask helpers. |
| src/modules/github/pr/editor-sync.js | Swaps file-content API import to new repository-files API module. |
| src/modules/github/pr/drawer/summary.js | New PR/push confirmation summary builder. |
| src/modules/github/pr/drawer/source-transform.js | New helper to strip top-level App wrapper from entry source. |
| src/modules/github/pr/drawer/file-commits.js | New helpers to validate/normalize file commits and ensure trailing newline. |
| src/modules/github/pr/drawer/controller/ui-state.js | New PR drawer UI state/pending/mode (open vs push) handlers. |
| src/modules/github/pr/drawer/controller/run-submit.js | New submit workflow for “open PR” vs “push commit” flows. |
| src/modules/github/pr/drawer/controller/repository-form.js | New repository/base-branch selection + persistence + branch loading. |
| src/modules/github/pr/drawer/controller/public-actions.js | New external actions (disconnect/clear/close PR, set token, dispose). |
| src/modules/github/pr/drawer/controller/events.js | New DOM event bindings for the PR drawer controller. |
| src/modules/github/pr/drawer/controller/create-controller.js | New PR drawer controller composition/wiring. |
| src/modules/github/pr/drawer/controller/context-sync.js | New active PR context verification + editor-content sync orchestration. |
| src/modules/github/pr/drawer/config.js | New localStorage PR config storage w/ pruning + context sanitization. |
| src/modules/github/pr/drawer/common.js | Shared PR drawer normalization/sanitization helpers. |
| src/modules/github/pr/drawer/branches.js | Branch name generation and branch <select> option helpers. |
| src/modules/github/pr/context.js | New PR context URL parsing + compact PR reference formatting. |
| src/modules/github/github-pr-drawer.js | Removed monolithic PR drawer implementation (replaced by modular controller). |
| src/modules/github/github-api.js | Removed monolithic GitHub API implementation (replaced by api/*). |
| src/modules/github/chat-drawer/drawer.js | Updates chat API imports to new api/chat.js. |
| src/modules/github/chat-drawer/chat-utils.js | Updates default model import to new api/chat.js. |
| src/modules/github/byot-controls.js | Updates token/repo/PR-config imports to new module structure. |
| src/modules/github/api/repository-files.js | New module for contents API + git ref helpers needed by editor flows. |
| src/modules/github/api/repositories.js | New module for listing writable repos and branches. |
| src/modules/github/api/pull-requests.js | New module for PR CRUD + PR lookup by head. |
| src/modules/github/api/editor-content.js | New module for committing editor content and opening PRs via Git DB API. |
| src/modules/github/api/core.js | New shared HTTP/rate-limit/error utilities for GitHub API modules. |
| src/modules/github/api/constants.js | New constants for GitHub REST + Models API endpoints and model list. |
| src/modules/github/api/chat.js | New module for GitHub Models chat requests (streaming + non-streaming). |
| src/modules/app-core/workspace-local-helpers.js | Adds PR number fallback into workspace snapshot getter. |
| src/modules/app-core/workspace-controllers-setup.js | Wires new setters for workspace PR context state/number into setup. |
| src/modules/app-core/workspace-context-controller.js | Applies prContextState/prNumber when loading a workspace record. |
| src/modules/app-core/github-workflows.js | Passes PR close/disconnect results to callbacks for persistence. |
| src/modules/app-core/app-bindings-startup.js | Adjusts unload handling (notably removes best-effort save flush). |
| src/app.js | Updates imports to refactored GitHub modules + persists PR context metadata. |
| playwright/workspace-tabs.spec.ts | Adds a helper to wait for debounced tab order persistence in IDB. |
| playwright/github-pr-drawer.spec.ts | Updates expectations to match new “closed” localStorage config behavior. |
| playwright/github-byot-ai.spec.ts | Updates default model import to new api/chat.js. |
| docs/pr-context-storage-matrix.md | New doc describing PR context persistence surfaces + expected matrix. |
| docs/dual-build-gh-pages-strategy.md | Removed documentation file. |
| docs/contributing.md | Removed documentation file. |
| docs/code-mirror.md | Removed documentation file. |
Comments suppressed due to low confidence (1)
src/modules/app-core/app-bindings-startup.js:404
- The
beforeunloadhandler no longer attempts to flush the pending debounced workspace save.workspaceSaveController.dispose()only disposes the debouncer and does not persist queued changes, so closing/reloading the tab can drop the most recent workspace edits. Consider re-adding a best-effort flush here (or moving the flush intoworkspaceSaveController.dispose()), ideally usingnavigator.sendBeacon/sync-friendly storage if available.
window.addEventListener('beforeunload', () => {
clearToastTimer()
diagnosticsFlowController.dispose()
workspaceSaveController.dispose()
void workspaceStorage.close()
chatDrawerController.dispose()
prDrawerController.dispose()
})
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
No description provided.