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) <noreply@anthropic.com>
This commit is contained in:
James
2026-03-25 23:13:12 +00:00
co-authored by Claude Opus 4.6
parent dd586f4705
commit 6c88c56cd2
2 changed files with 13 additions and 6 deletions
+4 -1
View File
@@ -44,7 +44,10 @@ const main = defineCommand({
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
const commandArg = process.argv[2]; 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"; const command = commandArg && commandArg in subCommands ? commandArg : "unknown";
if (command !== "telemetry" && command !== "unknown" && !isHelpOrVersion) { if (command !== "telemetry" && command !== "unknown" && !isHelpOrVersion) {
+9 -5
View File
@@ -50,7 +50,7 @@ export function shouldTrack(): boolean {
} }
// Placeholder API key means it hasn't been configured yet // 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; telemetryEnabled = false;
return 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. // Spawn a detached process to send the request so we don't block exit.
// The subprocess inherits nothing and runs independently. // The subprocess inherits nothing and runs independently.
const { execFileSync } = require("node:child_process") as typeof import("node:child_process"); const { execFileSync } = require("node:child_process") as typeof import("node:child_process");
execFileSync(process.execPath, [ execFileSync(
"-e", process.execPath,
`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 }); "-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 { } catch {
// Silently ignore // Silently ignore
} }