mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-07 06:52:28 +00:00
feat: add git worktree session support with improved UI
Implement comprehensive worktree session support allowing users to spawn sessions in temporary git worktrees. Includes backend worktree management, full-stack integration, and refined UI for session type selection. Backend: - Add worktree creation/removal utilities with branch management - Track worktree metadata (basePath, branch, name, path) in session metadata - Automatic cleanup of worktrees when sessions fail or exit - Enhanced error handling with stderr tail logging UI improvements: - Redesign session type toggle with improved alignment and spacing - Move worktree description inline with label for cleaner layout - Add branch name input field that appears when worktree mode selected - Auto-focus on worktree input when switching modes - Reduce gap between radio options from gap-3 to gap-1.5 - Update descriptive text and placeholders for clarity Integration: - Thread worktree parameters through API client, RPC handlers, and daemon - Add worktreeEnv utility to read worktree info from environment - Update session spawning to support both simple and worktree modes
This commit is contained in:
@@ -108,7 +108,9 @@ export function startDaemonControlServer({
|
||||
schema: {
|
||||
body: z.object({
|
||||
directory: z.string(),
|
||||
sessionId: z.string().optional()
|
||||
sessionId: z.string().optional(),
|
||||
sessionType: z.enum(['simple', 'worktree']).optional(),
|
||||
worktreeName: z.string().optional()
|
||||
}),
|
||||
response: {
|
||||
200: z.object({
|
||||
@@ -129,10 +131,10 @@ export function startDaemonControlServer({
|
||||
}
|
||||
}
|
||||
}, async (request, reply) => {
|
||||
const { directory, sessionId } = request.body;
|
||||
const { directory, sessionId, sessionType, worktreeName } = request.body;
|
||||
|
||||
logger.debug(`[CONTROL SERVER] Spawn session request: dir=${directory}, sessionId=${sessionId || 'new'}`);
|
||||
const result = await spawnSession({ directory, sessionId });
|
||||
const result = await spawnSession({ directory, sessionId, sessionType, worktreeName });
|
||||
|
||||
switch (result.type) {
|
||||
case 'success':
|
||||
@@ -208,4 +210,4 @@ export function startDaemonControlServer({
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user