feat(cli): add telemetry#22
Conversation
|
✅ No new issues Reviewed by reactreview for commit 0b76f09. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 0b76f09 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Warning Review limit reached
Your plan currently allows 1 review/hour. Refill in 11 minutes and 12 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThis PR introduces anonymous usage telemetry to the Verno CLI using PostHog. A new analytics module manages environment-driven enablement, persistent anonymous ID generation, and event tracking. The CLI displays an opt-out notice at startup, and four core commands ( ChangesCLI Telemetry with PostHog
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cli/src/analytics.ts`:
- Around line 38-41: The code currently uses raw git user.email and user.name as
identifiable telemetry (variables email, name) and sets distinctId to the plain
email; change this to preserve anonymity by not sending plain PII: compute a
stable one-way hash (e.g., SHA-256) of the email and use that hash as distinctId
instead of the raw email, and do not include the plain email or name in the
returned telemetry payload (remove or set them to undefined). Update the block
that calls execSync(..., GIT_EXEC_OPTIONS) to still read git values for hashing
but ensure only the hashed value is emitted (referencing the variables email,
name, distinctId, and execSync) so telemetry remains anonymous.
In `@packages/cli/src/commands/create/index.ts`:
- Around line 146-156: The telemetry call to trackEvent is currently invoked
fire-and-forget; update the async flow to await the call (replace the void
trackEvent(...) invocation with await trackEvent(...)) so the promise is
resolved before proceeding and preserves ordering/reliability; ensure this
change is made where trackEvent is called with the payload (addons:
resolved.addons, frontend: resolved.frontend, linter: resolved.ultraciteLinter,
package_manager: resolved.packageManager, shadcn_preset: resolved.shadcnPreset,
skip_git: !resolved.doGit, skip_install: !resolved.doInstall, ui: resolved.ui)
inside the async function.
In `@packages/cli/src/commands/doctor/index.ts`:
- Around line 63-67: The telemetry trackEvent calls in runDoctor are being
invoked fire-and-forget; update the logic in runDoctor to await the promises
returned by trackEvent so the async function waits for delivery (e.g., replace
bare void trackEvent(...) with await trackEvent(...) or collect both promises
and await Promise.all([...]) for the two instrumentation calls referenced around
the first instance and the second at lines ~140-144); make sure to preserve
existing payloads (fix, issues_found, package_manager) and handle/propagate any
errors per project conventions.
In `@packages/cli/src/commands/init/index.ts`:
- Around line 153-160: The telemetry call currently silences the returned
promise with "void trackEvent(...)" inside runInit; change it to "await
trackEvent(...)" so the promise is awaited and errors propagate correctly, and
ensure the enclosing function (runInit) is declared async if it isn't already;
update the call site that references trackEvent to use await rather than void.
In `@packages/cli/src/commands/update/index.ts`:
- Around line 174-178: The telemetry call inside runUpdate is being invoked with
void (void trackEvent(...)) which drops the promise; change it to await
trackEvent(...) so the async telemetry send is awaited for reliability; update
the call site in the runUpdate function (where trackEvent("update_run", {...})
is invoked) to await the promise and ensure the enclosing function remains
async/await-friendly (no suppression with void) so errors can propagate or be
handled.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0ebee813-5580-4252-aef1-41dac999c7ac
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
.changeset/telemetry-and-cli-notice.mdpackages/cli/package.jsonpackages/cli/src/analytics.tspackages/cli/src/commands/create/index.tspackages/cli/src/commands/doctor/index.tspackages/cli/src/commands/init/index.tspackages/cli/src/commands/update/index.tspackages/cli/src/index.ts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Description
Add PostHog usage tracking for the main CLI flows and print a startup notice when telemetry is enabled.
Telemetry collects git identity (email and name from `git config`) when available, using it as the distinct ID in PostHog. When git is not configured, a persistent anonymous UUID stored at `~/.config/verno/anonymous-id` is used instead.
Related Issues
N/A
Checklist
Opt-out
Telemetry is opt-out via
DO_NOT_TRACK=1orVERNO_TELEMETRY_DISABLED=1.Additional Notes
N/A