Repository navigation
feat(workflow): add review workflow helper scripts - #92
Conversation
Add utility scripts to streamline the code review workflow process. These scripts encapsulate common operations used by agents during task completion. Co-Authored-By: Claude Opus 4.5 <[email protected]>
📝 WalkthroughWalkthroughThis pull request extracts common inline Git and shell commands from agent documentation and complete-task workflows into dedicated utility scripts. Four new scripts are added for retrieving changed files, extracting issue numbers, setting up review directories, and writing review files. A permissions rule is removed from settings.json. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||||
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||||||||
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @scripts/setup-review-dir.sh:
- Around line 8-10: The script uses BRANCH=$(git branch --show-current) and then
mkdir -p "reviews/$BRANCH" which will create a wrong directory when BRANCH is
empty (detached HEAD); detect if BRANCH is empty after the git command and exit
with a non-zero status and a clear error message (e.g., "Detached HEAD or no
branch detected: aborting") instead of proceeding to mkdir, ensuring downstream
code never receives an empty BRANCH variable.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (8)
.claude/agents/bug-scanner.md.claude/agents/code-review.md.claude/commands/complete-task.md.claude/settings.jsonscripts/get-changed-files.shscripts/get-issue-number.shscripts/setup-review-dir.shscripts/write-review.sh
💤 Files with no reviewable changes (1)
- .claude/settings.json
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-09T18:58:21.008Z
Learning: Always use scripts in `./scripts/` for git and GitHub operations (PRs, issues, tasks). Do not use `gh` or `git` commands directly unless no script exists. If you need functionality that doesn't have a script, propose creating one
📚 Learning: 2026-01-06T18:02:51.422Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 58
File: scripts/get-pr-feedback.sh:45-55
Timestamp: 2026-01-06T18:02:51.422Z
Learning: In shell scripts that call GraphQL APIs (e.g., scripts/get-pr-feedback.sh and similar), prefer using sed-based interpolation for GraphQL variables instead of gh api graphql's -f/-F flags. Rationale: sed-based interpolation is typically simpler and more robust in Bash contexts, avoids JSON encoding pitfalls, and keeps the script portable. Implement by building the GraphQL query as a string and substituting variables with sed or parameter expansion, ensuring proper escaping. If you must use -f/-F, provide clear justification in a comment.
Applied to files:
scripts/get-changed-files.shscripts/get-issue-number.shscripts/write-review.shscripts/setup-review-dir.sh
📚 Learning: 2026-01-06T18:13:47.289Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 58
File: scripts/reply-to-thread.sh:1-12
Timestamp: 2026-01-06T18:13:47.289Z
Learning: In shell scripts across the repository (e.g., scripts/reply-to-thread.sh), keep the code simple by not adding explicit preflight tool-availability checks for external commands (like gh or jq) when those tools would fail on first use anyway. Such checks add boilerplate without changing behavior. If you must guard against missing tools, prefer a minimal, early startup check or rely on the script failing naturally at the point of use.
Applied to files:
scripts/get-changed-files.shscripts/get-issue-number.shscripts/write-review.shscripts/setup-review-dir.sh
📚 Learning: 2026-01-09T18:10:15.724Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 85
File: .claude/commands/post-merge-completion.md:35-39
Timestamp: 2026-01-09T18:10:15.724Z
Learning: In .claude/commands/post-merge-completion.md, the review files in `reviews/<branch>/` (code-review.md, bug-scanner.md, task-check.md, doc-suggestions.md) are optional inputs to the reflection process. The post-merge-completion command should work gracefully even if these files are missing or if /complete-task wasn't run before merging.
Applied to files:
.claude/commands/complete-task.md.claude/agents/bug-scanner.md.claude/agents/code-review.md
📚 Learning: 2026-01-07T08:54:48.071Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/workflow/code-review.md:0-0
Timestamp: 2026-01-07T08:54:48.071Z
Learning: Applies to docs/workflow/**/*.{ts,tsx,js,jsx} : Review usage of `/* v8 ignore next -- preserve */` coverage skip directives. This is only acceptable for unreachable code needed to satisfy the compiler. Most cases should be solved by extracting code or writing tests to mock behavior.
Applied to files:
.claude/agents/code-review.md
🔇 Additional comments (9)
.claude/agents/bug-scanner.md (1)
15-15: LGTM! Clean refactoring to use centralized script.This change aligns with the repository pattern of using dedicated scripts for git operations rather than inline commands. Based on learnings, this is the preferred approach for consistency and maintainability.
scripts/write-review.sh (1)
1-17: LGTM! Clean stdin-to-file utility.The script correctly:
- Validates required arguments
- Creates intermediate directories
- Writes stdin to the target path
- Provides user feedback
The implementation is straightforward and follows shell best practices.
scripts/get-changed-files.sh (1)
1-30: LGTM! Solid implementation of file enumeration utility.The script correctly:
- Parses optional
--filterparameter- Combines changed (staged/unstaged) and untracked files
- Applies regex filtering when requested
- Uses
|| trueto handle empty filter results gracefully withset -eThe command substitution on line 24 is appropriate for typical filenames. The implementation aligns with the documented use cases in the agent files.
.claude/agents/code-review.md (1)
21-24: LGTM! Excellent refactoring with improved clarity.The change:
- Replaces inline git commands with the new centralized script
- Uses the
--filterparameter to restrict to TypeScript and shell files- Simplifies the messaging about the early exit condition
This aligns with the repository learning to always use scripts in
./scripts/for git operations. The regex filter\.(ts|tsx|sh)$correctly matches the intended file types.scripts/get-issue-number.sh (1)
1-9: Executable permissions confirmed for all scripts.The implementation is clean and handles edge cases correctly (e.g., branches without issue numbers return empty string via
|| true). All scripts in the PR have proper executable permissions set..claude/commands/complete-task.md (2)
63-63: LGTM! Good refactoring to use dedicated script.This change aligns with the codebase convention to use scripts in
./scripts/for git operations. The script also handles directory creation, making this a clean improvement.Based on learnings, this follows the preferred pattern of using repository scripts instead of direct git commands.
76-76: No action required. The script./scripts/get-issue-number.shexists in the repository and has executable permissions. The code is safe to use.Likely an incorrect or invalid review comment.
scripts/setup-review-dir.sh (2)
6-6: LGTM! Excellent use of strict error handling.The
set -euo pipefailis the correct choice for ensuring the script fails fast on errors, undefined variables, or pipeline failures.
1-1: [rewritten comment]
[classification tag]



User description
Summary
Test plan
Generated with Claude Code
PR Type
Enhancement
Description
Add 4 utility scripts for code review workflow operations
Refactor agent commands to use helper scripts for consistency
Remove redundant inline git commands in favor of reusable utilities
Simplify permissions configuration by removing unused script allowlist
Diagram Walkthrough
File Walkthrough
get-changed-files.sh
List changed and untracked files with filteringscripts/get-changed-files.sh
--filterparameter for regex pattern matchinggit diff --name-only HEADandgit ls-files --others--exclude-standardset -euo pipefailget-issue-number.sh
Extract issue number from branch namescripts/get-issue-number.sh
issue-pattern in branch namesetup-review-dir.sh
Create review directory for current branchscripts/setup-review-dir.sh
reviews//directorywrite-review.sh
Write review content to file from stdinscripts/write-review.sh
needed
reviews/bug-scanner.md
Refactor to use get-changed-files helper script.claude/agents/bug-scanner.md
./scripts/get-changed-files.shcallcode-review.md
Refactor to use filtered get-changed-files script.claude/agents/code-review.md
./scripts/get-changed-files.sh--filtercallscript call
complete-task.md
Refactor task completion to use helper scripts.claude/commands/complete-task.md
./scripts/setup-review-dir.shcall./scripts/get-issue-number.shcallinvocations
settings.json
Remove unused script permissions allowlist.claude/settings.json
allowpermissions array that referencedsubmit-pr.shscriptdenypermissions for protected configuration filesSummary by CodeRabbit
Refactor
Chores
✏️ Tip: You can customize this high-level summary in your review settings.