From f69426c47c07d18f88138b1c77baab87341fa704 Mon Sep 17 00:00:00 2001 From: Jonatan Dahl Date: Mon, 2 Feb 2026 13:34:58 -0500 Subject: [PATCH] feat: auto-add branches to stack without prompting When running `stack sync` on a branch that isn't in a stack, automatically add it with main/master as parent instead of prompting for confirmation. Co-Authored-By: Claude Opus 4.5 --- cmd/sync.go | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/cmd/sync.go b/cmd/sync.go index a8e0c6d..a75dde5 100644 --- a/cmd/sync.go +++ b/cmd/sync.go @@ -264,22 +264,7 @@ func runSync(gitClient git.GitClient, githubClient github.GitHubClient) error { parent := gitClient.GetConfig(fmt.Sprintf("branch.%s.stackparent", originalBranch)) if parent == "" && originalBranch != baseBranch { - fmt.Printf("Branch '%s' is not in a stack.\n", ui.Branch(originalBranch)) - fmt.Printf("Add it with parent '%s'? [Y/n] ", ui.Branch(baseBranch)) - - reader := bufio.NewReader(stdinReader) - input, err := reader.ReadString('\n') - if err != nil { - return fmt.Errorf("failed to read input: %w", err) - } - - input = strings.TrimSpace(strings.ToLower(input)) - if input != "" && input != "y" && input != "yes" { - fmt.Println("Aborted.") - return nil - } - - // Set the parent + // Auto-add branch to stack with base branch as parent configKey := fmt.Sprintf("branch.%s.stackparent", originalBranch) if err := gitClient.SetConfig(configKey, baseBranch); err != nil { return fmt.Errorf("failed to set parent: %w", err)