Repository navigation
Telemetry consent via SessionStart nudge (replaces osascript dialog) - #44
Conversation
The plugin gated telemetry on a per-project opt-in stored in
.claude/settings.local.json. On first session in a new working
directory the value was missing and logger.js called
promptTelemetryOptIn, which spawned a macOS osascript Yes/No dialog.
Three problems with that:
- Linux and Windows had no dialog at all. execSync threw, the
catch returned false, and telemetry was silently opted out
forever without the user ever seeing a prompt.
- The dialog blocked the session startup path until dismissed.
- It hijacked the user's GUI mid-task.
New flow — no native dialog, consent stays per-project:
1. SessionStart hook inspects the per-project setting.
enabled → stderr "SkillMeter vX (activated)", telemetry on
disabled → stderr "... (telemetry disabled for this project)"
unset → stderr nudge with /skillmeter:sk-telemetry enable|
disable instructions; telemetry skipped this session
2. User runs the slash command once per working directory. The
existing /skillmeter:sk-telemetry writes to .claude/
settings.local.json and subsequent SessionStarts take the
enabled/disabled path.
Cross-OS, non-blocking, visible in-session. The user chooses when
they want to and their choice is per-workdir (same granularity as
before).
Changes:
logger.js — remove promptTelemetryOptIn + its export
session_start.js — new checkOptIn branches with per-state stderr;
refactor to use getTelemetryOptIn directly
Verified end-to-end (spawnSync session_start.js with stubbed stdin):
- enabled state → stderr "activated", retryFailedLogs runs,
checkOptIn returns true (telemetry on)
- disabled state → stderr "telemetry disabled", returns false
- unset state → stderr "telemetry not configured" + the two
slash-command hints, returns false
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
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 (2)
💤 Files with no reviewable changes (1)
WalkthroughThe changes remove interactive telemetry prompting via native macOS dialogs and replace it with a configuration-driven approach. Users must explicitly set telemetry preferences through configuration files or slash-commands rather than being prompted during session initialization. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary
The plugin's per-project telemetry opt-in flow depended on a macOS-only `osascript` dialog. That's the last cross-OS hole in the consent path: Linux/Windows users hit the `catch` branch silently, got `false` back, and never saw a prompt. This PR removes the dialog and replaces it with a SessionStart stderr nudge that works identically on every platform.
Why not UserPromptSubmit block?
Considered. A hard block on the user's first prompt would force a choice, but:
SessionStart stderr is the same mechanism the plugin already uses to announce its version (`SkillMeter vX.Y (activated)`). Adding the consent hint there is consistent UX.
Flow
```
Session starts in a working directory
│
▼
SessionStart hook reads .claude/settings.local.json's skillmeter.telemetry
│
├─ true → stderr "SkillMeter vX.Y (activated)", telemetry on
├─ false → stderr "SkillMeter vX.Y (telemetry disabled for this project)"
└─ unset → stderr
"SkillMeter vX.Y (telemetry not configured for this project)
Run /skillmeter:sk-telemetry enable — send anonymized session data
Run /skillmeter:sk-telemetry disable — opt out for this project"
— and skips telemetry this session
```
The existing `/skillmeter:sk-telemetry enable|disable` slash command writes to `.claude/settings.local.json`; next SessionStart takes the corresponding branch.
Changes
Verified
`spawnSync` harness drives `session_start.js` against a scratch cwd with each of the three consent states seeded into a throwaway `.claude/settings.local.json`:
Out of scope
🤖 Generated with Claude Code
Summary by CodeRabbit
/skillmeter:sk-telemetry enable/disable).