t1224.8: Integrate localdev with worktree workflow for auto branch subdomain routing#1948
t1224.8: Integrate localdev with worktree workflow for auto branch subdomain routing#1948marcusquinn merged 2 commits intomainfrom
Conversation
…main routing (t1224.8) When worktree-helper.sh creates a worktree for a localdev-registered project, it auto-runs `localdev branch <project> <branch>` to create a subdomain route (e.g., feature-auth.myapp.local) and outputs the URL. Worktree removal (remove, clean) auto-cleans the corresponding branch route. Detection: matches repo basename against ~/.local-dev-proxy/ports.json. Non-fatal: if localdev is not configured or the project is not registered, the worktree workflow proceeds normally without error.
Summary of ChangesHello @marcusquinn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request integrates the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
WalkthroughThis PR adds Localdev integration to the worktree helper: detects localdev-registered projects via ~/.local-dev-proxy/ports.json, and automatically creates/removes branch-specific subdomain routes by invoking a localdev helper when worktrees are added, removed, or cleaned. Documentation is updated. Changes
Sequence DiagramsequenceDiagram
actor User
participant WorktreeHelper as worktree-helper.sh
participant LocaldevHelper as localdev-helper.sh
participant PortsFile as ~/.local-dev-proxy/ports.json
rect rgba(100, 200, 150, 0.5)
Note over User,PortsFile: Add Worktree with Localdev
User->>WorktreeHelper: cmd_add <branch>
WorktreeHelper->>WorktreeHelper: create worktree
WorktreeHelper->>WorktreeHelper: detect_localdev_project()
WorktreeHelper->>PortsFile: check for repo entry
alt Project registered
WorktreeHelper->>LocaldevHelper: localdev_auto_branch(branch)
LocaldevHelper->>PortsFile: create branch route
LocaldevHelper-->>WorktreeHelper: branch URL
WorktreeHelper-->>User: output branch URL
else Not registered
WorktreeHelper-->>User: no route created
end
end
rect rgba(200, 150, 100, 0.5)
Note over User,PortsFile: Remove/Clean Worktree with Cleanup
User->>WorktreeHelper: cmd_remove|cmd_clean <branch>
WorktreeHelper->>WorktreeHelper: remove/clean worktree(s)
WorktreeHelper->>WorktreeHelper: localdev_auto_branch_rm(branch)
alt Route exists
WorktreeHelper->>LocaldevHelper: request remove route
LocaldevHelper->>PortsFile: remove branch route
end
WorktreeHelper-->>User: cleanup complete
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–25 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Thu Feb 19 08:11:43 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
There was a problem hiding this comment.
Code Review
The integration of localdev with the worktree workflow is well-implemented and follows the project's non-fatal design philosophy. The detection logic for projects is robust, and the hooks into add, remove, and clean cover the necessary lifecycle events. I have one recommendation regarding the removal of redundant logic in the branch cleanup function to improve maintainability, aligning with the repository's rules on avoiding logic duplication. This review was informed by the Repository Style Guide's emphasis on reusing existing helpers and preventing maintenance drift.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.agents/scripts/worktree-helper.sh:
- Around line 90-95: The grep fallback treats $base_name as a regex which breaks
on metacharacters; update the grep call that currently reads grep -q
"\"$base_name\"" "$LOCALDEV_PORTS_FILE" to use fixed-string matching and safe
argument handling (e.g., grep -F -q -- "\"$base_name\"" "$LOCALDEV_PORTS_FILE"
2>/dev/null) so repo names with characters like . or [ ] are matched literally;
keep the surrounding quoted-string match so you still look for the JSON key
form.
In @.agents/tools/git/worktrunk.md:
- Around line 220-226: The post-create hook in .worktrunk/hooks/post-create
hardcodes the helper path ~/.aidevops/agents/scripts/localdev-helper.sh and
masks failures with "2>/dev/null || true", which hides command-not-found when
aidevops is installed elsewhere; update the hook or docs to either (a) document
the default-install assumption so users know to adjust the path, or (b) change
the hook to resolve the helper dynamically (e.g., respect an AIDEVOPS_HOME env
var, search PATH or use command -v to locate localdev-helper.sh) and remove the
silent suppression so a clear error or fallback message appears instead of
swallowing failures.
Auto-dismissed: bot review does not block autonomous pipeline
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Thu Feb 19 08:43:16 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.agents/scripts/worktree-helper.sh:
- Around line 120-129: The function localdev_auto_branch_rm currently swallows
failures from the "$LOCALDEV_HELPER" branch rm call with "|| true"; change it to
capture the command's exit status and, on non-zero exit, print a warning similar
to localdev_auto_branch (use the ${YELLOW}Localdev branch route removal failed
(non-fatal)${NC} style message) so failures are logged for observability;
reference the localdev_auto_branch_rm function and the "$LOCALDEV_HELPER" branch
rm invocation when making the change.
In @.agents/tools/git/worktrunk.md:
- Around line 208-228: The docs claim cleanup happens with Worktrunk's
post-create hook but omit the corresponding pre-remove hook so users using wt
remove will not trigger localdev_auto_branch_rm; add either (A) a pre-remove
hook example that calls the same LOCALDEV_HELPER and invokes
localdev_auto_branch_rm (mirror the post-create snippet but run the cleanup for
the current worktree/branch), or (B) a clear note stating that automatic route
removal only occurs when using worktree-helper.sh (and not just the post-create
hook), referencing worktree-helper.sh, localdev_auto_branch_rm, post-create and
pre-remove so maintainers can find the right spots; also change the example URL
scheme from https://feature-xyz.myapp.local to http:// or append “(https if
mkcert/local CA configured)” to avoid implying TLS by default.
Auto-dismissed: bot review does not block autonomous pipeline



Summary
worktree-helper.sh addcreates a worktree for a project registered withlocaldev add, it auto-runslocaldev branch <project> <branch>to create a subdomain route (e.g.,feature-auth.myapp.local) and outputs the URLremove,clean) auto-cleans the corresponding localdev branch route~/.local-dev-proxy/ports.json— non-fatal if localdev is not configuredChanges
.agents/scripts/worktree-helper.sh: Addeddetect_localdev_project(),localdev_auto_branch(),localdev_auto_branch_rm()functions; hooked intocmd_add,cmd_remove,cmd_clean.agents/tools/git/worktrunk.md: Added Localdev Integration section with Worktrunkpost-createhook example.agents/workflows/worktree.md: Added Localdev Integration section documenting auto-routing behaviourDesign Decisions
cmd_remove(single) andcmd_clean(batch) pathsbranchandbranch rmcommands rather than duplicating logicRef #1881
Summary by CodeRabbit
New Features
Documentation