diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c938e0..96e33ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ Earlier entries pre-date this convention and only carry their version's compare ## [Unreleased] +### Added + +- Report `savedPreference`, `transportConfigured`, and `captureActive` in telemetry status output. `enabled` continues to reflect runtime opt-outs ([#76](https://github.com/AgoraIO/cli/pull/76)). + ### Changed - Rename the `project show --json` token debug status to `signalingTokenDebugEnabled` and remove the misleading token capability warning from `project doctor`. Update consumers of the old `tokenEnabled` result field. diff --git a/docs/automation.md b/docs/automation.md index 4a86a01..fd1ea6d 100644 --- a/docs/automation.md +++ b/docs/automation.md @@ -1183,6 +1183,20 @@ Safe branch fields by command shape: - Show/create/update: `projectId`, `feature`, `configId`, `enabled`, `eventIds`, `urlRegion` - Delete: `projectId`, `feature`, `configId`, `deleted` +### `telemetry status`, `telemetry enable`, `telemetry disable` + +The `telemetry` result reports these fields: + +- `action` identifies the operation as `status`, `enable`, or `disable`. +- `configPath` is the local configuration file path. +- `doNotTrack` indicates whether `DO_NOT_TRACK` is set to a non-empty value. +- `savedPreference` is the configured telemetry preference. +- `enabled` combines the preference and runtime opt-outs. +- `transportConfigured` indicates whether a valid collector URL is configured. +- `captureActive` requires both `enabled` and `transportConfigured`. + +The `agora.telemetry.status` MCP tool returns the same fields. + ### `config path` Example: diff --git a/docs/telemetry.md b/docs/telemetry.md index 0b03fc4..131281e 100644 --- a/docs/telemetry.md +++ b/docs/telemetry.md @@ -13,8 +13,8 @@ configuration are required before production capture is active. Events contain a random local installation ID, a per-operation ID, CLI version, OS/architecture, coarse AI-tool categories, public recipe/template IDs, timings and structured results. Project/init events can include validated Agora App IDs. -An installation profile can be created in PostHog; website identities are not -linked. OAuth tokens, App Certificates, project names, source code, conversation +An installation profile can be created in PostHog. Agora App IDs can be +associated with Agora projects and companies. OAuth tokens, App Certificates, project names, source code, conversation content, local paths and raw errors are not included. Recipe init attempts are labeled as Recipe usage even if the catalog lookup @@ -68,10 +68,16 @@ agora telemetry disable --json agora telemetry enable --json ``` -`enabled` reports the saved preference. `transportConfigured` reports whether a -valid collector URL is configured. `captureActive` combines the preference, -runtime opt-out and transport configuration; it does not confirm delivery. -A first-use disclosure is printed to stderr unless quiet mode suppresses it. +`savedPreference` reports the configured preference. `enabled` also accounts +for runtime opt-outs. `transportConfigured` reports whether a valid collector +URL is configured. `captureActive` requires both `enabled` and +`transportConfigured`. It tracks whether capture can start. + +Shell commands print a first-use disclosure to stderr unless quiet mode +suppresses it. MCP includes the disclosure in its initialization instructions +when a collector is configured. MCP hosts decide how to present instructions. +The disclosure provides notice. The first instrumented call can collect events +when capture is active. Any of these signals disables capture: diff --git a/internal/cli/analytics_test.go b/internal/cli/analytics_test.go index 2132d11..d940996 100644 --- a/internal/cli/analytics_test.go +++ b/internal/cli/analytics_test.go @@ -379,10 +379,10 @@ func TestAnalyticsProjectCreateFailureBeforeAPIIsReported(t *testing.T) { if err == nil { t.Fatal("fixture must fail before the create API call") } - events := waitAnalyticsEvents(t, read, 1) + waitAnalyticsEvents(t, read, 1) // Give a duplicate a chance to arrive before asserting exactly one. time.Sleep(50 * time.Millisecond) - events = read() + events := read() if len(events) != 1 { t.Fatalf("want exactly one event, got %+v", events) } diff --git a/internal/cli/env_help.go b/internal/cli/env_help.go index 9891f0e..bc9e21d 100644 --- a/internal/cli/env_help.go +++ b/internal/cli/env_help.go @@ -50,7 +50,7 @@ func agoraEnvCatalog() []agoraEnvVar { {Name: "AGORA_RECIPES_BASE_URL", Category: "endpoints", Description: "Override the versioned Agora recipes API base URL for staging and integration tests.", Default: "https://recipes.agora.io/api/v1"}, {Name: "AGORA_QUICKSTART_