mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
- 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
27 lines
1.1 KiB
TypeScript
27 lines
1.1 KiB
TypeScript
import type { GitOperationState } from '@opencode-manager/shared'
|
|
|
|
interface ConflictResolutionPromptInput {
|
|
operation: GitOperationState
|
|
branch: string
|
|
}
|
|
|
|
export function buildConflictResolutionPrompt({ operation, branch }: ConflictResolutionPromptInput): string {
|
|
const conflictedFiles = operation.conflictedFiles.map((file) => `- ${file}`).join('\n')
|
|
|
|
return [
|
|
`A git ${operation.kind} is in progress on branch \`${branch}\` and stopped with merge conflicts.`,
|
|
'',
|
|
'Conflicted files:',
|
|
conflictedFiles,
|
|
'',
|
|
'Work through this in order:',
|
|
'1. Inspect each conflicted file and understand both sides of every conflict.',
|
|
'2. Propose a per-file resolution strategy with your reasoning.',
|
|
'3. Wait for the user to confirm the strategy before editing any file.',
|
|
'',
|
|
`After the user confirms, resolve the conflicts, stage each resolved file with \`git add\`, and finish the operation with \`GIT_EDITOR=true git ${operation.kind} --continue\`.`,
|
|
'',
|
|
`Do not run \`git ${operation.kind} --abort\` and do not force-push unless the user explicitly asks.`,
|
|
].join('\n')
|
|
}
|