Description
Add first-class support for error/crash reporting, debug logging, and optional telemetry in kidd so CLI authors don't have to roll their own.
Motivation
When a CLI crashes or errors silently (especially on unfamiliar platforms like Windows), there's no easy way to:
- See what went wrong without reproducing with
--verbose
- Collect crash data from users for debugging
- Track error patterns across the user base
Currently each CLI has to build its own debug logging, crash file writing, and error reporting - this should be a framework concern.
Proposed Features
1. Crash & Debug Log Writer
- Automatically write crash/error data to a well-known location (e.g.
~/<dotdir>/.debug/crashes/)
- Include stack traces, platform info, CLI version, command + args (sanitized)
- Users can share these files when reporting issues (
<cli> debug --last to print the latest crash log)
- Configurable log retention (auto-prune old logs)
2. Telemetry / 3rd-Party Integration
- Optional telemetry hook that CLI authors can wire up to services like:
- Statsig (feature flags + event logging)
- Sentry (crash reporting)
- PostHog (product analytics)
- Custom HTTP endpoints
- Opt-in by default with clear disclosure, easy opt-out (
<cli> telemetry off)
- Minimal API surface, e.g.:
cli({
telemetry: {
provider: statsig({ key: '...' }),
// or: provider: sentry({ dsn: '...' }),
// or: provider: custom({ send: async (event) => { ... } }),
consent: 'opt-in', // 'opt-in' | 'opt-out' | 'required'
},
})
3. Error Context Enrichment
- Automatically capture platform, arch, Node version, CLI version, shell, terminal info
- Attach to crash logs and telemetry events
- Respect privacy - no PII, no args that look like tokens/keys
Use Cases
- User reports "cli command fails silently on Windows" - we can ask them to run
<cli> debug --last and share the crash log
- Proactively detect that Windows users are hitting a specific error pattern via telemetry
- Feature flag rollouts via Statsig to gate experimental features
Additional Context
This came up while debugging silent failures on Windows in Parallels - the CLI exited with no output and no crash log, making it impossible to diagnose without source access.
Description
Add first-class support for error/crash reporting, debug logging, and optional telemetry in kidd so CLI authors don't have to roll their own.
Motivation
When a CLI crashes or errors silently (especially on unfamiliar platforms like Windows), there's no easy way to:
--verboseCurrently each CLI has to build its own debug logging, crash file writing, and error reporting - this should be a framework concern.
Proposed Features
1. Crash & Debug Log Writer
~/<dotdir>/.debug/crashes/)<cli> debug --lastto print the latest crash log)2. Telemetry / 3rd-Party Integration
<cli> telemetry off)3. Error Context Enrichment
Use Cases
<cli> debug --lastand share the crash logAdditional Context
This came up while debugging silent failures on Windows in Parallels - the CLI exited with no output and no crash log, making it impossible to diagnose without source access.