-
feat(cli): stamp telemetry with journey_stage + cli_channel; tag installer origin (#3928)
发布于
2026-07-30 18:37:53 +00:00 Stacked on #3927 (A1 — direct-to-PostHog + install→Apollo identity).
Targets that branch; will auto-retarget tonextwhen #3927 merges.
Review only this diff.What
Makes every CLI event self-describe its funnel stage, so the adoption
funnel can be queried without string-matching event names — which is how
it silently broke in the first place.journey_stageon every event:install | setup | login | connect | execute | other. Declared as an exported typed const plus a single
exhaustive map,as const satisfies Record<CliAnalyticsEventName, CliJourneyStage>— so the compiler refuses to build if a future event
has no stage. No per-event literals; stamped in one shared builder.cli_channelalongsidecli_version, reusing the existing
inferSkillReleaseChannel()/CLI_RELEASE_CHANNELS. Makes "did this
fix reach stable users?" answerable — the question that went unanswered
in the 0.2.30 assetless-release incident.- Installer origin fix:
install.shran"$exe" installwithout
COMPOSIO_CLI_INVOCATION_ORIGIN=installer(thesetupcall on line 410
had it), so a genuine install was indistinguishable from a user running
composio installby hand. Now tagged, with a regression test that
readsinstall.shand asserts it.
Stage mapping (reviewed against 30d volume)
install=CLI_INSTALL_*·setup=CLI_SETUP_*+CLI_PLUGIN_*·
login=CLI_LOGIN_*·connect=CLI_LINK_*·execute=
CLI_EXECUTE_*+CLI_TOOL_INVOCATION_*·other=CLI_COMMAND_*,
CLI_SEARCH_*,CLI_PROXY_*,CLI_RUN_*,CLI_LOGOUT_*Judgment calls, made with data rather than by default:
proxy→other. 2,060 of 2,140 proxy users (96%) already
execute; only 80 are proxy-only. Reclassifying would move the activated
cohort ~1%, soexecutestays precisely "tool execution".run→other.runchildren emit their own execute events
carryingparent_run_id; staging the parent asexecutewould
double-count.search→other. Not a required funnel stage. Candidate for a
"discovery" step later if the flow page wants one.
Note for whoever builds the flow page
CLI_TOOL_INVOCATION_*andCLI_EXECUTE_FAILEDcan both fire for a
single failure, so theexecutestage double-counts at the event
level. Count distinct users per stage, not events.Known coverage limit
npm and Homebrew installs don't run
install.sh, so they emit no
CLI_INSTALL_*. Theinstallstage means "installed via install.sh",
not all installs.Verification
pnpm typecheckclean ·validate:boundariesOK (46 disables, zero
added) · CLI suite 107 files / 971 passed (+15 tests) ·
dispatch.tsidentity/transport untouched.🤖 Generated with Claude Code
下载附件