@diegopetrucci/pi-code-reviewer 0.1.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/.pi-fleet-tested-version +1 -0
- package/README.md +84 -0
- package/index.ts +1280 -0
- package/package.json +35 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.80.3
|
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# code-reviewer
|
|
2
|
+
|
|
3
|
+
Adds a read-only `code_reviewer` subagent tool that adapts The Last Harness [`code-reviewer`](https://github.com/diegopetrucci/the-last-harness/blob/main/agents/subagents/code-reviewer.md) prompt into a standalone pi extension.
|
|
4
|
+
|
|
5
|
+
Use it when you want an isolated second-pass review of a proposed change against the local checkout. The tool stays read-only, checks ticket fit and scope first, then looks for diff mismatches, correctness bugs, security/safety issues, unnecessary complexity, and missing validation.
|
|
6
|
+
|
|
7
|
+
This package is adapted from the TLH code-reviewer workflow for use as a standalone pi extension.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
### Standalone npm package
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pi install npm:@diegopetrucci/pi-code-reviewer
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Collection package
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pi install npm:@diegopetrucci/pi-extensions
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### GitHub package
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pi install git:github.com/diegopetrucci/pi-extensions
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Then reload pi:
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
/reload
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## `code_reviewer` tool behavior
|
|
36
|
+
|
|
37
|
+
The tool accepts:
|
|
38
|
+
|
|
39
|
+
- `task` — required review target and success criteria
|
|
40
|
+
- `diff` — optional diff, patch, or change summary
|
|
41
|
+
- `context` — optional extra constraints or known risks
|
|
42
|
+
|
|
43
|
+
When called, it launches an isolated in-memory child agent with:
|
|
44
|
+
|
|
45
|
+
- no inherited extensions, skills, prompt templates, themes, context files, or agents files;
|
|
46
|
+
- an auto-selected review model that prefers contrarian-style opposite-provider and opposite-family candidates before same-provider fallbacks;
|
|
47
|
+
- requested thinking taken from the active session when available, otherwise defaulting to `high` for reasoning models and `off` for non-reasoning models, then clamped to the selected model's supported level;
|
|
48
|
+
- read-only tools only: `read`, `grep`, `find`, `ls`, and guarded `bash`;
|
|
49
|
+
- a local-checkout path guard for file inspection;
|
|
50
|
+
- a bash guard that allows only direct read-only `git`, `gh`, or `pwd` invocations.
|
|
51
|
+
|
|
52
|
+
The review prompt prioritizes:
|
|
53
|
+
|
|
54
|
+
1. ticket fit and scope
|
|
55
|
+
2. diff accuracy
|
|
56
|
+
3. correctness and regressions
|
|
57
|
+
4. security and safety
|
|
58
|
+
5. simplicity and maintainability
|
|
59
|
+
6. tests and validation gaps
|
|
60
|
+
|
|
61
|
+
The final output is concise and includes a verdict, findings, validation notes, a scope check, and run details that show the final selected model and effective thinking level.
|
|
62
|
+
|
|
63
|
+
## Read-only guarantees
|
|
64
|
+
|
|
65
|
+
- The subagent is explicitly instructed not to implement changes.
|
|
66
|
+
- Runtime guards block write/edit tools, shell control operators, pipelines, redirection, path traversal outside the checkout, mutating `git`/`gh` commands, `npm`/publish commands, and other filesystem mutation.
|
|
67
|
+
- Built-in file-inspection tools are preferred over shell commands for local files.
|
|
68
|
+
|
|
69
|
+
## Example
|
|
70
|
+
|
|
71
|
+
```text
|
|
72
|
+
Use code_reviewer on this task before merging:
|
|
73
|
+
|
|
74
|
+
{
|
|
75
|
+
"task": "Review ticket pe-7lpt implementation for scope fit and correctness.",
|
|
76
|
+
"context": "Focus on whether the new extension stays runtime-only and keeps tools read-only."
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Limitations
|
|
81
|
+
|
|
82
|
+
- The subagent has an 8-turn and 8-minute budget.
|
|
83
|
+
- The review quality depends on the local checkout matching the change being reviewed.
|
|
84
|
+
- `gh`-based inspection is available only when GitHub CLI is installed and authenticated, but the tool can still review local changes without it.
|