From 701b3b2006ac45a920bd68039164b2803b424926 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <209825114+claude[bot]@users.noreply.github.com> Date: Tue, 12 Aug 2025 20:17:17 +0000 Subject: [PATCH] feat: auto-change directory after setup command Add automatic directory change to newly created repository after successful setup, making the setup command consistent with other worktree commands (add, switch, remove) that also change directories. Resolves #6 Co-authored-by: Liam White --- cmd/setup.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/setup.go b/cmd/setup.go index 7387d2c..10aaa5e 100644 --- a/cmd/setup.go +++ b/cmd/setup.go @@ -15,6 +15,9 @@ package cmd import ( + "fmt" + "os" + "github.com/liamawhite/worktree/pkg/setup" "github.com/spf13/cobra" ) @@ -34,7 +37,13 @@ Clones the repository and configures upstream/origin remotes.`, return err } - return setup.SetupRepository(config, getConfigPath()) + if err := setup.SetupRepository(config, getConfigPath()); err != nil { + return err + } + + // Change to the newly created repository directory + fmt.Fprintf(os.Stderr, "WT_CHDIR:%s\n", config.RepoName) + return nil }, }