Files
openmotion/shared/install-attribution.ts
open-design-crew[bot] 756f623973 fix(studio): prevent overlapping model menu rows (#653)
* fix(studio): preserve intrinsic model menu row heights

* fix(ci): type installer events and schedule new root suites

---------

Co-authored-by: stevenguotj <stevenguotj@stevengotjdeMBP.lan>
2026-11-19 17:02:32 +08:00

22 lines
1.3 KiB
TypeScript

import path from 'node:path';
import { saveInstallationSource } from '../tracking/node.ts';
import { createAppTracking, closeTracking, trackingLocked, trackingPreference } from './tracking.ts';
async function recordInstallationEvent(directory: string, host: string, source: string | undefined, event: 'installation_started' | 'installation_result'): Promise<void> {
if (trackingLocked() || !trackingPreference(directory)) return;
await saveInstallationSource(path.join(directory, 'tracking'), source);
const tracking = await createAppTracking(directory, 'installer');
const hostProduct = (['codex', 'claude', 'deepseek', 'workbuddy'] as const).find(product => product === host) ?? 'other';
if (event === 'installation_result') tracking.track(event, { outcome: 'success', host_product: hostProduct });
else tracking.track(event, { host_product: hostProduct });
await closeTracking(tracking);
}
export async function recordInstallationStart(directory: string, host: string, source?: string): Promise<void> {
await recordInstallationEvent(directory, host, source, 'installation_started');
}
export async function recordInstallation(directory: string, host: string, source?: string): Promise<void> {
await recordInstallationEvent(directory, host, source, 'installation_result');
}