Skip to content

chore: add reset:dev script for clean dev-state restart#4

Open
skalkii wants to merge 1 commit into
video-db:mainfrom
skalkii:chore/reset-dev-script
Open

chore: add reset:dev script for clean dev-state restart#4
skalkii wants to merge 1 commit into
video-db:mainfrom
skalkii:chore/reset-dev-script

Conversation

@skalkii
Copy link
Copy Markdown

@skalkii skalkii commented Apr 25, 2026

Summary

  • Adds scripts/reset-dev.sh and a reset:dev npm script.
  • One command takes dev-mode state back to a true first-run baseline (TCC, userData, leftover processes) so the onboarding/permission flow can be re-tested cleanly.
  • Designed to be safe alongside a packaged install of focusd on the same machine.

Production safety

Care was taken so this does not clobber a packaged install:

  • TCC reset is dev-launcher-only. Resets Screen Recording + Microphone for com.github.Electron, com.googlecode.iterm2, com.apple.Terminal, com.microsoft.VSCode, and Cursor. The production bundle id com.videodb.focusd is intentionally excluded, so a packaged install on the same machine keeps its grants.
  • userData wipe is guarded. Dev and prod share ~/Library/Application Support/VideoDB Focusd/ because app.name = 'VideoDB Focusd' in both modes. The script checks for /Applications/VideoDB Focusd.app and aborts the userData wipe (with a clear --force instruction) when a packaged install is present. Other reset steps still run.
  • Process kill is path-scoped. pkill -f "VideoDB Focusd/bin/recorder" (and meet_detector) — the full path means we cannot hit an unrelated process named recorder.
  • No keychain access. focusd's API key is stored via Electron safeStorage inside userData; removing userData removes the secret. No security delete-generic-password calls, no risk of touching unrelated keychain entries.
  • No source / node_modules / build output is touched.

Usage

```bash
npm run reset:dev # standard reset (preserves userData when prod app installed)
npm run reset:dev -- --force # also wipes userData (use only if no packaged install)
```

Test plan

  • No packaged install: npm run reset:dev → expect TCC + Electron dev dir + userData all cleared. Next npm run dev runs the full onboarding flow from scratch.
  • With packaged install at /Applications/VideoDB Focusd.app: npm run reset:dev → expect TCC + Electron dev dir cleared, userData preserved, abort message printed.
  • With packaged install + --force: npm run reset:dev -- --force → expect everything cleared including userData.
  • bash -n scripts/reset-dev.sh passes (syntax-only lint).
  • No regressions on the existing reset:db script (still works independently).

Fixes #3

Resets dev-mode TCC entries (Screen Recording + Microphone for the
launchers that spawn the dev binary — Electron, iTerm, Terminal, VS
Code, Cursor), removes the generic Electron dev dir, and kills any
orphaned recorder/meet_detector processes spawned from this app's
userData/bin directory.

Designed to be safe alongside a packaged install of focusd on the same
machine:
- com.videodb.focusd (production bundle id) is intentionally excluded
  from the TCC reset list, so a packaged install keeps its grants.
- Dev and prod share the userData dir (app.name = 'VideoDB Focusd' in
  both modes). The script aborts the userData wipe when it detects a
  packaged install at /Applications/VideoDB Focusd.app, unless --force
  is passed.
- Process kill is path-scoped to userData/bin so it cannot hit
  unrelated processes.

Fixes video-db#3

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add reset:dev script to reset dev-mode state without affecting packaged installs

1 participant