test(worktree-isolation): add worktree detection tests

This commit is contained in:
Hibryda 2026-03-11 03:23:58 +01:00
parent 0da53e7390
commit 643ab0a6b6
8 changed files with 125 additions and 2 deletions

View file

@ -53,10 +53,11 @@
profile?: string;
provider?: ProviderId;
capabilities?: ProviderCapabilities;
useWorktrees?: boolean;
onExit?: () => void;
}
let { sessionId, projectId, prompt: initialPrompt = '', cwd: initialCwd, profile: profileName, provider: providerId = 'claude', capabilities = DEFAULT_CAPABILITIES, onExit }: Props = $props();
let { sessionId, projectId, prompt: initialPrompt = '', cwd: initialCwd, profile: profileName, provider: providerId = 'claude', capabilities = DEFAULT_CAPABILITIES, useWorktrees = false, onExit }: Props = $props();
let session = $derived(getAgentSession(sessionId));
let inputPrompt = $state(initialPrompt);
@ -184,6 +185,7 @@
setting_sources: ['user', 'project'],
claude_config_dir: profile?.config_dir,
system_prompt: systemPrompt,
worktree_name: useWorktrees ? sessionId : undefined,
});
inputPrompt = '';
if (promptRef) {

View file

@ -130,6 +130,7 @@
profile={project.profile || undefined}
provider={providerId}
capabilities={providerMeta?.capabilities}
useWorktrees={project.useWorktrees ?? false}
onExit={handleNewSession}
/>
{/if}

View file

@ -793,6 +793,21 @@
</div>
</div>
<div class="card-field card-field-row">
<span class="card-field-label">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 3v12"/><path d="M18 9a3 3 0 0 0-3-3H7"/><path d="M18 9v12"/></svg>
Worktree Isolation
</span>
<label class="card-toggle" title={project.useWorktrees ? 'Worktrees enabled' : 'Worktrees disabled'}>
<input
type="checkbox"
checked={project.useWorktrees ?? false}
onchange={e => updateProject(activeGroupId, project.id, { useWorktrees: (e.target as HTMLInputElement).checked })}
/>
<span class="toggle-track"><span class="toggle-thumb"></span></span>
</label>
</div>
<div class="card-footer">
<button class="btn-remove" onclick={() => removeProject(activeGroupId, project.id)}>
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18"/><path d="M8 6V4h8v2"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/></svg>
@ -1200,6 +1215,12 @@
gap: 0.25rem;
}
.card-field.card-field-row {
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.card-field-label {
display: flex;
align-items: center;