Add git integration: branch picker + worktrees
Allows users to right-click "+ New thread" to create threads from specific git branches, with optional worktree creation for isolated work. Includes branch sorting (current/default first), graceful handling of non-git repos, and ability to initialize git repos. - New git IPC contract (listBranches, createWorktree, removeWorktree, init) - Branch context menu with worktree sub-option in Sidebar - Thread model extended with branch/worktreePath fields - Session cwd uses worktree path when available - Branch sorting: current > main/master > alphabetical Co-Authored-By: Claude Haiku 4.5 <[email protected]>
This commit is contained in:
1 parent
9023d13929
commit
d64f78a949
5 files changed
+79
No files matched your search
@@ -34,6 +34,8 @@ const persistedThreadSchema = z.object({
|
||||
model: z.string().min(1),
|
||||
messages: z.array(persistedMessageSchema),
|
||||
createdAt: z.string().min(1),
|
||||
branch: z.string().min(1).nullable().optional(),
|
||||
worktreePath: z.string().min(1).nullable().optional(),
|
||||
});
|
||||
|
||||
const persistedStateBodySchema = z.object({
|
||||
@@ -112,6 +114,8 @@ function hydrateThread(
|
||||
events: [],
|
||||
error: null,
|
||||
createdAt: thread.createdAt,
|
||||
branch: thread.branch ?? null,
|
||||
worktreePath: thread.worktreePath ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -170,6 +174,8 @@ export function toPersistedState(
|
||||
model: thread.model,
|
||||
messages: thread.messages,
|
||||
createdAt: thread.createdAt,
|
||||
branch: thread.branch,
|
||||
worktreePath: thread.worktreePath,
|
||||
})),
|
||||
activeThreadId: state.activeThreadId,
|
||||
runtimeMode: state.runtimeMode,
|
||||
|
||||
@@ -35,4 +35,6 @@ export interface Thread {
|
||||
latestTurnStartedAt?: string | undefined;
|
||||
latestTurnCompletedAt?: string | undefined;
|
||||
latestTurnDurationMs?: number | undefined;
|
||||
branch: string | null;
|
||||
worktreePath: string | null;
|
||||
}
|
||||
Reference in new issue
Block a user