redline-review 1.0.0
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 +239 -0
- package/adapters/antigravity/redline-review.md +32 -0
- package/adapters/claude/redline-review.md +41 -0
- package/adapters/codex/redline-review.md +38 -0
- package/adapters/copilot/redline-review.md +38 -0
- package/adapters/opencode/redline-review.md +34 -0
- package/bin/redline-review +4 -0
- package/dist/build-context.d.ts +6 -0
- package/dist/build-context.d.ts.map +1 -0
- package/dist/build-context.js +47 -0
- package/dist/build-context.js.map +1 -0
- package/dist/detect-domains.d.ts +2 -0
- package/dist/detect-domains.d.ts.map +1 -0
- package/dist/detect-domains.js +66 -0
- package/dist/detect-domains.js.map +1 -0
- package/dist/redline-review.d.ts +3 -0
- package/dist/redline-review.d.ts.map +1 -0
- package/dist/redline-review.js +171 -0
- package/dist/redline-review.js.map +1 -0
- package/package.json +54 -0
- package/prompts/base-reviewer.md +28 -0
- package/prompts/lightweight-reviewer.md +20 -0
- package/prompts/strict-reviewer.md +24 -0
- package/rules/architecture.yaml +55 -0
- package/rules/auth.yaml +57 -0
- package/rules/concurrency.yaml +62 -0
- package/rules/correctness.yaml +108 -0
- package/rules/frontend.yaml +46 -0
- package/rules/maintainability.yaml +42 -0
- package/rules/observability.yaml +59 -0
- package/rules/performance-algorithmic.yaml +49 -0
- package/rules/performance-db.yaml +44 -0
- package/rules/performance-system.yaml +37 -0
- package/rules/risk-patterns.yaml +58 -0
- package/rules/simplicity.yaml +85 -0
- package/schemas/rule.schema.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# redline-review
|
|
2
|
+
|
|
3
|
+
Adaptive AI code review skill for any frontier agent — context-aware, rule-driven, diff-native.
|
|
4
|
+
|
|
5
|
+
`redline-review` assembles a focused review prompt from your git diff and injects only the rule categories relevant to your stack. Your agent (Claude Code, Copilot, Codex, etc.) performs the actual review using its own model. No API keys. No external calls.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Getting started
|
|
10
|
+
|
|
11
|
+
### Step 1 — Clone the repo
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
git clone https://github.com/nabil1440/redline-review
|
|
15
|
+
cd redline-review
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Step 2 — Install dependencies and build
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The build runs automatically as part of install (`prepare` script). You should see `tsc` compile without errors.
|
|
25
|
+
|
|
26
|
+
### Step 3 — Install globally
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm link
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
This makes `redline-review` available as a global command from any directory on your machine.
|
|
33
|
+
|
|
34
|
+
### Step 4 — Verify it works
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
which redline-review
|
|
38
|
+
# → /path/to/node/bin/redline-review
|
|
39
|
+
|
|
40
|
+
redline-review --help 2>&1 || redline-review | head -5
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Using as a Claude Code command
|
|
46
|
+
|
|
47
|
+
There are two ways to install the command — global (recommended) or per-project.
|
|
48
|
+
|
|
49
|
+
### Global install — available in every project
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
mkdir -p ~/.claude/commands
|
|
53
|
+
cp /path/to/redline-review/adapters/claude/redline-review.md ~/.claude/commands/redline-review.md
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
That's it. Open any project in Claude Code and `/redline-review` will be available immediately — no per-project setup needed.
|
|
57
|
+
|
|
58
|
+
### Per-project install — scoped to one project
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
cd /your/project
|
|
62
|
+
mkdir -p .claude/commands
|
|
63
|
+
cp /path/to/redline-review/adapters/claude/redline-review.md .claude/commands/redline-review.md
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Step 6 — Use it in Claude Code
|
|
67
|
+
|
|
68
|
+
Open any project in Claude Code and type:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
/redline-review
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Claude Code will:
|
|
75
|
+
|
|
76
|
+
1. Run `redline-review` as a shell command
|
|
77
|
+
2. Receive the assembled review prompt (rules + your git diff)
|
|
78
|
+
3. Perform the code review inline using its own model
|
|
79
|
+
|
|
80
|
+
You can pass flags directly:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
/redline-review --stack laravel --type auth,backend
|
|
84
|
+
/redline-review --prompt strict
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## How it works
|
|
90
|
+
|
|
91
|
+
1. Detects your git diff automatically (`git diff main...HEAD`, falls back through `master...HEAD` → `HEAD~1` → `--cached`)
|
|
92
|
+
2. **Auto-detects relevant rule categories** from the diff content (or uses your `--stack`/`--type` flags)
|
|
93
|
+
3. Prints the assembled review prompt to stdout
|
|
94
|
+
4. Your agent reads that prompt and performs the review — no external calls made by the CLI
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Flags
|
|
99
|
+
|
|
100
|
+
### `--type` — focus by concern
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
redline-review --type auth
|
|
104
|
+
redline-review --type auth,backend,performance
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
| Value | Rule categories loaded |
|
|
108
|
+
| --------------- | ----------------------------------------------------------- |
|
|
109
|
+
| `auth` | auth, correctness |
|
|
110
|
+
| `security` | auth, correctness, risk-patterns |
|
|
111
|
+
| `performance` | db-performance, system-performance, algorithmic-performance |
|
|
112
|
+
| `backend` | correctness, concurrency, observability |
|
|
113
|
+
| `frontend` | frontend, simplicity |
|
|
114
|
+
| `architecture` | architecture, maintainability |
|
|
115
|
+
| `concurrency` | concurrency, correctness |
|
|
116
|
+
| `observability` | observability, correctness |
|
|
117
|
+
| `risk` | risk-patterns, architecture |
|
|
118
|
+
|
|
119
|
+
### `--stack` — focus by technology
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
redline-review --stack laravel
|
|
123
|
+
redline-review --stack go --type backend
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
| Stack | Focus areas | Why |
|
|
127
|
+
| ------------------- | ----------------------------------------------------------- | ----------------------------------------------- |
|
|
128
|
+
| `laravel` | architecture, db-performance | ORM-heavy, layered architecture |
|
|
129
|
+
| `inertia` | frontend, architecture | SSR frontend patterns |
|
|
130
|
+
| `react` | frontend | Component & state patterns |
|
|
131
|
+
| `vue` | frontend | Component & state patterns |
|
|
132
|
+
| `svelte` | frontend | Component & state patterns |
|
|
133
|
+
| `node` | concurrency, system-performance | Async I/O, event loop |
|
|
134
|
+
| `django` | architecture, db-performance | ORM, layered architecture |
|
|
135
|
+
| `rails` | architecture, db-performance | ORM, layered architecture |
|
|
136
|
+
| `go` | concurrency, system-performance, correctness, observability | Goroutines, error handling, distributed systems |
|
|
137
|
+
| `csharp` / `dotnet` | architecture, correctness, concurrency, system-performance | DDD/clean arch, async/await, nullability |
|
|
138
|
+
| `java` | architecture, concurrency, db-performance, correctness | Spring/JPA, Hibernate N+1, thread safety |
|
|
139
|
+
|
|
140
|
+
### `--prompt` — control review depth
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
redline-review --prompt base # default
|
|
144
|
+
redline-review --prompt strict # CRITICAL and HIGH only + fix suggestions
|
|
145
|
+
redline-review --prompt lightweight # top 3 issues only
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
| Value | Output |
|
|
149
|
+
| ---------------- | ------------------------------------------------- |
|
|
150
|
+
| `base` (default) | All issues grouped CRITICAL → HIGH → MEDIUM → LOW |
|
|
151
|
+
| `strict` | CRITICAL and HIGH only, concrete fix per issue |
|
|
152
|
+
| `lightweight` | Top 3 issues, one tight paragraph each |
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Examples
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Auto-detect everything (recommended default)
|
|
160
|
+
redline-review
|
|
161
|
+
|
|
162
|
+
# Laravel + Inertia, focused on auth and backend
|
|
163
|
+
redline-review --stack laravel,inertia --type auth,backend
|
|
164
|
+
|
|
165
|
+
# Go service, strict pass (CRITICAL/HIGH only)
|
|
166
|
+
redline-review --stack go --prompt strict
|
|
167
|
+
|
|
168
|
+
# Java backend, quick scan
|
|
169
|
+
redline-review --stack java --prompt lightweight
|
|
170
|
+
|
|
171
|
+
# Security review, any stack
|
|
172
|
+
redline-review --type security
|
|
173
|
+
|
|
174
|
+
# Pipe to clipboard (macOS) — paste into any agent
|
|
175
|
+
redline-review | pbcopy
|
|
176
|
+
|
|
177
|
+
# Preview the prompt
|
|
178
|
+
redline-review | head -80
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Auto-detection
|
|
184
|
+
|
|
185
|
+
When no `--type` or `--stack` flags are given, `redline-review` scans the diff for keyword patterns and loads only the matching rule files. For example:
|
|
186
|
+
|
|
187
|
+
- Diff contains `middleware`, `policy`, `permission` → loads `auth.yaml`
|
|
188
|
+
- Diff contains `goroutine`, `mutex`, `transaction` → loads `concurrency.yaml`
|
|
189
|
+
- Diff contains `->with(`, `paginate`, `::all()` → loads `performance-db.yaml`
|
|
190
|
+
- Diff contains `useState`, `useEffect`, `.tsx` → loads `frontend.yaml`
|
|
191
|
+
|
|
192
|
+
If nothing is detected, falls back to `correctness + maintainability + risk-patterns`.
|
|
193
|
+
|
|
194
|
+
Detected domains are printed to stderr so they don't pollute the prompt:
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
Domains (auto-detected): auth.yaml, concurrency.yaml, performance-db.yaml
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Rule categories
|
|
203
|
+
|
|
204
|
+
| Category | What it catches |
|
|
205
|
+
| ------------------------- | -------------------------------------------------------------- |
|
|
206
|
+
| Auth & Authorization | Missing auth checks, IDOR, privilege bypass, hardcoded roles |
|
|
207
|
+
| Correctness & Safety | Swallowed exceptions, hidden side effects, bad error messages |
|
|
208
|
+
| Architecture & Design | God classes, responsibility leakage, bad abstractions |
|
|
209
|
+
| Frontend Heuristics | God components, duplicated state, prop drilling |
|
|
210
|
+
| Database Performance | N+1 queries, unbounded queries, overfetching |
|
|
211
|
+
| Algorithmic Performance | Nested loops, brute-force, bad complexity |
|
|
212
|
+
| System Performance | Sync waterfalls, serialized I/O, excess roundtrips |
|
|
213
|
+
| Concurrency & Consistency | Race conditions, missing transactions, non-idempotent retries |
|
|
214
|
+
| Observability | Sensitive data in logs, missing error logging, silent failures |
|
|
215
|
+
| Simplicity & Clarity | Redundant checks, nested conditionals, unclear naming |
|
|
216
|
+
| Maintainability | Large functions, implicit mutations, future change friction |
|
|
217
|
+
| Risk Patterns | Dangerous defaults, hidden blast radius, fragile assumptions |
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Other agents
|
|
222
|
+
|
|
223
|
+
Adapter files for other agents are in `adapters/`:
|
|
224
|
+
|
|
225
|
+
| Agent | File to use |
|
|
226
|
+
| -------------- | -------------------------------------------------------------------------- |
|
|
227
|
+
| Claude Code | `adapters/claude/redline-review.md` → `.claude/commands/redline-review.md` |
|
|
228
|
+
| GitHub Copilot | `adapters/copilot/redline-review.md` → `.github/copilot-instructions.md` |
|
|
229
|
+
| Codex CLI | `adapters/codex/redline-review.md` → `AGENTS.md` |
|
|
230
|
+
| OpenCode | `adapters/opencode/redline-review.md` → `AGENTS.md` |
|
|
231
|
+
| Anti-gravity | `adapters/antigravity/redline-review.md` |
|
|
232
|
+
|
|
233
|
+
Each adapter follows the same pattern: run `redline-review`, take the output as the review task.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## License
|
|
238
|
+
|
|
239
|
+
MIT
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# redline-review — Anti-gravity adapter
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install -g redline-review
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
Run the CLI in your project root:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
redline-review
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Anti-gravity will receive the assembled review prompt. Use it as the task instructions for the code review.
|
|
18
|
+
|
|
19
|
+
## Focused reviews
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
redline-review --type auth,performance
|
|
23
|
+
redline-review --stack laravel,inertia --type backend,auth
|
|
24
|
+
redline-review --prompt strict # CRITICAL/HIGH severity only
|
|
25
|
+
redline-review --prompt lightweight # top 3 issues, quick scan
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## One-shot (no global install)
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx redline-review
|
|
32
|
+
```
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# redline-review
|
|
2
|
+
|
|
3
|
+
Run `redline-review` (or `npx redline-review` if not globally installed) in the current project root.
|
|
4
|
+
|
|
5
|
+
The CLI assembles a focused code review prompt from the git diff and the installed rule set, then prints it to stdout.
|
|
6
|
+
|
|
7
|
+
**Take that output and use it as your task.** Perform the code review based on the prompt content.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install -g redline-review
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# All rules (default — base branch auto-detected)
|
|
19
|
+
redline-review
|
|
20
|
+
|
|
21
|
+
# Pin the base branch explicitly (use when auto-detection picks the wrong base)
|
|
22
|
+
redline-review --base origin/develop
|
|
23
|
+
redline-review --base develop
|
|
24
|
+
|
|
25
|
+
# Focused by review type
|
|
26
|
+
redline-review --type auth,performance
|
|
27
|
+
|
|
28
|
+
# Focused by stack
|
|
29
|
+
redline-review --stack laravel,inertia --type backend,auth
|
|
30
|
+
|
|
31
|
+
# Strict mode (CRITICAL/HIGH only)
|
|
32
|
+
redline-review --prompt strict
|
|
33
|
+
|
|
34
|
+
# Quick scan (top 3 issues)
|
|
35
|
+
redline-review --prompt lightweight
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## How to use as a Claude Code skill
|
|
39
|
+
|
|
40
|
+
Place this file at `.claude/commands/redline-review.md` in your project.
|
|
41
|
+
Then invoke it with `/redline-review` in Claude Code.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# redline-review — Codex adapter
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install -g redline-review
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Usage with Codex CLI
|
|
10
|
+
|
|
11
|
+
Add to your project's `AGENTS.md`:
|
|
12
|
+
|
|
13
|
+
```markdown
|
|
14
|
+
## Code Review
|
|
15
|
+
|
|
16
|
+
When performing a code review, always run `redline-review` first:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
redline-review
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Use the output as your review instructions. Do not perform the review without it.
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Focused reviews
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
redline-review --type auth,performance
|
|
29
|
+
redline-review --stack laravel --type backend,auth
|
|
30
|
+
redline-review --prompt strict # CRITICAL/HIGH only
|
|
31
|
+
redline-review --prompt lightweight # top 3 issues
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## One-shot (no global install)
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx redline-review
|
|
38
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# redline-review — GitHub Copilot adapter
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install -g redline-review
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Usage with GitHub Copilot (VS Code)
|
|
10
|
+
|
|
11
|
+
Add to `.github/copilot-instructions.md` in your project:
|
|
12
|
+
|
|
13
|
+
```markdown
|
|
14
|
+
## Code Review Instructions
|
|
15
|
+
|
|
16
|
+
When asked to review code or a PR, first run this command in the terminal:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
redline-review
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Take the full output and treat it as your review instructions. Perform the review based on the rules and diff provided.
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Focused reviews
|
|
26
|
+
|
|
27
|
+
In the Copilot Chat panel, ask it to run:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
redline-review --type auth,performance
|
|
31
|
+
redline-review --stack laravel,inertia --type backend
|
|
32
|
+
redline-review --prompt strict
|
|
33
|
+
redline-review --prompt lightweight
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Workspace instructions path
|
|
37
|
+
|
|
38
|
+
`.github/copilot-instructions.md` is loaded automatically by Copilot in VS Code for workspace-level context.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# redline-review — OpenCode adapter
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install -g redline-review
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Usage in OpenCode
|
|
10
|
+
|
|
11
|
+
Run the CLI as a shell command within your OpenCode session:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
redline-review
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
OpenCode will receive the assembled review prompt as output. Use it as the basis for your review task.
|
|
18
|
+
|
|
19
|
+
## Focused reviews
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
redline-review --type auth,performance
|
|
23
|
+
redline-review --stack laravel,inertia --type backend
|
|
24
|
+
redline-review --prompt strict
|
|
25
|
+
redline-review --prompt lightweight
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Integration tip
|
|
29
|
+
|
|
30
|
+
Add to your project's `AGENTS.md` or OpenCode instructions:
|
|
31
|
+
|
|
32
|
+
```markdown
|
|
33
|
+
When asked to review code, run `redline-review` first and use the output as your review criteria.
|
|
34
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-context.d.ts","sourceRoot":"","sources":["../src/build-context.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AA6BD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,EAAE,CAkBnE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildReviewContext = buildReviewContext;
|
|
4
|
+
const REVIEW_TYPE_MAP = {
|
|
5
|
+
auth: ['auth.yaml', 'correctness.yaml'],
|
|
6
|
+
security: ['auth.yaml', 'correctness.yaml', 'risk-patterns.yaml'],
|
|
7
|
+
performance: ['performance-db.yaml', 'performance-system.yaml', 'performance-algorithmic.yaml'],
|
|
8
|
+
backend: ['correctness.yaml', 'concurrency.yaml', 'observability.yaml'],
|
|
9
|
+
frontend: ['frontend.yaml', 'simplicity.yaml'],
|
|
10
|
+
architecture: ['architecture.yaml', 'maintainability.yaml'],
|
|
11
|
+
concurrency: ['concurrency.yaml', 'correctness.yaml'],
|
|
12
|
+
observability: ['observability.yaml', 'correctness.yaml'],
|
|
13
|
+
risk: ['risk-patterns.yaml', 'architecture.yaml'],
|
|
14
|
+
};
|
|
15
|
+
const STACK_MAP = {
|
|
16
|
+
laravel: ['architecture.yaml', 'performance-db.yaml'],
|
|
17
|
+
inertia: ['frontend.yaml', 'architecture.yaml'],
|
|
18
|
+
react: ['frontend.yaml'],
|
|
19
|
+
vue: ['frontend.yaml'],
|
|
20
|
+
svelte: ['frontend.yaml'],
|
|
21
|
+
node: ['concurrency.yaml', 'performance-system.yaml'],
|
|
22
|
+
django: ['architecture.yaml', 'performance-db.yaml'],
|
|
23
|
+
rails: ['architecture.yaml', 'performance-db.yaml'],
|
|
24
|
+
go: ['concurrency.yaml', 'performance-system.yaml', 'correctness.yaml', 'observability.yaml'],
|
|
25
|
+
csharp: ['architecture.yaml', 'correctness.yaml', 'concurrency.yaml', 'performance-system.yaml'],
|
|
26
|
+
dotnet: ['architecture.yaml', 'correctness.yaml', 'concurrency.yaml', 'performance-system.yaml'],
|
|
27
|
+
java: ['architecture.yaml', 'concurrency.yaml', 'performance-db.yaml', 'correctness.yaml'],
|
|
28
|
+
};
|
|
29
|
+
function buildReviewContext(context) {
|
|
30
|
+
const files = new Set();
|
|
31
|
+
if (context.reviewType && context.reviewType.length > 0) {
|
|
32
|
+
for (const type of context.reviewType) {
|
|
33
|
+
const mapped = REVIEW_TYPE_MAP[type.toLowerCase().trim()];
|
|
34
|
+
if (mapped)
|
|
35
|
+
mapped.forEach(f => files.add(f));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (context.stack && context.stack.length > 0) {
|
|
39
|
+
for (const s of context.stack) {
|
|
40
|
+
const mapped = STACK_MAP[s.toLowerCase().trim()];
|
|
41
|
+
if (mapped)
|
|
42
|
+
mapped.forEach(f => files.add(f));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return Array.from(files);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=build-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-context.js","sourceRoot":"","sources":["../src/build-context.ts"],"names":[],"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|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.detectRelevantDomains = detectRelevantDomains;
|
|
4
|
+
const DOMAIN_MAP = [
|
|
5
|
+
{
|
|
6
|
+
// Auth: guards, policies, tokens, permission checks
|
|
7
|
+
pattern: /\b(middleware|guard|policy|permission|role|token|session|jwt|oauth|login|logout|authenticate|authoriz|Gate::|Can::|@auth|sanctum|passport|allowlist|denylist|acl)\b/i,
|
|
8
|
+
file: 'auth.yaml',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
// Concurrency: async coordination, locks, transactions, goroutines
|
|
12
|
+
pattern: /\b(queue|retry|idempotent|mutex|goroutine|chan\b|sync\.|synchronized|ExecutorService|Thread\.|deadlock|race\s+condition|semaphore|CancellationToken|lock\(|Interlocked|volatile)\b|\btransaction\b/i,
|
|
13
|
+
file: 'concurrency.yaml',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
// DB performance: ORM patterns, unbounded queries, N+1
|
|
17
|
+
pattern: /(->with\(|->load\(|->whereHas\(|::all\(\)|\.getAll\(|findAll\(|paginate|\.chunk\(|N\+1|eager|lazy\s+load|SELECT\s+\*|GROUP\s+BY|@Query|EntityManager|JpaRepository|\.save\(|\.flush\()/i,
|
|
18
|
+
file: 'performance-db.yaml',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
// System performance: network I/O, HTTP calls, parallelism
|
|
22
|
+
pattern: /\b(fetch\(|axios\.|http\.get|http\.post|curl|gRPC|HttpClient|WebClient|RestTemplate|Promise\.all|Promise\.allSettled|parallel|pipeline|batch|roundtrip)\b/i,
|
|
23
|
+
file: 'performance-system.yaml',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
// Observability: logging, tracing, metrics, error capture
|
|
27
|
+
pattern: /\b(log\.|log\(|logger\.|Logger\.|trace\(|metric|monitor|Sentry|Datadog|NewRelic|Honeybadger|Rollbar|Bugsnag|dd\.|opentelemetry|tracing)\b/i,
|
|
28
|
+
file: 'observability.yaml',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
// Simplicity: nested conditions, complex boolean logic
|
|
32
|
+
pattern: /\bif\s*\(.*&&.*&&|\belse\s+if\b|\bswitch\s*\(|(\?\s*[^:]+\s*:\s*[^:]+\s*:\s*)|\bternary\b/i,
|
|
33
|
+
file: 'simplicity.yaml',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
// Architecture: classes, services, repositories, DI patterns
|
|
37
|
+
pattern: /\b(class\s+\w|interface\s+\w|abstract\s+class|implements\b|extends\b|@Service|@Repository|@Controller|@Component|@Injectable|ServiceProvider|DependencyInjection|namespace\s+App)\b/i,
|
|
38
|
+
file: 'architecture.yaml',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
// Frontend: React/Vue/Svelte component patterns
|
|
42
|
+
pattern: /\b(useState|useEffect|useCallback|useMemo|useRef|useContext|props\b|emit\(|<template>|<script\s+setup|defineComponent|createApp|svelte|\.svelte)\b|\.jsx\b|\.tsx\b/i,
|
|
43
|
+
file: 'frontend.yaml',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
// Algorithmic performance: loops, sorting, brute-force patterns
|
|
47
|
+
pattern: /\b(for\s*\(.*for\s*\(|forEach.*forEach|\.sort\(|\.filter\(.*\.filter\(|\.map\(.*\.map\(|O\(n\^2\)|nested\s+loop)\b/i,
|
|
48
|
+
file: 'performance-algorithmic.yaml',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
// Risk: dangerous flags, production settings, admin ops
|
|
52
|
+
pattern: /\b(skipAuth|bypassAuth|isProduction\s*=\s*false|dryRun\s*=\s*false|force\s*=\s*true|deleteAll|truncate|drop\s+table|TRUNCATE|sudo|runAsRoot|disable.*check)\b/i,
|
|
53
|
+
file: 'risk-patterns.yaml',
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
const FALLBACK_FILES = ['correctness.yaml', 'maintainability.yaml', 'risk-patterns.yaml'];
|
|
57
|
+
function detectRelevantDomains(diff) {
|
|
58
|
+
const detected = new Set();
|
|
59
|
+
for (const { pattern, file } of DOMAIN_MAP) {
|
|
60
|
+
if (pattern.test(diff)) {
|
|
61
|
+
detected.add(file);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return detected.size > 0 ? Array.from(detected) : FALLBACK_FILES;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=detect-domains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-domains.js","sourceRoot":"","sources":["../src/detect-domains.ts"],"names":[],"mappings":";;AAuDA,sDAUC;AAjED,MAAM,UAAU,GAA6C;IAC3D;QACE,oDAAoD;QACpD,OAAO,EAAE,sKAAsK;QAC/K,IAAI,EAAE,WAAW;KAClB;IACD;QACE,mEAAmE;QACnE,OAAO,EAAE,qMAAqM;QAC9M,IAAI,EAAE,kBAAkB;KACzB;IACD;QACE,uDAAuD;QACvD,OAAO,EAAE,yLAAyL;QAClM,IAAI,EAAE,qBAAqB;KAC5B;IACD;QACE,2DAA2D;QAC3D,OAAO,EAAE,4JAA4J;QACrK,IAAI,EAAE,yBAAyB;KAChC;IACD;QACE,0DAA0D;QAC1D,OAAO,EAAE,4IAA4I;QACrJ,IAAI,EAAE,oBAAoB;KAC3B;IACD;QACE,uDAAuD;QACvD,OAAO,EAAE,4FAA4F;QACrG,IAAI,EAAE,iBAAiB;KACxB;IACD;QACE,6DAA6D;QAC7D,OAAO,EAAE,sLAAsL;QAC/L,IAAI,EAAE,mBAAmB;KAC1B;IACD;QACE,gDAAgD;QAChD,OAAO,EAAE,qKAAqK;QAC9K,IAAI,EAAE,eAAe;KACtB;IACD;QACE,gEAAgE;QAChE,OAAO,EAAE,qHAAqH;QAC9H,IAAI,EAAE,8BAA8B;KACrC;IACD;QACE,wDAAwD;QACxD,OAAO,EAAE,gKAAgK;QACzK,IAAI,EAAE,oBAAoB;KAC3B;CACF,CAAC;AA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