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:
- Environment variable:
SWAMP_NO_TELEMETRY=1 or SWAMP_TELEMETRY=false
- Repository configuration: Add
telemetryEnabled: false to .swamp.yaml
- User-level configuration: Add setting to
~/.config/swamp/config.yaml (if such a config exists or will be created)
Priority order should be:
- Command-line flag
--no-telemetry (highest priority)
- Environment variable
SWAMP_NO_TELEMETRY
- Repository config
.swamp.yaml
- User-level config
- 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
- Shell alias only: Users can create
alias swamp='swamp --no-telemetry', but this doesn't work well with shell completions and requires manual setup
- 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.
Problem
Currently, users must pass
--no-telemetryon 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:
SWAMP_NO_TELEMETRY=1orSWAMP_TELEMETRY=falsetelemetryEnabled: falseto.swamp.yaml~/.config/swamp/config.yaml(if such a config exists or will be created)Priority order should be:
--no-telemetry(highest priority)SWAMP_NO_TELEMETRY.swamp.yamlImplementation Scope
This feature would require changes to:
src/cli/mod.ts): Check environment variable and config files before initializing telemetry servicesrc/cli/telemetry_integration.ts): ExtendisTelemetryDisabled()to check multiple sourcessrc/infrastructure/persistence/repo_marker_repository.ts): AddtelemetryEnabledfield toRepoMarkerDatainterfaceThe approach would check these sources in priority order during telemetry initialization, similar to how
SWAMP_MODELS_DIRis currently resolved with environment variable taking precedence over config files.Alternatives Considered
alias swamp='swamp --no-telemetry', but this doesn't work well with shell completions and requires manual setupAdditional Context
This is a common pattern in other CLI tools (e.g.,
DO_NOT_TRACK,HOMEBREW_NO_ANALYTICS) and respects user privacy preferences.