* feat: integrate GitHub OAuth device flow across runtimes Add GitHub OAuth device flow endpoints across runtimes Introduce GitHubSettings UI panel and sidebar entry Persist GitHub auth state in per-runtime storage * feat: add GitHub PR status and PR description generation Show PR status for the current branch in the Git view Generate a pull request description from the diff between base and head Expose prStatus, prCreate, and prMerge APIs in web and desktop clients * feat: add GitHub PR ready for review Add API to mark pull requests as ready for review Show a Ready button for draft PRs and reflect status in UI Handle token expiration and GraphQL errors when marking ready
35 lines
1.5 KiB
TypeScript
35 lines
1.5 KiB
TypeScript
import type {
|
|
GitHubAPI,
|
|
GitHubAuthStatus,
|
|
GitHubPullRequest,
|
|
GitHubPullRequestCreateInput,
|
|
GitHubPullRequestMergeInput,
|
|
GitHubPullRequestMergeResult,
|
|
GitHubPullRequestReadyInput,
|
|
GitHubPullRequestReadyResult,
|
|
GitHubPullRequestStatus,
|
|
GitHubDeviceFlowComplete,
|
|
GitHubDeviceFlowStart,
|
|
GitHubUserSummary,
|
|
} from '@openchamber/ui/lib/api/types';
|
|
|
|
import { sendBridgeMessage } from './bridge';
|
|
|
|
export const createVSCodeGitHubAPI = (): GitHubAPI => ({
|
|
authStatus: async () => sendBridgeMessage<GitHubAuthStatus>('api:github/auth:status'),
|
|
authStart: async () => sendBridgeMessage<GitHubDeviceFlowStart>('api:github/auth:start'),
|
|
authComplete: async (deviceCode: string) =>
|
|
sendBridgeMessage<GitHubDeviceFlowComplete>('api:github/auth:complete', { deviceCode }),
|
|
authDisconnect: async () => sendBridgeMessage<{ removed: boolean }>('api:github/auth:disconnect'),
|
|
me: async () => sendBridgeMessage<GitHubUserSummary>('api:github/me'),
|
|
|
|
prStatus: async (directory: string, branch: string) =>
|
|
sendBridgeMessage<GitHubPullRequestStatus>('api:github/pr:status', { directory, branch }),
|
|
prCreate: async (payload: GitHubPullRequestCreateInput) =>
|
|
sendBridgeMessage<GitHubPullRequest>('api:github/pr:create', payload),
|
|
prMerge: async (payload: GitHubPullRequestMergeInput) =>
|
|
sendBridgeMessage<GitHubPullRequestMergeResult>('api:github/pr:merge', payload),
|
|
prReady: async (payload: GitHubPullRequestReadyInput) =>
|
|
sendBridgeMessage<GitHubPullRequestReadyResult>('api:github/pr:ready', payload),
|
|
});
|