feat(mq): add configurable integration branch naming (#104)

Enterprise teams can now customize integration branch names to match
their conventions (e.g., username/TICKET-123/feature-name).

- Add integration_branch_template to MergeQueueConfig
- Add --branch CLI override for gt mq integration create
- Support {epic}, {prefix}, {user} template variables
- Validate branch names for git-safe characters
- Store actual branch name in epic metadata at create time
- Read stored branch name in land/status (fallback for old epics)

Also fixes unrelated build error in polecat/manager.go (polecatPath
variable was undefined).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gastown/crew/joe
2026-01-09 00:41:15 -08:00
committed by Steve Yegge
parent f19ddc5400
commit 358fcaf935
4 changed files with 443 additions and 15 deletions

View File

@@ -47,6 +47,9 @@ var (
// Integration status flags
mqIntegrationStatusJSON bool
// Integration create flags
mqIntegrationCreateBranch string
)
var mqCmd = &cobra.Command{
@@ -190,18 +193,31 @@ var mqIntegrationCreateCmd = &cobra.Command{
Short: "Create an integration branch for an epic",
Long: `Create an integration branch for batch work on an epic.
Creates a branch named integration/<epic-id> from main and pushes it
to origin. Future MRs for this epic's children can target this branch.
Creates a branch from main and pushes it to origin. Future MRs for this
epic's children can target this branch.
Branch naming:
Default: integration/<epic-id>
Config: Set merge_queue.integration_branch_template in rig settings
Override: Use --branch flag for one-off customization
Template variables:
{epic} - Full epic ID (e.g., "RA-123")
{prefix} - Epic prefix before first hyphen (e.g., "RA")
{user} - Git user.name (e.g., "klauern")
Actions:
1. Verify epic exists
2. Create branch integration/<epic-id> from main
2. Create branch from main (using template or --branch)
3. Push to origin
4. Store integration branch info in epic metadata
4. Store actual branch name in epic metadata
Example:
Examples:
gt mq integration create gt-auth-epic
# Creates integration/gt-auth-epic from main`,
# Creates integration/gt-auth-epic (default)
gt mq integration create RA-123 --branch "klauern/PROJ-1234/{epic}"
# Creates klauern/PROJ-1234/RA-123`,
Args: cobra.ExactArgs(1),
RunE: runMqIntegrationCreate,
}
@@ -287,6 +303,7 @@ func init() {
mqCmd.AddCommand(mqStatusCmd)
// Integration branch subcommands
mqIntegrationCreateCmd.Flags().StringVar(&mqIntegrationCreateBranch, "branch", "", "Override branch name template (supports {epic}, {prefix}, {user})")
mqIntegrationCmd.AddCommand(mqIntegrationCreateCmd)
// Integration land flags