feat(worktree): mirror Doppler scopes into worktrees automatically#50
Merged
Conversation
Doppler binds project/config to absolute directory paths in ~/.doppler/.doppler.yaml, so a fresh worktree starts unscoped and `doppler run` fails with "You must specify a project" until the user re-runs `doppler setup` by hand. Copy the main checkout's scopes (including per-subdirectory scopes in monorepos) to the equivalent paths inside the worktree, via the doppler CLI so we never fight its on-disk format: - on worktree creation, with a progress step in the create modal - on the first shell spawned in a worktree, covering worktrees created outside alacritree - on worktree deletion, drop the project/config options again so the config file stops accumulating entries for dead paths (tokens and other options are preserved) Existing worktree scopes are never overwritten, and a missing doppler binary is a silent no-op. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Doppler binds project/config to absolute directory paths in
~/.doppler/.doppler.yaml, so a fresh git worktree starts unscoped anddoppler runfails:Until now the fix was re-running
doppler setupby hand in every single worktree.What this does
New
doppler.rsmodule reads all scopes viadoppler configure --all --jsonand mirrors every scope under a project's main checkout to the rebased path inside the worktree — including per-subdirectory scopes in monorepos (e.g.<main>/apps/web→<worktree>/apps/web), which env-var injection could not express. All writes go through the doppler CLI so we never fight its on-disk format.Hooked in three places:
project/configoptions under the deleted path so the config file stops accumulating entries for dead paths.Safety
doppler setup(different config, saydevvsdev_personal) survives.project/config; tokens and other options are preserved (doppler configure setmerges andunsetprunes only emptied entries — verified live against doppler v3.76.0).Testing
/repo-otheragainst a/repoprefix (component-wisestrip_prefix).--all --jsonshape,setmerge,unsettoken preservation, parent-scope resolution) verified against a live doppler v3.76.0 using an isolated--config-dir.🤖 Generated with Claude Code