Commit Graph

13 Commits

Author SHA1 Message Date
Steve Yegge
1b66b9a2f2 feat: Implement bare repo architecture for branch visibility (gt-gmqe)
- Add .repo.git as shared bare repo for worktrees
- Update polecat manager to use bare repo when available
- Add git.NewGitWithDir() and CloneBare() for bare repo support
- Update gt rig init to create bare repo architecture for new rigs
- Refinery and polecats now share branch visibility via shared .git

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 18:49:34 -08:00
Steve Yegge
9f2eefe9ce fix: verify polecat branch pushed before cleanup (gt-gl6s)
Add BranchPushedToRemote() to git package that properly handles
polecat branches without upstream tracking. Update verifyPolecatState
in witness to check that branches are pushed before allowing cleanup.

This prevents the scenario where polecats close issues without pushing
their work, causing all commits to be lost when the worktree is deleted.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 21:50:31 -08:00
Steve Yegge
4f21002132 feat(polecat): refuse to lose uncommitted work during cleanup (gt-8v8)
Add comprehensive uncommitted work checks before any polecat cleanup:
- Check for uncommitted changes (modified/untracked files)
- Check for stashes
- Check for unpushed commits

Affected commands:
- gt polecat remove: now refuses if uncommitted work exists
- gt rig shutdown: checks all polecats before shutdown
- Witness cleanup: refuses to clean polecats with uncommitted work
- gt spawn: warns if spawning to polecat with uncommitted work

Safety model:
- --force: bypasses uncommitted changes check only
- --nuclear: bypasses ALL safety checks (will lose work)

New git helpers:
- StashCount(): count stashes in repo
- UnpushedCommits(): count commits not pushed to upstream
- CheckUncommittedWork(): comprehensive work status check

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 16:54:16 -08:00
Steve Yegge
ac16446f83 Remove duplicate DeleteRemoteBranch method
Duplicate introduced during rebase.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 19:15:13 -08:00
Steve Yegge
71918a1be4 Merge remote-tracking branch 'origin/polecat/Immortan'
# Conflicts:
#	internal/refinery/engineer.go
#	internal/refinery/engineer_test.go
2025-12-19 18:27:51 -08:00
Steve Yegge
349205eda1 feat(refinery): implement handleSuccess for merge queue
Implement success handling for the merge queue Engineer:
- Add handleSuccess method that handles successful merge completion
- Update MR body with merge_commit SHA and close_reason
- Close MR with 'merged' reason
- Close source issue with reference to MR ID
- Delete source branch if delete_merged_branches is configured
- Add DeleteRemoteBranch method to git package
- Add git client to Engineer struct
- Add tests for new functionality

Closes gt-3x1.5

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 14:48:13 -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
4048cdc373 fix(lint): resolve all errcheck warnings
Fix ~50 errcheck warnings across the codebase:

- Add explicit `_ =` for intentionally ignored error returns (cleanup,
  best-effort operations, etc.)
- Use `defer func() { _ = ... }()` pattern for defer statements
- Handle tmux SetEnvironment, KillSession, SendKeysRaw returns
- Handle mail router.Send returns
- Handle os.RemoveAll, os.Rename in cleanup paths
- Handle rand.Read returns for ID generation
- Handle fmt.Fprint* returns when writing to io.Writer
- Fix for-select with single case to use for-range
- Handle cobra MarkFlagRequired returns

All tests pass. Code compiles without errors.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:44:42 -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
999abe672c feat: add FetchBranch and CheckConflicts for merge queue
Add git helper functions for merge request conflict checking:
- FetchBranch(remote, branch): fetch a specific branch from remote
- CheckConflicts(source, target): test merge to detect conflicts
- Returns list of conflicting files without modifying working directory
- runMergeCheck helper to capture stdout (where CONFLICT appears)

Tests cover clean merges, conflicting merges, and working dir cleanup.

Closes gt-3x1.2

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:17:42 -08:00
Steve Yegge
691971a16a feat: crew attach auto-detection, worktree polecats, beads mail
- gt crew at: auto-detect crew from cwd, run gt prime after launch
- Polecats now use git worktrees from refinery (faster than clones)
- Updated architecture.md for two-tier beads mail model
- Town beads (gm-*) for Mayor mail/coordination
- Rig .beads/ symlinks to refinery/rig/.beads

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 19:51:36 -08:00
Steve Yegge
f46a1e6eab feat: add git wrapper package for subprocess operations
Operations:
- Clone, Checkout, Fetch, Pull, Push
- Add, Commit, CommitAll
- Status, CurrentBranch, HasUncommittedChanges, RemoteURL
- Merge, Rebase, AbortMerge, AbortRebase
- CreateBranch, DeleteBranch, Rev, IsAncestor

Error handling:
- Detects ErrNotARepo, ErrMergeConflict, ErrAuthFailure, ErrRebaseConflict
- Wraps git stderr in error messages

Closes gt-u1j.3

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:27:03 -08:00