Output Modes & Integration
Output Modes & Integration
Kit provides different output modes for various workflows - from direct GitHub posting to piping output to CLI code writers and custom automation systems.
Output Modes
Standard Mode
# Posts comment directly to GitHub PRkit review https://github.com/owner/repo/pull/123
Output includes: Review comment posted to GitHub, status messages, cost breakdown, and quality metrics.
Dry Run Mode (--dry-run
/ -n
)
# Shows formatted preview without postingkit review --dry-run https://github.com/owner/repo/pull/123
Output includes: Status messages, cost breakdown, quality metrics, and formatted review preview. Perfect for testing configurations and seeing full diagnostics.
Plain Mode (--plain
/ -p
)
# Clean output perfect for piping to other toolskit review --plain https://github.com/owner/repo/pull/123kit review -p https://github.com/owner/repo/pull/123
Output: Just the raw review content with no status messages or formatting. Ideal for automation and piping workflows.
Priority Filtering
Focus reviews on what matters most:
# Focus on critical issues onlykit review --priority=high https://github.com/owner/repo/pull/123
# Show important issues (high + medium priority)kit review --priority=high,medium https://github.com/owner/repo/pull/123
# Get only style/improvement suggestionskit review --priority=low https://github.com/owner/repo/pull/123
# Combine with other flagskit review -p --priority=high https://github.com/owner/repo/pull/123 | \ claude "Fix these critical security issues"
Benefits: Reduces noise, saves costs, and focuses attention on issues that matter to your workflow.
Piping to CLI Code Writers
Combine kitβs repository intelligence with your favorite CLI code-generation tooling:
Basic Piping Patterns
# Analyze with kit, implement with Claude Codekit review -p https://github.com/owner/repo/pull/123 | \ claude -p "Implement all the suggestions from this code review"
# Use specific models for cost optimizationkit review -p --model gpt-4.1-nano https://github.com/owner/repo/pull/123 | \ claude -p "Fix the high-priority issues mentioned in this review"
# Focus on critical issues onlykit review -p --priority=high https://github.com/owner/repo/pull/123 | \ claude -p "Implement these security and reliability fixes"
Advanced Multi-Stage Workflows
# Stage 1: Kit analyzes codebase contextREVIEW=$(kit review -p --model claude-3-5-haiku-20241022 <pr-url>)
# Stage 2: Claude Code implements fixesecho "$REVIEW" | claude -p "Implement these code review suggestions"
# Stage 3: Your custom toolingecho "$REVIEW" | your-priority-tracker --extract-issues
Integration Examples
Pipe to Any Tool
# Save review to filekit review -p <pr-url> > review.md
# Send to Slackkit review -p <pr-url> | curl -X POST -H 'Content-type: application/json' \ --data '{"text":"'"$(cat)"'"}' YOUR_SLACK_WEBHOOK
# Process with jq or other toolskit review -p <pr-url> | your-custom-processor
# Extract specific sectionskit review -p <pr-url> | grep -A 5 "High Priority"
# Convert to different formatskit review -p <pr-url> | pandoc -f markdown -t html > review.html
Custom Processing Scripts
Extract Security Issues:
#!/bin/bashkit review -p --priority=high "$1" | \ grep -i "security\|vulnerability\|injection\|auth" | \ while read -r line; do echo "π $line" >> security-report.md done
Team Notification System:
#!/bin/bashREVIEW=$(kit review -p "$1")CRITICAL_COUNT=$(echo "$REVIEW" | grep -c "High Priority")
if [ "$CRITICAL_COUNT" -gt 0 ]; then echo "$REVIEW" | your-slack-bot --channel security --urgentelse echo "$REVIEW" | your-slack-bot --channel code-reviewfi
CI/CD Integration Patterns
Basic GitHub Actions Integration
- name: AI Review with Plain Output run: | pip install cased-kit kit review -p ${{ github.event.pull_request.html_url }} > review.txt
# Post to PR as comment gh pr comment ${{ github.event.pull_request.number }} --body-file review.txt env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} KIT_ANTHROPIC_TOKEN: ${{ secrets.ANTHROPIC_API_KEY }}
Multi-Stage Processing
- name: AI Review with Multi-Stage Processing run: | pip install cased-kit
# Stage 1: Generate review with kit's repository intelligence REVIEW=$(kit review -p --model claude-3-5-haiku-20241022 ${{ github.event.pull_request.html_url }})
# Stage 2: Extract action items and post as separate comment echo "$REVIEW" | your-issue-tracker --extract-priorities | \ gh pr comment ${{ github.event.pull_request.number }} --body-file -
# Stage 3: Save review for later processing echo "$REVIEW" > review-${{ github.event.pull_request.number }}.md
# Stage 4: Send to team notification system echo "$REVIEW" | your-slack-notifier --channel engineering env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} KIT_ANTHROPIC_TOKEN: ${{ secrets.ANTHROPIC_API_KEY }}
Integration with External Tools
- name: Review and Process run: | pip install cased-kit
# Get clean review output for processing kit review -p ${{ github.event.pull_request.html_url }} > raw-review.txt
# Parse with your custom tools python scripts/extract-security-issues.py raw-review.txt python scripts/update-team-dashboard.py raw-review.txt python scripts/generate-metrics.py raw-review.txt
# Optional: Post processed results back to PR gh pr comment ${{ github.event.pull_request.number }} --body-file processed-summary.md
Cost Optimization Strategies
Budget-Conscious Multi-Stage Analysis
# Stage 1: Quick high-priority scan with budget modelHIGH_ISSUES=$(kit review -p --model gpt-4o-mini --priority=high <pr-url>)
# Stage 2: If critical issues found, do full review with premium modelif echo "$HIGH_ISSUES" | grep -q "High Priority"; then kit review --model claude-sonnet-4 <pr-url>else echo "$HIGH_ISSUES" | gh pr comment $PR_NUMBER --body-file -fi
Model Selection Based on Content
#!/bin/bashPR_URL=$1PR_NUMBER=$(echo "$PR_URL" | grep -o '/pull/[0-9]*' | cut -d'/' -f3)
# Check PR size and select appropriate modelFILES_CHANGED=$(gh pr view "$PR_NUMBER" --json files --jq '.files | length')
if [ "$FILES_CHANGED" -gt 20 ]; then MODEL="claude-sonnet-4" # Premium for large changeselif [ "$FILES_CHANGED" -gt 5 ]; then MODEL="gpt-4.1" # Mid-tier for medium changeselse MODEL="gpt-4.1-nano" # Budget for small changesfi
kit review --model "$MODEL" -p "$PR_URL"
Best Practices
Output Mode Selection
- Standard mode: For direct GitHub integration and team collaboration
- Dry run (
--dry-run
): For testing configurations and seeing full diagnostics - Plain mode (
--plain
/-p
): For piping to CLI code composers, custom tools, or automation - Tip: Use plain mode in CI/CD for processing reviews with external systems
Piping & Integration Workflows
- Kit β Claude Code:
kit review -p <pr-url> | claude "implement these suggestions"
- Multi-tool chains: Use kit for analysis, pipe to specialized tools for processing
- Cost optimization: Use budget models for analysis, premium models for implementation
- Automation: Pipe plain output to issue trackers, notification systems, or custom processors
Error Handling in Scripts
#!/bin/bashset -e # Exit on error
PR_URL=$1if [ -z "$PR_URL" ]; then echo "Usage: $0 <pr-url>" exit 1fi
# Generate review with error handlingif REVIEW=$(kit review -p "$PR_URL" 2>/dev/null); then echo "β
Review generated successfully" echo "$REVIEW" | your-processorelse echo "β Review failed, check configuration" exit 1fi
Real-World Integration Examples
Slack Integration
#!/bin/bashREVIEW=$(kit review -p --priority=high,medium "$1")WEBHOOK_URL="your-slack-webhook-url"
curl -X POST -H 'Content-type: application/json' \ --data '{ "text": "π€ AI Code Review Complete", "blocks": [ { "type": "section", "text": { "type": "mrkdwn", "text": "```'"$REVIEW"'```" } } ] }' "$WEBHOOK_URL"
Jira Integration
#!/bin/bashREVIEW=$(kit review -p --priority=high "$1")CRITICAL_ISSUES=$(echo "$REVIEW" | grep -c "High Priority" || echo "0")
if [ "$CRITICAL_ISSUES" -gt 0 ]; then # Create Jira ticket for critical issues jira issue create \ --project="CODE" \ --type="Bug" \ --summary="Critical issues found in PR review" \ --description="$REVIEW"fi
Dashboard Integration
#!/usr/bin/env python3import sysimport requestsimport subprocess
def get_review(pr_url): result = subprocess.run([ 'kit', 'review', '-p', '--priority=high,medium', pr_url ], capture_output=True, text=True) return result.stdout
def post_to_dashboard(review_data): response = requests.post('https://your-dashboard.com/api/reviews', json={'content': review_data}) return response.status_code == 200
if __name__ == "__main__": pr_url = sys.argv[1] review = get_review(pr_url) success = post_to_dashboard(review) print(f"Dashboard update: {'β
' if success else 'β'}")