Skip to content

Commit c08b3ae

Browse files
committed
Merge remote-tracking branch 'origin/main' into t3code/pr-refresh-freshness
2 parents c835645 + 9da0fab commit c08b3ae

191 files changed

Lines changed: 6415 additions & 970 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.

‎.github/workflows/release.yml‎

Lines changed: 63 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,6 @@ jobs:
100100
cache: true
101101
run-install: true
102102

103-
- name: Ensure Electron runtime is installed
104-
run: vp run --filter @t3tools/desktop ensure:electron
105-
106103
- id: release_meta
107104
name: Resolve release version
108105
shell: bash
@@ -157,6 +154,40 @@ jobs:
157154
fi
158155
fi
159156
157+
- id: previous_tag
158+
name: Resolve previous release tag
159+
run: |
160+
node scripts/resolve-previous-release-tag.ts \
161+
--channel "${{ steps.release_meta.outputs.release_channel }}" \
162+
--current-tag "${{ steps.release_meta.outputs.tag }}" \
163+
--github-output
164+
165+
quality:
166+
name: Release quality checks
167+
needs: [preflight]
168+
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' }}
169+
runs-on: blacksmith-8vcpu-ubuntu-2404
170+
timeout-minutes: 10
171+
steps:
172+
- name: Checkout
173+
uses: actions/checkout@v6
174+
with:
175+
ref: ${{ needs.preflight.outputs.ref }}
176+
sparse-checkout: |
177+
/*
178+
!/.repos/
179+
sparse-checkout-cone-mode: false
180+
181+
- name: Setup Vite+
182+
uses: voidzero-dev/setup-vp@v1
183+
with:
184+
node-version-file: package.json
185+
cache: true
186+
run-install: true
187+
188+
- name: Ensure Electron runtime is installed
189+
run: vp run --filter @t3tools/desktop ensure:electron
190+
160191
- name: Check
161192
run: vp check
162193

@@ -166,14 +197,6 @@ jobs:
166197
- name: Test
167198
run: vp run test
168199

169-
- id: previous_tag
170-
name: Resolve previous release tag
171-
run: |
172-
node scripts/resolve-previous-release-tag.ts \
173-
--channel "${{ steps.release_meta.outputs.release_channel }}" \
174-
--current-tag "${{ steps.release_meta.outputs.tag }}" \
175-
--github-output
176-
177200
relay_public_config:
178201
name: Resolve T3 Connect public config
179202
needs: preflight
@@ -385,14 +408,34 @@ jobs:
385408
uses: voidzero-dev/setup-vp@v1
386409
with:
387410
node-version-file: package.json
388-
cache: true
389-
run-install: |
390-
args:
391-
- --filter=@t3tools/desktop...
392-
- --filter=t3...
393-
- --filter=@t3tools/scripts...
411+
cache: ${{ matrix.platform != 'win' }}
412+
run-install: false
413+
414+
- name: Resolve Windows package cache path
415+
if: matrix.platform == 'win'
416+
id: package_cache_path
417+
shell: pwsh
418+
run: '"path=$(vp pm cache dir)" >> $env:GITHUB_OUTPUT'
419+
420+
- name: Cache Windows packages
421+
if: matrix.platform == 'win'
422+
uses: actions/cache@v6
423+
with:
424+
path: ${{ steps.package_cache_path.outputs.path }}
425+
key: windows-release-packages-v1-${{ matrix.arch }}-${{ hashFiles('pnpm-lock.yaml') }}
426+
427+
- name: Install desktop dependencies
428+
run: vp install --filter=@t3tools/desktop... --filter=t3... --filter=@t3tools/scripts...
429+
430+
- name: Cache resource monitor
431+
id: resource_monitor_cache
432+
uses: actions/cache@v6
433+
with:
434+
path: native/resource-monitor/target/${{ matrix.rust_target }}/release/t3-resource-monitor${{ matrix.platform == 'win' && '.exe' || '' }}
435+
key: resource-monitor-${{ matrix.rust_target }}-${{ hashFiles('native/resource-monitor/Cargo.lock', 'native/resource-monitor/Cargo.toml', 'native/resource-monitor/src/**') }}
394436

395437
- name: Setup Rust
438+
if: steps.resource_monitor_cache.outputs.cache-hit != 'true'
396439
uses: dtolnay/rust-toolchain@stable
397440
with:
398441
targets: ${{ matrix.rust_target }}
@@ -518,6 +561,7 @@ jobs:
518561
- name: Build desktop artifact
519562
shell: bash
520563
env:
564+
T3CODE_DESKTOP_REUSE_RESOURCE_MONITOR: ${{ steps.resource_monitor_cache.outputs.cache-hit == 'true' }}
521565
CSC_LINK: ${{ secrets.CSC_LINK }}
522566
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
523567
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
@@ -664,8 +708,8 @@ jobs:
664708

665709
publish_cli:
666710
name: Publish CLI to npm
667-
needs: [preflight, relay_public_config, build]
668-
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.build.result == 'success' }}
711+
needs: [preflight, relay_public_config, quality, build]
712+
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.quality.result == 'success' && needs.build.result == 'success' }}
669713
runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404
670714
timeout-minutes: 10
671715
permissions:

‎.macroscope/approvability.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use Macroscope's default approvability criteria.

‎.macroscope/check-run-agents/ui-consistency.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ The goal is not to minimize CSS or class counts at any cost. The goal is to put
4747
- light-only declarations use `@variant light`;
4848
- raw `.dark` should remain only in the `dark` and `light` custom-variant definitions.
4949
- Preserve custom themes and runtime token bridges. Removing a variable or selector is safe only when all runtime, inspector, generated, and theme-palette consumers are accounted for.
50+
- Contrast and accessibility settings that target app chrome must derive from semantic color tokens. Do not apply `filter` to `html`, `body`, or the app root: it also changes user media, previews, terminals, glass backdrop ownership, and view-transition snapshots.
51+
- Preserve alpha and surface ownership when deriving contrast tokens. Soften translucent borders and inputs toward transparent rather than an opaque canvas, use a modest semantic-foreground mix for stronger borders, and adjust card, popover, accent, secondary, and message foregrounds against their own surfaces when the base foreground changes.
52+
- Runtime-adjusted roles must be ordinary custom properties shared by the Tailwind bridge, global CSS, imperative style strings, and bridge snapshots sent to other renderers. Audit literal `var(--foreground)`, `var(--border)`, and related role reads so headings, markdown chrome, menus, previews, and utilities do not split into adjusted and unadjusted colors.
5053
- Inspect emitted production CSS after unusual variants, arbitrary selectors, nested pseudo-elements, or attribute matching. Source syntax that looks valid is insufficient.
5154
- Flag malformed or empty emitted selectors such as empty `:is()` or `:not(:is())`, selector branches that can never match their own class attribute, and transformations that silently drop the intended rule.
5255
- Prefer source-level logic over clever selectors when behavior depends on consumer-provided class strings. Preserve `MenuPopup`'s current defaulting contract: a string `className` containing a `w-*`, `min-w-*`, or `max-w-*` utility after variant prefixes are stripped suppresses `min-w-32`; a string without one and a functional/non-string `className` keep the default. Arbitrary width values count as width utilities, and the consumer class must be merged last so it retains control. Do not replace this with a raw class-attribute substring selector.

‎apps/desktop/src/electron/ElectronDialog.test.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,34 @@ describe("ElectronDialog", () => {
5353
}).pipe(Effect.provide(ElectronDialog.layer)),
5454
);
5555

56+
it.effect("opens a single-file picker when multiple selections are disabled", () =>
57+
Effect.gen(function* () {
58+
showOpenDialogMock.mockResolvedValue({
59+
canceled: false,
60+
filePaths: ["/pictures/icon.png"],
61+
});
62+
const dialog = yield* ElectronDialog.ElectronDialog;
63+
64+
const paths = yield* dialog.pickFiles({
65+
owner: Option.none(),
66+
defaultPath: Option.some("/project"),
67+
filters: [{ name: "Images", extensions: ["png"] }],
68+
multiple: false,
69+
});
70+
71+
assert.deepEqual(paths, ["/pictures/icon.png"]);
72+
assert.deepEqual(showOpenDialogMock.mock.calls, [
73+
[
74+
{
75+
defaultPath: "/project",
76+
filters: [{ name: "Images", extensions: ["png"] }],
77+
properties: ["openFile"],
78+
},
79+
],
80+
]);
81+
}).pipe(Effect.provide(ElectronDialog.layer)),
82+
);
83+
5684
it.effect("preserves message box request context and cause", () =>
5785
Effect.gen(function* () {
5886
const cause = new Error("message box failed");

‎apps/desktop/src/electron/ElectronDialog.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export interface ElectronDialogPickFilesInput {
8484
readonly owner: Option.Option<Electron.BrowserWindow>;
8585
readonly defaultPath: Option.Option<string>;
8686
readonly filters: readonly Electron.FileFilter[];
87+
readonly multiple: boolean;
8788
}
8889

8990
export class ElectronDialog extends Context.Service<
@@ -144,7 +145,7 @@ export const make = ElectronDialog.of({
144145
});
145146
const defaultPath = Option.getOrNull(input.defaultPath);
146147
const openDialogOptions: Electron.OpenDialogOptions = {
147-
properties: ["openFile", "multiSelections"],
148+
properties: input.multiple ? ["openFile", "multiSelections"] : ["openFile"],
148149
filters: [...input.filters],
149150
...(defaultPath === null ? {} : { defaultPath }),
150151
};

‎apps/desktop/src/ipc/DesktopIpcHandlers.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import {
3939
openExternal,
4040
probeRemoteEditors,
4141
pickFolder,
42+
pickProjectFavicon,
4243
pickThemeFiles,
4344
setTheme,
4445
showContextMenu,
@@ -82,6 +83,7 @@ export const installDesktopIpcHandlers = Effect.fn("desktop.ipc.installHandlers"
8283
yield* ipc.handle(setWslOnly);
8384

8485
yield* ipc.handle(pickFolder);
86+
yield* ipc.handle(pickProjectFavicon);
8587
yield* ipc.handle(pickThemeFiles);
8688
yield* ipc.handle(setTheme);
8789
yield* ipc.handle(showContextMenu);

‎apps/desktop/src/ipc/channels.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export const PICK_FOLDER_CHANNEL = "desktop:pick-folder";
2+
export const PICK_PROJECT_FAVICON_CHANNEL = "desktop:pick-project-favicon";
23
export const PICK_THEME_FILES_CHANNEL = "desktop:pick-theme-files";
34
export const SET_THEME_CHANNEL = "desktop:set-theme";
45
export const CONTEXT_MENU_CHANNEL = "desktop:context-menu";

‎apps/desktop/src/ipc/methods/window.test.ts‎

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@ import { assert, describe, it } from "@effect/vitest";
22
import * as Effect from "effect/Effect";
33
import * as Layer from "effect/Layer";
44
import * as Option from "effect/Option";
5+
import { vi } from "vite-plus/test";
56

67
import type * as Electron from "electron";
78

89
import * as DesktopBackendManager from "../../backend/DesktopBackendManager.ts";
910
import * as DesktopBackendPool from "../../backend/DesktopBackendPool.ts";
11+
import * as ElectronDialog from "../../electron/ElectronDialog.ts";
1012
import * as ElectronWindow from "../../electron/ElectronWindow.ts";
11-
import { getLocalEnvironmentBootstraps, getWindowFullscreenState } from "./window.ts";
13+
import {
14+
getLocalEnvironmentBootstraps,
15+
getWindowFullscreenState,
16+
pickProjectFavicon,
17+
} from "./window.ts";
1218

1319
const readyWslConfig: DesktopBackendManager.DesktopBackendStartConfig = {
1420
executablePath: "wsl.exe",
@@ -146,3 +152,38 @@ describe("getWindowFullscreenState", () => {
146152
);
147153
});
148154
});
155+
156+
describe("pickProjectFavicon", () => {
157+
it.effect("opens a single-image picker from the project directory", () =>
158+
Effect.gen(function* () {
159+
const pickFiles = vi.fn(() => Effect.succeed(["/pictures/icon.png"]));
160+
const result = yield* pickProjectFavicon.handler("/project").pipe(
161+
Effect.provide(
162+
Layer.mergeAll(
163+
Layer.mock(ElectronDialog.ElectronDialog)({ pickFiles }),
164+
Layer.mock(ElectronWindow.ElectronWindow)({
165+
focusedMainOrFirst: Effect.succeed(Option.none()),
166+
}),
167+
),
168+
),
169+
);
170+
171+
assert.strictEqual(result, "/pictures/icon.png");
172+
assert.deepEqual(pickFiles.mock.calls, [
173+
[
174+
{
175+
owner: Option.none(),
176+
defaultPath: Option.some("/project"),
177+
multiple: false,
178+
filters: [
179+
{
180+
name: "Images",
181+
extensions: ["avif", "gif", "ico", "jpeg", "jpg", "png", "svg", "webp"],
182+
},
183+
],
184+
},
185+
],
186+
]);
187+
}),
188+
);
189+
});

‎apps/desktop/src/ipc/methods/window.ts‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
type DesktopEnvironmentBootstrap,
1313
type PickedThemeFile,
1414
} from "@t3tools/contracts";
15+
import { WORKSPACE_IMAGE_PREVIEW_EXTENSIONS } from "@t3tools/shared/filePreview";
1516
import { isCommandAvailable } from "@t3tools/shared/shell";
1617
import * as NodeOS from "node:os";
1718
import * as FileSystem from "effect/FileSystem";
@@ -234,6 +235,28 @@ export const pickFolder = DesktopIpc.makeIpcMethod({
234235
}),
235236
});
236237

238+
export const pickProjectFavicon = DesktopIpc.makeIpcMethod({
239+
channel: IpcChannels.PICK_PROJECT_FAVICON_CHANNEL,
240+
payload: Schema.UndefinedOr(Schema.String),
241+
result: Schema.NullOr(Schema.String),
242+
handler: Effect.fn("desktop.ipc.window.pickProjectFavicon")(function* (initialPath) {
243+
const dialog = yield* ElectronDialog.ElectronDialog;
244+
const electronWindow = yield* ElectronWindow.ElectronWindow;
245+
const paths = yield* dialog.pickFiles({
246+
owner: yield* electronWindow.focusedMainOrFirst,
247+
defaultPath: Option.fromNullishOr(initialPath),
248+
multiple: false,
249+
filters: [
250+
{
251+
name: "Images",
252+
extensions: WORKSPACE_IMAGE_PREVIEW_EXTENSIONS.map((extension) => extension.slice(1)),
253+
},
254+
],
255+
});
256+
return paths[0] ?? null;
257+
}),
258+
});
259+
237260
export const setTheme = DesktopIpc.makeIpcMethod({
238261
channel: IpcChannels.SET_THEME_CHANNEL,
239262
payload: DesktopThemeSchema,
@@ -323,6 +346,7 @@ export const pickThemeFiles = DesktopIpc.makeIpcMethod({
323346
owner: yield* electronWindow.focusedMainOrFirst,
324347
defaultPath: defaultPath ? Option.some(extensionsDir) : Option.none(),
325348
filters: [{ name: "JSON", extensions: ["json"] }],
349+
multiple: true,
326350
});
327351
if (paths.length === 0) {
328352
return null;

‎apps/desktop/src/preload.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ contextBridge.exposeInMainWorld("desktopBridge", {
101101
setWslDistro: (distro) => ipcRenderer.invoke(IpcChannels.SET_WSL_DISTRO_CHANNEL, distro),
102102
setWslOnly: (enabled) => ipcRenderer.invoke(IpcChannels.SET_WSL_ONLY_CHANNEL, enabled),
103103
pickFolder: (options) => ipcRenderer.invoke(IpcChannels.PICK_FOLDER_CHANNEL, options),
104+
pickProjectFavicon: (initialPath) =>
105+
ipcRenderer.invoke(IpcChannels.PICK_PROJECT_FAVICON_CHANNEL, initialPath),
104106
pickThemeFiles: () => ipcRenderer.invoke(IpcChannels.PICK_THEME_FILES_CHANNEL, undefined),
105107
setTheme: (theme) => ipcRenderer.invoke(IpcChannels.SET_THEME_CHANNEL, theme),
106108
showContextMenu: (items, position) =>

0 commit comments

Comments
 (0)