Add project file picker (⌘P) and project content search (⇧⌘F) (#4855)

Co-authored-by: Claude Fable 5 <[email protected]>
Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
authored and GitHub committed 2026-07-30 16:39:15 +02:00
1 parent 1877237c7a
commit abc409c2d4
39 files changed
+2932 -480

No files matched your search

@@ -0,0 +1,41 @@
import { scopeThreadRef } from "@t3tools/client-runtime/environment";
import type { EnvironmentId, ScopedThreadRef } from "@t3tools/contracts";
import { useProjects } from "~/state/entities";
import { useHandleNewThread } from "./useHandleNewThread";
export interface ActiveProjectTarget {
readonly environmentId: EnvironmentId;
readonly cwd: string;
readonly projectName: string;
readonly threadRef: ScopedThreadRef;
}
/**
* Resolves the project workspace behind the active thread (or draft) so
* project-scoped surfaces like the file picker and content search know which
* workspace to query and which thread's right panel opens their results.
*/
export function useActiveProjectTarget(): ActiveProjectTarget | null {
const { activeDraftThread, activeThread } = useHandleNewThread();
const projects = useProjects();
const thread = activeThread ?? activeDraftThread;
const threadId = activeThread?.id ?? activeDraftThread?.threadId;
const project = thread
? projects.find(
(candidate) =>
candidate.environmentId === thread.environmentId && candidate.id === thread.projectId,
)
: null;
const cwd = thread?.worktreePath ?? project?.workspaceRoot;
if (!thread || !threadId || !project || !cwd) return null;
return {
environmentId: project.environmentId,
cwd,
projectName: project.title,
threadRef: scopeThreadRef(thread.environmentId, threadId),
};
}