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
84 changes: 65 additions & 19 deletions .fork/customizations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -583,43 +583,89 @@

- id: fork-brand-name
intent: >
Every web and desktop string a user reads names the app "no3y Code", the
same name fork-app-identity gives the installed app, and the fork still
says where it comes from. Upstream writes "T3 Code" inline in hundreds of
strings and adds more each sync, so the name is rewritten at build time
instead of in each file: one plugin (scripts/lib/fork-brand-name.ts) runs
in the web Vite build and dev server and in both desktop pack entries
(main, workers), and replaces "T3 Code" in script modules and index.html.
The web config leaves it out under Vitest so upstream tests keep
asserting upstream copy; desktop pack never runs under Vitest.
The whole keep-as-written policy is two lists in that file:
Every web, desktop and mobile string a user reads names the app "no3y
Code", the same name fork-app-identity gives the installed app, and the
fork still says where it comes from. Upstream writes "T3 Code" and bare
"T3 <word>" inline in hundreds of strings and adds more each sync, so the
name is rewritten at build time instead of in each file. The rewrite is
a rename-by-default rule in scripts/lib/fork-brand-name-core.ts: every
"T3 " that starts a word and precedes a letter becomes "no3y " ("T3 Code"
→ "no3y Code", "Started a T3 thread" → "Started a no3y thread"). The
t3_thread_* tool-row lookups key on the same rewritten labels, so they
keep matching. The core is import-free because two bundlers load it:
the Vite plugin (scripts/lib/fork-brand-name.ts) in the web build and dev
server and in both desktop pack entries (main, workers), and a Metro
Babel-transformer wrapper (apps/mobile/fork/forkBrandNameTransformer.cjs)
for mobile. The web config leaves it out under Vitest so upstream tests
keep asserting upstream copy; desktop pack and Metro never run under
Vitest.
The whole keep-as-written policy is two lists in the core:
PRESERVED_PHRASES (the fork's credit, prose about upstream, the Linux
capture extension's own name, upstream's registered "T3 Code for GitHub"
app, and the server-issued "T3 Code · <label>" peer session a revoke
prompt quotes) and EXCLUDED_MODULES (DesktopUserData's legacy profile
names and the dictation vocabulary). A string that must match something
outside this bundle (server text, an OS or third-party name) is added
there, never as a one-off elsewhere.
app, the server-issued peer session a revoke prompt quotes as "T3 Code ·
…", Ping's services and accounts — T3 Connect, T3 Chat, T3 Account —
and the T3 server and T3 home, whose names the client also matches in
server text such as "Unable to connect to the T3 server WebSocket") and
EXCLUDED_MODULES (DesktopUserData's legacy profile names). A string that
must match something outside this bundle (server text, an OS or
third-party name) is added there, never as a one-off elsewhere.
Decided, not incidental: the rewrite also renames the labels this client
sends when it pairs or links ("no3y Code Desktop", "no3y Code Web",
"no3y Code link"), so a host's Connections list names the fork's
clients; nothing compares those labels. Connection copy about software on
another host is renamed too, though a linked VPS may run upstream.
T3 Connect, the T3 server, and the t3 CLI keep their names.
Decided trade-off: GT looks translations up by a hash of the source
text, so a rewritten string misses its catalog entry and shows in
English in every other locale. The fork's copy is English-first; this
keeps the name right everywhere instead of translated.
Upstream's "T3" letter glyph (T3Wordmark), which marks the app's own tool
rows in the transcript and heads the standalone auth pages, is shadowed
with the no3y flower as currentColor line art: the outline cells of
assets/fork/n3-favicon.svg merged into row runs, the same path in the
web shadow, the mobile T3Wordmark and the widget T3Mark.svg (the guard
derives it from the favicon). The auth header spells "no3y Code" beside
it. Mobile also shows "no3y Code" in its header title, the no3y tile on
its loading screen (preview builds share the production tile), and
"no3y" as the widget's app name ("Open no3y"). Native copy that Expo
reads from the app config before Metro runs (permission prompts, widget
gallery descriptions) takes the same rename in fork/identity.ts's
no3yNativeConfig, limited by key to display fields so build inputs such
as file paths stay untouched, and the Android agent-notification status-bar icon is
the same flower path. The iOS widgets bundle
through expo-widgets' own Metro config, outside the rewrite, so their
fallback copy and their T3Mark.svg logo (the flower, centred in the 1.5:1
frame they draw it in) are edited in place.
Not bundled, so edited in place: public/manifest.webmanifest and the
macOS permission prompts (local network, screen capture, camera) in
build-desktop-artifact.ts, beside fork-local-dictation's microphone
prompt. Settings, About carries a row crediting T3 Code with a link to
the upstream repository, and the macOS About panel credits it.
Server-sent text and the mobile app are out of scope and still say
T3 Code.
Server-sent text (including agent-facing prompts and the relay's Live
Activity title, which the activity layout does not draw) is out of scope
and still says T3 Code.
tier: 4
files:
- scripts/lib/fork-brand-name-core.ts
- scripts/lib/fork-brand-name.ts
- apps/web/src/custom/ForkUpstreamCreditRow.tsx
shadows: []
- apps/mobile/fork/forkBrandNameTransformer.cjs
shadows:
- apps/web/src/components/T3Wordmark.tsx
watch:
- apps/web/vite.config.ts
- apps/web/src/components/ui/standalone-page.tsx
- apps/mobile/metro.config.js
- apps/mobile/src/components/T3Wordmark.tsx
- apps/mobile/src/components/CompactBrandTitle.tsx
- apps/mobile/src/components/brandAssets.ts
- apps/mobile/src/widgets/subscriptionUsageSnapshot.ts
# Widget layouts bundle through expo-widgets' own Metro config, outside the rename.
- apps/mobile/src/widgets/SubscriptionUsage.tsx
- apps/mobile/src/widgets/SubscriptionUsage.android.tsx
- apps/mobile/src/widgets/AgentActivityWidget.tsx
- apps/mobile/assets/widget/T3Mark.svg
- apps/mobile/modules/t3-agent-notifications/android/src/main/res/drawable/agent_activity_mark.xml
- apps/mobile/fork/identity.ts
- apps/desktop/vite.config.ts
- apps/web/public/manifest.webmanifest
- apps/web/src/components/settings/SettingsPanels.tsx
Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/assets/widget/T3Mark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions apps/mobile/fork/forkBrandNameTransformer.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Fork display-name rewrite for Metro — see .fork/customizations.yaml#fork-brand-name.
// The same rewrite the web and desktop builds run (scripts/lib/fork-brand-name-core.ts),
// applied to each app module's source before the Babel transformer it wraps sees it.
const NodeCrypto = require("node:crypto");
const NodeFS = require("node:fs");
const NodePath = require("node:path");

const brandNameSource = NodePath.resolve(__dirname, "../../../scripts/lib/fork-brand-name-core.ts");
const { isRebrandedModule, rewriteUpstreamDisplayName } = require(brandNameSource);
Comment thread
NoahHendrickson marked this conversation as resolved.
Resolved
// metro.config.js sets this: workers receive only this file's path, never a closure, so the
// transformer it wraps (Expo's, plus whatever Uniwind layers on) can only arrive this way.
const upstreamPath = process.env.NO3Y_UPSTREAM_BABEL_TRANSFORMER;
if (!upstreamPath) {
throw new Error("NO3Y_UPSTREAM_BABEL_TRANSFORMER is unset; load this through metro.config.js.");
}
const upstream = require(upstreamPath);

module.exports = {
...upstream,
transform(props) {
const src = isRebrandedModule(props.filename)
Comment thread
NoahHendrickson marked this conversation as resolved.
Resolved
? (rewriteUpstreamDisplayName(props.src) ?? props.src)
: props.src;
return upstream.transform(src === props.src ? props : { ...props, src });
Comment thread
NoahHendrickson marked this conversation as resolved.
Resolved
},
// Metro hashes this file in place of the transformer it wraps, and neither one's imports.
getCacheKey(options) {
const sources = NodeCrypto.createHash("sha1")
.update(NodeFS.readFileSync(brandNameSource))
.update(NodeFS.readFileSync(require.resolve(upstreamPath)))
.digest("hex");
return `${upstream.getCacheKey?.(options) ?? ""}:${sources}`;
},
};
13 changes: 13 additions & 0 deletions apps/mobile/fork/identity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ vi.mock("../../../scripts/lib/public-config.ts", () => ({
loadRepoEnv: () => ({
APP_VARIANT: process.env.APP_VARIANT,
NO3Y_MOBILE_IDENTITY: process.env.NO3Y_MOBILE_IDENTITY,
T3CODE_ANDROID_GOOGLE_SERVICES_FILE: process.env.T3CODE_ANDROID_GOOGLE_SERVICES_FILE,
}),
}));

Expand Down Expand Up @@ -53,6 +54,18 @@ it.each([
dark: { image: "./fork/assets/no3y-splash-sparkle.png", backgroundColor: "#191817" },
});
expect(config.extra?.eas?.projectId).toBeUndefined();
// Native permission copy is read before Metro's rename runs.
expect(config.ios?.infoPlist?.NSLocalNetworkUsageDescription).toBe(
"Allow no3y Code to connect to no3y Code servers on your local network or tailnet.",
);
expect(pluginOptions(config, "expo-camera")?.cameraPermission).toMatch(/^Allow no3y Code /u);
expect(JSON.stringify(config)).not.toMatch(/\bT3 Code\b/u);
});

it("renames only display copy, never build inputs such as file paths", async () => {
vi.stubEnv("T3CODE_ANDROID_GOOGLE_SERVICES_FILE", "/tmp/T3 Code/google-services.json");
const config = await loadConfig("production", undefined);
expect(config.android?.googleServicesFile).toBe("/tmp/T3 Code/google-services.json");
});

it("builds upstream's identity with NO3Y_MOBILE_IDENTITY=0", async () => {
Expand Down
28 changes: 27 additions & 1 deletion apps/mobile/fork/identity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/** Fork-owned — see `.fork/customizations.yaml#no3y-mobile-identity`. */
import type { ExpoConfig } from "expo/config";

import { rewriteUpstreamDisplayName } from "../../../scripts/lib/fork-brand-name-core.ts";
import { NO3Y_APPLE_TEAM_ID, NO3Y_BUNDLE_IDENTIFIER } from "./no3yConstants.ts";

type AppVariant = "development" | "preview" | "production";
Expand Down Expand Up @@ -108,5 +109,30 @@ export function no3yNativeConfig(config: ExpoConfig, env: RepoEnv): ExpoConfig {
extra: { ...config.extra, eas: { observe: config.extra?.eas?.observe } },
};
delete next.owner;
return next;
return withForkBrandName(next);
}

// Native copy (permission prompts, widget gallery descriptions) is read from this config before
// Metro runs, so it takes the same rename here — see .fork/customizations.yaml#fork-brand-name.
// Only display fields, picked by key: other strings are build inputs such as file paths.
const DISPLAY_COPY_KEY = /(?:UsageDescription|Permission|^description)$/u;

function withForkBrandName<T>(value: T, key = ""): T {
if (typeof value === "string") {
return DISPLAY_COPY_KEY.test(key) ? ((rewriteUpstreamDisplayName(value) ?? value) as T) : value;
}
if (Array.isArray(value)) return value.map((entry) => withForkBrandName(entry)) as T;
if (
value === null ||
typeof value !== "object" ||
Object.getPrototypeOf(value) !== Object.prototype
) {
return value;
}
return Object.fromEntries(
Object.entries(value).map(([entryKey, entry]) => [
entryKey,
withForkBrandName(entry, entryKey),
]),
) as T;
}
13 changes: 13 additions & 0 deletions apps/mobile/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,16 @@ module.exports = Promise.all([generateMobileThirdPartyLicenses(), prepareStreamS
polyfills: { rem: 14 },
}),
);

/* fork:begin fork-brand-name — see .fork/customizations.yaml#fork-brand-name */
// Metro hands workers only the transformer's path, so the one it wraps travels in the environment,
// which workers inherit.
module.exports = module.exports.then((finalConfig) => {
const wrapper = require.resolve("./fork/forkBrandNameTransformer.cjs");
if (finalConfig.transformer.babelTransformerPath !== wrapper) {
process.env.NO3Y_UPSTREAM_BABEL_TRANSFORMER = finalConfig.transformer.babelTransformerPath;
finalConfig.transformer.babelTransformerPath = wrapper;
}
return finalConfig;
});
/* fork:end fork-brand-name */
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!-- The T3 mark, full bleed, so it renders as large as other apps' status bar icons. -->
<!-- fork:begin fork-brand-name — see .fork/customizations.yaml#fork-brand-name -->
<!-- The no3y flower's outline cells, full bleed, so it renders as large as other apps' status bar icons. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:height="24dp"
android:viewportWidth="120" android:viewportHeight="120">
<group android:translateX="-2.5" android:translateY="-6">
<path android:fillColor="#FFFFFFFF"
android:pathData="M33.4509,93V47.56H15.5309V37H64.3309V47.56H46.4109V93H33.4509ZM86.7253,93.96C82.832,93.96 78.9653,93.4533 75.1253,92.44C71.2853,91.3733 68.032,89.88 65.3653,87.96L70.4053,78.04C72.5386,79.5867 75.0186,80.8133 77.8453,81.72C80.672,82.6267 83.5253,83.08 86.4053,83.08C89.6586,83.08 92.2186,82.44 94.0853,81.16C95.952,79.88 96.8853,78.12 96.8853,75.88C96.8853,73.7467 96.0586,72.0667 94.4053,70.84C92.752,69.6133 90.0853,69 86.4053,69H80.4853V60.44L96.0853,42.76L97.5253,47.4H68.1653V37H107.365V45.4L91.8453,63.08L85.2853,59.32H89.0453C95.9253,59.32 101.125,60.8667 104.645,63.96C108.165,67.0533 109.925,71.0267 109.925,75.88C109.925,79.0267 109.099,81.9867 107.445,84.76C105.792,87.48 103.259,89.6933 99.8453,91.4C96.432,93.1067 92.0586,93.96 86.7253,93.96Z" />
</group>
android:viewportWidth="15" android:viewportHeight="15">
<path android:fillColor="#FFFFFFFF"
android:pathData="M6 0h3v1h-3zM5 1h1v1h-1zM7 1h1v1h-1zM9 1h1v1h-1zM4 2h1v1h-1zM7 2h1v1h-1zM10 2h1v1h-1zM4 3h2v1h-2zM7 3h1v1h-1zM9 3h2v1h-2zM2 4h7v1h-7zM10 4h3v1h-3zM1 5h1v1h-1zM4 5h1v1h-1zM7 5h1v1h-1zM10 5h2v1h-2zM13 5h1v1h-1zM0 6h1v1h-1zM5 6h1v1h-1zM8 6h1v1h-1zM10 6h1v1h-1zM14 6h1v1h-1zM0 7h15v1h-15zM0 8h1v1h-1zM5 8h1v1h-1zM8 8h1v1h-1zM10 8h1v1h-1zM14 8h1v1h-1zM1 9h1v1h-1zM4 9h1v1h-1zM7 9h1v1h-1zM11 9h1v1h-1zM13 9h1v1h-1zM2 10h11v1h-11zM4 11h2v1h-2zM7 11h1v1h-1zM9 11h2v1h-2zM4 12h1v1h-1zM7 12h1v1h-1zM10 12h1v1h-1zM5 13h1v1h-1zM7 13h1v1h-1zM9 13h1v1h-1zM6 14h3v1h-3z" />
</vector>
<!-- fork:end fork-brand-name -->
5 changes: 4 additions & 1 deletion apps/mobile/src/components/CompactBrandTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import { resolveMobileStageLabel } from "../lib/mobileBranding";
import { useAndroidControlSizing } from "./ui/useAndroidControlSizing";

const BRAND_MAX_FONT_SCALE = 1.4;
const WORDMARK_SUFFIX = "Code";
/* fork:begin fork-brand-name — see .fork/customizations.yaml#fork-brand-name */
// The glyph is the no3y flower, not letters, so the name is spelled out beside it.
const WORDMARK_SUFFIX = "no3y Code";
/* fork:end fork-brand-name */

export function brandTitleOffset(): number {
if (Platform.OS !== "ios") return 0;
Expand Down
13 changes: 8 additions & 5 deletions apps/mobile/src/components/T3Wordmark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,23 @@ export function T3Wordmark(props: {
readonly color?: ColorValue;
readonly colorClassName?: string;
}) {
const aspectRatio = 94.3941 / 56.96;
/* fork:begin fork-brand-name — see .fork/customizations.yaml#fork-brand-name */
// The no3y flower as line art in place of upstream's "T3" letters: the outline cells of
// assets/fork/n3-favicon.svg merged into row runs, so touching cells leave no seams.
return (
<Svg
accessibilityLabel="T3"
accessibilityLabel="no3y"
height={props.height}
width={props.height * aspectRatio}
viewBox="15.5309 37 94.3941 56.96"
width={props.height}
viewBox="-0.5 -0.5 16 16"
>
<ThemedPath
Comment thread
NoahHendrickson marked this conversation as resolved.
Resolved
d="M33.4509 93V47.56H15.5309V37H64.3309V47.56H46.4109V93H33.4509ZM86.7253 93.96C82.832 93.96 78.9653 93.4533 75.1253 92.44C71.2853 91.3733 68.032 89.88 65.3653 87.96L70.4053 78.04C72.5386 79.5867 75.0186 80.8133 77.8453 81.72C80.672 82.6267 83.5253 83.08 86.4053 83.08C89.6586 83.08 92.2186 82.44 94.0853 81.16C95.952 79.88 96.8853 78.12 96.8853 75.88C96.8853 73.7467 96.0586 72.0667 94.4053 70.84C92.752 69.6133 90.0853 69 86.4053 69H80.4853V60.44L96.0853 42.76L97.5253 47.4H68.1653V37H107.365V45.4L91.8453 63.08L85.2853 59.32H89.0453C95.9253 59.32 101.125 60.8667 104.645 63.96C108.165 67.0533 109.925 71.0267 109.925 75.88C109.925 79.0267 109.099 81.9867 107.445 84.76C105.792 87.48 103.259 89.6933 99.8453 91.4C96.432 93.1067 92.0586 93.96 86.7253 93.96Z"
d="M6 0h3v1h-3zM5 1h1v1h-1zM7 1h1v1h-1zM9 1h1v1h-1zM4 2h1v1h-1zM7 2h1v1h-1zM10 2h1v1h-1zM4 3h2v1h-2zM7 3h1v1h-1zM9 3h2v1h-2zM2 4h7v1h-7zM10 4h3v1h-3zM1 5h1v1h-1zM4 5h1v1h-1zM7 5h1v1h-1zM10 5h2v1h-2zM13 5h1v1h-1zM0 6h1v1h-1zM5 6h1v1h-1zM8 6h1v1h-1zM10 6h1v1h-1zM14 6h1v1h-1zM0 7h15v1h-15zM0 8h1v1h-1zM5 8h1v1h-1zM8 8h1v1h-1zM10 8h1v1h-1zM14 8h1v1h-1zM1 9h1v1h-1zM4 9h1v1h-1zM7 9h1v1h-1zM11 9h1v1h-1zM13 9h1v1h-1zM2 10h11v1h-11zM4 11h2v1h-2zM7 11h1v1h-1zM9 11h2v1h-2zM4 12h1v1h-1zM7 12h1v1h-1zM10 12h1v1h-1zM5 13h1v1h-1zM7 13h1v1h-1zM9 13h1v1h-1zM6 14h3v1h-3z"
color={props.color}
colorClassName={props.colorClassName}
fill="currentColor"
/>
</Svg>
);
/* fork:end fork-brand-name */
}
10 changes: 6 additions & 4 deletions apps/mobile/src/components/brandAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import Constants from "expo-constants";

const appVariant = Constants.expoConfig?.extra?.appVariant;

/* fork:begin fork-brand-name — see .fork/customizations.yaml#fork-brand-name */
// The no3y flower tile, orange for development like the installed dev app. Preview builds share
// the production tile; the fork ships no nightly art, and the badge beside it names the stage.
export const T3_CODE_BRAND_MARK_SOURCE =
appVariant === "development"
? require("../../../../assets/dev/blueprint-ios-1024.png")
: appVariant === "preview"
? require("../../../../assets/nightly/nightly-ios-1024.png")
: require("../../../../assets/prod/black-ios-1024.png");
? require("../../../../assets/fork/n3-dev-web-apple-touch-180.png")
: require("../../../../assets/fork/n3-web-apple-touch-180.png");
/* fork:end fork-brand-name */
Comment thread
NoahHendrickson marked this conversation as resolved.
Resolved
Loading
Loading