Skip to content

feat: hybrid Ctrl-C + picker-first bare perchd + -v/--version (0.5.0)#3

Merged
irwansetiawan merged 4 commits into
mainfrom
feat/version-flag
Jul 12, 2026
Merged

feat: hybrid Ctrl-C + picker-first bare perchd + -v/--version (0.5.0)#3
irwansetiawan merged 4 commits into
mainfrom
feat/version-flag

Conversation

@irwansetiawan

@irwansetiawan irwansetiawan commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Three UX fixes on top of the published 0.4.0, all in 0.5.0.

1. perchd -v / --version (was an error)

perchd --version threw Unknown option. Now wired to cac's .version(), read from package.json so it's correct under both the published binary and pnpm dev.

2. Hybrid Ctrl-C — the drop-in stops on Ctrl-C again

0.4.0 made Ctrl-C detach and never stop, which violates the npm run dev muscle memory the drop-in is built on. Now it's hybrid, keyed on who started the server:

You ran Ctrl-C Window close (SIGHUP)
perchd / perchd <branch> / switch (you started it) stops — like npm run dev stops (no orphans)
perchd attach (peeking at a running one) detaches, keeps running detaches

runViewport stays pure — reports { interrupted, signal }, never signals the server; the stop-vs-detach policy lives in attachViewport (stopOnInterrupt), and the banner states the mode. perchd stop still kills from anywhere.

3. Bare perchd shows the worktree picker again (cwd pre-selected)

This is the important one. 0.4.0 made bare perchd inside a worktree silently run that worktree and never show the menu — which hid the other worktrees and, with them, perchd's actual moat: switching what you preview without cd-ing between worktrees.

Now bare perchd always shows the picker, with the worktree you're standing in floated to the top and pre-selected:

  • Enter → run where you stand (the npm run dev drop-in, one gesture).
  • Arrow to another → switch. The other worktrees are visible again.
  • perchd <branch> still skips the menu for direct/scripted use.
  • A non-interactive bare perchd (piped / CI) now fails with a clear "name a target" message instead of a raw uv_tty_init crash.

Verification

  • pnpm typecheck clean · pnpm test 125/125 · pnpm build clean.
  • Drove the real binary end-to-end for every path: Ctrl-C stops a started server / detaches an attached one / SIGHUP stops; picker pre-select + Enter runs the cwd worktree (via a pty); perchd <branch> -d skips the menu; non-TTY gives the clean error.

Release

BREAKING vs 0.4.0 (Ctrl-C reversal) → 0.5.0. Not merged or published — your call, since it's breaking and npm is immutable. perchd dev still works with its deprecation hint. CLAUDE.md, CONTRIBUTING, README, and CHANGELOG all updated.

Wire cac's .version() from package.json, read via ../package.json relative to
the entry — resolves the same under tsx (src/cli.ts) and the bundled dist/cli.js
(the tarball ships package.json one level above dist/). Test drives the real
entry through tsx so it guards the actual flag, not a stand-in.
…o detaches

Bare `perchd`/`switch` own the server they start, so Ctrl-C (and window-close
via SIGHUP) stop it, matching `npm run dev` — the drop-in promise. `perchd attach`
does not own the server, so Ctrl-C only detaches; killing something you attached
to peek at would be a footgun. The banner states which, per mode.

runViewport now reports {interrupted, signal} and never signals the server
itself; attachViewport applies the stop-vs-detach policy (graceful stopGroup on
SIGINT, best-effort SIGTERM-to-group on SIGHUP since the terminal is gone).

BREAKING (0.5.0): reverses the 0.4.0 'Ctrl-C always detaches' invariant.
…sion

- README: reframe around 'Ctrl-C stops, like npm run dev' with the attach
  exception; fix the hero line, quickstart, migration table, and FAQ.
- CLAUDE.md + CONTRIBUTING: document the hybrid stopOnInterrupt model and that
  runViewport stays pure (reports the signal; policy lives in attachViewport).
- CHANGELOG: 0.5.0 with the breaking Ctrl-C reversal and the --version fix.
- Bump to 0.5.0.
…cted

0.4.0 made bare perchd inside a worktree silently run that worktree — hiding the
other worktrees and, with them, perchd's whole 'switch without cd' point. Restore
the picker as the default, but float the cwd worktree to the top and pre-select it
(clack initialValue): Enter re-runs where you stand (the npm run dev drop-in),
arrowing to another is the switch. `perchd <branch>` still skips the menu.

A non-interactive bare perchd now fails with a clear 'name a target' message
instead of a raw uv_tty_init crash.
@irwansetiawan irwansetiawan changed the title feat: hybrid Ctrl-C (stop what you started) + perchd -v/--version (0.5.0) feat: hybrid Ctrl-C + picker-first bare perchd + -v/--version (0.5.0) Jul 12, 2026
@irwansetiawan
irwansetiawan merged commit 881bcaf into main Jul 12, 2026
4 checks passed
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.

1 participant