Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 29 additions & 27 deletions .fork/customizations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@
first V2 launch carries the fork's drafts over and never upstream's.
The fork presents as "no3y Code": bundle id com.t3tools.t3code.fork,
installs as "no3y Code.app", ships no3y-Code-* artifacts, packages the
green-grid mark from assets/fork on all three platforms (plus web splash
sparkle mark from assets/fork on all three platforms (plus web splash
and favicon), and keeps all filesystem state under ~/.t3-fork. The bundle
id and the base directory are the stable identities and must never change
across display renames; display strings are safe to rename precisely
Expand Down Expand Up @@ -407,35 +407,37 @@
is excluded from the test, fmt and lint discovery lists in vite.config.ts
and from the four .repos exclusions in .vscode/settings.json, the way
.repos already was.
The rendered app carries the name too: the sidebar brand drops the T3
wordmark and draws Figma t3-fork 676:41854 — the 16px pixel mark and the
13x3 "no3y" wordmark owned by fork-sidebar-chrome. APP_BASE_NAME still
The rendered app carries the name too: the sidebar header draws no brand
(fork-sidebar-chrome), so neither upstream's T3 wordmark nor its name
appears there. APP_BASE_NAME still
names the packaged app and branding.ts's bridge-less fallback, which
points at the fork's own constant instead of upstream's "T3 Code". Splash and favicon also ship from assets/fork (copied into
apps/web/public for local/dev and into the packaged desktop client at
build time via FORK_WEB_ICON_ASSETS + the shared applyWebIconOverrides
path). The layered Icon Composer projects in assets/fork/app-icon.icon and
assets/fork/dev-app-icon.icon are the Figma source of truth (file t3-fork,
node 598:6597), so the surrounding tile receives the system Liquid Glass
treatment on macOS without rasterizing the mark. Production fills the
tile with the Figma green (#37C570); development keeps a solid orange
tile so installed variants remain distinguishable in the Dock.
Glass stays off on the mark layer itself so the pixel grid remains crisp
(glass on it melts the cells into blobs); the system treatment belongs to
the surrounding tile. Every app-icon raster, including the Linux PNG, the
Windows ICO and the apps/web/public apple-touch copy, is rendered from
these projects by `node .fork/export-icons.ts` (macOS only; `--check`
reports stale files), so every packaged channel carries the same artwork.
The macOS Dock exports add only a transparent outer canvas around the
rendered artwork, matching the standard Mac icon footprint. The local dev
splash uses the orange family, while packaged builds stamp the green
production family. Web favicons and the project icon are the bare leaf
with no tile (t3-fork 556:28871): assets/fork/n3-project-icon.svg is
the earlier 23-cell leaf (it did not follow the sidebar mark to 676:42956)
as integer cells with crispEdges, literal fills, and a #373737 outline, and the n3-web-favicon*
rasters (with apps/web/public copies) are rendered from it at an exact
multiple of its 23-cell grid, then downscaled; export-icons.ts leaves
them alone. Filenames still say n3-* for path stability. t3.json's
path). The brand mark is the sparkle (Figma OnHdu0r2mAwMEiC4s7Gvjv
39:4), one path drawn identically everywhere. The layered Icon Composer
projects in assets/fork/app-icon.icon and assets/fork/dev-app-icon.icon
are its app-icon source of truth: a white sparkle placed as in the no3y
app icon design (Figma 1qVCaK2XuosbVJtYqa3n0n 54:3507), about 56% of the
tile wide. Production is a black tile under that design's blurred glows,
rendered from Figma to Assets/background.png and layered as a flat image
(no glass) beneath the mark, since Icon Composer cannot draw SVG blur
filters; development keeps a solid orange tile so installed variants
remain distinguishable in the Dock. Glass is on for the mark layer as well
as the tile — the smooth shape takes the system treatment cleanly. Every
app-icon raster, including the Linux PNG, the Windows ICO, the 192/512
installable web icons and the apps/web/public apple-touch and icon copies,
is rendered from these projects by `node .fork/export-icons.ts` (macOS
only; `--check` reports stale files), so every packaged channel carries
the same artwork. The macOS Dock exports add only a transparent outer
canvas around the rendered artwork, matching the standard Mac icon
footprint. The local dev splash uses the orange family, while packaged
builds stamp the black production family. Web favicons and the project
icon are the bare sparkle in #00C26B with no tile, which stays legible at
16px: assets/fork/n3-project-icon.svg carries the same path, and the
n3-web-favicon* rasters (with apps/web/public copies) are rendered from it
as vectors at 16 and 32px; export-icons.ts leaves them alone. Filenames
still say n3-* for path stability. t3.json's
iconPath points at n3-project-icon.svg, never upstream's
assets/dev/blueprint-*. The apple-touch icons keep the tile because iOS
fills transparency with black.
Expand Down Expand Up @@ -477,7 +479,7 @@
- assets/fork/n3-windows.ico
- assets/fork/n3-dev-web-apple-touch-180.png
- assets/fork/n3-web-apple-touch-180.png
# Installable web icons (upstream #30420), from the 1024 masters.
# Installable web icons (upstream #30420), rendered by export-icons.ts.
- assets/fork/n3-web-icon-192x192.png
- assets/fork/n3-web-icon-512x512.png
- assets/fork/n3-dev-web-icon-192x192.png
Expand Down
17 changes: 11 additions & 6 deletions .fork/export-icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
* macOS platform so each one carries the system Liquid Glass tile; the Dock
* PNG pads the 1024 render onto a transparent 1272 canvas, the standard Mac
* icon footprint. `--check` renders into memory and fails on any stale file.
* Web favicons are not rendered here: they are the bare leaf from Figma
* (t3-fork 556:28871, assets/fork/n3-project-icon.svg), committed as rasters.
* Web favicons are not rendered here: they are the bare sparkle

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This carve-out is now the only brand raster with no regeneration path or --check coverage. It is the same gap this PR closes for 192/512. See point 1 in the review body: render n3-project-icon.svg at 16/32 here, encode the ICO with encodePngIco, and delete this paragraph.

* (assets/fork/n3-project-icon.svg) with no tile, committed as rasters.
*/

import * as NodeChildProcess from "node:child_process";
Expand Down Expand Up @@ -93,6 +93,8 @@ function variantOutputs(source: string, prefix: string): Map<string, Buffer> {
[`assets/fork/${prefix}-macos-1024.png`, macos],
[`assets/fork/${prefix}-macos-dock.png`, padToDockCanvas(macos)],
[`assets/fork/${prefix}-web-apple-touch-180.png`, render(source, 180)],
[`assets/fork/${prefix}-web-icon-192x192.png`, render(source, 192)],
[`assets/fork/${prefix}-web-icon-512x512.png`, render(source, 512)],
]);
}

Expand All @@ -110,10 +112,13 @@ try {
const development = variantOutputs("assets/fork/dev-app-icon.icon", "n3-dev");
for (const [path, contents] of development) outputs.set(path, contents);
// `vp run dev` serves apps/web/public, so it carries the development family.
outputs.set(
"apps/web/public/apple-touch-icon.png",
development.get("assets/fork/n3-dev-web-apple-touch-180.png")!,
);
for (const [target, source] of [
["apple-touch-icon.png", "n3-dev-web-apple-touch-180.png"],
["icon-192x192.png", "n3-dev-web-icon-192x192.png"],
["icon-512x512.png", "n3-dev-web-icon-512x512.png"],
] as const) {
outputs.set(`apps/web/public/${target}`, development.get(`assets/fork/${source}`)!);
}
} finally {
NodeFS.rmSync(workDir, { recursive: true, force: true });
}
Expand Down
Binary file modified apps/web/public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/web/public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/web/public/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/web/public/favicon.ico
Binary file not shown.
Binary file modified apps/web/public/icon-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/web/public/icon-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 27 additions & 38 deletions apps/web/src/__fork_guards__/forkAppIdentity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,13 @@ const SERVER_CONFIG = "apps/server/src/config.ts";
const BUILD_SCRIPT = "scripts/build-desktop-artifact.ts";
const FORK_RELEASE_WORKFLOW = ".github/workflows/fork-release.yml";

// Every 1-row rect inside a `<g fill>` group, expanded to "x,y" -> lowercase hex fill.
const cellFills = (svg: string) => {
const cells = new Map<string, string>();
let grouped = 0;
for (const [, fill = "", body = ""] of svg.matchAll(/<g fill="([^"]+)">([\s\S]*?)<\/g>/gu)) {
const hex = (/#[0-9a-f]{6}/iu.exec(fill)?.[0] ?? fill).toLowerCase();
for (const [, w, x, y] of body.matchAll(
/<rect height="1" width="(\d+)" x="(\d+)" y="(\d+)" \/>/gu,
)) {
grouped += 1;
for (let dx = 0; dx < Number(w); dx += 1) cells.set(`${Number(x) + dx},${y}`, hex);
}
}
expect(svg.match(/<rect\b/gu)?.length ?? 0).toBe(grouped);
return cells;
// The one drawn shape of a single-path SVG: its path data and lowercase fill.
const soleShape = (svg: string) => {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things make this guard weaker than it looks:

  • It uses a blocklist. It forbids rect|circle|ellipse|polygon|image|g but lets through line, polyline, use, text, mask and so on. The invariant is "this SVG is one <svg> holding one <path>", so assert that directly:
    expect([...svg.matchAll(/<([a-z]+)\b/giu)].map(([, tag]) => tag)).toEqual(["svg", "path"]);
  • It depends on attribute order. The d=…fill= regex only matches when d comes before fill. The two toHaveLength(1) checks then fail on a re-export that only reorders attributes, with a message that doesn't say why. Read each attribute separately from the one path tag, e.g. /\bd="([^"]+)"/ and /\bfill="([^"]+)"/.

The ?? "" fallbacks after a length assertion are dead code. With the allowlist above they can go.

expect(svg.match(/<(?:rect|circle|ellipse|polygon|image|g)\b/gu)).toBeNull();
expect(svg.match(/<path\b/gu)).toHaveLength(1);
const paths = [...svg.matchAll(/<path\b[^>]*\bd="([^"]+)"[^>]*\bfill="([^"]+)"/gu)];
expect(paths).toHaveLength(1);
return { d: paths[0]?.[1] ?? "", fill: paths[0]?.[2]?.toLowerCase() ?? "" };
};

describe("fork guard: fork-app-identity", () => {
Expand Down Expand Up @@ -182,7 +174,7 @@ describe("fork guard: fork-app-identity", () => {

// Dev (`vp run dev`) serves apps/web/public — the orange apple-touch family
// there, while packaged builds stamp the green production family above.
// Favicons are one flat Figma tile, so dev serves the production set.
// Favicons are the bare mark with no tile, so dev serves the production set.
for (const [source, target] of [
["assets/fork/n3-web-favicon.ico", "apps/web/public/favicon.ico"],
["assets/fork/n3-web-favicon-16x16.png", "apps/web/public/favicon-16x16.png"],
Expand Down Expand Up @@ -213,19 +205,29 @@ describe("fork guard: fork-app-identity", () => {
) as IconComposerProject;
expect(developmentIcon.fill?.solid).toBe("srgb:1.00000,0.41569,0.00000,1.00000");
for (const icon of [productionIcon, developmentIcon]) {
// The smooth sparkle takes the system glass on the mark itself.
expect(icon.groups[0]?.layers[0]).toMatchObject({
glass: false,
glass: true,
"image-name": "mark.svg",
});
expect(icon.groups[0]?.translucency?.enabled).toBe(true);
}
// Production is the Figma green tile; development stays a solid orange tile.
expect(productionIcon.fill?.solid).toBe("srgb:0.21569,0.77255,0.43922,1.00000");
expect(productionIcon.groups).toHaveLength(1);
// Production is a black tile under the Figma glows (no3y app icon, 54:3507), a flat image
// with no glass; development stays a solid orange tile.
expect(productionIcon.fill?.solid).toBe("srgb:0.00000,0.00000,0.00000,1.00000");
expect(productionIcon.groups).toHaveLength(2);
expect(productionIcon.groups[1]?.layers).toMatchObject([
{ glass: false, "image-name": "background.png" },
]);
expect(productionIcon.groups[1]?.translucency?.enabled).toBe(false);
expect(developmentIcon.groups).toHaveLength(1);

// One white sparkle, the same drawing as the project icon and favicons.
const mark = read("assets/fork/app-icon.icon/Assets/mark.svg");
expect(mark).toContain('viewBox="0 0 1024 1024"');
const markShape = soleShape(mark);
expect(markShape.fill).toBe("#ffffff");
expect(markShape.d).toBe(soleShape(read("assets/fork/n3-project-icon.svg")).d);
expect(
NodeFS.readFileSync(NodePath.join(repoRoot, "assets/fork/dev-app-icon.icon/Assets/mark.svg")),
).toEqual(
Expand All @@ -244,24 +246,11 @@ describe("fork guard: fork-app-identity", () => {

it("shows the fork's own icon beside this repo's project", () => {
expect(JSON.parse(read("t3.json")).iconPath).toBe("assets/fork/n3-project-icon.svg");
const icon = read("assets/fork/n3-project-icon.svg");
expect(icon).toContain('viewBox="0 0 23 23"');
// The bare 23-cell leaf (t3-fork 556:28871) with a #373737 outline and no
// backdrop. It keeps that drawing while the sidebar mark moved to Figma
// 676:42956; the web favicons are rendered from it, so they move together.
const icon23 = cellFills(icon);
expect(icon23.size).toBe(253);
expect([...new Set(icon23.values())].toSorted()).toEqual([
"#008755",
"#08b776",
"#26b846",
"#373737",
"#3aed62",
"#f95b1c",
"#fcb01a",
"#ff8f0c",
"#ffd233",
]);
// The bare sparkle in the tile's green with no backdrop; the web favicons
// are rendered from it, so they move together.
const icon = soleShape(read("assets/fork/n3-project-icon.svg"));
expect(icon.fill).toBe("#00c26b");
expect(icon.d).toMatch(/^M407\.129 346\.602C/u);

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prefix is the only thing tying the drawing to the Figma sparkle. Swapping the art in both files would pass as long as the first point stays M407.129 346.602. Either pin the whole d once, as a SPARKLE_PATH constant that both this assertion and the mark assertion compare against, or drop the prefix and say that only the cross-file equality is guarded. A first-point check is a half-measure that looks like a full pin.

});

it("keeps packaged state out of the shared ~/.t3 base directory", () => {
Expand Down
Binary file added assets/fork/app-icon.icon/Assets/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading