feat(analytics): add PostHog analytics for CLI command tracking#293
Open
feat(analytics): add PostHog analytics for CLI command tracking#293
Conversation
Add comprehensive, privacy-conscious analytics using PostHog that captures every command invocation with args, flags, execution context, and system info. Users are prompted to opt in during login, with preference stored in personal_settings.json. Tracked properties include: command path, duration, success/failure, OS/arch, CLI version, TTY/pipe detection, CI/SSH detection, shell, locale, timezone, GPU info, parent process, and cwd.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PersistentPostRunEon the root commandbrev login, with preference persisted in~/.brev/personal_settings.jsonposthog.Aliaslinks anonymous and real user IDsTracked Properties
command,args,flagssucceeded,duration_mscli_version,go_versionos,arch,num_cpusruntimepackagecwdos.Getwd()is_tty,is_stdin_pipedshell,terminal$SHELL,$TERMis_ciCI,GITHUB_ACTIONS,GITLAB_CI, etc.is_ssh$SSH_TTY,$SSH_CONNECTIONlocale,timezone$LANG/time.Now().Zone()gpu_infonvidia-smiorsystem_profileron macOSparent_process,parent_cmdlineTest plan
go buildcompiles successfullybrev login— should prompt for analytics preference after auth~/.brev/personal_settings.jsonhasanalytics_enabledandanalytics_idbrev ls— if opted in,cli_commandevent should appear in PostHogbrev loginagain — should NOT re-prompt (preference already set)succeeded: false