@devries-cameron20 / t3code-1 / commits / e319735ed1
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Refactor commit hash resolution in About panel

- Remove git command execution for commit hash retrieval - Simplify commit hash resolution to use environment variable and embedded hash only - Clean up unused code in IPC handler registration

Julius Marminge committed Mar 2, 2026 at 18:21 UTC e319735ed1aedb5f117cd320511581e240f257d1
1 file changed +4 -23
apps/desktop/src/main.ts
+4 -23
@@ -1,4 +1,4 @@
1 -import { execFileSync, spawn, type ChildProcess } from "node:child_process";
1 +import { spawn, type ChildProcess } from "node:child_process";
2 import { randomBytes } from "node:crypto";
3 import fs from "node:fs";
4 import net from "node:net";
@@ -110,28 +110,13 @@ function resolveEmbeddedCommitHash(): string | null {
110 }
111 }
112
113 -function resolveGitCommitHash(): string | null {
114 - try {
115 - const stdout = execFileSync("git", ["rev-parse", `--short=${COMMIT_HASH_DISPLAY_LENGTH}`, "HEAD"], {
116 - cwd: ROOT_DIR,
117 - encoding: "utf8",
118 - stdio: ["ignore", "pipe", "ignore"],
119 - });
120 - return normalizeCommitHash(stdout);
121 - } catch {
122 - return null;
123 - }
124 -}
125 -
113 function resolveAboutCommitHash(): string | null {
114 if (aboutCommitHashCache !== undefined) {
115 return aboutCommitHashCache;
116 }
117
118 aboutCommitHashCache =
132 - normalizeCommitHash(process.env.T3CODE_COMMIT_HASH) ??
133 - resolveEmbeddedCommitHash() ??
134 - resolveGitCommitHash();
119 + normalizeCommitHash(process.env.T3CODE_COMMIT_HASH) ?? resolveEmbeddedCommitHash();
120
121 return aboutCommitHashCache;
122 }
@@ -483,11 +468,7 @@ function registerIpcHandlers(): void {
468 ipcMain.removeHandler(CONTEXT_MENU_CHANNEL);
469 ipcMain.handle(
470 CONTEXT_MENU_CHANNEL,
486 - async (
487 - _event,
488 - items: ContextMenuItem[],
489 - position?: { x: number; y: number },
490 - ) => {
471 + async (_event, items: ContextMenuItem[], position?: { x: number; y: number }) => {
472 const normalizedItems = items
473 .filter((item) => typeof item.id === "string" && typeof item.label === "string")
474 .map((item) => ({
@@ -538,7 +519,7 @@ function registerIpcHandlers(): void {
519 const menu = Menu.buildFromTemplate(template);
520 menu.popup({
521 window,
541 - ...(popupPosition ?? {}),
522 + ...popupPosition,
523 callback: () => resolve(null),
524 });
525 });