Skip to content

Commit 9a01fe5

Browse files
Claude Code Botclaude
andcommitted
fix(code-critic): fix remaining set -e dead code in all examples
Triple-agent review found the set -e + $? dead code pattern was only fixed in the pre-commit example but persisted in: - GIT_HOOKS.md pre-push hook example - GIT_HOOKS.md selective review example - USAGE.md quick setup example (also fixed trailing -p flag) All now use set +e / set -e with REVIEW_EXIT capture. Also softened Config/IaC self-review note for accuracy. AI review: code-critic:adversarial-reviewer (auto via hook) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 692f94b commit 9a01fe5

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

plugins/code-critic/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ model: opus
153153

154154
To use a different model, edit `agents/adversarial-reviewer.md` and change the model field.
155155

156-
Note: The agent's Configuration/prompts/IaC domain awareness means it can review its own prompt file — this is intentional and useful for self-improvement workflows.
156+
Note: The agent's Configuration/prompts/IaC domain covers prompt and config files, which includes its own prompt file — useful for self-review workflows where the agent evaluates changes to its own definition.
157157

158158
## Contributing
159159

plugins/code-critic/docs/GIT_HOOKS.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ if [ -z "$DIFF" ]; then
7373
exit 0
7474
fi
7575

76-
# Run review
76+
# Run review (temporarily allow non-zero exit to capture result)
77+
set +e
7778
echo "$DIFF" | claude --agent adversarial-reviewer \
7879
--no-session-persistence \
7980
-p "Review these changes before push. Focus on:
@@ -83,8 +84,8 @@ echo "$DIFF" | claude --agent adversarial-reviewer \
8384
- Maintenance burden
8485
8586
Provide specific, actionable feedback."
86-
8787
REVIEW_EXIT=$?
88+
set -e
8889

8990
if [ $REVIEW_EXIT -ne 0 ]; then
9091
echo "${RED}❌ Code Critic found issues${NC}"
@@ -182,6 +183,8 @@ fi
182183
echo "🔒 Security-critical files detected, running adversarial review..."
183184
echo "$CRITICAL_FILES"
184185

186+
# Run review (temporarily allow non-zero exit to capture result)
187+
set +e
185188
git diff origin/main...HEAD | claude --agent adversarial-reviewer \
186189
--no-session-persistence \
187190
-p "Review these security-critical changes:
@@ -195,8 +198,10 @@ Focus on:
195198
- XSS vulnerabilities
196199
- Race conditions
197200
- Data exposure"
201+
REVIEW_EXIT=$?
202+
set -e
198203

199-
if [ $? -ne 0 ]; then
204+
if [ $REVIEW_EXIT -ne 0 ]; then
200205
echo "❌ Security review failed"
201206
exit 1
202207
fi

plugins/code-critic/docs/USAGE.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,14 @@ if [ -z "$FILES" ]; then
190190
fi
191191

192192
echo "Running adversarial code review..."
193-
git diff origin/main...HEAD | claude --agent adversarial-reviewer -p "Review these changes before push" --no-session-persistence -p
193+
set +e
194+
git diff origin/main...HEAD | claude --agent adversarial-reviewer \
195+
--no-session-persistence \
196+
-p "Review these changes before push"
197+
REVIEW_EXIT=$?
198+
set -e
194199

195-
if [ $? -ne 0 ]; then
200+
if [ $REVIEW_EXIT -ne 0 ]; then
196201
echo "❌ Adversarial review found critical issues"
197202
exit 1
198203
fi

0 commit comments

Comments
 (0)