Skip to content

Repository files navigation

Spotlight Testing

Run a git worktree's changes inside your main checkout, so you never build a second dev environment

Edit in the worktree and Spotlight keeps the repo root in sync, then puts the root back exactly as it was when you stop.

Install

npm install -g spotlight-testing

Quickstart

Run it from inside a linked worktree. Spotlight infers the main checkout, saves its current state, and starts syncing.

spotlight-testing

Your slow Docker or database setup keeps running in the repo root while you work in the worktree. When you are done:

# Restore the repo root to how it was before spotlight started
spotlight-testing off
# Or realign it with the remote instead
spotlight-testing reset

Commands

CommandDescription
spotlight-testingStart syncing the current worktree, the same as on
spotlight-testing onStart syncing an explicit worktree path
spotlight-testing offStop, and restore the checkpoint saved when spotlight started
spotlight-testing resetStop if needed, then fetch and hard-reset the root to origin/main
spotlight-testing statusShow which worktree is currently spotlit, and where

Options

FlagDefaultDescription
-t, --target <path>inferredRepo root to sync into or reset, for on and reset
-d, --debounce <ms>300How long file events are coalesced before a sync
-r, --remote <name>originRemote that reset fetches from
--to <ref>origin/mainRef that reset moves the repo root to
--no-fetchSkip the fetch before reset

Notes

  • Node.js 24 or newer, on macOS.
  • The worktree and the repo root have to share one git object store, so a linked git worktree rather than a second clone.
  • Syncing and restoring both use destructive git operations on the repo root. Anything uncommitted there is captured in the startup checkpoint and comes back on off.
  • Untracked files in the worktree are included by default. Ignored files are left untouched.
  • Checkpoints are git refs under refs/conductor-checkpoints/, so nothing lands in your history.

License

MIT


Crafted by Matthew Blode

About

See your code changes in a running dev server instantly

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages