Skip to content

feat: make bump shortcut + main-checkout-read-only doctrine#928

Merged
buremba merged 1 commit into
mainfrom
feat/worktree-bump-helper
May 19, 2026
Merged

feat: make bump shortcut + main-checkout-read-only doctrine#928
buremba merged 1 commit into
mainfrom
feat/worktree-bump-helper

Conversation

@buremba
Copy link
Copy Markdown
Member

@buremba buremba commented May 19, 2026

Summary

Two related fixes for an invariant the codebase relies on but doesn't enforce.

The problem. ~/Code/lobu (the main checkout) is supposed to stay on main — that's what lets parallel agents git worktree add ... cleanly. But submodule pointer bumps and "tiny build fixes" kept landing as direct commits in the main checkout, leaving it on chore/some-fix branches. Reflog evidence from a single afternoon:

```
17:11:51 checkout: moving from main to chore/bump-owletto-guardrails
17:54:59 checkout: moving from main to chore/bump-owletto-loading-skeletons
18:39:24 checkout: moving from main to chore/unblock-image-builds
```

Each of these silently broke any parallel make task-setup that ran while the main checkout was on a non-main branch.

The fix.

  1. AGENTS.md doctrine line — new `Scope discipline` rule: `~/Code/lobu` is read-only for agents. Every write — commit, branch, submodule bump, one-line fix — goes through a worktree. Was implicit in the "subagent isolation" line; now explicit for direct edits too.

  2. `make bump SUBMODULE= [TARGET=] [NAME=]` — the missing lightweight alternative to `make task-setup` for the trivial "advance a submodule pointer" case. Skips bun install, .env copy, port allocation — none needed for a one-line commit. Resolves TARGET inside the submodule, no-ops cleanly if already at target, otherwise commits + pushes + opens an auto-merge PR.

    The temptation to skip `task-setup` for "it's just one line" disappears when there's a one-command shortcut that already uses a worktree.

Smoke test

  • Bad args: rejects with usage
  • Bad submodule path: prints available submodules and exits 1
  • Target = current SHA (no-op): creates worktree, initializes submodule, detects no-op, cleans up worktree + branch ref. No orphan branches.

Usage

```
make bump SUBMODULE=packages/owletto # bump to origin/main
make bump SUBMODULE=packages/owletto TARGET=abc123def # bump to specific SHA
make bump SUBMODULE=packages/owletto NAME=cancel-button # custom slug
```

Summary by CodeRabbit

  • New Features

    • Introduced make bump command for submodule pointer updates with optional automatic pull request creation support.
  • Documentation

    • Clarified development workflow instructions and repository modification procedures for configuration and dependency updates.

Review Change Stack

Two related fixes for an invariant that's been silently broken: the
main `~/Code/lobu` checkout was supposed to stay on `main` so other
agents could `git worktree add` cleanly, but agents (and humans
running ad-hoc commands) were doing 1-line submodule pointer bumps
directly in it. That left the main checkout on `chore/some-fix`
branches, breaking parallel `make task-setup` runs.

1. AGENTS.md: new "Scope discipline" rule — `~/Code/lobu` is
   read-only for agents. All writes, even trivial bumps, go through
   a worktree. The rule was implicit in the existing "Subagent
   isolation" line but only mentioned in the context of subagents,
   not the dispatcher's own direct edits.

2. `make bump SUBMODULE=<path> [TARGET=<ref>] [NAME=<slug>]`: the
   missing lightweight alternative to `make task-setup` for the
   "advance a submodule pointer" case. Skips bun install, .env copy,
   port allocation — none of which are needed for a one-line commit.
   Resolves TARGET inside the submodule, no-ops cleanly if already
   at target, otherwise commits + pushes + opens an auto-merge PR.

   Smoke tested with NAME=smoke-noop targeting the current pin:
   creates worktree, initializes submodule, detects no-op, cleans up
   worktree + branch ref. No orphan branches left behind.

Why this matters: lobu/owletto pointer bumps happen multiple times
per day. Without this shortcut the temptation to skip `task-setup`
("it's just one line") is overwhelming, and that's exactly how the
main checkout ends up on a `chore/*` branch.
@buremba buremba enabled auto-merge (squash) May 19, 2026 17:56
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

📝 Walkthrough

Walkthrough

This PR introduces make bump as a lightweight command for bumping Git submodule pointers. It includes agent-facing documentation, a Makefile target with parameter validation, and a Bash script that orchestrates worktree creation, submodule target resolution, pointer updates, and automated PR creation with optional GitHub CLI integration.

Changes

Submodule bump command

Layer / File(s) Summary
Submodule bump command interface and documentation
AGENTS.md, Makefile
Documents the make bump command for read-only agent workflows, declares the .PHONY target, adds help text, and implements the Makefile target with SUBMODULE validation and delegation to the Bash script.
Submodule bump script implementation
scripts/bump-submodule.sh
Implements the full workflow: validates the submodule in .gitmodules, creates a worktree from origin/main, initializes and resolves the target SHA, detaches the submodule, commits the pointer change to a chore/bump-* branch, pushes to origin, and optionally creates an auto-merge squash PR via gh CLI.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • lobu-ai/lobu#926: Modifies AGENTS.md to enforce the make task-setup workflow, which aligns with the workflow guidance and make bump shortcut formalized in this PR.
  • lobu-ai/lobu#907: Bumps the packages/owletto submodule pointer, which is the type of operation that the new make bump command is designed to streamline.
  • lobu-ai/lobu#753: Bumps the packages/web submodule pointer, directly exemplifying the use case for the new make bump workflow.

Poem

🐰 A bump command hops along so light,
Submodule pointers set just right,
No worktrees left in weary sight,
Just make bump and push—pure delight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is comprehensive and well-structured with summary, smoke tests, and usage examples. However, the required test plan section is completely missing. Add the 'Test plan' section from the template and check off which validation steps were actually performed before merging.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately captures both main changes: introducing a 'make bump' shortcut and the read-only doctrine for the main checkout.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/worktree-bump-helper

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Makefile`:
- Line 20: Update the Makefile help string for the bump target to document the
optional NAME parameter: modify the help echo that currently shows "make bump
SUBMODULE=<path> [TARGET=<ref>]" so it includes "[NAME=<slug>]" (e.g. "make bump
SUBMODULE=<path> [TARGET=<ref>] [NAME=<slug>]") to match how the bump target
uses NAME to customize the branch slug; ensure the updated help text appears in
the same echo statement that prints the bump usage.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 04561d94-8684-44b2-9657-5dc62d3b2b62

📥 Commits

Reviewing files that changed from the base of the PR and between 5369c5b and 4f6e202.

📒 Files selected for processing (3)
  • AGENTS.md
  • Makefile
  • scripts/bump-submodule.sh

Comment thread Makefile
@echo " make task-setup NAME=<name> - Create a paired worktree at .claude/worktrees/<name> (lobu + submodule on real branch, .env copied, ports auto-assigned, Lobu context registered)"
@echo " make task-clean NAME=<name> [FORCE=1] - Remove the worktree, both branches, and the Lobu context (refuses if there's uncommitted/unpushed work unless FORCE=1)"
@echo " make task-use NAME=<name|main> - Point Chrome ext / Mac app symlinks at this worktree (or 'main' for the canonical checkout)"
@echo " make bump SUBMODULE=<path> [TARGET=<ref>] - Lightweight worktree + commit + PR for a trivial submodule pointer bump (skips bun install, .env, ports)"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Document the optional NAME parameter.

The help text omits [NAME=<slug>], but line 94 shows the target accepts it and the script uses it to customize the branch slug. Users reading make help won't discover this option.

📝 Proposed fix
-	`@echo` "  make bump SUBMODULE=<path> [TARGET=<ref>]  - Lightweight worktree + commit + PR for a trivial submodule pointer bump (skips bun install, .env, ports)"
+	`@echo` "  make bump SUBMODULE=<path> [TARGET=<ref>] [NAME=<slug>]  - Lightweight worktree + commit + PR for a trivial submodule pointer bump (skips bun install, .env, ports)"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@echo " make bump SUBMODULE=<path> [TARGET=<ref>] - Lightweight worktree + commit + PR for a trivial submodule pointer bump (skips bun install, .env, ports)"
`@echo` " make bump SUBMODULE=<path> [TARGET=<ref>] [NAME=<slug>] - Lightweight worktree + commit + PR for a trivial submodule pointer bump (skips bun install, .env, ports)"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Makefile` at line 20, Update the Makefile help string for the bump target to
document the optional NAME parameter: modify the help echo that currently shows
"make bump SUBMODULE=<path> [TARGET=<ref>]" so it includes "[NAME=<slug>]" (e.g.
"make bump SUBMODULE=<path> [TARGET=<ref>] [NAME=<slug>]") to match how the bump
target uses NAME to customize the branch slug; ensure the updated help text
appears in the same echo statement that prints the bump usage.

@buremba buremba merged commit 57cd312 into main May 19, 2026
25 of 26 checks passed
@buremba buremba deleted the feat/worktree-bump-helper branch May 19, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants