Skip to content

feat: wire PostHog telemetry into CLI lifecycle#141

Merged
rhuanbarreto merged 3 commits into
mainfrom
feat/enable-posthog-telemetry
Mar 22, 2026
Merged

feat: wire PostHog telemetry into CLI lifecycle#141
rhuanbarreto merged 3 commits into
mainfrom
feat/enable-posthog-telemetry

Conversation

@rhuanbarreto

Copy link
Copy Markdown
Contributor

Summary

  • Set the real PostHog API key (replacing phc_placeholder)
  • Call initTelemetry() at CLI startup alongside Sentry
  • Track command invocations (command_executed) via preAction hook
  • Track command completions (command_completed) with exit code and duration via postAction hook
  • Flush telemetry events before exit (parallel with Sentry flush, including error path)

Test plan

  • bun run validate passes (lint, typecheck, format, 499 tests, 22 ADR rules, build)
  • Run a CLI command and verify events appear in PostHog dashboard
  • Run with ARCHGATE_TELEMETRY=0 and verify no events are sent

Connect the existing telemetry module to the CLI entry point so
analytics events are actually captured. Sets the real PostHog API
key, initializes telemetry at startup, tracks command invocations
and completions (with duration), and flushes events before exit.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Mar 22, 2026

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: e3c075f
Status: ✅  Deploy successful!
Preview URL: https://c0105b57.archgate-cli.pages.dev
Branch Preview URL: https://feat-enable-posthog-telemetr.archgate-cli.pages.dev

View logs

The auth tests were setting process.env.HOME which doesn't affect
Bun.env on Windows. Since internalPath() reads Bun.env.HOME, the
tests were hitting the real ~/.archgate/ directory on Windows CI,
causing credential store hangs and wrong file reads.
@rhuanbarreto rhuanbarreto merged commit 292ff58 into main Mar 22, 2026
7 of 8 checks passed
@rhuanbarreto rhuanbarreto deleted the feat/enable-posthog-telemetry branch March 22, 2026 22:58
@github-actions github-actions Bot mentioned this pull request Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant