feat(cli): add system metrics to telemetry and expand doctor command (#110)

* feat(cli): add system metrics to telemetry and expand doctor command

Enrich render telemetry with device/environment metadata (CPU, memory,
OS, Docker/CI/WSL detection) following patterns from Next.js and
Turborepo. Add speed_ratio (render time / composition duration),
per-frame capture timing, and resource usage to render events.

Expand the doctor command with CPU, memory, disk, /dev/shm, and
environment checks to help debug rendering issues on user machines.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(cli): invert speed_ratio to match experiment-framework convention

composition_duration / render_time — higher is better, >1 means faster
than realtime. Matches magic_edit.render.speed_ratio in experiment-framework.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(cli): wire errorMessage into render error telemetry

Address review feedback — the errorMessage field was declared in the
trackRenderError interface but never populated.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(cli): add render telemetry to embedded studio server

Track render_complete and render_error from the studio's render API
endpoint (hyperframes dev). Uses dynamic imports so telemetry is
resolved at call time within the CLI package — no telemetry coupling
added to @hyperframes/studio or @hyperframes/producer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
James Russo
2026-03-27 20:53:06 -07:00
committed by GitHub
co-authored by Claude Opus 4.6
parent ce63160907
commit 865843ba9a
7 changed files with 395 additions and 32 deletions
+12
View File
@@ -2,6 +2,7 @@ import { readConfig, writeConfig } from "./config.js";
import { VERSION } from "../version.js";
import { c } from "../ui/colors.js";
import { isDevMode } from "../utils/env.js";
import { getSystemMeta } from "./system.js";
// This is a public project API key — safe to embed in client-side code.
// It only allows writing events, not reading data.
@@ -66,6 +67,7 @@ export function shouldTrack(): boolean {
export function trackEvent(event: string, properties: EventProperties = {}): void {
if (!shouldTrack()) return;
const sys = getSystemMeta();
eventQueue.push({
event,
properties: {
@@ -74,6 +76,16 @@ export function trackEvent(event: string, properties: EventProperties = {}): voi
os: process.platform,
arch: process.arch,
node_version: process.version,
os_release: sys.os_release,
cpu_count: sys.cpu_count,
cpu_model: sys.cpu_model ?? undefined,
cpu_speed: sys.cpu_speed ?? undefined,
memory_total_mb: sys.memory_total_mb,
is_docker: sys.is_docker,
is_ci: sys.is_ci,
ci_name: sys.ci_name ?? undefined,
is_wsl: sys.is_wsl,
is_tty: sys.is_tty,
},
timestamp: new Date().toISOString(),
});