Skip to content

Commit 7d846ac

Browse files
authored
Merge branch 'main' into fix-gitlab-context-review-comments
2 parents bf2dd8c + 6bc6cb6 commit 7d846ac

13 files changed

Lines changed: 373 additions & 12 deletions

‎apps/web/src/components/CommandPalette.logic.test.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,20 @@ describe("buildThreadActionItems", () => {
264264
expect(item?.description).toBe("T3 Code · #feat/search");
265265
});
266266

267+
it("prefers renderDescription when provided", () => {
268+
const [item] = buildThreadActionItems({
269+
threads: [makeThread({ branch: "feat/search", worktreePath: "/tmp/wt" })],
270+
projectTitleById: new Map([[PROJECT_ID, "T3 Code"]]),
271+
sortOrder: "updated_at",
272+
icon: null,
273+
renderDescription: (thread, { projectTitle }) =>
274+
`${projectTitle}:${thread.branch}:${thread.worktreePath ? "wt" : "local"}`,
275+
runThread: async (_thread) => undefined,
276+
});
277+
278+
expect(item?.description).toBe("T3 Code:feat/search:wt");
279+
});
280+
267281
it("filters archived threads out of thread search items", () => {
268282
const items = buildThreadActionItems({
269283
threads: [

‎apps/web/src/components/CommandPalette.logic.ts‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,16 @@ export function buildProjectActionItems(input: {
154154

155155
export type BuildThreadActionItemsThread = Pick<
156156
SidebarThreadSummary,
157-
"archivedAt" | "branch" | "createdAt" | "environmentId" | "id" | "projectId" | "title"
157+
| "archivedAt"
158+
| "branch"
159+
| "createdAt"
160+
| "environmentId"
161+
| "id"
162+
| "modelSelection"
163+
| "projectId"
164+
| "session"
165+
| "title"
166+
| "worktreePath"
158167
> & {
159168
updatedAt: string;
160169
latestUserMessageAt?: string | null;
@@ -170,6 +179,8 @@ export function buildThreadActionItems<TThread extends BuildThreadActionItemsThr
170179
renderLeadingContent?: (thread: TThread) => ReactNode;
171180
/** Optional content rendered inline after the title text per-thread. */
172181
renderTrailingContent?: (thread: TThread) => ReactNode;
182+
/** Optional rich description (e.g. favicon + workspace icons). Falls back to text. */
183+
renderDescription?: (thread: TThread, meta: { projectTitle: string | undefined }) => ReactNode;
173184
getContentMatch?: (thread: TThread) => CommandPaletteThreadContentMatch | undefined;
174185
runThread: (thread: Pick<SidebarThreadSummary, "environmentId" | "id">) => Promise<void>;
175186
limit?: number;
@@ -198,6 +209,9 @@ export function buildThreadActionItems<TThread extends BuildThreadActionItemsThr
198209
const leadingContent = input.renderLeadingContent?.(thread);
199210
const trailingContent = input.renderTrailingContent?.(thread);
200211
const contentMatch = input.getContentMatch?.(thread);
212+
const description = input.renderDescription
213+
? input.renderDescription(thread, { projectTitle })
214+
: descriptionParts.join(` · `);
201215

202216
return Object.assign(
203217
{
@@ -210,7 +224,7 @@ export function buildThreadActionItems<TThread extends BuildThreadActionItemsThr
210224
contentMatch?.snippet ?? ``,
211225
],
212226
title: thread.title,
213-
description: descriptionParts.join(` · `),
227+
description,
214228
timestamp: formatRelativeTimeLabel(
215229
thread.latestUserMessageAt ?? thread.updatedAt ?? thread.createdAt,
216230
),

‎apps/web/src/components/CommandPalette.tsx‎

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,14 @@ import { ProjectFavicon } from "./ProjectFavicon";
124124
import { ProjectFilePicker } from "./files/ProjectFilePicker";
125125
import { ProjectContentSearchDialog } from "./search/ProjectContentSearchDialog";
126126
import { toggleThemeEditorForTheme } from "./settings/themeEditorStore";
127+
import { ThreadCommandSubtitle } from "./ThreadCommandSubtitle";
127128
import { ThreadRowLeadingStatus, ThreadRowTrailingStatus } from "./ThreadStatusIndicators";
128129
import { primaryServerKeybindingsAtom, primaryServerProvidersAtom } from "../state/server";
129-
import { resolveDefaultProviderModelSelection } from "../providerInstances";
130+
import {
131+
deriveProviderInstanceEntries,
132+
resolveDefaultProviderModelSelection,
133+
type ProviderInstanceEntry,
134+
} from "../providerInstances";
130135
import { resolveShortcutCommand, threadJumpIndexFromCommand } from "../keybindings";
131136
import { CommandDialog, CommandDialogPopup } from "./ui/command";
132137
import { Button } from "./ui/button";
@@ -584,6 +589,18 @@ function OpenCommandPaletteDialog(props: {
584589
const keybindings = useAtomValue(primaryServerKeybindingsAtom);
585590
const { theme, themeHalves, resolvedTheme } = useTheme();
586591
const providers = useAtomValue(primaryServerProvidersAtom);
592+
const providerEntryByEnvironmentAndInstanceId = useMemo(() => {
593+
const map = new Map<string, ProviderInstanceEntry>();
594+
for (const environment of environments) {
595+
const environmentProviders =
596+
environment.serverConfig?.providers ??
597+
(environment.environmentId === primaryEnvironmentId ? providers : []);
598+
for (const entry of deriveProviderInstanceEntries(environmentProviders)) {
599+
map.set(`${environment.environmentId}:${entry.instanceId}`, entry);
600+
}
601+
}
602+
return map;
603+
}, [environments, primaryEnvironmentId, providers]);
587604
const [viewStack, setViewStack] = useState<CommandPaletteView[]>([]);
588605
const currentView = viewStack.at(-1) ?? null;
589606
const environmentIds = useMemo(
@@ -816,6 +833,10 @@ function OpenCommandPaletteDialog(props: {
816833
new Map<ProjectId, string>(projects.map((project) => [project.id, project.workspaceRoot])),
817834
[projects],
818835
);
836+
const projectFaviconPathById = useMemo(
837+
() => new Map(projects.map((project) => [project.id, project.faviconPath ?? null] as const)),
838+
[projects],
839+
);
819840
const projectTitleById = useMemo(
820841
() => new Map<ProjectId, string>(projects.map((project) => [project.id, project.title])),
821842
[projects],
@@ -1000,6 +1021,29 @@ function OpenCommandPaletteDialog(props: {
10001021
icon: <MessageSquareIcon className={ITEM_ICON_CLASS} />,
10011022
renderLeadingContent: (thread) => <ThreadRowLeadingStatus thread={thread} />,
10021023
renderTrailingContent: (thread) => <ThreadRowTrailingStatus thread={thread} />,
1024+
renderDescription: (thread, { projectTitle }) => {
1025+
const modelInstanceId =
1026+
thread.session?.providerInstanceId ?? thread.modelSelection.instanceId;
1027+
const providerEntry =
1028+
providerEntryByEnvironmentAndInstanceId.get(
1029+
`${thread.environmentId}:${modelInstanceId}`,
1030+
) ?? null;
1031+
return (
1032+
<ThreadCommandSubtitle
1033+
environmentId={thread.environmentId}
1034+
projectCwd={projectCwdById.get(thread.projectId) ?? null}
1035+
projectFaviconPath={projectFaviconPathById.get(thread.projectId) ?? null}
1036+
projectTitle={projectTitle ?? null}
1037+
branch={thread.branch}
1038+
worktreePath={thread.worktreePath}
1039+
isCurrent={thread.id === activeThreadId}
1040+
driverKind={providerEntry?.driverKind ?? null}
1041+
providerDisplayName={
1042+
thread.session?.providerName ?? providerEntry?.displayName ?? modelInstanceId
1043+
}
1044+
/>
1045+
);
1046+
},
10031047
getContentMatch: (thread) => {
10041048
const match = threadContentMatchByKey.get(
10051049
threadSearchMatchKey({
@@ -1026,7 +1070,10 @@ function OpenCommandPaletteDialog(props: {
10261070
activeThreadId,
10271071
clientSettings.sidebarThreadSortOrder,
10281072
navigate,
1073+
projectCwdById,
1074+
projectFaviconPathById,
10291075
projectTitleById,
1076+
providerEntryByEnvironmentAndInstanceId,
10301077
threadContentMatchByKey,
10311078
threadSearchQuery,
10321079
threads,

‎apps/web/src/components/CommandPaletteResults.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function DisabledCommandPaletteResultRow(props: {
142142
<ThreadContentMatch match={props.item.threadContentMatch} />
143143
) : null}
144144
{props.item.description ? (
145-
<span className="truncate text-muted-foreground/70 text-xs">
145+
<span className="min-w-0 text-muted-foreground/70 text-xs">
146146
{props.item.description}
147147
</span>
148148
) : null}
@@ -193,7 +193,7 @@ function CommandPaletteResultRow(props: {
193193
<ThreadContentMatch match={props.item.threadContentMatch} />
194194
) : null}
195195
{props.item.description ? (
196-
<span className="truncate text-muted-foreground/70 text-xs">
196+
<span className="min-w-0 text-muted-foreground/70 text-xs">
197197
{props.item.description}
198198
</span>
199199
) : null}
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
import type { EnvironmentId, ProviderDriverKind } from "@t3tools/contracts";
2+
import { FolderGit2Icon, FolderIcon, GitBranchIcon } from "lucide-react";
3+
import { ProjectFavicon } from "./ProjectFavicon";
4+
import { ProviderInstanceIcon } from "./chat/ProviderInstanceIcon";
5+
import { cn } from "~/lib/utils";
6+
7+
/**
8+
* Flip this while reviewing command-palette thread subtitles.
9+
* - favicon-workspace-harness: favicon + Folder/FolderGit2 + branch + harness (default)
10+
* - favicon-workspace: same without harness
11+
* - favicon-branch-harness: GitBranch for local, FolderGit2 for worktrees, + harness
12+
*/
13+
export type ThreadCommandSubtitleVariant =
14+
| "favicon-workspace-harness"
15+
| "favicon-workspace"
16+
| "favicon-branch-harness";
17+
18+
export const THREAD_COMMAND_SUBTITLE_VARIANT: ThreadCommandSubtitleVariant =
19+
"favicon-workspace-harness";
20+
21+
const META_ICON_CLASS = "size-3 shrink-0 text-muted-foreground/70";
22+
23+
function Dot() {
24+
return <span className="shrink-0 text-muted-foreground/50">·</span>;
25+
}
26+
27+
function WorkspaceIcon(props: { variant: ThreadCommandSubtitleVariant; isWorktree: boolean }) {
28+
if (props.isWorktree) {
29+
return <FolderGit2Icon className={META_ICON_CLASS} aria-hidden />;
30+
}
31+
if (props.variant === "favicon-branch-harness") {
32+
return <GitBranchIcon className={META_ICON_CLASS} aria-hidden />;
33+
}
34+
return <FolderIcon className={META_ICON_CLASS} aria-hidden />;
35+
}
36+
37+
export function ThreadCommandSubtitle(props: {
38+
environmentId: EnvironmentId;
39+
projectCwd: string | null;
40+
projectFaviconPath?: string | null;
41+
projectTitle: string | null;
42+
branch: string | null;
43+
worktreePath: string | null;
44+
isCurrent: boolean;
45+
driverKind?: ProviderDriverKind | null;
46+
providerDisplayName?: string | null;
47+
variant?: ThreadCommandSubtitleVariant;
48+
className?: string;
49+
}) {
50+
const variant = props.variant ?? THREAD_COMMAND_SUBTITLE_VARIANT;
51+
const isWorktree = props.worktreePath != null && props.worktreePath.trim().length > 0;
52+
const showHarness =
53+
variant !== "favicon-workspace" && props.driverKind != null && props.providerDisplayName;
54+
55+
const projectLabel = props.projectTitle?.trim() || null;
56+
const branchLabel = props.branch?.trim() || null;
57+
58+
if (!projectLabel && !branchLabel && !props.isCurrent && !showHarness) {
59+
return null;
60+
}
61+
62+
return (
63+
<span
64+
className={cn(
65+
"inline-flex min-w-0 max-w-full items-center gap-1 text-xs text-muted-foreground/70",
66+
props.className,
67+
)}
68+
>
69+
{projectLabel ? (
70+
<span className="inline-flex min-w-0 items-center gap-1">
71+
{props.projectCwd ? (
72+
<ProjectFavicon
73+
environmentId={props.environmentId}
74+
cwd={props.projectCwd}
75+
faviconPath={props.projectFaviconPath}
76+
className="size-3 shrink-0"
77+
/>
78+
) : null}
79+
<span className="min-w-0 truncate">{projectLabel}</span>
80+
</span>
81+
) : null}
82+
83+
{branchLabel ? (
84+
<>
85+
{projectLabel ? <Dot /> : null}
86+
<span className="inline-flex min-w-0 items-center gap-1">
87+
<WorkspaceIcon variant={variant} isWorktree={isWorktree} />
88+
<span className="min-w-0 truncate">{branchLabel}</span>
89+
</span>
90+
</>
91+
) : null}
92+
93+
{showHarness && props.driverKind ? (
94+
<>
95+
{projectLabel || branchLabel ? <Dot /> : null}
96+
<ProviderInstanceIcon
97+
driverKind={props.driverKind}
98+
displayName={props.providerDisplayName ?? props.driverKind}
99+
iconClassName="size-3 shrink-0 opacity-70"
100+
/>
101+
</>
102+
) : null}
103+
104+
{props.isCurrent ? (
105+
<>
106+
{projectLabel || branchLabel || showHarness ? <Dot /> : null}
107+
<span className="shrink-0">Current thread</span>
108+
</>
109+
) : null}
110+
</span>
111+
);
112+
}

‎apps/web/src/components/chat/DraftHeroHeadline.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,11 @@ export function DraftHeroHeadline({
115115
return;
116116
}
117117
const project = entry.targetProject;
118+
// Changing the repo of a draft moves the typed content along:
119+
// the user started writing in the wrong project, not a new task.
118120
void handleNewThread(scopeProjectRef(project.environmentId, project.id), {
119121
replace: true,
122+
carryComposerContent: true,
120123
});
121124
}}
122125
>

‎apps/web/src/components/diffs/StyledDiffCodeView.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe("StyledDiffCodeView", () => {
4444
diffHeaderHeight: 32,
4545
hunkSeparatorHeight: 24,
4646
paddingTop: 0,
47-
paddingBottom: 0,
47+
paddingBottom: 8,
4848
},
4949
layout: { paddingTop: 0, paddingBottom: 0, gap: 0 },
5050
});

‎apps/web/src/components/diffs/StyledDiffCodeView.tsx‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,16 @@ export function StyledDiffCodeView<LAnnotation = undefined>({
304304
diffHeaderHeight: 32,
305305
hunkSeparatorHeight: 24,
306306
// Pierre uses its general file spacing as a fallback in expanded-file layout paths.
307-
// Keep it zero alongside the explicit paddings or expanding the first file can
307+
// Keep it zero alongside the explicit paddingTop or expanding the first file can
308308
// reintroduce the library's default 8px gap above its header.
309309
spacing: 0,
310310
paddingTop: 0,
311-
paddingBottom: 0,
311+
// Unlike the gap above, the 8px under a file's last line is painted
312+
// unconditionally by Pierre's stylesheet (`--diffs-gap-fallback`), so the metric has
313+
// to count it: at zero every expanded file's virtual height ran 8px short of its
314+
// rendered height, and the end of the list sat past the reachable scroll range —
315+
// one clipped file row per expanded file above it.
316+
paddingBottom: 8,
312317
},
313318
layout: { paddingTop: 0, paddingBottom: 0, gap: 0 },
314319
}}

‎apps/web/src/components/preview/PreviewMoreMenu.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ export function PreviewMoreMenu({
169169
type="button"
170170
onClick={callTab(bridge.resetZoom)}
171171
aria-label="Reset zoom"
172+
className="[:hover,[data-pressed]]:bg-foreground/10"
172173
disabled={tabDisabled}
173174
>
174175
<RotateCcw />

‎apps/web/src/components/settings/SourceControlSettings.tsx‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919

2020
import { usePrimarySettings, useUpdatePrimarySettings } from "../../hooks/useSettings";
2121
import { cn } from "../../lib/utils";
22-
import { usePrimaryEnvironment } from "../../state/environments";
22+
import { useEnvironments, usePrimaryEnvironment } from "../../state/environments";
2323
import { useEnvironmentQuery } from "../../state/query";
2424
import { sourceControlEnvironment } from "../../state/sourceControl";
2525
import { Badge } from "../ui/badge";
@@ -508,7 +508,15 @@ function EmptySourceControlDiscovery({
508508
}
509509

510510
export function SourceControlSettingsPanel() {
511-
const environmentId = usePrimaryEnvironment()?.environmentId ?? null;
511+
const { environments } = useEnvironments();
512+
const primaryEnvironment = usePrimaryEnvironment();
513+
const fallbackEnvironment =
514+
environments.find((environment) => environment.connection.phase === "connected") ??
515+
environments[0] ??
516+
null;
517+
const environmentId =
518+
primaryEnvironment?.environmentId ?? fallbackEnvironment?.environmentId ?? null;
519+
const isPrimaryEnvironment = environmentId === primaryEnvironment?.environmentId;
512520
const discovery = useEnvironmentQuery(
513521
environmentId === null
514522
? null
@@ -561,7 +569,9 @@ export function SourceControlSettingsPanel() {
561569
>
562570
{result.versionControlSystems.map((item) => (
563571
<DiscoveryItemRow key={`vcs:${item.kind}`} item={item}>
564-
{item.kind === "git" ? <GitFetchIntervalSettings /> : undefined}
572+
{item.kind === "git" && isPrimaryEnvironment ? (
573+
<GitFetchIntervalSettings />
574+
) : undefined}
565575
</DiscoveryItemRow>
566576
))}
567577
</SettingsSection>
@@ -587,7 +597,7 @@ export function SourceControlSettingsPanel() {
587597
/>
588598
)}
589599

590-
{environmentId !== null ? <SourceControlWritingSettingsSection /> : null}
600+
{isPrimaryEnvironment ? <SourceControlWritingSettingsSection /> : null}
591601
</SettingsPageContainer>
592602
);
593603
}

0 commit comments

Comments
 (0)