@devries-cameron20 / t3code Mirror · read-only / commits / 6f5838f9bc
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 09:45 UTC

fix(client-runtime): a relative "Add project starts in" opens the picker under home (#37691)

Julius Marminge committed Nov 16, 2026 at 08:49 UTC 6f5838f9bcdaf31864b93694c5935c93f9532e06
3 files changed +18 -9
apps/web/src/components/CommandPalette.tsx
+2 -7
@@ -19,6 +19,7 @@ import {
19 getNewProjectPublishTarget,
20 getNewProjectPublishTargets,
21 getNewProjectRepository,
22 + getAddProjectInitialQuery,
23 githubIncompleteOwnerRepositoryMessage,
24 normalizePastedCloneUrl,
25 addProjectRemoteSourceLabel,
@@ -154,7 +155,6 @@ import {
155 } from "../lib/chatThreadActions";
156 import {
157 appendBrowsePathSegment,
157 - ensureBrowseDirectoryPath,
158 findProjectByPath,
159 getBrowseDirectoryPath,
160 hasTrailingPathSeparator,
@@ -683,12 +683,7 @@ function OpenCommandPaletteDialog(props: {
683 const paletteMode = getCommandPaletteMode({ currentView, isBrowsing });
684 const getAddProjectInitialQueryForEnvironment = (environmentId: EnvironmentId | null): string => {
685 const environment = environments.find((candidate) => candidate.environmentId === environmentId);
686 - const environmentSettings = environment?.serverConfig?.settings ?? null;
687 - const baseDirectory = environmentSettings?.addProjectBaseDirectory?.trim() ?? "";
688 - if (baseDirectory.length === 0) {
689 - return "~/";
690 - }
691 - return ensureBrowseDirectoryPath(baseDirectory);
686 + return getAddProjectInitialQuery(environment?.serverConfig?.settings.addProjectBaseDirectory);
687 };
688
689 const { projectByKey } = useProjectLookups();
packages/client-runtime/src/operations/projects.test.ts
+11
@@ -9,14 +9,25 @@ import {
9 getCloneDirectoryLeafName,
10 getCloneDirectoryName,
11 getCloneDirectoryPath,
12 + getAddProjectInitialQuery,
13 getDefaultCloneUrl,
14 githubIncompleteOwnerRepositoryMessage,
15 normalizePastedCloneUrl,
16 sortAddProjectProviderSources,
17 } from "./projects.ts";
18 import type { EnvironmentProject } from "../state/models.ts";
19 +import { isFilesystemBrowseQuery } from "../state/projects.ts";
20
21 describe("add project shared logic", () => {
22 + it("starts the Add Project picker on a browsable path for a relative base directory", () => {
23 + expect(isFilesystemBrowseQuery(getAddProjectInitialQuery("Desktop/dev"))).toBe(true);
24 + expect(getAddProjectInitialQuery("Desktop/dev")).toBe("~/Desktop/dev/");
25 + expect(getAddProjectInitialQuery("/srv/code")).toBe("/srv/code/");
26 + expect(getAddProjectInitialQuery("~")).toBe("~/");
27 + expect(getAddProjectInitialQuery("./work")).toBe("./work/");
28 + expect(getAddProjectInitialQuery("C:\\dev")).toBe("C:\\dev\\");
29 + });
30 +
31 it("offers only GitHub until other hosts are turned on", () => {
32 const ready = () => ({ ready: true, hint: null });
33 expect(sortAddProjectProviderSources(ready, {})).toEqual(["github"]);
packages/client-runtime/src/operations/projects.ts
+5 -2
@@ -11,7 +11,7 @@ import type {
11 } from "@t3tools/contracts";
12 import { SourceControlProviderKind } from "@t3tools/contracts";
13 import { cloneUrlRepositoryPath } from "@t3tools/shared/cloneUrl";
14 -import { newProjectFolderName } from "@t3tools/shared/path";
14 +import { isExplicitRelativePath, isHostPath, newProjectFolderName } from "@t3tools/shared/path";
15 import * as Arr from "effect/Array";
16 import * as Option from "effect/Option";
17 import * as Order from "effect/Order";
@@ -204,7 +204,10 @@ export function buildAddProjectRemoteSourceReadiness(
204
205 export function getAddProjectInitialQuery(baseDirectory: string | null | undefined): string {
206 const trimmed = baseDirectory?.trim() ?? "";
207 - return trimmed.length === 0 ? "~/" : ensureBrowseDirectoryPath(trimmed);
207 + if (trimmed.length === 0) return "~/";
208 + // A bare relative setting such as `Desktop/dev` means a folder under home.
209 + const isAnchored = trimmed === "~" || isHostPath(trimmed) || isExplicitRelativePath(trimmed);
210 + return ensureBrowseDirectoryPath(isAnchored ? trimmed : `~/${trimmed}`);
211 }
212
213 export function getCloneDirectoryName(repositoryOrRemoteUrl: string | null | undefined): string {