Commit Graph

22 Commits

Author SHA1 Message Date
gastown/crew/joe
358fcaf935 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>
2026-01-09 00:41:35 -08:00
dag
5a4a691dfd feat(mq): Add 'mr' alias for merge request operations (gt-t85hw)
Adds 'gt mr' as an alias for 'gt mq' so both work:
- gt mr submit → gt mq submit
- gt mr status → gt mq status
- gt mr list → gt mq list

'MR' (merge request) is the conceptual noun; 'mq' (merge queue) is the
implementation detail. This reduces friction for agents and humans who
think in terms of "I have a merge request."

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 18:56:35 -08:00
gastown/crew/joe
df46e75a51 Fix: Unknown subcommands now error instead of silently showing help
Parent commands (mol, mail, crew, polecat, etc.) previously showed help
and exited 0 for unknown subcommands like "gt mol foobar". This masked
errors in scripts and confused users.

Added requireSubcommand() helper to root.go and applied it to all parent
commands. Now unknown subcommands properly error with exit code 1.

Example before: gt mol unhook → shows help, exits 0
Example after:  gt mol unhook → "Error: unknown command "unhook"", exits 1

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 20:52:23 -08:00
Steve Yegge
91fa5e63dc Replace 'gastown' with 'greenplace' in user-facing docs/examples
Using "greenplace" (The Green Place from Mad Max: Fury Road) as the
canonical example project/rig name in documentation and help text.
This provides a clearer distinction from the actual gastown repo name.

Changes:
- docs/*.md: Updated all example paths and commands
- internal/cmd/*.go: Updated help text examples
- internal/templates/: Updated example references
- Tests: Updated to use greenplace in example session names

Note: Import paths (github.com/steveyegge/gastown) and actual code
paths referencing the gastown repo structure are unchanged.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 18:03:06 -08:00
Steve Yegge
34b5a3bb8d Document intentional error suppressions with comments (gt-zn9m)
All 156 instances of _ = error suppression in non-test code now have
explanatory comments documenting why the error is intentionally ignored.

Categories of intentional suppressions:
- non-fatal: session works without these - tmux environment setup
- non-fatal: theming failure does not affect operation - visual styling
- best-effort cleanup - defer cleanup on failure paths
- best-effort notification - mail/notifications that should not block
- best-effort interrupt - graceful shutdown attempts
- crypto/rand.Read only fails on broken system - random ID generation
- output errors non-actionable - fmt.Fprint to io.Writer

This addresses the silent failure and debugging concerns raised in the
issue by making the intentionality explicit in the code.

Generated with Claude Code https://claude.com/claude-code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 23:14:29 -08:00
Steve Yegge
f86a73c2f0 feat: Add gcloud-style command grouping to gt help output
Organize 43 commands into 7 logical groups using cobra's built-in
AddGroup/GroupID feature:

- Work Management: spawn, sling, hook, handoff, done, mol, mq, etc.
- Agent Management: mayor, witness, refinery, deacon, polecat, etc.
- Communication: mail, nudge, broadcast, peek
- Services: daemon, start, stop, up, down, shutdown
- Workspace: rig, crew, init, install, git-init, namepool
- Configuration: account, theme, hooks, issue, completion
- Diagnostics: status, doctor, prime, version, help

Also renamed molecule to mol as the primary command name
(molecule is now an alias).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 02:32:01 -08:00
Steve Yegge
db87ec7b7b feat(refinery): Auto-detect rig from cwd for refinery commands
All gt refinery subcommands (start, stop, status, queue, attach) now
accept an optional rig argument. If not provided, the rig is inferred
from the current working directory.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 13:38:31 -08:00
Steve Yegge
ff654eee59 feat(mq): auto-cleanup polecats after MR submission
When `gt mq submit` is run from a polecat work branch (polecat/<worker>/<issue>),
it now automatically triggers polecat shutdown after submitting the MR. The
polecat sends a lifecycle request to its Witness and waits for termination.

This eliminates the need for polecats to manually run `gt handoff --shutdown`
after completing work - they can just run `gt mq submit` and the cleanup
happens automatically.

Added `--no-cleanup` flag to disable auto-cleanup when needed (e.g., for
submitting multiple MRs or continuing work).

Closes gt-tca

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 11:44:35 -08:00
Steve Yegge
61f94d1e04 refactor: split mq.go (1738 lines) into focused modules
- mq.go (400): commands, flags, init, shared helpers
- mq_integration.go (606): integration branch create/land/status
- mq_status.go (357): status display and formatting
- mq_submit.go (219): submit command and branch parsing
- mq_list.go (206): list command and filtering

Also adds unit tests for helper functions:
- formatStatus, getStatusIcon, formatTimeAgo
- filterMRsByTarget with edge cases
- Test utilities for mocking beads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 23:25:16 -08:00
Steve Yegge
2ca679ad86 fix(mq): gt mq list shows all priorities, not just P0 (gt-72so)
The ListOptions struct defaults Priority to 0 (Go zero value), which
caused bd list to filter to only P0 merge requests. This fix explicitly
sets Priority: -1 to disable priority filtering.

Root cause: beads.ListOptions{Type: "merge-request"} created opts with
Priority=0, passing --priority=0 to bd, filtering out P1-P4 MRs.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 16:18:54 -08:00
Steve Yegge
f6d7da3284 feat(mq): add integration status command (gt-h5n.6)
Implement 'gt mq integration status <epic>' command that displays:
- Integration branch name and creation date
- Commits ahead of main
- Merged MRs (closed, targeting integration branch)
- Pending MRs (open, targeting integration branch)

Also adds git helpers for BranchCreatedDate and CommitsAhead.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:53:04 -08:00
Steve Yegge
9660fd414b feat(mq): auto-target integration branch for epic children
When 'gt mq submit' is called:
1. Parse source issue from branch
2. Check if issue has a parent epic
3. Check if integration/<epic> branch exists
4. If yes: set target=integration/<epic>
5. If no: set target=main

The --epic flag still works for explicit targeting.

Closes gt-h5n.7

🤝 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:47:12 -08:00
Steve Yegge
7de003a18b feat(mq): implement integration land command (gt-h5n.5)
Add 'gt mq integration land <epic>' command that:
- Verifies all MRs targeting integration/<epic> are merged
- Verifies integration branch exists
- Merges integration/<epic> to main (--no-ff)
- Runs tests on main (if configured)
- Pushes to origin
- Deletes integration branch (local and remote)
- Updates epic status to closed

Options:
- --force: land even if some MRs still open
- --skip-tests: skip test run
- --dry-run: preview only

Also adds:
- MergeNoFF() and DeleteRemoteBranch() to git package
- WorkDir() accessor for git.Git
- Unit tests for mq helper functions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:01:42 -08:00
Steve Yegge
50cdd638cb feat(mq): add gt mq integration create command
Implement 'gt mq integration create <epic>' command to create integration
branches for batch work on epics. The command:

1. Verifies the epic exists in beads
2. Creates branch integration/<epic-id> from origin/main
3. Pushes the branch to origin
4. Stores integration branch info in the epic's metadata

Also adds helper methods to git package:
- CreateBranchFrom: create branch from specific ref
- BranchExists: check if local branch exists
- RemoteBranchExists: check if branch exists on remote

Future MRs for the epic's children can target the integration branch
with: gt mq submit --epic <epic-id>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 01:46:04 -08:00
Steve Yegge
2edf2358dd fix: session start timing and MR type issues
- Add 200ms delay after NewSession before sending keys to fix race
  condition where shell is not ready (mayor.go, crew.go)
- Use merge-request type instead of task for gt mq submit (mq.go)

Fixes gt-tulx

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 22:17:13 -08:00
Steve Yegge
bc8e7e66ea Merge polecat/Coma: gt mq status + Engineer main loop 2025-12-18 20:49:46 -08:00
Steve Yegge
eb0ac8e384 feat(mq): implement gt mq submit command
Adds the merge queue submit command for workers to submit completed
work to the merge queue. The command creates a merge-request bead
that the Engineer will process.

Features:
- Auto-detects branch, issue, worker, and rig from current context
- Parses polecat/<worker>/<issue> branch naming convention
- Supports explicit --branch, --issue, --epic, --priority flags
- Inherits priority from source issue by default
- Creates merge-request bead with structured MR fields

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:33:42 -08:00
Steve Yegge
784c0582b5 Merge polecat/Ace: mq list + mq reject commands
Combined with Dag's mq retry from previous merge.
Full MQ CLI now includes: list, retry, reject subcommands.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:23:26 -08:00
Steve Yegge
dea935f647 feat: implement gt mq list command for merge queue display
- Add gt mq list <rig> command with table output
- Support --ready flag to show only unblocked MRs
- Support --status, --worker, --epic filtering
- Support --json output format
- Parse MR fields from beads issues for display
- Show blocking info for blocked MRs

Closes gt-svi.2

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:16:10 -08:00
Steve Yegge
81c5f6afd5 feat: implement gt mq retry command for failed merge requests
Add 'gt mq retry <rig> <mr-id>' command to retry failed MRs:
- Added GetMR() and Retry() methods to refinery.Manager
- Added RegisterMR() for persistent MR tracking
- Added PendingMRs field to Refinery state
- Created new mq.go command file with retry subcommand
- Support --now flag for immediate processing
- Added comprehensive tests for retry functionality

Closes gt-svi.4

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:11:09 -08:00
Steve Yegge
3acb0e9c12 feat: implement gt mq reject command for manual MR rejection
- Add gt mq command group with reject subcommand
- Add FindMR method to locate MRs by ID or branch
- Add RejectMR method to reject MRs with reason
- Add notifyWorkerRejected for optional mail notification
- Add tests for rejection state transitions

Closes gt-svi.5

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:10:40 -08:00
Steve Yegge
ae0c532723 feat: implement gt mq status command for detailed MR view
Adds the 'gt mq status <id>' command for displaying detailed merge request
information. Features:

- Shows all MR fields (branch, target, source_issue, worker, rig)
- Displays current status with timestamps and relative time
- Shows dependencies (what it's waiting on) with status icons
- Shows blockers (what's waiting on it)
- Supports JSON output with --json flag

This is part of the merge queue CLI commands (gt-svi).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:05:06 -08:00