mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
feat(git): extend source control with worktrees, stashes, conflicts and identities
- Create a worktree from a new or existing branch - Integrate a worktree branch into a target branch by merge commit or cherry-pick, with continue/abort on conflicts - Delete a worktree with keep, delete-local, or delete-local-and-remote branch options, using safe branch deletion for unmerged branches - Add a stash tab (list, push, apply, pop, drop) shared across a repository and its worktrees - Rename and delete branches, optionally deleting the remote branch and updating scheduled base branches - Detect in-progress merge, rebase, cherry-pick and revert operations and hand conflicts to an agent session - Generate commit messages from staged changes with the default model - Add a default git identity and saved per-repository identities written to git config - Unify git error mapping behind a typed error and one route helper; consolidate git mutations and cache invalidation - Update repository docs
This commit is contained in:
1 parent
52b6147ed3
commit
53238a6324
89 files changed
+7704
-793
No files matched your search
@@ -1,5 +1,8 @@
|
||||
import type { GitCredential } from '@opencode-manager/shared'
|
||||
import { githubFetch } from './github'
|
||||
import { logger } from './logger'
|
||||
|
||||
const GITHUB_USER_INFO_TIMEOUT_MS = 10_000
|
||||
|
||||
export function isGitHubHttpsUrl(repoUrl: string): boolean {
|
||||
const url = normalizeGitCredentialUrl(repoUrl)
|
||||
@@ -210,9 +213,10 @@ export function createGitIdentityEnv(identity: GitIdentity): Record<string, stri
|
||||
|
||||
export async function fetchGitHubUserInfo(token: string): Promise<GitHubUserInfo | null> {
|
||||
try {
|
||||
const signal = AbortSignal.timeout(GITHUB_USER_INFO_TIMEOUT_MS)
|
||||
const [userResponse, emailsResponse] = await Promise.all([
|
||||
githubFetch('https://api.github.com/user', { token, apiVersion: '2022-11-28' }),
|
||||
githubFetch('https://api.github.com/user/emails', { token, apiVersion: '2022-11-28' }),
|
||||
githubFetch('https://api.github.com/user', { token, apiVersion: '2022-11-28', signal }),
|
||||
githubFetch('https://api.github.com/user/emails', { token, apiVersion: '2022-11-28', signal }),
|
||||
])
|
||||
|
||||
if (!userResponse.ok) return null
|
||||
@@ -236,7 +240,8 @@ export async function fetchGitHubUserInfo(token: string): Promise<GitHubUserInfo
|
||||
email,
|
||||
login: data.login
|
||||
}
|
||||
} catch {
|
||||
} catch (error) {
|
||||
logger.warn(`Failed to fetch GitHub user info, falling back to the manual git identity: ${error instanceof Error ? error.message : String(error)}`)
|
||||
return null
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user