Skip to content

Commit 7a7c581

Browse files
BunsDevclaude
andcommitted
Centralize brand constants in @okcode/shared/brand
Create a single source of truth for the product name by introducing packages/shared/src/brand.ts with APP_BASE_NAME and GIT_IDENTITY_NAME. Re-export from apps/web/src/branding.ts and import in all workspace packages instead of hardcoding "OK Code" strings. - New: @okcode/shared/brand module with canonical constants - Web: branding.ts re-exports APP_BASE_NAME from shared package - Web: ChatHomeEmptyState uses APP_BASE_NAME instead of hardcoded string - Desktop: main.ts imports APP_BASE_NAME for display name construction - Desktop: electron-launcher.mjs extracts APP_BASE_NAME with sync comment - Server: CheckpointStore uses GIT_IDENTITY_NAME for git author/committer - Server: codexCliVersion uses APP_BASE_NAME in upgrade message - Scripts: build-desktop-artifact uses APP_BASE_NAME for product name fallback Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ec967d7 commit 7a7c581

File tree

9 files changed

+34
-9
lines changed

9 files changed

+34
-9
lines changed

apps/desktop/scripts/electron-launcher.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ import { dirname, join, resolve } from "node:path";
1717
import { fileURLToPath } from "node:url";
1818

1919
const isDevelopment = Boolean(process.env.VITE_DEV_SERVER_URL);
20-
const APP_DISPLAY_NAME = isDevelopment ? "OK Code (Dev)" : "OK Code";
20+
// Keep in sync with APP_BASE_NAME from @okcode/shared/brand
21+
const APP_BASE_NAME = "OK Code";
22+
const APP_DISPLAY_NAME = isDevelopment ? `${APP_BASE_NAME} (Dev)` : APP_BASE_NAME;
2123
const APP_BUNDLE_ID = "com.openknots.okcode";
2224
const LAUNCHER_VERSION = 1;
2325

apps/desktop/src/main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import type {
2626
PreviewTabsState,
2727
} from "@okcode/contracts";
2828
import { autoUpdater } from "electron-updater";
29+
import { APP_BASE_NAME } from "@okcode/shared/brand";
2930

3031
import type { ContextMenuItem } from "@okcode/contracts";
3132
import { NetService } from "@okcode/shared/Net";
@@ -79,7 +80,7 @@ const STATE_DIR = Path.join(BASE_DIR, "userdata");
7980
const DESKTOP_SCHEME = "okcode";
8081
const ROOT_DIR = Path.resolve(__dirname, "../../..");
8182
const isDevelopment = Boolean(process.env.VITE_DEV_SERVER_URL);
82-
const APP_DISPLAY_NAME = isDevelopment ? "OK Code (Dev)" : "OK Code";
83+
const APP_DISPLAY_NAME = isDevelopment ? `${APP_BASE_NAME} (Dev)` : APP_BASE_NAME;
8384
const APP_USER_MODEL_ID = "com.openknots.okcode";
8485
const USER_DATA_DIR_NAME = isDevelopment ? "okcode-dev" : "okcode";
8586
const LEGACY_USER_DATA_DIR_NAME = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Alpha)";

apps/server/src/checkpointing/Layers/CheckpointStore.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { GitCommandError } from "../../git/Errors.ts";
1818
import { GitCore } from "../../git/Services/GitCore.ts";
1919
import { CheckpointStore, type CheckpointStoreShape } from "../Services/CheckpointStore.ts";
2020
import { CheckpointRef } from "@okcode/contracts";
21+
import { GIT_IDENTITY_NAME } from "@okcode/shared/brand";
2122

2223
const makeCheckpointStore = Effect.gen(function* () {
2324
const fs = yield* FileSystem.FileSystem;
@@ -98,9 +99,9 @@ const makeCheckpointStore = Effect.gen(function* () {
9899
const commitEnv: NodeJS.ProcessEnv = {
99100
...process.env,
100101
GIT_INDEX_FILE: tempIndexPath,
101-
GIT_AUTHOR_NAME: "OK Code",
102+
GIT_AUTHOR_NAME: GIT_IDENTITY_NAME,
102103
GIT_AUTHOR_EMAIL: "okcode@users.noreply.github.com",
103-
GIT_COMMITTER_NAME: "OK Code",
104+
GIT_COMMITTER_NAME: GIT_IDENTITY_NAME,
104105
GIT_COMMITTER_EMAIL: "okcode@users.noreply.github.com",
105106
};
106107

apps/server/src/provider/codexCliVersion.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { APP_BASE_NAME } from "@okcode/shared/brand";
2+
13
const CODEX_VERSION_PATTERN = /\bv?(\d+\.\d+(?:\.\d+)?(?:-[0-9A-Za-z.-]+)?)\b/;
24

35
export const MINIMUM_CODEX_CLI_VERSION = "0.37.0";
@@ -137,5 +139,5 @@ export function isCodexCliVersionSupported(version: string): boolean {
137139

138140
export function formatCodexCliUpgradeMessage(version: string | null): string {
139141
const versionLabel = version ? `v${version}` : "the installed version";
140-
return `Codex CLI ${versionLabel} is too old for OK Code. Upgrade to v${MINIMUM_CODEX_CLI_VERSION} or newer and restart OK Code.`;
142+
return `Codex CLI ${versionLabel} is too old for ${APP_BASE_NAME}. Upgrade to v${MINIMUM_CODEX_CLI_VERSION} or newer and restart ${APP_BASE_NAME}.`;
141143
}

apps/web/src/branding.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
export const APP_BASE_NAME = "OK Code";
1+
export { APP_BASE_NAME } from "@okcode/shared/brand";
2+
23
export const APP_STAGE_LABEL = import.meta.env.DEV ? "Dev" : "";
34
export const APP_DISPLAY_NAME = APP_STAGE_LABEL
45
? `${APP_BASE_NAME} (${APP_STAGE_LABEL})`

apps/web/src/components/ChatHomeEmptyState.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
import { useCallback, useMemo, useState } from "react";
1616

1717
import { useAppSettings } from "../appSettings";
18-
import { APP_DISPLAY_NAME } from "../branding";
18+
import { APP_BASE_NAME, APP_DISPLAY_NAME } from "../branding";
1919
import { isElectron } from "../env";
2020
import { useHandleNewThread } from "../hooks/useHandleNewThread";
2121
import { serverConfigQueryOptions } from "../lib/serverReactQuery";
@@ -363,7 +363,7 @@ export function ChatHomeEmptyState() {
363363
Launch a premium coding workspace with reliable agent sessions built in.
364364
</h1>
365365
<p className="mt-5 max-w-2xl text-sm leading-7 text-muted-foreground sm:text-base">
366-
OK Code keeps threads tied to real repositories, preserves provider state,
366+
{APP_BASE_NAME} keeps threads tied to real repositories, preserves provider state,
367367
and gives your desktop a calmer control surface for deep, multi-session
368368
work.
369369
</p>

packages/shared/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
"./skillCatalog": {
4848
"types": "./src/skillCatalog.ts",
4949
"import": "./src/skillCatalog.ts"
50+
},
51+
"./brand": {
52+
"types": "./src/brand.ts",
53+
"import": "./src/brand.ts"
5054
}
5155
},
5256
"scripts": {

packages/shared/src/brand.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Canonical brand constants for the OK Code product.
3+
*
4+
* Import from `@okcode/shared/brand` in any workspace package.
5+
* The web app's `branding.ts` re-exports these with Vite-specific additions
6+
* (stage labels, build-time version injection).
7+
*/
8+
9+
/** Base product name — use for display text that should not include a stage label. */
10+
export const APP_BASE_NAME = "OK Code";
11+
12+
/** Git committer identity used by OK Code's internal operations (checkpoints, etc.). */
13+
export const GIT_IDENTITY_NAME = APP_BASE_NAME;

scripts/build-desktop-artifact.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import rootPackageJson from "../package.json" with { type: "json" };
88
import desktopPackageJson from "../apps/desktop/package.json" with { type: "json" };
99
import serverPackageJson from "../apps/server/package.json" with { type: "json" };
1010

11+
import { APP_BASE_NAME } from "@okcode/shared/brand";
1112
import { BRAND_ASSET_PATHS } from "./lib/brand-assets.ts";
1213
import { resolveCatalogDependencies } from "./lib/resolve-catalog.ts";
1314

@@ -736,7 +737,7 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
736737
build: yield* createBuildConfig(
737738
options.platform,
738739
options.target,
739-
desktopPackageJson.productName ?? "OK Code",
740+
desktopPackageJson.productName ?? APP_BASE_NAME,
740741
options.signed,
741742
options.signed && options.platform === "mac" ? macEntitlementsPlistAbsolutePath : undefined,
742743
),

0 commit comments

Comments
 (0)