Skip to content

refactor: github pr context.#85

Merged
knightedcodemonkey merged 3 commits intonextfrom
bananas
Apr 19, 2026
Merged

refactor: github pr context.#85
knightedcodemonkey merged 3 commits intonextfrom
bananas

Conversation

@knightedcodemonkey
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings April 19, 2026 15:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.js into focused modules under src/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 beforeunload handler 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 into workspaceSaveController.dispose()), ideally using navigator.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.

Comment thread src/app.js Outdated
Comment thread src/app.js Outdated
@knightedcodemonkey knightedcodemonkey merged commit 8ae4b9a into next Apr 19, 2026
6 checks passed
@knightedcodemonkey knightedcodemonkey deleted the bananas branch April 19, 2026 17:11
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.

2 participants