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:
Chris Scott committed 2026-10-03 21:59:00 -04:00
1 parent 52b6147ed3
commit 53238a6324
89 files changed
+7704 -793

No files matched your search

+13 -2
View File
@@ -140,10 +140,13 @@ export async function addSessionContext(sessionID: string, text: string): Promis
await callOpenCode((api) => api.session.synthetic({ sessionID, text, resume: false }))
}
export async function createSessionWithContext(input: CreateSessionInput, context: string): Promise<SessionInfo> {
async function createSessionThen(
input: CreateSessionInput,
step: (session: SessionInfo) => Promise<unknown>,
): Promise<SessionInfo> {
const session = await createSession(input)
try {
await addSessionContext(session.id, context)
await step(session)
} catch (error) {
await deleteSession(session.id).catch(() => undefined)
throw error
@@ -151,6 +154,14 @@ export async function createSessionWithContext(input: CreateSessionInput, contex
return session
}
export async function createSessionWithContext(input: CreateSessionInput, context: string): Promise<SessionInfo> {
return createSessionThen(input, (session) => addSessionContext(session.id, context))
}
export async function createSessionWithPrompt(input: CreateSessionInput, text: string): Promise<SessionInfo> {
return createSessionThen(input, (session) => sendPrompt({ sessionID: session.id, text }))
}
export async function switchSessionModel(sessionID: string, model: ModelRef): Promise<void> {
await callOpenCode((api) => api.session.switchModel({ sessionID, model }))
}