mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +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
@@ -0,0 +1,44 @@
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { createSessionWithPrompt } from '@/api/opencode'
|
||||
import { buildConflictResolutionPrompt } from '@/lib/git-conflict-prompt'
|
||||
import { getSessionPath } from '@/lib/navigation'
|
||||
import { invalidateSessionListCaches } from '@/lib/queryInvalidation'
|
||||
import { showToast } from '@/lib/toast'
|
||||
import type { GitOperationState } from '@opencode-manager/shared'
|
||||
|
||||
interface ResolveConflictsInput {
|
||||
operation: GitOperationState
|
||||
branch: string
|
||||
}
|
||||
|
||||
interface ResolveConflictsRepo {
|
||||
id: number
|
||||
fullPath: string
|
||||
}
|
||||
|
||||
export function useResolveConflictsWithAgent(repo: ResolveConflictsRepo) {
|
||||
const queryClient = useQueryClient()
|
||||
const navigate = useNavigate()
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async ({ operation, branch }: ResolveConflictsInput) => {
|
||||
return createSessionWithPrompt(
|
||||
{
|
||||
directory: repo.fullPath,
|
||||
title: `Resolve ${operation.kind} conflicts`,
|
||||
},
|
||||
buildConflictResolutionPrompt({ operation, branch }),
|
||||
)
|
||||
},
|
||||
onSuccess: (session) => {
|
||||
invalidateSessionListCaches(queryClient)
|
||||
navigate(getSessionPath(repo.id, session.id))
|
||||
},
|
||||
onError: (error) => {
|
||||
showToast.error(
|
||||
`Could not start conflict resolution: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
||||
)
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user