|
13 | 13 | git pull |
14 | 14 | git status --porcelain # stp |
15 | 15 |
|
16 | | -# PR create v4.0 |
| 16 | +# PR create v4.1 |
17 | 17 | [group('Process')] |
18 | 18 | pr: _has_commits && pr_checks |
19 | 19 | #!/usr/bin/env bash |
@@ -146,7 +146,7 @@ release rel_version: |
146 | 146 |
|
147 | 147 | # watch GHAs then check for Copilot suggestions |
148 | 148 | [group('Process')] |
149 | | -pr_checks: _on_a_pull_request |
| 149 | +pr_checks: _on_a_pull_request && claude_review |
150 | 150 | #!/usr/bin/env bash |
151 | 151 |
|
152 | 152 | gh pr checks --watch -i 5 |
@@ -185,6 +185,13 @@ pr_checks: _on_a_pull_request |
185 | 185 | } |
186 | 186 | ' |
187 | 187 |
|
| 188 | + # chains to claude_review |
| 189 | + |
| 190 | +# Claude's latest PR code review |
| 191 | +[group('Process')] |
| 192 | +claude_review: _on_a_pull_request |
| 193 | + #!/usr/bin/env bash |
| 194 | + |
188 | 195 | # did Claude comment? |
189 | 196 | echo -e "\n\n🟧🟠🔶🔸 Claude:" |
190 | 197 | gh pr view --json comments --jq '[.comments[] | select(.author.login == "claude")] | last | .body' |
@@ -317,3 +324,77 @@ pr_verify: _on_a_pull_request |
317 | 324 |
|
318 | 325 | # cleanup |
319 | 326 | rm "$stdin_content" "$bodyfile" "$updated_body" |
| 327 | + |
| 328 | +# check how long ago the last release was |
| 329 | +[group('Process')] |
| 330 | +release_age: |
| 331 | + #!/usr/bin/env bash |
| 332 | + set -euo pipefail # strict mode |
| 333 | + |
| 334 | + echo "{{BLUE}}Checking last release age...{{NORMAL}}" |
| 335 | + echo "" |
| 336 | + |
| 337 | + # Get the latest release tag using JSON for robustness |
| 338 | + release_tag=$(gh release list --limit 1 --json tagName -q '.[0].tagName' 2>/dev/null) |
| 339 | + |
| 340 | + if [[ -z "$release_tag" ]]; then |
| 341 | + echo "{{YELLOW}}No releases found{{NORMAL}}" |
| 342 | + exit 0 |
| 343 | + fi |
| 344 | + |
| 345 | + # Get release date using JSON |
| 346 | + release_date=$(gh release view "$release_tag" --json publishedAt -q .publishedAt 2>/dev/null | cut -d'T' -f1) |
| 347 | + |
| 348 | + if [[ -z "$release_date" ]]; then |
| 349 | + echo "{{RED}}Could not determine release date{{NORMAL}}" |
| 350 | + exit 1 |
| 351 | + fi |
| 352 | + |
| 353 | + # Convert release date to epoch seconds (cross-platform) |
| 354 | + # Try GNU date first (Linux), then BSD date (macOS) |
| 355 | + if release_epoch=$(date -d "$release_date" +%s 2>/dev/null); then |
| 356 | + # GNU date (Linux) |
| 357 | + current_epoch=$(date +%s) |
| 358 | + elif release_epoch=$(date -j -f "%Y-%m-%d" "$release_date" +%s 2>/dev/null); then |
| 359 | + # BSD date (macOS) |
| 360 | + current_epoch=$(date +%s) |
| 361 | + else |
| 362 | + echo "{{RED}}Could not parse release date: $release_date{{NORMAL}}" |
| 363 | + exit 1 |
| 364 | + fi |
| 365 | + |
| 366 | + days_old=$(( (current_epoch - release_epoch) / 86400 )) |
| 367 | + |
| 368 | + # Count commits since last release on main/master branch |
| 369 | + if git rev-parse --verify main >/dev/null 2>&1; then |
| 370 | + main_branch="main" |
| 371 | + elif git rev-parse --verify master >/dev/null 2>&1; then |
| 372 | + main_branch="master" |
| 373 | + else |
| 374 | + echo "{{RED}}Could not find main or master branch{{NORMAL}}" |
| 375 | + exit 1 |
| 376 | + fi |
| 377 | + |
| 378 | + commits_since=$(git rev-list --count "${release_tag}..${main_branch}" 2>/dev/null || echo "0") |
| 379 | + |
| 380 | + # Display results with color coding |
| 381 | + echo "Latest release: {{CYAN}}$release_tag{{NORMAL}}" |
| 382 | + echo "Published: {{CYAN}}$release_date{{NORMAL}}" |
| 383 | + |
| 384 | + if [[ $days_old -gt 60 ]]; then |
| 385 | + echo "Age: {{YELLOW}}$days_old days old{{NORMAL}}" |
| 386 | + echo "Commits since release: {{YELLOW}}$commits_since{{NORMAL}}" |
| 387 | + echo "" |
| 388 | + echo "{{YELLOW}}⚠ Release is more than 60 days old - consider creating a new release{{NORMAL}}" |
| 389 | + else |
| 390 | + echo "Age: {{GREEN}}$days_old days old{{NORMAL}}" |
| 391 | + echo "Commits since release: {{GREEN}}$commits_since{{NORMAL}}" |
| 392 | + fi |
| 393 | + |
| 394 | +# push changes, update PR description, and watch GHAs |
| 395 | +[group('Process')] |
| 396 | +again: |
| 397 | + git push |
| 398 | + just pr_update |
| 399 | + sleep 2 |
| 400 | + just pr_checks |
0 commit comments