feat: consume worktree field from status line hook events

Parse structured WorktreeInfo (name, path, branch, original_repo_directory)
from WorktreeCreate/Remove hook events and emit a dedicated claude:worktree
event. Store per-conversation worktree state and display an emerald branch
badge in the status bar so users can see at a glance which worktree and
branch each session is running on.

Closes #206
This commit is contained in:
2026-03-11 12:51:04 -07:00
committed by Naomi Carrigan
parent 31d156d768
commit d7b1ff44c4
8 changed files with 246 additions and 15 deletions
+13
View File
@@ -13,6 +13,7 @@ import type {
} from "$lib/types/messages";
import type { CharacterState } from "$lib/types/states";
import type { AgentStartPayload, AgentEndPayload } from "$lib/types/agents";
import type { WorktreeEvent } from "$lib/types/worktree";
import { agentStore } from "$lib/stores/agents";
import { todos } from "$lib/stores/todos";
import {
@@ -563,6 +564,18 @@ export async function initializeTauriListeners() {
});
unlisteners.push(agentEndUnlisten);
const worktreeUnlisten = await listen<WorktreeEvent>("claude:worktree", (event) => {
const { conversation_id, event_type, worktree } = event.payload;
const targetConversationId = conversation_id || get(claudeStore.activeConversationId);
if (targetConversationId) {
claudeStore.setWorktreeInfo(
targetConversationId,
event_type === "create" && worktree ? worktree : null
);
}
});
unlisteners.push(worktreeUnlisten);
const questionUnlisten = await listen<UserQuestionEvent>("claude:question", (event) => {
const questionEvent = event.payload;