fix(install): isolate installer telemetry failures
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
+52
-20
@@ -65,8 +65,16 @@ export async function runCliInstaller(args: InstallArgs, version: string): Promi
|
||||
const unsupportedVersionMessage = getUnsupportedOpenCodeVersionMessage(openCodeVersion)
|
||||
if (unsupportedVersionMessage) {
|
||||
printWarning(unsupportedVersionMessage)
|
||||
posthog.capture({ distinctId, event: "install_failed", properties: { command: "install", reason: "unsupported_opencode_version", is_update: isUpdate } })
|
||||
await posthog.shutdown()
|
||||
try {
|
||||
posthog.capture({ distinctId, event: "install_failed", properties: { command: "install", reason: "unsupported_opencode_version", is_update: isUpdate } })
|
||||
} catch {
|
||||
// telemetry failure is non-fatal, silently ignore
|
||||
}
|
||||
try {
|
||||
await posthog.shutdown()
|
||||
} catch {
|
||||
// telemetry failure is non-fatal, silently ignore
|
||||
}
|
||||
return 1
|
||||
}
|
||||
}
|
||||
@@ -82,8 +90,16 @@ export async function runCliInstaller(args: InstallArgs, version: string): Promi
|
||||
const pluginResult = await addPluginToOpenCodeConfig(version)
|
||||
if (!pluginResult.success) {
|
||||
printError(`Failed: ${pluginResult.error}`)
|
||||
posthog.capture({ distinctId, event: "install_failed", properties: { command: "install", reason: "plugin_config_write_failed", is_update: isUpdate } })
|
||||
await posthog.shutdown()
|
||||
try {
|
||||
posthog.capture({ distinctId, event: "install_failed", properties: { command: "install", reason: "plugin_config_write_failed", is_update: isUpdate } })
|
||||
} catch {
|
||||
// telemetry failure is non-fatal, silently ignore
|
||||
}
|
||||
try {
|
||||
await posthog.shutdown()
|
||||
} catch {
|
||||
// telemetry failure is non-fatal, silently ignore
|
||||
}
|
||||
return 1
|
||||
}
|
||||
printSuccess(
|
||||
@@ -94,8 +110,16 @@ export async function runCliInstaller(args: InstallArgs, version: string): Promi
|
||||
const omoResult = writeOmoConfig(config)
|
||||
if (!omoResult.success) {
|
||||
printError(`Failed: ${omoResult.error}`)
|
||||
posthog.capture({ distinctId, event: "install_failed", properties: { command: "install", reason: "omo_config_write_failed", is_update: isUpdate } })
|
||||
await posthog.shutdown()
|
||||
try {
|
||||
posthog.capture({ distinctId, event: "install_failed", properties: { command: "install", reason: "omo_config_write_failed", is_update: isUpdate } })
|
||||
} catch {
|
||||
// telemetry failure is non-fatal, silently ignore
|
||||
}
|
||||
try {
|
||||
await posthog.shutdown()
|
||||
} catch {
|
||||
// telemetry failure is non-fatal, silently ignore
|
||||
}
|
||||
return 1
|
||||
}
|
||||
printSuccess(`Config written ${SYMBOLS.arrow} ${color.dim(omoResult.configPath)}`)
|
||||
@@ -144,20 +168,28 @@ export async function runCliInstaller(args: InstallArgs, version: string): Promi
|
||||
console.log(color.dim("oMoMoMoMo... Enjoy!"))
|
||||
console.log()
|
||||
|
||||
posthog.capture({
|
||||
distinctId,
|
||||
event: "install_completed",
|
||||
properties: {
|
||||
command: "install",
|
||||
is_update: isUpdate,
|
||||
has_claude: config.hasClaude,
|
||||
has_openai: config.hasOpenAI,
|
||||
has_gemini: config.hasGemini,
|
||||
has_copilot: config.hasCopilot,
|
||||
has_opencode_zen: config.hasOpencodeZen,
|
||||
},
|
||||
})
|
||||
await posthog.shutdown()
|
||||
try {
|
||||
posthog.capture({
|
||||
distinctId,
|
||||
event: "install_completed",
|
||||
properties: {
|
||||
command: "install",
|
||||
is_update: isUpdate,
|
||||
has_claude: config.hasClaude,
|
||||
has_openai: config.hasOpenAI,
|
||||
has_gemini: config.hasGemini,
|
||||
has_copilot: config.hasCopilot,
|
||||
has_opencode_zen: config.hasOpencodeZen,
|
||||
},
|
||||
})
|
||||
} catch {
|
||||
// telemetry failure is non-fatal, silently ignore
|
||||
}
|
||||
try {
|
||||
await posthog.shutdown()
|
||||
} catch {
|
||||
// telemetry failure is non-fatal, silently ignore
|
||||
}
|
||||
|
||||
if ((config.hasClaude || config.hasGemini || config.hasCopilot) && !args.skipAuth) {
|
||||
printBox(
|
||||
|
||||
Reference in New Issue
Block a user