mirror of
https://github.com/humanlayer/humanlayer.git
synced 2025-08-20 19:01:22 +03:00
Merge pull request #415 from dexhorthy/dexter/eng-1904-add-local_review-command-for-automated-branch-review-setup
dexter/eng 1904 add local review command for automated branch review setup
This commit is contained in:
49
.claude/commands/local_review.md
Normal file
49
.claude/commands/local_review.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# Local Review
|
||||
|
||||
You are tasked with setting up a local review environment for a colleague's branch. This involves creating a worktree, setting up dependencies, and launching a new Claude Code session.
|
||||
|
||||
## Process
|
||||
|
||||
When invoked with a parameter like `gh_username:branchName`:
|
||||
|
||||
1. **Parse the input**:
|
||||
- Extract GitHub username and branch name from the format `username:branchname`
|
||||
- If no parameter provided, ask for it in the format: `gh_username:branchName`
|
||||
|
||||
2. **Extract ticket information**:
|
||||
- Look for ticket numbers in the branch name (e.g., `eng-1696`, `ENG-1696`)
|
||||
- Use this to create a short worktree directory name
|
||||
- If no ticket found, use a sanitized version of the branch name
|
||||
|
||||
3. **Set up the remote and worktree**:
|
||||
- Check if the remote already exists using `git remote -v`
|
||||
- If not, add it: `git remote add USERNAME git@github.com:USERNAME/humanlayer`
|
||||
- Fetch from the remote: `git fetch USERNAME`
|
||||
- Create worktree: `git worktree add -b BRANCHNAME ~/wt/humanlayer/SHORT_NAME USERNAME/BRANCHNAME`
|
||||
|
||||
4. **Configure the worktree**:
|
||||
- Copy Claude settings: `cp .claude/settings.local.json WORKTREE/.claude/`
|
||||
- Run setup: `make -C WORKTREE setup`
|
||||
- Initialize thoughts: `cd WORKTREE && npx humanlayer thoughts init --directory humanlayer`
|
||||
|
||||
5. **Launch Claude Code session**:
|
||||
- If a ticket number was found: `npx humanlayer launch --model opus -w WORKTREE "We're working on ENG-XXXX - fetch the issue and then await further instructions"`
|
||||
- Otherwise: `npx humanlayer launch --model opus -w WORKTREE "We're reviewing the branch BRANCHNAME - please familiarize yourself with the changes and await further instructions"`
|
||||
|
||||
## Error Handling
|
||||
|
||||
- If worktree already exists, inform the user they need to remove it first
|
||||
- If remote fetch fails, check if the username/repo exists
|
||||
- If setup fails, provide the error but continue with the launch
|
||||
|
||||
## Example Usage
|
||||
|
||||
```
|
||||
/local_review samdickson22:sam/eng-1696-hotkey-for-yolo-mode
|
||||
```
|
||||
|
||||
This will:
|
||||
- Add 'samdickson22' as a remote
|
||||
- Create worktree at `~/wt/humanlayer/eng-1696`
|
||||
- Set up the environment
|
||||
- Launch Claude with: "We're working on ENG-1696 - fetch the issue and then await further instructions"
|
||||
Reference in New Issue
Block a user