summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-03-25 05:31:14 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-03-25 05:31:14 +0000
commit9fe915674ee7e1f91771eb5fa5a73f99bcecef88 (patch)
tree9d73f93639cda1404da008ce8d0290d98f9cb000
parent436862484e53e9cf06b2594bcefd99621e603a72 (diff)
chore: replace all master branch references with main
- executor.go: merge story branch to main before deploy - container.go: error messages reference git push origin main - api/stories.go: create story branch from origin/main (drop master fallback) - executor_test.go: test setup uses main branch Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
-rw-r--r--internal/api/stories.go12
-rw-r--r--internal/executor/container.go4
-rw-r--r--internal/executor/executor.go8
-rw-r--r--internal/executor/executor_test.go12
4 files changed, 15 insertions, 21 deletions
diff --git a/internal/api/stories.go b/internal/api/stories.go
index 640bb0e..2f26040 100644
--- a/internal/api/stories.go
+++ b/internal/api/stories.go
@@ -14,20 +14,14 @@ import (
"github.com/thepeterstone/claudomator/internal/task"
)
-// createStoryBranch creates a new git branch in localPath from origin/master (or main)
+// createStoryBranch creates a new git branch in localPath from origin/main
// and pushes it to origin. Idempotent: treats "already exists" as success.
func createStoryBranch(localPath, branchName string) error {
- // Fetch latest from origin so origin/master is up to date.
+ // Fetch latest from origin so origin/main is up to date.
if out, err := exec.Command("git", "-C", localPath, "fetch", "origin").CombinedOutput(); err != nil {
return fmt.Errorf("git fetch: %w (output: %s)", err, string(out))
}
- // Try to create branch from origin/master; fall back to origin/main.
- base := "origin/master"
- if out, err := exec.Command("git", "-C", localPath, "rev-parse", "--verify", "origin/master").CombinedOutput(); err != nil {
- if strings.Contains(string(out), "fatal") || err != nil {
- base = "origin/main"
- }
- }
+ base := "origin/main"
out, err := exec.Command("git", "-C", localPath, "checkout", "-b", branchName, base).CombinedOutput()
if err != nil {
if !strings.Contains(string(out), "already exists") {
diff --git a/internal/executor/container.go b/internal/executor/container.go
index 8b244c6..95717b4 100644
--- a/internal/executor/container.go
+++ b/internal/executor/container.go
@@ -473,7 +473,7 @@ func detectUncommittedChanges(workspace string) error {
if err == nil {
for _, line := range strings.Split(strings.TrimSpace(string(diffOut)), "\n") {
if line != "" && !isScaffold(line) {
- return fmt.Errorf("agent left uncommitted changes (work would be lost on sandbox deletion):\n%s\nInstructions must include: git add -A && git commit && git push origin master", strings.TrimSpace(string(diffOut)))
+ return fmt.Errorf("agent left uncommitted changes (work would be lost on sandbox deletion):\n%s\nInstructions must include: git add -A && git commit && git push origin main", strings.TrimSpace(string(diffOut)))
}
}
}
@@ -489,7 +489,7 @@ func detectUncommittedChanges(workspace string) error {
}
}
if len(dirty) > 0 {
- return fmt.Errorf("agent left untracked files not committed (work would be lost on sandbox deletion):\n%s\nInstructions must include: git add -A && git commit && git push origin master", strings.Join(dirty, "\n"))
+ return fmt.Errorf("agent left untracked files not committed (work would be lost on sandbox deletion):\n%s\nInstructions must include: git add -A && git commit && git push origin main", strings.Join(dirty, "\n"))
}
}
diff --git a/internal/executor/executor.go b/internal/executor/executor.go
index 7213b34..9052bd7 100644
--- a/internal/executor/executor.go
+++ b/internal/executor/executor.go
@@ -512,13 +512,13 @@ func (p *Pool) triggerStoryDeploy(ctx context.Context, storyID string) {
if proj.DeployScript == "" {
return
}
- // Merge story branch to master before deploying (ADR-007).
+ // Merge story branch to main before deploying (ADR-007).
if story.BranchName != "" && proj.LocalPath != "" {
mergeSteps := [][]string{
{"git", "-C", proj.LocalPath, "fetch", "origin"},
- {"git", "-C", proj.LocalPath, "checkout", "master"},
+ {"git", "-C", proj.LocalPath, "checkout", "main"},
{"git", "-C", proj.LocalPath, "merge", "--no-ff", story.BranchName, "-m", "Merge " + story.BranchName},
- {"git", "-C", proj.LocalPath, "push", "origin", "master"},
+ {"git", "-C", proj.LocalPath, "push", "origin", "main"},
}
for _, args := range mergeSteps {
if mergeOut, mergeErr := exec.CommandContext(ctx, args[0], args[1:]...).CombinedOutput(); mergeErr != nil {
@@ -526,7 +526,7 @@ func (p *Pool) triggerStoryDeploy(ctx context.Context, storyID string) {
return
}
}
- p.logger.Info("story branch merged to master", "storyID", storyID, "branch", story.BranchName)
+ p.logger.Info("story branch merged to main", "storyID", storyID, "branch", story.BranchName)
}
out, err := exec.CommandContext(ctx, proj.DeployScript).CombinedOutput()
if err != nil {
diff --git a/internal/executor/executor_test.go b/internal/executor/executor_test.go
index c68d37b..a8fd9da 100644
--- a/internal/executor/executor_test.go
+++ b/internal/executor/executor_test.go
@@ -1832,12 +1832,12 @@ func TestPool_StoryDeploy_MergesStoryBranch(t *testing.T) {
runGit(t, localDir, "config", "user.email", "test@test.com")
runGit(t, localDir, "config", "user.name", "Test")
- // Initial commit on master.
- runGit(t, localDir, "checkout", "-b", "master")
+ // Initial commit on main.
+ runGit(t, localDir, "checkout", "-b", "main")
os.WriteFile(filepath.Join(localDir, "README.md"), []byte("initial"), 0644)
runGit(t, localDir, "add", ".")
runGit(t, localDir, "commit", "-m", "initial")
- runGit(t, localDir, "push", "-u", "origin", "master")
+ runGit(t, localDir, "push", "-u", "origin", "main")
// Story branch with a feature commit.
runGit(t, localDir, "checkout", "-b", "story/test-feature")
@@ -1845,7 +1845,7 @@ func TestPool_StoryDeploy_MergesStoryBranch(t *testing.T) {
runGit(t, localDir, "add", ".")
runGit(t, localDir, "commit", "-m", "feature work")
runGit(t, localDir, "push", "origin", "story/test-feature")
- runGit(t, localDir, "checkout", "master")
+ runGit(t, localDir, "checkout", "main")
store := testStore(t)
logger := slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelError}))
@@ -1872,9 +1872,9 @@ func TestPool_StoryDeploy_MergesStoryBranch(t *testing.T) {
pool.triggerStoryDeploy(context.Background(), story.ID)
- // feature.go should now be on master in the working copy.
+ // feature.go should now be on main in the working copy.
if _, err := os.Stat(filepath.Join(localDir, "feature.go")); os.IsNotExist(err) {
- t.Error("story branch was not merged to master: feature.go missing")
+ t.Error("story branch was not merged to main: feature.go missing")
}
got, _ := store.GetStory(story.ID)
if got.Status != task.StoryDeployed {