loop: enforce rather than fix branch formatting
This way the UI will always be correct;
the UI runs off the LLM response, not the fixed version.
diff --git a/loop/agent.go b/loop/agent.go
index 563273d..55f92b5 100644
--- a/loop/agent.go
+++ b/loop/agent.go
@@ -760,8 +760,10 @@
if params.Title == "" {
return "", fmt.Errorf("title parameter cannot be empty")
}
-
- branchName := "sketch/" + cleanBranchName(params.BranchName)
+ if params.BranchName != cleanBranchName(params.BranchName) {
+ return "", fmt.Errorf("branch_name parameter must be alphanumeric hyphenated slug")
+ }
+ branchName := "sketch/" + params.BranchName
if branchExists(a.workingDir, branchName) {
return "", fmt.Errorf("branch %q already exists; please choose a different branch name", branchName)
}