Skip to content

Commit 00e8cb8

Browse files
committed
chore(dotfiles): apply review fixes and format/lint updates
1 parent 8a2922c commit 00e8cb8

37 files changed

Lines changed: 955 additions & 597 deletions

.agents/commands/worktree-pr.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ Migrate changes from a worktree to a new branch cut from main (or a specified ba
44

55
## Arguments
66

7-
$ARGUMENTS = `[branch-name] [base-branch=main]`
7+
$ARGUMENTS = `[branch_name] [base_branch=main]`
88

9-
- **branch-name** (optional): Name of the branch to create (e.g., `feat/add-buy-agent`)
10-
- **base-branch** (optional): Base branch to cut from (default: `main`)
9+
- **branch_name** (optional): Name of the branch to create (e.g., `feat/add-buy-agent`)
10+
- **base_branch** (optional): Base branch to cut from (default: `main`)
1111

12-
### Auto-generated Branch Name (when branch-name is omitted)
12+
### Auto-generated Branch Name (when branch_name is omitted)
1313

14-
When branch-name is omitted, the branch name is automatically determined from the **change analysis in Step 2**.
14+
When branch_name is omitted, the branch name is automatically determined from the **change analysis in Step 2**.
1515

1616
#### Auto-naming Rules
1717

@@ -52,38 +52,38 @@ git branch --show-current
5252
# Full picture of changes (staged + unstaged + untracked)
5353
git status --porcelain=v1
5454

55-
# Committed changes ahead of origin/base-branch
56-
git log origin/${base-branch}..HEAD --oneline 2>/dev/null || echo "No commits ahead"
55+
# Committed changes ahead of origin/base_branch
56+
git log origin/${base_branch}..HEAD --oneline 2>/dev/null || echo "No commits ahead"
5757

58-
# Diff stat against origin/base-branch
59-
git diff origin/${base-branch} --stat 2>/dev/null
58+
# Diff stat against origin/base_branch
59+
git diff origin/${base_branch} --stat 2>/dev/null
6060

6161
# Fetch latest from remote
62-
git fetch origin ${base-branch}
62+
git fetch origin ${base_branch}
6363
```
6464

6565
### 2. Analyze Changes
6666

67-
1. Analyze **all changes** by combining `git diff origin/${base-branch}` (committed + unstaged) with untracked files
67+
1. Analyze **all changes** by combining `git diff origin/${base_branch}` (committed + unstaged) with untracked files
6868
2. Read the content of each changed file and determine:
6969
- Functional grouping (which responsibility/layer each change belongs to)
7070
- Intent of each group (feat / fix / refactor / chore / docs / test / style / perf)
7171
- Appropriate scope (e.g., db, api, web, infra, auth, etc.)
7272
3. Plan the commit strategy (following the format described below)
73-
4. **If branch-name was omitted**: Determine the branch name from the analysis above using the auto-naming rules
73+
4. **If branch_name was omitted**: Determine the branch name from the analysis above using the auto-naming rules
7474
- Generate `${type}/${slug}` from the most dominant type and scope across all changes
7575
- If an active spec exists under `.kiro/specs/`, reflect its feature name in the slug
7676

7777
### 3. Create Branch and Migrate Changes
7878

79-
**Case A: Uncommitted changes only (HEAD is the same as origin/${base-branch}, or no commits ahead)**
79+
**Case A: Uncommitted changes only (HEAD is the same as origin/${base_branch}, or no commits ahead)**
8080

8181
```bash
8282
# Stash all changes
83-
git stash push -u -m "worktree-pr: temp stash for ${branch-name}"
83+
git stash push -u -m "worktree-pr: temp stash for ${branch_name}"
8484

85-
# Create new branch from origin/${base-branch}
86-
git checkout -b ${branch-name} origin/${base-branch}
85+
# Create new branch from origin/${base_branch}
86+
git checkout -b ${branch_name} origin/${base_branch}
8787

8888
# Apply stashed changes
8989
git stash pop
@@ -93,19 +93,19 @@ git stash pop
9393

9494
```bash
9595
# Record the range of committed changes
96-
FIRST_COMMIT=$(git log origin/${base-branch}..HEAD --reverse --format='%H' | head -1)
96+
FIRST_COMMIT=$(git log origin/${base_branch}..HEAD --reverse --format='%H' | head -1)
9797
LAST_COMMIT=$(git rev-parse HEAD)
9898

9999
# Stash uncommitted changes if any
100-
git stash push -u -m "worktree-pr: temp stash for ${branch-name}" 2>/dev/null
100+
git stash push -u -m "worktree-pr: temp stash for ${branch_name}" 2>/dev/null
101101

102-
# Create new branch from origin/${base-branch}
103-
git checkout -b ${branch-name} origin/${base-branch}
102+
# Create new branch from origin/${base_branch}
103+
git checkout -b ${branch_name} origin/${base_branch}
104104

105105
# Cherry-pick committed changes
106106
git cherry-pick ${FIRST_COMMIT}^..${LAST_COMMIT}
107107
# If cherry-pick conflicts: fall back to soft reset for manual commit
108-
# git reset --soft origin/${base-branch}
108+
# git reset --soft origin/${base_branch}
109109

110110
# Apply stash if present
111111
git stash pop 2>/dev/null
@@ -114,14 +114,14 @@ git stash pop 2>/dev/null
114114
**Case C: Patch-based migration (fallback when Case B conflicts)**
115115

116116
```bash
117-
# Create patch of all diffs against origin/${base-branch}
118-
git diff origin/${base-branch} > /tmp/worktree-pr.patch
117+
# Create patch of all diffs against origin/${base_branch}
118+
git diff origin/${base_branch} > /tmp/worktree-pr.patch
119119

120120
# Archive untracked files
121-
git ls-files --others --exclude-standard -z | xargs -0 tar czf /tmp/worktree-pr-untracked.tar.gz 2>/dev/null
121+
git ls-files --others --exclude-standard -z | xargs -0 --no-run-if-empty tar czf /tmp/worktree-pr-untracked.tar.gz 2>/dev/null
122122

123123
# Create new branch
124-
git checkout -b ${branch-name} origin/${base-branch}
124+
git checkout -b ${branch_name} origin/${base_branch}
125125

126126
# Apply patch
127127
git apply /tmp/worktree-pr.patch
@@ -138,7 +138,7 @@ Based on the analysis from Step 2, commit changes in logical groups. **Follow `.
138138
### 5. Push
139139

140140
```bash
141-
git push -u origin ${branch-name}
141+
git push -u origin ${branch_name}
142142
```
143143

144144
### 6. Create PR
@@ -181,7 +181,7 @@ Create a pull request using `gh pr create`.
181181

182182
```bash
183183
gh pr create \
184-
--base ${base-branch} \
184+
--base ${base_branch} \
185185
--title "${pr_title}" \
186186
--body "$(cat <<'EOF'
187187
${pr_body}
@@ -208,6 +208,6 @@ Report the PR URL to the user as the final output.
208208
- Follow `.gitignore` strictly. Additionally, never stage `.env`, `.cursor/**` (except commands)
209209
- Never commit files containing credentials or secrets
210210
- If a conflict occurs, report the situation to the user and ask for instructions
211-
- Default base-branch to `main` when omitted
212-
- Auto-generate branch-name from change analysis when omitted (see auto-naming rules)
213-
- If the branch-name (specified or auto-generated) already exists, report an error and suggest an alternative name
211+
- Default base_branch to `main` when omitted
212+
- Auto-generate branch_name from change analysis when omitted (see auto-naming rules)
213+
- If the branch_name (specified or auto-generated) already exists, report an error and suggest an alternative name

.agents/skills/create-pr/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Note: Keep commands CI-safe and avoid interactive `gh` prompts. Ensure `GH_TOKEN
8080

8181
16. After successful merge, check if we're in a git worktree:
8282
- Run: `[ "$(git rev-parse --git-common-dir)" != "$(git rev-parse --git-dir)" ]`
83-
- **If in a worktree**: Use the ask user question tool (`request_user_input`) to ask if they want to clean up the worktree. If yes, run `wt remove --yes --force` to remove the worktree and local branch, then switch back to the main worktree.
83+
- **If in a worktree**: Use the ask user question tool (`request_user_input`) to ask if they want to clean up the worktree. If yes, run `git worktree remove --force` to remove the worktree and local branch, then switch back to the main worktree.
8484
- **If not in a worktree**: Just switch back to main with `git checkout main && git pull`
8585

8686
## Completion

.agents/skills/create-pr/scripts/poll-pr.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ if ! [[ "$interval" =~ ^[0-9]+$ && "$minutes" =~ ^[0-9]+$ ]]; then
7878
echo "interval and minutes must be integers." >&2
7979
exit 1
8080
fi
81+
if (( interval < 1 || minutes < 0 )); then
82+
echo "interval must be >= 1 and minutes must be >= 0." >&2
83+
exit 1
84+
fi
8185

8286
iterations=$(( (minutes * 60) / interval ))
8387
if (( iterations < 1 )); then
@@ -187,7 +191,8 @@ for i in $(seq 1 "$iterations"); do
187191
changed=1
188192
fi
189193

190-
issue_line=$(gh api "repos/$repo/issues/$pr/comments?per_page=100" --jq '
194+
issue_line=$(gh api --paginate --slurp "repos/$repo/issues/$pr/comments?per_page=100" --jq '
195+
[ .[][] ] |
191196
if length == 0 then "" else
192197
(max_by(.created_at)) | "\(.id)\t\(.created_at)\t\(.user.login)\t\(.html_url)\t\(.body | gsub("\\n"; " ") | gsub("\\t"; " ") | .[0:200])"
193198
end
@@ -201,7 +206,8 @@ for i in $(seq 1 "$iterations"); do
201206
fi
202207
fi
203208

204-
review_comment_line=$(gh api "repos/$repo/pulls/$pr/comments?per_page=100" --jq '
209+
review_comment_line=$(gh api --paginate --slurp "repos/$repo/pulls/$pr/comments?per_page=100" --jq '
210+
[ .[][] ] |
205211
if length == 0 then "" else
206212
(max_by(.created_at)) | "\(.id)\t\(.created_at)\t\(.user.login)\t\(.html_url)\t\(.body | gsub("\\n"; " ") | gsub("\\t"; " ") | .[0:200])"
207213
end
@@ -215,8 +221,8 @@ for i in $(seq 1 "$iterations"); do
215221
fi
216222
fi
217223

218-
review_line=$(gh api "repos/$repo/pulls/$pr/reviews?per_page=100" --jq '
219-
[ .[] | select(.submitted_at != null) ] |
224+
review_line=$(gh api --paginate --slurp "repos/$repo/pulls/$pr/reviews?per_page=100" --jq '
225+
[ .[][] | select(.submitted_at != null) ] |
220226
if length == 0 then "" else
221227
(max_by(.submitted_at)) | "\(.id)\t\(.submitted_at)\t\(.user.login)\t\(.html_url)\t\(.state)\t\(.body | gsub("\\n"; " ") | gsub("\\t"; " ") | .[0:200])"
222228
end

.agents/skills/create-pr/scripts/triage-pr.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ if [[ -n "$failed_checks" ]]; then
9797
done <<< "$failed_checks"
9898
fi
9999

100-
review_line=$(gh api "repos/$repo/pulls/$pr/reviews?per_page=100" --jq '
101-
[ .[] | select(.submitted_at != null) ] |
100+
review_line=$(gh api --paginate --slurp "repos/$repo/pulls/$pr/reviews?per_page=100" --jq '
101+
[ .[][] | select(.submitted_at != null) ] |
102102
if length == 0 then "" else
103103
(max_by(.submitted_at)) | "\(.state)\t\(.user.login)\t\(.submitted_at)\t\(.html_url)"
104104
end
@@ -108,7 +108,8 @@ if [[ -n "$review_line" ]]; then
108108
echo "REVIEW: $r_state $r_user $r_time $r_url"
109109
fi
110110

111-
issue_line=$(gh api "repos/$repo/issues/$pr/comments?per_page=100" --jq '
111+
issue_line=$(gh api --paginate --slurp "repos/$repo/issues/$pr/comments?per_page=100" --jq '
112+
[ .[][] ] |
112113
if length == 0 then "" else
113114
(max_by(.created_at)) | "\(.user.login)\t\(.created_at)\t\(.html_url)\t\(.body | gsub("\\n"; " ") | gsub("\\t"; " ") | .[0:200])"
114115
end
@@ -118,7 +119,8 @@ if [[ -n "$issue_line" ]]; then
118119
echo "COMMENT: conversation $c_user $c_time $c_url $c_body"
119120
fi
120121

121-
review_comment_line=$(gh api "repos/$repo/pulls/$pr/comments?per_page=100" --jq '
122+
review_comment_line=$(gh api --paginate --slurp "repos/$repo/pulls/$pr/comments?per_page=100" --jq '
123+
[ .[][] ] |
122124
if length == 0 then "" else
123125
(max_by(.created_at)) | "\(.user.login)\t\(.created_at)\t\(.html_url)\t\(.body | gsub("\\n"; " ") | gsub("\\t"; " ") | .[0:200])"
124126
end

0 commit comments

Comments
 (0)