Skip to content

Add global telemetry disable option #362

@stack72

Description

@stack72

Problem

Currently, users must pass --no-telemetry on every single command invocation to disable telemetry. This is cumbersome for users who want to permanently opt out of telemetry collection.

Proposed Solution

Add support for globally disabling telemetry through multiple mechanisms:

  1. Environment variable: SWAMP_NO_TELEMETRY=1 or SWAMP_TELEMETRY=false
  2. Repository configuration: Add telemetryEnabled: false to .swamp.yaml
  3. User-level configuration: Add setting to ~/.config/swamp/config.yaml (if such a config exists or will be created)

Priority order should be:

  1. Command-line flag --no-telemetry (highest priority)
  2. Environment variable SWAMP_NO_TELEMETRY
  3. Repository config .swamp.yaml
  4. User-level config
  5. Default (enabled)

Implementation Scope

This feature would require changes to:

  • Telemetry initialization (src/cli/mod.ts): Check environment variable and config files before initializing telemetry service
  • Telemetry integration (src/cli/telemetry_integration.ts): Extend isTelemetryDisabled() to check multiple sources
  • Repository marker (src/infrastructure/persistence/repo_marker_repository.ts): Add telemetryEnabled field to RepoMarkerData interface
  • User configuration: Potentially create a new user-level config file and repository for global settings

The approach would check these sources in priority order during telemetry initialization, similar to how SWAMP_MODELS_DIR is currently resolved with environment variable taking precedence over config files.

Alternatives Considered

  1. Shell alias only: Users can create alias swamp='swamp --no-telemetry', but this doesn't work well with shell completions and requires manual setup
  2. Opt-in instead of opt-out: Flip to opt-in telemetry, but this would significantly reduce telemetry collection for improvement purposes

Additional Context

This is a common pattern in other CLI tools (e.g., DO_NOT_TRACK, HOMEBREW_NO_ANALYTICS) and respects user privacy preferences.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureFeature request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions