feat(KB-175): move file browser to header with workspace support

- Add workspace file APIs and hooks for session-scoped file browsing
- Create WorkspaceSelector component for switching between workspaces
- Update FileBrowserModal with workspace mode and improved UX
- Add files button to header with workspace-aware file browsing
- Add session files indicator to task cards for quick file access
- Include comprehensive tests for all new components and hooks
This commit is contained in:
gsxdsm
2026-03-31 01:26:57 -07:00
parent 18c4f0cb25
commit 9e03c47b91
30 changed files with 1779 additions and 829 deletions

View File

@@ -0,0 +1,46 @@
import { useEffect, useState } from "react";
import { fetchSessionFiles } from "../api";
const ACTIVE_COLUMNS = new Set(["in-progress", "in-review"]);
interface UseSessionFilesResult {
files: string[];
loading: boolean;
}
export function useSessionFiles(taskId: string, worktree: string | undefined, column: string): UseSessionFilesResult {
const [files, setFiles] = useState<string[]>([]);
const [loading, setLoading] = useState(false);
useEffect(() => {
if (!taskId || !worktree || !ACTIVE_COLUMNS.has(column)) {
setFiles([]);
setLoading(false);
return;
}
let cancelled = false;
async function load() {
setLoading(true);
try {
const result = await fetchSessionFiles(taskId);
if (!cancelled) {
setFiles(result);
}
} catch {
if (!cancelled) {
setFiles([]);
}
} finally {
if (!cancelled) {
setLoading(false);
}
}
}
void load();
}, [taskId, worktree, column]);
return { files, loading };
}