Skip to content

Commit c6b76cd

Browse files
committed
Merge remote-tracking branch 'upstream/main' into t3code/evaluate-upstream-updates
2 parents 1d9114f + 4d83436 commit c6b76cd

86 files changed

Lines changed: 2186 additions & 741 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/desktop/src/settings/DesktopClientSettings.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const clientSettings: ClientSettings = {
1919
dismissedProviderUpdateNotificationKeys: [],
2020
diffIgnoreWhitespace: true,
2121
favorites: [],
22+
glassOpacity: 80,
2223
providerModelPreferences: {},
2324
sidebarAutoSettleAfterDays: 3,
2425
sidebarProjectGroupingMode: "repository_path",

‎apps/marketing/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"typecheck": "astro check"
1111
},
1212
"dependencies": {
13+
"@t3tools/shared": "workspace:*",
1314
"astro": "^7.0.3"
1415
},
1516
"devDependencies": {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { APIRoute } from "astro";
2+
3+
import { buildT3ProjectFileJsonSchema } from "@t3tools/shared/t3ProjectFile";
4+
5+
// Rendered at build time; published at https://t3.codes/schema/t3.json so
6+
// t3.json files can reference it via "$schema" for editor/LSP support.
7+
export const GET: APIRoute = () =>
8+
new Response(`${JSON.stringify(buildT3ProjectFileJsonSchema(), null, 2)}\n`, {
9+
headers: { "Content-Type": "application/json" },
10+
});

‎apps/marketing/vercel.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { VercelConfig } from "@vercel/config/v1";
22

33
export const config: VercelConfig = {
4-
installCommand: "npm install -g vite-plus && vp install --filter '@t3tools/marketing'",
4+
installCommand: "npm install -g vite-plus && vp install --filter '@t3tools/marketing...'",
55
buildCommand: "vp run --filter @t3tools/marketing build",
66
outputDirectory: "dist",
77
};

‎apps/mobile/src/features/threads/NewTaskDraftScreen.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,10 +582,13 @@ export function NewTaskDraftScreen(props: {
582582
? "Approve actions"
583583
: flow.runtimeMode === "auto-accept-edits"
584584
? "Auto-accept edits"
585-
: "Full access",
585+
: flow.runtimeMode === "auto"
586+
? "Auto"
587+
: "Full access",
586588
subactions: [
587589
{ id: "options:runtime:approval-required", title: "Approve actions" },
588590
{ id: "options:runtime:auto-accept-edits", title: "Auto-accept edits" },
591+
{ id: "options:runtime:auto", title: "Auto" },
589592
{ id: "options:runtime:full-access", title: "Full access" },
590593
].map((option) => {
591594
const value = option.id.replace("options:runtime:", "");

‎apps/mobile/src/features/threads/ThreadComposer.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,10 +638,13 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer
638638
? "Approve actions"
639639
: currentRuntimeMode === "auto-accept-edits"
640640
? "Auto-accept edits"
641-
: "Full access",
641+
: currentRuntimeMode === "auto"
642+
? "Auto"
643+
: "Full access",
642644
subactions: [
643645
{ id: "options:runtime:approval-required", title: "Approve actions" },
644646
{ id: "options:runtime:auto-accept-edits", title: "Auto-accept edits" },
647+
{ id: "options:runtime:auto", title: "Auto" },
645648
{ id: "options:runtime:full-access", title: "Full access" },
646649
].map((option) => {
647650
const value = option.id.replace("options:runtime:", "");

‎apps/server/src/assets/AssetAccess.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import * as PlatformError from "effect/PlatformError";
1111
import * as ServerSecretStore from "../auth/ServerSecretStore.ts";
1212
import * as ServerConfig from "../config.ts";
1313
import * as ProjectFaviconResolver from "../project/ProjectFaviconResolver.ts";
14+
import * as T3ProjectFileLoader from "../project/T3ProjectFileLoader.ts";
1415
import * as WorkspacePaths from "../workspace/WorkspacePaths.ts";
1516
import { ASSET_ROUTE_PREFIX, issueAssetUrl, resolveAsset } from "./AssetAccess.ts";
1617

@@ -20,7 +21,10 @@ const configLayer = ServerConfig.ServerConfig.layerTest(process.cwd(), {
2021
const testLayer = Layer.mergeAll(
2122
configLayer,
2223
WorkspacePaths.layer,
23-
ProjectFaviconResolver.layer.pipe(Layer.provide(WorkspacePaths.layer)),
24+
ProjectFaviconResolver.layer.pipe(
25+
Layer.provide(WorkspacePaths.layer),
26+
Layer.provide(T3ProjectFileLoader.layer),
27+
),
2428
ServerSecretStore.layer.pipe(Layer.provide(configLayer)),
2529
).pipe(Layer.provideMerge(NodeServices.layer));
2630

‎apps/server/src/project/ProjectFaviconResolver.test.ts‎

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@ import * as PlatformError from "effect/PlatformError";
88

99
import * as WorkspacePaths from "../workspace/WorkspacePaths.ts";
1010
import * as ProjectFaviconResolver from "./ProjectFaviconResolver.ts";
11+
import * as T3ProjectFileLoader from "./T3ProjectFileLoader.ts";
1112

1213
const TestLayer = Layer.empty.pipe(
13-
Layer.provideMerge(ProjectFaviconResolver.layer.pipe(Layer.provide(WorkspacePaths.layer))),
14+
Layer.provideMerge(
15+
ProjectFaviconResolver.layer.pipe(
16+
Layer.provide(WorkspacePaths.layer),
17+
Layer.provide(T3ProjectFileLoader.layer),
18+
),
19+
),
1420
Layer.provideMerge(NodeServices.layer),
1521
);
1622

@@ -37,7 +43,7 @@ const writeTextFile = Effect.fn("writeTextFile")(function* (
3743

3844
const makeResolverWithFileSystem = (fileSystem: FileSystem.FileSystem) =>
3945
ProjectFaviconResolver.make.pipe(
40-
Effect.provide(WorkspacePaths.layer),
46+
Effect.provide([WorkspacePaths.layer, T3ProjectFileLoader.layer]),
4147
Effect.provideService(FileSystem.FileSystem, fileSystem),
4248
);
4349

@@ -56,6 +62,63 @@ it.layer(TestLayer)("ProjectFaviconResolverLive", (it) => {
5662
}),
5763
);
5864

65+
it.effect("prefers a t3.json iconPath over well-known files", () =>
66+
Effect.gen(function* () {
67+
const resolver = yield* ProjectFaviconResolver.ProjectFaviconResolver;
68+
const cwd = yield* makeTempDir;
69+
yield* writeTextFile(cwd, "t3.json", '{ "iconPath": "brand/mark.svg" }');
70+
yield* writeTextFile(cwd, "brand/mark.svg", "<svg>mark</svg>");
71+
yield* writeTextFile(cwd, "favicon.svg", "<svg>favicon</svg>");
72+
73+
const resolved = yield* resolver.resolvePath(cwd);
74+
75+
expect(resolved).not.toBeNull();
76+
expect(resolved).toContain("brand/mark.svg");
77+
}),
78+
);
79+
80+
it.effect("falls back to well-known files when the t3.json iconPath does not exist", () =>
81+
Effect.gen(function* () {
82+
const resolver = yield* ProjectFaviconResolver.ProjectFaviconResolver;
83+
const cwd = yield* makeTempDir;
84+
yield* writeTextFile(cwd, "t3.json", '{ "iconPath": "brand/missing.svg" }');
85+
yield* writeTextFile(cwd, "favicon.svg", "<svg>favicon</svg>");
86+
87+
const resolved = yield* resolver.resolvePath(cwd);
88+
89+
expect(resolved).not.toBeNull();
90+
expect(resolved).toContain("favicon.svg");
91+
}),
92+
);
93+
94+
it.effect("ignores invalid t3.json files", () =>
95+
Effect.gen(function* () {
96+
const resolver = yield* ProjectFaviconResolver.ProjectFaviconResolver;
97+
const cwd = yield* makeTempDir;
98+
yield* writeTextFile(cwd, "t3.json", "{ not json");
99+
yield* writeTextFile(cwd, "favicon.svg", "<svg>favicon</svg>");
100+
101+
const resolved = yield* resolver.resolvePath(cwd);
102+
103+
expect(resolved).not.toBeNull();
104+
expect(resolved).toContain("favicon.svg");
105+
}),
106+
);
107+
108+
it.effect("does not resolve a t3.json iconPath outside the workspace root", () =>
109+
Effect.gen(function* () {
110+
const resolver = yield* ProjectFaviconResolver.ProjectFaviconResolver;
111+
const parent = yield* makeTempDir;
112+
const cwd = `${parent}/app`;
113+
yield* writeTextFile(parent, "secret.svg", "<svg>secret</svg>");
114+
yield* writeTextFile(cwd, "t3.json", '{ "iconPath": "../secret.svg" }');
115+
116+
const resolved = yield* resolver.resolvePath(cwd);
117+
118+
expect(resolved).toBeNull();
119+
}),
120+
);
121+
59122
it.effect("resolves icon hrefs from project source files", () =>
60123
Effect.gen(function* () {
61124
const resolver = yield* ProjectFaviconResolver.ProjectFaviconResolver;

‎apps/server/src/project/ProjectFaviconResolver.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import * as PlatformError from "effect/PlatformError";
1616
import * as Schema from "effect/Schema";
1717

1818
import * as WorkspacePaths from "../workspace/WorkspacePaths.ts";
19+
import * as T3ProjectFileLoader from "./T3ProjectFileLoader.ts";
1920

2021
// Well-known favicon paths checked in order.
2122
const FAVICON_CANDIDATES = [
@@ -117,6 +118,7 @@ export const make = Effect.gen(function* () {
117118
const fileSystem = yield* FileSystem.FileSystem;
118119
const path = yield* Path.Path;
119120
const workspacePaths = yield* WorkspacePaths.WorkspacePaths;
121+
const projectFileLoader = yield* T3ProjectFileLoader.T3ProjectFileLoader;
120122

121123
const resolveIconHref = (href: string): ReadonlyArray<string> => {
122124
const clean = href.replace(/^\//, "");
@@ -177,6 +179,15 @@ export const make = Effect.gen(function* () {
177179
}),
178180
),
179181
);
182+
// A t3.json iconPath takes precedence over the well-known locations.
183+
const projectFile = yield* projectFileLoader.load(projectCwd);
184+
if (Option.isSome(projectFile) && projectFile.value.iconPath !== undefined) {
185+
const existing = yield* findExistingFile(projectCwd, [projectFile.value.iconPath]);
186+
if (existing) {
187+
return existing;
188+
}
189+
}
190+
180191
for (const candidate of FAVICON_CANDIDATES) {
181192
const existing = yield* findExistingFile(projectCwd, [candidate]);
182193
if (existing) {
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import * as NodeServices from "@effect/platform-node/NodeServices";
2+
import { it, describe, expect } from "@effect/vitest";
3+
import * as Effect from "effect/Effect";
4+
import * as FileSystem from "effect/FileSystem";
5+
import * as Layer from "effect/Layer";
6+
import * as Option from "effect/Option";
7+
import * as Path from "effect/Path";
8+
9+
import * as T3ProjectFileLoader from "./T3ProjectFileLoader.ts";
10+
11+
const TestLayer = Layer.empty.pipe(
12+
Layer.provideMerge(T3ProjectFileLoader.layer),
13+
Layer.provideMerge(NodeServices.layer),
14+
);
15+
16+
const makeTempDir = Effect.gen(function* () {
17+
const fileSystem = yield* FileSystem.FileSystem;
18+
return yield* fileSystem.makeTempDirectoryScoped({
19+
prefix: "t3code-project-file-",
20+
});
21+
});
22+
23+
const writeProjectFile = Effect.fn("writeProjectFile")(function* (cwd: string, contents: string) {
24+
const fileSystem = yield* FileSystem.FileSystem;
25+
const path = yield* Path.Path;
26+
yield* fileSystem.writeFileString(path.join(cwd, "t3.json"), contents).pipe(Effect.orDie);
27+
});
28+
29+
it.layer(TestLayer)("T3ProjectFileLoader", (it) => {
30+
describe("load", () => {
31+
it.effect("loads and decodes a valid t3.json", () =>
32+
Effect.gen(function* () {
33+
const loader = yield* T3ProjectFileLoader.T3ProjectFileLoader;
34+
const cwd = yield* makeTempDir;
35+
yield* writeProjectFile(
36+
cwd,
37+
`{
38+
// JSONC is tolerated
39+
"iconPath": "assets/logo.svg",
40+
"scripts": [{ "name": "Dev", "command": "pnpm dev" }],
41+
}`,
42+
);
43+
44+
const loaded = yield* loader.load(cwd);
45+
46+
expect(Option.isSome(loaded)).toBe(true);
47+
if (Option.isSome(loaded)) {
48+
expect(loaded.value.iconPath).toBe("assets/logo.svg");
49+
expect(loaded.value.scripts).toEqual([{ name: "Dev", command: "pnpm dev" }]);
50+
}
51+
}),
52+
);
53+
54+
it.effect("returns none when t3.json is missing", () =>
55+
Effect.gen(function* () {
56+
const loader = yield* T3ProjectFileLoader.T3ProjectFileLoader;
57+
const cwd = yield* makeTempDir;
58+
59+
const loaded = yield* loader.load(cwd);
60+
61+
expect(Option.isNone(loaded)).toBe(true);
62+
}),
63+
);
64+
65+
it.effect("returns none for malformed JSON without failing", () =>
66+
Effect.gen(function* () {
67+
const loader = yield* T3ProjectFileLoader.T3ProjectFileLoader;
68+
const cwd = yield* makeTempDir;
69+
yield* writeProjectFile(cwd, "{ not json");
70+
71+
const loaded = yield* loader.load(cwd);
72+
73+
expect(Option.isNone(loaded)).toBe(true);
74+
}),
75+
);
76+
77+
it.effect("returns none for schema-invalid files without failing", () =>
78+
Effect.gen(function* () {
79+
const loader = yield* T3ProjectFileLoader.T3ProjectFileLoader;
80+
const cwd = yield* makeTempDir;
81+
yield* writeProjectFile(cwd, '{ "scripts": [{ "name": "Dev" }] }');
82+
83+
const loaded = yield* loader.load(cwd);
84+
85+
expect(Option.isNone(loaded)).toBe(true);
86+
}),
87+
);
88+
});
89+
});

0 commit comments

Comments
 (0)