Compare commits

..
Author SHA1 Message Date
Cursor AgentandJulius Marminge 7a0c606fb5 Add react-scan command palette recordings
Co-authored-by: Julius Marminge <[email protected]>
2026-05-18 16:19:00 +00:00
Cursor AgentandJulius Marminge 7dbf3105b4 Open command palette from sidebar store
Co-authored-by: Julius Marminge <[email protected]>
2026-05-18 16:13:16 +00:00
Cursor AgentandJulius Marminge fdf2210cfa Isolate command palette renders
Co-authored-by: Julius Marminge <[email protected]>
2026-05-18 16:10:42 +00:00
t3-code[bot] d1e85c4e8f chore(release): prepare v0.0.24 2026-05-15 06:40:13 +00:00
14 changed files with 165 additions and 118 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@t3tools/desktop",
"version": "0.0.23",
"version": "0.0.24",
"private": true,
"type": "module",
"main": "dist-electron/main.cjs",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "t3",
"version": "0.0.23",
"version": "0.0.24",
"license": "MIT",
"repository": {
"type": "git",
+2 -21
View File
@@ -41,7 +41,8 @@ describe("VcsProjectConfig", () => {
yield* fileSystem.makeDirectory(nested, { recursive: true });
yield* fileSystem.writeFileString(
path.join(configDir, "vcs.json"),
'{"vcs":{"kind":"jj"}}',
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({ vcs: { kind: "jj" } }),
);
const config = yield* VcsProjectConfig.VcsProjectConfig;
@@ -66,24 +67,4 @@ describe("VcsProjectConfig", () => {
}),
);
});
it.layer(TestLayer)("falls back to auto when config JSON is invalid", (it) => {
it.effect("returns auto", () =>
Effect.gen(function* () {
const fileSystem = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const root = yield* fileSystem.makeTempDirectoryScoped({
prefix: "t3-vcs-config-test-",
});
const configDir = path.join(root, ".t3code");
yield* fileSystem.makeDirectory(configDir, { recursive: true });
yield* fileSystem.writeFileString(path.join(configDir, "vcs.json"), "{invalid-json");
const config = yield* VcsProjectConfig.VcsProjectConfig;
const kind = yield* config.resolveKind({ cwd: root });
assert.equal(kind, "auto");
}),
);
});
});
+30 -15
View File
@@ -2,7 +2,6 @@ import * as Context from "effect/Context";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Layer from "effect/Layer";
import * as Option from "effect/Option";
import * as Path from "effect/Path";
import * as Schema from "effect/Schema";
@@ -16,9 +15,16 @@ const ProjectVcsConfig = Schema.Struct({
),
vcsKind: Schema.optional(VcsDriverKind),
});
const decodeProjectVcsConfig = Schema.decodeUnknownOption(Schema.fromJsonString(ProjectVcsConfig));
const isProjectVcsConfig = Schema.is(ProjectVcsConfig);
type ProjectVcsConfigFile = typeof ProjectVcsConfig.Type;
interface ProjectVcsConfigFile {
readonly vcs?:
| {
readonly kind?: VcsDriverKindType | undefined;
}
| undefined;
readonly vcsKind?: VcsDriverKindType | undefined;
}
export interface VcsProjectConfigResolveInput {
readonly cwd: string;
@@ -39,8 +45,14 @@ function configuredKind(config: ProjectVcsConfigFile): VcsDriverKindType | "auto
return config.vcs?.kind ?? config.vcsKind ?? "auto";
}
const parseConfig = (raw: string): Option.Option<ProjectVcsConfigFile> =>
decodeProjectVcsConfig(raw);
function parseConfig(raw: string): ProjectVcsConfigFile | null {
try {
const parsed = JSON.parse(raw) as unknown;
return isProjectVcsConfig(parsed) ? parsed : null;
} catch {
return null;
}
}
export const make = Effect.fn("makeVcsProjectConfig")(function* () {
const fileSystem = yield* FileSystem.FileSystem;
@@ -51,12 +63,12 @@ export const make = Effect.fn("makeVcsProjectConfig")(function* () {
while (true) {
const candidate = path.join(current, ".t3code", "vcs.json");
if (yield* fileSystem.exists(candidate).pipe(Effect.orElseSucceed(() => false))) {
return Option.some(candidate);
return candidate;
}
const parent = path.dirname(current);
if (parent === current) {
return Option.none();
return null;
}
current = parent;
}
@@ -66,25 +78,26 @@ export const make = Effect.fn("makeVcsProjectConfig")(function* () {
configPath: string,
) {
const raw = yield* fileSystem.readFileString(configPath).pipe(
Effect.map(Option.some),
Effect.catch((error) =>
Effect.logWarning("failed to read VCS project config", {
configPath,
error,
}).pipe(Effect.as(Option.none<string>())),
}).pipe(Effect.as(null)),
),
);
if (Option.isNone(raw)) return "auto" as const;
if (raw === null) {
return "auto" as const;
}
const parsed = parseConfig(raw.value);
if (Option.isNone(parsed)) {
const parsed = parseConfig(raw);
if (parsed === null) {
yield* Effect.logWarning("invalid VCS project config", {
configPath,
});
return "auto" as const;
}
return configuredKind(parsed.value);
return configuredKind(parsed);
});
const resolveKind: VcsProjectConfigShape["resolveKind"] = Effect.fn(
@@ -95,9 +108,11 @@ export const make = Effect.fn("makeVcsProjectConfig")(function* () {
}
const configPath = yield* findConfigPath(input.cwd);
if (Option.isNone(configPath)) return "auto";
if (configPath === null) {
return "auto";
}
return yield* readConfiguredKind(configPath.value);
return yield* readConfiguredKind(configPath);
});
return VcsProjectConfig.of({
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@t3tools/web",
"version": "0.0.23",
"version": "0.0.24",
"private": true,
"type": "module",
"scripts": {
+92 -39
View File
@@ -121,6 +121,8 @@ import type { ChatComposerHandle } from "./chat/ChatComposer";
const EMPTY_BROWSE_ENTRIES: FilesystemBrowseResult["entries"] = [];
const BROWSE_STALE_TIME_MS = 30_000;
type CommandPaletteOpenIntent = ReturnType<typeof useCommandPaletteStore.getState>["openIntent"];
type BrowseEntry = FilesystemBrowseResult["entries"][number];
function getLocalFileManagerName(platform: string): string {
if (isMacPlatform(platform)) {
@@ -327,11 +329,31 @@ function errorMessage(error: unknown): string {
}
export function CommandPalette({ children }: { children: ReactNode }) {
const composerHandleRef = useRef<ChatComposerHandle | null>(null);
return (
<ComposerHandleContext value={composerHandleRef}>
{children}
<CommandPaletteController />
</ComposerHandleContext>
);
}
function CommandPaletteController() {
const open = useCommandPaletteStore((store) => store.open);
const setOpen = useCommandPaletteStore((store) => store.setOpen);
useCommandPaletteShortcut();
return (
<CommandDialog open={open} onOpenChange={setOpen}>
<CommandPaletteDialog />
</CommandDialog>
);
}
function useCommandPaletteShortcut() {
const toggleOpen = useCommandPaletteStore((store) => store.toggleOpen);
const keybindings = useServerKeybindings();
const composerHandleRef = useRef<ChatComposerHandle | null>(null);
const routeTarget = useParams({
strict: false,
select: (params) => resolveThreadRouteTarget(params),
@@ -362,26 +384,12 @@ export function CommandPalette({ children }: { children: ReactNode }) {
window.addEventListener("keydown", onKeyDown);
return () => window.removeEventListener("keydown", onKeyDown);
}, [keybindings, terminalOpen, toggleOpen]);
return (
<ComposerHandleContext value={composerHandleRef}>
<CommandDialog open={open} onOpenChange={setOpen}>
{children}
<CommandPaletteDialog />
</CommandDialog>
</ComposerHandleContext>
);
}
function CommandPaletteDialog() {
const open = useCommandPaletteStore((store) => store.open);
const setOpen = useCommandPaletteStore((store) => store.setOpen);
useEffect(() => {
return () => {
setOpen(false);
};
}, [setOpen]);
useCloseCommandPaletteOnUnmount(setOpen);
if (!open) {
return null;
@@ -390,6 +398,70 @@ function CommandPaletteDialog() {
return <OpenCommandPaletteDialog />;
}
function useCloseCommandPaletteOnUnmount(setOpen: (open: boolean) => void) {
useEffect(() => {
return () => {
setOpen(false);
};
}, [setOpen]);
}
function usePrefetchBrowsePaths({
exactBrowseEntry,
filteredBrowseEntryCount,
highlightedBrowseEntry,
isBrowsing,
prefetchBrowsePath,
query,
}: {
readonly exactBrowseEntry: BrowseEntry | null;
readonly filteredBrowseEntryCount: number;
readonly highlightedBrowseEntry: BrowseEntry | null;
readonly isBrowsing: boolean;
readonly prefetchBrowsePath: (partialPath: string) => void;
readonly query: string;
}) {
// Prefetch the parent and the most likely next child so browse navigation
// stays warm without scanning every child directory in large trees.
useEffect(() => {
if (!isBrowsing || filteredBrowseEntryCount === 0) return;
if (canNavigateUp(query)) {
prefetchBrowsePath(getBrowseParentPath(query)!);
}
const nextChild = highlightedBrowseEntry ?? exactBrowseEntry;
if (nextChild) {
prefetchBrowsePath(appendBrowsePathSegment(query, nextChild.name));
}
}, [
exactBrowseEntry,
filteredBrowseEntryCount,
highlightedBrowseEntry,
isBrowsing,
prefetchBrowsePath,
query,
]);
}
function useOpenAddProjectIntent({
clearOpenIntent,
openAddProjectFlow,
openIntent,
}: {
readonly clearOpenIntent: () => void;
readonly openAddProjectFlow: () => void;
readonly openIntent: CommandPaletteOpenIntent;
}) {
useLayoutEffect(() => {
if (openIntent?.kind !== "add-project") {
return;
}
clearOpenIntent();
openAddProjectFlow();
}, [clearOpenIntent, openAddProjectFlow, openIntent]);
}
function OpenCommandPaletteDialog() {
const navigate = useNavigate();
const setOpen = useCommandPaletteStore((store) => store.setOpen);
@@ -587,27 +659,14 @@ function OpenCommandPaletteDialog() {
[browseEnvironmentId, currentProjectCwdForBrowse, fetchBrowseResult, queryClient],
);
// Prefetch the parent and the most likely next child so browse navigation
// stays warm without scanning every child directory in large trees.
useEffect(() => {
if (!isBrowsing || filteredBrowseEntries.length === 0) return;
if (canNavigateUp(query)) {
prefetchBrowsePath(getBrowseParentPath(query)!);
}
const nextChild = highlightedBrowseEntry ?? exactBrowseEntry;
if (nextChild) {
prefetchBrowsePath(appendBrowsePathSegment(query, nextChild.name));
}
}, [
usePrefetchBrowsePaths({
exactBrowseEntry,
filteredBrowseEntries.length,
filteredBrowseEntryCount: filteredBrowseEntries.length,
highlightedBrowseEntry,
isBrowsing,
prefetchBrowsePath,
query,
]);
});
const openProjectFromSearch = useMemo(
() => async (project: (typeof projects)[number]) => {
@@ -971,13 +1030,7 @@ function OpenCommandPaletteDialog() {
startAddProjectSourceSelection,
]);
useLayoutEffect(() => {
if (openIntent?.kind !== "add-project") {
return;
}
clearOpenIntent();
openAddProjectFlow();
}, [clearOpenIntent, openAddProjectFlow, openIntent]);
useOpenAddProjectIntent({ clearOpenIntent, openAddProjectFlow, openIntent });
const actionItems: Array<CommandPaletteActionItem | CommandPaletteSubmenuItem> = [];
+11 -10
View File
@@ -175,7 +175,6 @@ import {
import { sortThreads } from "../lib/threadSort";
import { SidebarUpdatePill } from "./sidebar/SidebarUpdatePill";
import { useCopyToClipboard } from "~/hooks/useCopyToClipboard";
import { CommandDialogTrigger } from "./ui/command";
import { readEnvironmentApi } from "../environmentApi";
import { useSettings, useUpdateSettings } from "~/hooks/useSettings";
import { useServerKeybindings } from "../rpc/serverState";
@@ -2619,20 +2618,22 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
},
[updateSettings],
);
const setCommandPaletteOpen = useCommandPaletteStore((store) => store.setOpen);
const handleCommandPaletteClick = useCallback(() => {
setCommandPaletteOpen(true);
}, [setCommandPaletteOpen]);
return (
<SidebarContent className="gap-0">
<SidebarGroup className="px-2 pt-2 pb-1">
<SidebarMenu>
<SidebarMenuItem>
<CommandDialogTrigger
render={
<SidebarMenuButton
size="sm"
className="gap-2 px-2 py-1.5 text-muted-foreground/70 hover:bg-accent hover:text-foreground focus-visible:ring-0"
data-testid="command-palette-trigger"
/>
}
<SidebarMenuButton
size="sm"
className="gap-2 px-2 py-1.5 text-muted-foreground/70 hover:bg-accent hover:text-foreground focus-visible:ring-0"
data-testid="command-palette-trigger"
aria-haspopup="dialog"
onClick={handleCommandPaletteClick}
>
<SearchIcon className="size-3.5" />
<span className="flex-1 truncate text-left text-xs">Search</span>
@@ -2641,7 +2642,7 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
{commandPaletteShortcutLabel}
</Kbd>
) : null}
</CommandDialogTrigger>
</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</SidebarGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@t3tools/contracts",
"version": "0.0.23",
"version": "0.0.24",
"private": true,
"files": [
"dist"
+3 -3
View File
@@ -242,9 +242,9 @@ describe("ssh tunnel scripts", () => {
Effect.result(
waitForHttpReady({
baseUrl: "http://127.0.0.1:41773/",
timeout: Duration.seconds(1),
interval: Duration.millis(100),
probeTimeout: Duration.millis(250),
timeoutMs: 1_000,
intervalMs: 100,
probeTimeoutMs: 250,
}),
),
);
+23 -26
View File
@@ -50,13 +50,11 @@ import {
export const DEFAULT_REMOTE_PORT = 3773;
const REMOTE_PORT_SCAN_WINDOW = 200;
const DEFAULT_HTTP_READY_TIMEOUT = Duration.seconds(30);
const DEFAULT_HTTP_READY_INTERVAL = Duration.millis(100);
const SSH_READY_TIMEOUT = Duration.seconds(20);
const SSH_READY_PROBE_TIMEOUT = Duration.seconds(1);
const TUNNEL_SHUTDOWN_TIMEOUT = Duration.seconds(2);
const REMOTE_READY_TIMEOUT = Duration.seconds(15);
const REMOTE_REUSE_READY_TIMEOUT = Duration.seconds(2);
const SSH_READY_TIMEOUT_MS = 20_000;
const SSH_READY_PROBE_TIMEOUT_MS = 1_000;
const TUNNEL_SHUTDOWN_TIMEOUT_MS = 2_000;
const REMOTE_READY_TIMEOUT_MS = 15_000;
const REMOTE_REUSE_READY_TIMEOUT_MS = 2_000;
export interface RemoteT3RunnerOptions {
readonly packageSpec?: string;
@@ -688,9 +686,9 @@ export function buildRemoteLaunchScript(input?: RemoteT3RunnerOptions): string {
T3_WAIT_READY_SCRIPT: stripTrailingNewlines(REMOTE_WAIT_READY_SCRIPT),
T3_DEFAULT_REMOTE_PORT: String(DEFAULT_REMOTE_PORT),
T3_REMOTE_PORT_SCAN_WINDOW: String(REMOTE_PORT_SCAN_WINDOW),
T3_READY_TIMEOUT_MS: String(Duration.toMillis(REMOTE_READY_TIMEOUT)),
T3_REUSE_READY_TIMEOUT_MS: String(Duration.toMillis(REMOTE_REUSE_READY_TIMEOUT)),
T3_READY_PROBE_TIMEOUT_MS: String(Duration.toMillis(SSH_READY_PROBE_TIMEOUT)),
T3_READY_TIMEOUT_MS: String(REMOTE_READY_TIMEOUT_MS),
T3_REUSE_READY_TIMEOUT_MS: String(REMOTE_REUSE_READY_TIMEOUT_MS),
T3_READY_PROBE_TIMEOUT_MS: String(SSH_READY_PROBE_TIMEOUT_MS),
});
}
@@ -872,18 +870,17 @@ const readRemoteServerLogTail = Effect.fn("ssh/tunnel.readRemoteServerLogTail")(
export const waitForHttpReady = Effect.fn("ssh/tunnel.waitForHttpReady")(function* (input: {
readonly baseUrl: string;
readonly timeout?: Duration.Duration;
readonly interval?: Duration.Duration;
readonly probeTimeout?: Duration.Duration;
readonly timeoutMs?: number;
readonly intervalMs?: number;
readonly probeTimeoutMs?: number;
readonly path?: string;
}): Effect.fn.Return<void, SshReadinessError, HttpClient.HttpClient> {
const timeout = input.timeout ?? DEFAULT_HTTP_READY_TIMEOUT;
const interval = input.interval ?? DEFAULT_HTTP_READY_INTERVAL;
const probeTimeout = input.probeTimeout ?? SSH_READY_PROBE_TIMEOUT;
const timeoutMs = Duration.toMillis(timeout);
const intervalMs = Duration.toMillis(interval);
const probeTimeoutMs = Duration.toMillis(probeTimeout);
const retryPolicy = Schedule.spaced(interval);
const timeoutMs = input.timeoutMs ?? 30_000;
const intervalMs = input.intervalMs ?? 100;
const probeTimeoutMs = input.probeTimeoutMs ?? SSH_READY_PROBE_TIMEOUT_MS;
const retryPolicy = Schedule.spaced(Duration.millis(intervalMs)).pipe(
Schedule.take(Math.max(0, Math.ceil(timeoutMs / intervalMs))),
);
const requestUrl = new URL(input.path ?? "/", input.baseUrl).toString();
const client = yield* HttpClient.HttpClient;
const lastProbeFailure = yield* Ref.make<unknown>(null);
@@ -903,7 +900,7 @@ export const waitForHttpReady = Effect.fn("ssh/tunnel.waitForHttpReady")(functio
Effect.gen(function* () {
attempt += 1;
const responseOption = yield* effect.pipe(
Effect.timeoutOption(probeTimeout),
Effect.timeoutOption(Duration.millis(probeTimeoutMs)),
Effect.mapError(
(cause) =>
new SshReadinessError({
@@ -956,7 +953,7 @@ export const waitForHttpReady = Effect.fn("ssh/tunnel.waitForHttpReady")(functio
cause,
}),
),
Effect.timeoutOption(timeout),
Effect.timeoutOption(Duration.millis(timeoutMs)),
);
return yield* Option.match(result, {
@@ -1239,7 +1236,7 @@ const startSshTunnel = Effect.fn("ssh/tunnel.startSshTunnel")(function* (input:
yield* Effect.raceFirst(
waitForHttpReady({
baseUrl: input.httpBaseUrl,
timeout: SSH_READY_TIMEOUT,
timeoutMs: SSH_READY_TIMEOUT_MS,
}),
exitFailure,
).pipe(
@@ -1299,7 +1296,7 @@ const startSshTunnel = Effect.fn("ssh/tunnel.startSshTunnel")(function* (input:
: child
.kill({
killSignal: "SIGTERM",
forceKillAfter: TUNNEL_SHUTDOWN_TIMEOUT,
forceKillAfter: TUNNEL_SHUTDOWN_TIMEOUT_MS,
})
.pipe(Effect.ignore),
),
@@ -1543,7 +1540,7 @@ const makeSshEnvironmentManager = Effect.fn("ssh/tunnel.SshEnvironmentManager.ma
[
tunnelEntry.process.kill({
killSignal: "SIGTERM",
forceKillAfter: TUNNEL_SHUTDOWN_TIMEOUT,
forceKillAfter: TUNNEL_SHUTDOWN_TIMEOUT_MS,
}),
stopRemoteServer(
tunnelEntry.target,
@@ -1597,7 +1594,7 @@ const makeSshEnvironmentManager = Effect.fn("ssh/tunnel.SshEnvironmentManager.ma
remotePort: entry.remotePort,
});
const readinessExit = yield* Effect.exit(
waitForHttpReady({ baseUrl: entry.httpBaseUrl, timeout: REMOTE_REUSE_READY_TIMEOUT }),
waitForHttpReady({ baseUrl: entry.httpBaseUrl, timeoutMs: 2_000 }),
);
if (Exit.isSuccess(readinessExit)) {
yield* Effect.logDebug("ssh.environment.tunnel.reused", {
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB