From 6c88c56cd2f244b9b7837d534a4ceee689d6716f Mon Sep 17 00:00:00 2001 From: James Date: Wed, 25 Mar 2026 23:13:12 +0000 Subject: [PATCH] fix(cli): fix CI format and typecheck failures - Run oxfmt on cli.ts and client.ts - Replace literal placeholder comparison with phc_ prefix check (TS2367: comparing two different string literals has no overlap) Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/cli/src/cli.ts | 5 ++++- packages/cli/src/telemetry/client.ts | 14 +++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index 2364038cb..9bf182aed 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -44,7 +44,10 @@ const main = defineCommand({ // --------------------------------------------------------------------------- const commandArg = process.argv[2]; -const isHelpOrVersion = process.argv.includes("--help") || process.argv.includes("--version") || process.argv.includes("-h"); +const isHelpOrVersion = + process.argv.includes("--help") || + process.argv.includes("--version") || + process.argv.includes("-h"); const command = commandArg && commandArg in subCommands ? commandArg : "unknown"; if (command !== "telemetry" && command !== "unknown" && !isHelpOrVersion) { diff --git a/packages/cli/src/telemetry/client.ts b/packages/cli/src/telemetry/client.ts index 8a5d1e975..370b35d6d 100644 --- a/packages/cli/src/telemetry/client.ts +++ b/packages/cli/src/telemetry/client.ts @@ -50,7 +50,7 @@ export function shouldTrack(): boolean { } // Placeholder API key means it hasn't been configured yet - if (POSTHOG_API_KEY === "__POSTHOG_API_KEY__") { + if (!POSTHOG_API_KEY.startsWith("phc_")) { telemetryEnabled = false; return false; } @@ -139,10 +139,14 @@ export function flushSync(): void { // Spawn a detached process to send the request so we don't block exit. // The subprocess inherits nothing and runs independently. const { execFileSync } = require("node:child_process") as typeof import("node:child_process"); - execFileSync(process.execPath, [ - "-e", - `fetch(${JSON.stringify(`${POSTHOG_HOST}/batch/`)},{method:"POST",headers:{"Content-Type":"application/json"},body:${JSON.stringify(payload)},signal:AbortSignal.timeout(${FLUSH_TIMEOUT_MS})}).catch(()=>{})`, - ], { stdio: "ignore", timeout: FLUSH_TIMEOUT_MS }); + execFileSync( + process.execPath, + [ + "-e", + `fetch(${JSON.stringify(`${POSTHOG_HOST}/batch/`)},{method:"POST",headers:{"Content-Type":"application/json"},body:${JSON.stringify(payload)},signal:AbortSignal.timeout(${FLUSH_TIMEOUT_MS})}).catch(()=>{})`, + ], + { stdio: "ignore", timeout: FLUSH_TIMEOUT_MS }, + ); } catch { // Silently ignore }