Add light optional telemetry#19
Conversation
PR SummaryMedium Risk Overview Introduces Updates the CLI entrypoint to initialize a Written by Cursor Bugbot for commit 538c30f. Configure here. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds end-to-end CLI telemetry via Amplitude: build flags and workflow changes to pass AMPLITUDE_KEY, a new tracking package and tests, CLI integration to initialize/record events, telemetry config commands, and config struct extension for telemetry control. Changes
Sequence DiagramsequenceDiagram
participant User as User
participant CLI as CLI Root
participant Config as Auth Config
participant Tracker as Tracker
participant Amplitude as Amplitude API
User->>CLI: run command
CLI->>CLI: record start time (PersistentPreRun)
CLI->>Config: load telemetry setting
CLI->>Tracker: New(cfg with amplitudeKey, enabled)
CLI->>CLI: execute command logic
alt success
CLI->>CLI: compute duration
CLI->>Tracker: Track(command_path, status=success, duration)
else error
CLI->>Tracker: Track(command_path, status=error, errorMsg, duration)
end
Tracker->>Amplitude: send "CLI Command Executed" event
Amplitude-->>Tracker: ack
CLI->>Tracker: Shutdown (flush)
CLI-->>User: return result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.5.0)Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Telemetry subcommands missing
skipAuthannotation require authentication- Added skipAuth annotation to all telemetry subcommands (telemetry, enable, disable, status) so they can run without API key authentication.
- ✅ Fixed:
dune authsilently resets user telemetry preference- Modified auth command to load existing config first and only update APIKey field, preserving the telemetry preference.
Or push these changes by commenting:
@cursor push 802e26ade7
Preview (802e26ade7)
diff --git a/cmd/auth/auth.go b/cmd/auth/auth.go
--- a/cmd/auth/auth.go
+++ b/cmd/auth/auth.go
@@ -40,7 +40,15 @@
return fmt.Errorf("no API key provided")
}
- if err := authconfig.Save(&authconfig.Config{APIKey: key}); err != nil {
+ cfg, err := authconfig.Load()
+ if err != nil {
+ return fmt.Errorf("loading config: %w", err)
+ }
+ if cfg == nil {
+ cfg = &authconfig.Config{}
+ }
+ cfg.APIKey = key
+ if err := authconfig.Save(cfg); err != nil {
return fmt.Errorf("saving config: %w", err)
}
diff --git a/cmd/config/telemetry.go b/cmd/config/telemetry.go
--- a/cmd/config/telemetry.go
+++ b/cmd/config/telemetry.go
@@ -10,8 +10,9 @@
func newTelemetryCmd() *cobra.Command {
cmd := &cobra.Command{
- Use: "telemetry",
- Short: "Manage anonymous usage telemetry",
+ Use: "telemetry",
+ Short: "Manage anonymous usage telemetry",
+ Annotations: map[string]string{"skipAuth": "true"},
}
cmd.AddCommand(
newTelemetryEnableCmd(),
@@ -23,8 +24,9 @@
func newTelemetryEnableCmd() *cobra.Command {
return &cobra.Command{
- Use: "enable",
- Short: "Enable anonymous usage telemetry",
+ Use: "enable",
+ Short: "Enable anonymous usage telemetry",
+ Annotations: map[string]string{"skipAuth": "true"},
RunE: func(cmd *cobra.Command, _ []string) error {
return setTelemetry(cmd, true)
},
@@ -33,8 +35,9 @@
func newTelemetryDisableCmd() *cobra.Command {
return &cobra.Command{
- Use: "disable",
- Short: "Disable anonymous usage telemetry",
+ Use: "disable",
+ Short: "Disable anonymous usage telemetry",
+ Annotations: map[string]string{"skipAuth": "true"},
RunE: func(cmd *cobra.Command, _ []string) error {
return setTelemetry(cmd, false)
},
@@ -43,8 +46,9 @@
func newTelemetryStatusCmd() *cobra.Command {
return &cobra.Command{
- Use: "status",
- Short: "Show current telemetry status",
+ Use: "status",
+ Short: "Show current telemetry status",
+ Annotations: map[string]string{"skipAuth": "true"},
RunE: func(cmd *cobra.Command, _ []string) error {
enabled := IsTelemetryEnabled()
if enabled {Comment @cursor review or bugbot run to trigger another review on this PR

CLI basic telemetry data, captured via amplitude sdk. Telemetry can be disabled.