@mrkaran/hodor 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +175 -0
- package/dist/chunk-QGUJENIG.js +1722 -0
- package/dist/chunk-QGUJENIG.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +252 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +178 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/package.json +61 -0
- package/templates/tool-review.md +125 -0
package/README.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
<a href="https://zerodha.tech"><img src="https://zerodha.tech/static/images/github-badge.svg" align="right" /></a>
|
|
2
|
+
|
|
3
|
+
# Hodor
|
|
4
|
+
|
|
5
|
+
> Agentic code reviewer for GitHub PRs, GitLab MRs, and local diffs. Powered by the [pi-coding-agent](https://github.com/badlogic/pi-mono) SDK.
|
|
6
|
+
|
|
7
|
+
Hodor runs as a stateful agent with tools (`bash`, `grep`, `read`, `git diff`) to autonomously analyze code changes, find bugs, and post structured reviews.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# npx (zero install, always latest)
|
|
13
|
+
npx @mrkaran/hodor <PR_URL>
|
|
14
|
+
|
|
15
|
+
# Global install
|
|
16
|
+
npm install -g @mrkaran/hodor
|
|
17
|
+
|
|
18
|
+
# Docker
|
|
19
|
+
docker pull ghcr.io/mr-karan/hodor:latest
|
|
20
|
+
|
|
21
|
+
# From source
|
|
22
|
+
git clone https://github.com/mr-karan/hodor && cd hodor
|
|
23
|
+
bun install && bun run build
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Review a GitHub PR
|
|
30
|
+
hodor https://github.com/owner/repo/pull/123
|
|
31
|
+
|
|
32
|
+
# Review a GitLab MR (including self-hosted)
|
|
33
|
+
hodor https://gitlab.example.com/org/project/-/merge_requests/42
|
|
34
|
+
|
|
35
|
+
# Post the review as a comment
|
|
36
|
+
hodor <PR_URL> --post
|
|
37
|
+
|
|
38
|
+
# Review local changes (no PR URL needed)
|
|
39
|
+
hodor --local # diff against origin/main
|
|
40
|
+
hodor --local --diff-against HEAD~1 # diff against specific ref
|
|
41
|
+
hodor --local --diff-against feature-branch
|
|
42
|
+
|
|
43
|
+
# Use a different model
|
|
44
|
+
hodor <PR_URL> --model openai/gpt-5
|
|
45
|
+
hodor <PR_URL> --model bedrock/converse/anthropic.claude-sonnet-4-5-v2
|
|
46
|
+
|
|
47
|
+
# Extended reasoning for complex PRs
|
|
48
|
+
hodor <PR_URL> --reasoning-effort high
|
|
49
|
+
hodor <PR_URL> --ultrathink
|
|
50
|
+
|
|
51
|
+
# Custom review instructions
|
|
52
|
+
hodor <PR_URL> --prompt "Focus on SQL injection and auth bypasses"
|
|
53
|
+
hodor <PR_URL> --prompt-file .hodor/security-review.md
|
|
54
|
+
|
|
55
|
+
# Verbose mode (watch the agent think)
|
|
56
|
+
hodor <PR_URL> -v
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Docker:**
|
|
60
|
+
```bash
|
|
61
|
+
docker run --rm \
|
|
62
|
+
-e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
|
|
63
|
+
-e GITHUB_TOKEN=$GITHUB_TOKEN \
|
|
64
|
+
ghcr.io/mr-karan/hodor:latest \
|
|
65
|
+
https://github.com/owner/repo/pull/123 --post
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Configuration
|
|
69
|
+
|
|
70
|
+
### CLI Flags
|
|
71
|
+
|
|
72
|
+
| Flag | Default | Description |
|
|
73
|
+
|------|---------|-------------|
|
|
74
|
+
| `--model` | `anthropic/claude-sonnet-4-5` | LLM model (Anthropic, OpenAI, or Bedrock) |
|
|
75
|
+
| `--reasoning-effort` | – | Extended thinking: `low`, `medium`, `high` |
|
|
76
|
+
| `--ultrathink` | Off | Maximum reasoning effort |
|
|
77
|
+
| `--local` | Off | Review local changes (no PR URL required) |
|
|
78
|
+
| `--diff-against` | `origin/main` | Git ref to diff against in local mode |
|
|
79
|
+
| `--post` | Off | Post review comment to GitHub/GitLab |
|
|
80
|
+
| `--prompt` | – | Append custom instructions to the review prompt |
|
|
81
|
+
| `--prompt-file` | – | Replace the review prompt entirely |
|
|
82
|
+
| `--workspace` | Temp dir | Workspace directory (re-use for faster multi-PR reviews) |
|
|
83
|
+
| `--bedrock-tags` | – | JSON cost allocation tags for AWS Bedrock |
|
|
84
|
+
| `--prometheus-push` | – | Push metrics to a Prometheus Pushgateway URL |
|
|
85
|
+
| `-v, --verbose` | Off | Stream agent reasoning and tool calls |
|
|
86
|
+
|
|
87
|
+
### Environment Variables
|
|
88
|
+
|
|
89
|
+
| Variable | Purpose |
|
|
90
|
+
|----------|---------|
|
|
91
|
+
| `ANTHROPIC_API_KEY` | Claude API key |
|
|
92
|
+
| `OPENAI_API_KEY` | OpenAI API key |
|
|
93
|
+
| `LLM_API_KEY` | Generic fallback (used when provider-specific key is not set) |
|
|
94
|
+
| `GITHUB_TOKEN` / `GITLAB_TOKEN` | Post comments to PRs/MRs (only with `--post`) |
|
|
95
|
+
| `AWS_PROFILE` or `AWS_ACCESS_KEY_ID` | AWS Bedrock auth (no API key needed) |
|
|
96
|
+
|
|
97
|
+
## CI/CD
|
|
98
|
+
|
|
99
|
+
### GitHub Actions
|
|
100
|
+
|
|
101
|
+
```yaml
|
|
102
|
+
name: Hodor Review
|
|
103
|
+
on:
|
|
104
|
+
pull_request:
|
|
105
|
+
types: [opened, synchronize]
|
|
106
|
+
|
|
107
|
+
jobs:
|
|
108
|
+
review:
|
|
109
|
+
runs-on: ubuntu-latest
|
|
110
|
+
container: ghcr.io/mr-karan/hodor:latest
|
|
111
|
+
steps:
|
|
112
|
+
- name: Run Hodor
|
|
113
|
+
env:
|
|
114
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
115
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
116
|
+
run: |
|
|
117
|
+
hodor "https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}" --post
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### GitLab CI
|
|
121
|
+
|
|
122
|
+
```yaml
|
|
123
|
+
include:
|
|
124
|
+
- project: 'commons/gitlab-templates'
|
|
125
|
+
ref: master
|
|
126
|
+
file: '/hodor/.gitlab-ci-template.yml'
|
|
127
|
+
|
|
128
|
+
hodor-review:
|
|
129
|
+
extends: .hodor-review
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
See [AUTOMATED_REVIEWS.md](./docs/AUTOMATED_REVIEWS.md) for advanced workflows.
|
|
133
|
+
|
|
134
|
+
## Token Optimization
|
|
135
|
+
|
|
136
|
+
Hodor automatically optimizes token usage:
|
|
137
|
+
|
|
138
|
+
- **Diff embedding**: For PRs under 200KB, the diff is embedded directly in the prompt, cutting turns from ~60 to ~5.
|
|
139
|
+
- **Incremental reviews**: On re-runs, only reviews changes since the last hodor comment (detected via SHA markers).
|
|
140
|
+
- **Compaction**: SDK auto-summarizes older turns when context grows too large.
|
|
141
|
+
|
|
142
|
+
## Skills
|
|
143
|
+
|
|
144
|
+
Hodor discovers repository-specific review guidelines from `.pi/skills/` or `.hodor/skills/`. Create a skill file to enforce conventions:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
mkdir -p .hodor/skills/review-guidelines
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
```markdown
|
|
151
|
+
# .hodor/skills/review-guidelines/SKILL.md
|
|
152
|
+
---
|
|
153
|
+
name: review-guidelines
|
|
154
|
+
description: Security and performance review checklist.
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
- All API endpoints must have authentication checks.
|
|
158
|
+
- Database queries must use parameterized statements.
|
|
159
|
+
- API responses should be < 200ms p95.
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Skills are loaded automatically during reviews. See [SKILLS.md](./docs/SKILLS.md) for details.
|
|
163
|
+
|
|
164
|
+
## Development
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
bun install # Install dependencies
|
|
168
|
+
bun run build # Build
|
|
169
|
+
bun run test # Run tests
|
|
170
|
+
bun run dev -- <url> # Run from source
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## License
|
|
174
|
+
|
|
175
|
+
MIT
|