refactor(cli): address review findings in telemetry code

- Extract shared isDevMode() to utils/env.ts (was duplicated in dev.ts and client.ts)
- Use ui/colors.ts instead of raw ANSI escapes in telemetry notice (respects NO_COLOR)
- Derive known commands from subCommands object instead of maintaining duplicate set
- Skip telemetry on --help/--version and unknown commands
- Gate incrementCommandCount() behind shouldTrack() (no disk writes in CI)
- Add flushSync() for process.exit() paths (beforeExit doesn't fire on explicit exit)
- Remove dead trackBrowserInstall(success) param (failure path never called it)
- Remove redundant isEnabled/anonymousId caching in client.ts (config.ts cache suffices)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
James
2026-03-25 23:02:33 +00:00
co-authored by Claude Opus 4.6
parent b7c75b814c
commit 6e530bc2dd
7 changed files with 121 additions and 122 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ async function runEnsure(): Promise<void> {
});
downloadSpinner.stop(c.success("Download complete"));
trackBrowserInstall(true);
trackBrowserInstall();
console.log();
console.log(` ${c.dim("Source:")} ${c.bold(result.source)}`);