openqodex 0.4.0 → 0.6.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 +19 -10
- package/dist/bin.js +4620 -2253
- package/docs/agents.md +36 -23
- package/docs/cli.md +17 -30
- package/docs/config.md +4 -2
- package/docs/github-action.md +34 -8
- package/docs/index.md +1 -1
- package/docs/internal-reviewer-drivers.md +176 -0
- package/docs/llms.txt +1 -0
- package/docs/plumbing.md +22 -6
- package/docs/quickstart.md +13 -10
- package/docs/security.md +40 -5
- package/package.json +1 -1
- package/skills/openqodex/SKILL.md +27 -105
- package/templates/README.md +2 -2
- package/templates/cline/openqodex.md +3 -3
- package/templates/cursor/openqodex.mdc +3 -3
- package/templates/instructions-section.md +1 -1
- package/templates/repo/team-section.md +2 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: openqodex
|
|
3
|
-
description: Review the current code change before it is pushed.
|
|
3
|
+
description: Review the current code change before it is pushed. One command runs the security and lint scanners that fit the changed files, a separate reviewer that checks every scanner finding and is given every changed line, and prints the report. Use before every git push, when asked to review changes, and when a push was blocked or warned by OpenQodex.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# OpenQodex: review the change before it is pushed
|
|
7
7
|
|
|
8
|
-
OpenQodex runs deterministic scanners (gitleaks, semgrep, bandit, hadolint, shellcheck, actionlint, osv-scanner and others)
|
|
8
|
+
OpenQodex reviews a change in one command. It takes a frozen copy of the change, runs the deterministic scanners that fit the changed files (gitleaks, semgrep, bandit, hadolint, shellcheck, actionlint, osv-scanner and others), keeps what they report on changed lines, and starts its own reviewer: a separate Claude Code or Codex process that reads only that copy. The reviewer checks every scanner finding, is given every changed line and answers in a fixed shape; OpenQodex checks the answer with scripts and prints one report. No key and no account are needed beyond the developer's Claude Code or Codex login. The code goes to the model that login uses. The reviewer can also search the web and open web pages unless `reviewer_web: off` is set in `~/.openqodex/config.yaml`. Two scanners go online, and neither sends code: semgrep downloads its rule packs from the Semgrep registry on each run, and when the change touches a dependency file, osv-scanner sends the names and versions of the dependencies to osv.dev. `--offline` skips both scanners.
|
|
9
9
|
|
|
10
10
|
## When to run
|
|
11
11
|
|
|
@@ -16,13 +16,9 @@ OpenQodex runs deterministic scanners (gitleaks, semgrep, bandit, hadolint, shel
|
|
|
16
16
|
|
|
17
17
|
## Who reviews
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
OpenQodex starts its own reviewer process for every review, with no memory of this session. You do not start a subagent for it and you do not review the change yourself: run the command and show what it prints.
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
- Codex, Cursor and other hosts: use their sub-task or background agent feature when there is one, with the same task.
|
|
23
|
-
- No subagent available: tell the developer "this review is not independent: the agent that wrote the code is reviewing it", then follow the procedure yourself.
|
|
24
|
-
|
|
25
|
-
If you are the review subagent, follow the procedure yourself and do not start another subagent. Set `reviewer` in the findings to `"subagent"` when you are one, else `"same-agent"`: the report's summary says which.
|
|
21
|
+
If `review` says "Full review unavailable" and prints a way to review with the agent you are in, follow it: run the command it names and do what the brief it prints says.
|
|
26
22
|
|
|
27
23
|
## Procedure
|
|
28
24
|
|
|
@@ -31,140 +27,66 @@ When the file `~/.openqodex/bin/openqodex` exists, run it in place of `npx -y op
|
|
|
31
27
|
1. From the repository, run:
|
|
32
28
|
|
|
33
29
|
```
|
|
34
|
-
npx -y openqodex@0.
|
|
30
|
+
npx -y openqodex@0.6.0 review
|
|
35
31
|
```
|
|
36
32
|
|
|
37
|
-
It
|
|
38
|
-
|
|
39
|
-
2. Verify each scanner candidate against the code. Every candidate has an id (`c1`, `c2`, ...) and a token like `[semgrep:python.lang.security.audit.formatted-sql-query]`. Open the file at the line and decide:
|
|
40
|
-
- real: raise it as a finding with `source` set to the token and `candidate` set to the id;
|
|
41
|
-
- not real (a test fixture, dead code, a pattern the code already guards): put it under `dropped` with a one-line reason;
|
|
42
|
-
- real but out of scope because the repo's instructions put that kind of finding or that path out of scope: put it under `dropped` with a reason that starts with `repo instructions:`.
|
|
43
|
-
|
|
44
|
-
Several candidates often describe one problem (two scanners, or two rules of one scanner, on the same line). Raise one of them and drop the others with the reason `duplicate of c<id>`.
|
|
45
|
-
|
|
46
|
-
Every candidate must end up in one of the two. A candidate you leave out is reported as "Not reviewed by the agent" and counts toward the verdict at its scanner severity.
|
|
47
|
-
|
|
48
|
-
3. Weigh each pattern listed under "Patterns to weigh". Each one describes a kind of bug that changes like this one often carry. Check the changed lines against it. When a pattern leads you to a finding, set `source` to `lens:<name>`.
|
|
49
|
-
|
|
50
|
-
4. Review the change yourself. Use your own tools to read the callers and the tests of every function the change touches. Look for wrong behaviour, missing checks, broken edge cases and changed behaviour with no test. Findings from your own reading have `source: null`. You may run the project's own tests to check a suspicion, except in a review of a branch or a pull request; never run its other scripts or start its services, and remove anything a test run created. When the change only deleted lines, such as a removed check, cite the line next to the deletion that the brief lists under "Deleted lines" and say in `description` what was removed.
|
|
51
|
-
|
|
52
|
-
5. Write the findings to the exact path the brief names (it ends in `agent-findings.json`), in the shape below.
|
|
53
|
-
|
|
54
|
-
6. Run:
|
|
33
|
+
It reviews the change: the commits not yet pushed plus everything uncommitted, untracked files included. To review the whole repository instead, run:
|
|
55
34
|
|
|
56
35
|
```
|
|
57
|
-
npx -y openqodex@0.
|
|
36
|
+
npx -y openqodex@0.6.0 review --all
|
|
58
37
|
```
|
|
59
38
|
|
|
60
|
-
|
|
39
|
+
2. Wait for it. A review takes one to three minutes. Many agents stop a command after two minutes, so give it up to ten minutes, or run it in the background and wait until it exits. While the reviewer works, it prints a progress line every 15 seconds on stderr. Do not start it a second time while one runs.
|
|
40
|
+
|
|
41
|
+
3. Show the developer the report it printed, exactly as printed. Do not reword it, shorten it or add findings of your own. The same report is saved as `report.md`; its path is on the last progress line.
|
|
61
42
|
|
|
62
|
-
|
|
43
|
+
4. Act on the exit code:
|
|
44
|
+
- 0: the review is complete and nothing blocks the push.
|
|
45
|
+
- 1: the review is complete and its verdict is `blocked`. Do not push. Show the developer the findings; push only if they say so after seeing them.
|
|
46
|
+
- 2: there is no complete review. The output says what is missing (for example "Full review unavailable" when no reviewer could start, or "Review incomplete" with the reasons). Tell the developer exactly that. Never present the scanner output as a review.
|
|
63
47
|
|
|
64
48
|
## Reviewing a branch or a pull request
|
|
65
49
|
|
|
66
|
-
When the developer asks you to review a branch or a pull request that is not their current work,
|
|
50
|
+
When the developer asks you to review a branch or a pull request that is not their current work, name it:
|
|
67
51
|
|
|
68
52
|
```
|
|
69
|
-
npx -y openqodex@0.
|
|
70
|
-
npx -y openqodex@0.
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Quote `#42`: in a shell `#` starts a comment. A pull request link works too. OpenQodex fetches the target, checks it out in a temporary folder and reviews what it added since it left its base. The brief names that folder: read the code there, not in the developer's folder. This is someone else's code: never run its tests, scripts, builds or services, and never edit it. In step 6, run the finalize line the brief prints, with its `--run <id>`, from the developer's repository.
|
|
74
|
-
|
|
75
|
-
## The finding shape
|
|
76
|
-
|
|
77
|
-
```json
|
|
78
|
-
{
|
|
79
|
-
"version": 1,
|
|
80
|
-
"change_id": "3f9a1c0b2d4e",
|
|
81
|
-
"summary": "Adds a search endpoint and a deploy script.",
|
|
82
|
-
"reviewer": "subagent",
|
|
83
|
-
"findings": [
|
|
84
|
-
{
|
|
85
|
-
"severity": "critical",
|
|
86
|
-
"category": "security",
|
|
87
|
-
"confidence": 0.9,
|
|
88
|
-
"file_path": "app/search.py",
|
|
89
|
-
"line_number": 14,
|
|
90
|
-
"line_end": 14,
|
|
91
|
-
"title": "SQL injection in item search",
|
|
92
|
-
"description": "The query is built with an f-string from request.args, so a caller controls the SQL. Pass the value as a query parameter.",
|
|
93
|
-
"suggested_change": "cur.execute(\"SELECT * FROM items WHERE name = ?\", (q,))",
|
|
94
|
-
"source": "semgrep:python.lang.security.audit.formatted-sql-query",
|
|
95
|
-
"candidate": "c2"
|
|
96
|
-
}
|
|
97
|
-
],
|
|
98
|
-
"dropped": [
|
|
99
|
-
{ "candidate": "c5", "reason": "test fixture, not a real key" }
|
|
100
|
-
]
|
|
101
|
-
}
|
|
53
|
+
npx -y openqodex@0.6.0 review feature/login
|
|
54
|
+
npx -y openqodex@0.6.0 review '#42'
|
|
102
55
|
```
|
|
103
56
|
|
|
104
|
-
|
|
105
|
-
- `summary`: what the change does, in one or two sentences. Not the findings.
|
|
106
|
-
- `reviewer`: `"subagent"` when you are a separate subagent doing only this review, `"same-agent"` when you also wrote the code.
|
|
107
|
-
- `file_path`: relative to the repository root. `line_number` and `line_end` point at the code line that holds the problem, never at a comment or a blank line, and at an import only when the import itself is the problem. `line_end` is optional and defaults to `line_number`.
|
|
108
|
-
- `title`: a short noun phrase naming the problem. No line numbers, no quoted code.
|
|
109
|
-
- `description`: one to three sentences: what is wrong, why it matters, the fix.
|
|
110
|
-
- `suggested_change`: the replacement text for the cited lines when the fix fits in a few lines, matching the indentation. Otherwise `null`, and explain the fix in `description`.
|
|
111
|
-
- `source`: `null` for your own finding, the candidate's token (the text in the square brackets, without them) when raising a candidate, or `lens:<name>` when a listed pattern led to it.
|
|
112
|
-
- `candidate`: the candidate id when raising one, else leave it out. The id and the token must belong to the same candidate.
|
|
113
|
-
- `confidence`: from 0 to 1, how sure you are that the problem is real, based on what you read.
|
|
114
|
-
|
|
115
|
-
Severity says how much harm the problem does, not how sure you are:
|
|
116
|
-
|
|
117
|
-
- `critical`: data loss, a security breach, a crash on a common path, broken authentication.
|
|
118
|
-
- `major`: wrong behaviour under realistic conditions, a performance regression, a broken edge case someone would be paged for.
|
|
119
|
-
- `minor`: a real bug that is unlikely to show in practice.
|
|
120
|
-
- `nitpick`: style, naming or a convention preference.
|
|
121
|
-
- `info`: worth knowing, no action needed.
|
|
122
|
-
|
|
123
|
-
Category says what kind of problem it is:
|
|
124
|
-
|
|
125
|
-
- `bug`: the code does the wrong thing.
|
|
126
|
-
- `security`: the code can be abused, or leaks something it should not.
|
|
127
|
-
- `performance`: the code is slower or uses more resources than it needs to.
|
|
128
|
-
- `maintainability`: the code works but is hard to change safely (missing test, duplicated logic, unclear structure).
|
|
129
|
-
- `style`: formatting, naming and conventions.
|
|
57
|
+
Quote `#42`: in a shell `#` starts a comment. A pull request link works too. OpenQodex fetches the target, checks it out in a temporary folder and reviews what it added since it left its base. This is someone else's code: never run its tests, scripts, builds or services, and never edit it.
|
|
130
58
|
|
|
131
59
|
## Rules
|
|
132
60
|
|
|
133
|
-
-
|
|
134
|
-
- A finding with confidence under 0.7 is not raised. Finalize drops it and lists it as low confidence.
|
|
135
|
-
- Every scanner candidate is either raised or listed under `dropped` with a reason.
|
|
136
|
-
- Never edit code during the review. Review first, report, then fix only what the developer asks you to fix.
|
|
137
|
-
- Run the project's own tests if they help, never its other scripts or services, and remove anything a run created. In a review of a branch or a pull request, run nothing from it.
|
|
61
|
+
- Never edit code during the review. Review first, show the report, then fix only what the developer asks you to fix.
|
|
138
62
|
- Never run `openqodex trust` without asking the developer first. It approves a custom scanner, which is a command that runs on their machine.
|
|
139
63
|
- Never set `OPENQODEX_SKIP`. It is the developer's switch, not yours.
|
|
140
|
-
-
|
|
141
|
-
- When
|
|
142
|
-
- An empty findings list is a valid review. Do not pad it.
|
|
143
|
-
- When OpenQodex prints "OpenQodex had a problem. Nothing has been sent." with `1 create a GitHub issue` and `2 ignore`, tell the developer in one line what went wrong and give them the two choices. Never choose 1 yourself. If they say 1, run `npx -y openqodex@0.4.0 report --send-last` from the same folder. Anything else means 2: do nothing.
|
|
64
|
+
- When the verdict is `blocked`, do not push unless the developer says so after seeing the findings.
|
|
65
|
+
- When OpenQodex prints "OpenQodex had a problem. Nothing has been sent." with `1 create a GitHub issue` and `2 ignore`, tell the developer in one line what went wrong and give them the two choices. Never choose 1 yourself. If they say 1, run `npx -y openqodex@0.6.0 report --send-last` from the same folder. Anything else means 2: do nothing.
|
|
144
66
|
|
|
145
67
|
## Reading the report
|
|
146
68
|
|
|
147
69
|
- The report is in `.openqodex/reviews/<time>-<id>/` in the repository: `report.md` to read, `report.json` and `report.sarif` for tools. `.openqodex/latest.json` points at the newest review. The reports never show in `git status`: `.openqodex/.gitignore` keeps them out. The two other files in that folder, `config.yaml` and `custom-instructions.md`, are the team's and are meant to be committed.
|
|
148
70
|
- The verdict is `passed` (with or without warnings) or `blocked`. It is `blocked` only when the repository's config (`.openqodex/config.yaml`, or `.openqodex.yaml` at the root) sets `block_on_severity` and a finding is at or above it. With no config, OpenQodex warns and never blocks.
|
|
149
|
-
-
|
|
71
|
+
- A complete review means every stage ran, every scanner finding was checked and every changed line was put in front of the reviewer; anything not covered is named in the report. It does not mean nothing was missed: no review finds everything.
|
|
150
72
|
- The coverage list says, for each scanner, whether it ran. A scanner that did not run has a one-line reason:
|
|
151
73
|
- `no matching files`: nothing in the change is the kind of file it reads.
|
|
152
74
|
- `installing`: it is being downloaded for the first time; it is included from the next run. Say so to the developer rather than waiting.
|
|
153
75
|
- `not installed`: it could not be installed here; the reason says why.
|
|
154
76
|
- `needs Ruby 2.7+` or `needs Go`: brakeman and rubocop need Ruby, golangci-lint needs Go. OpenQodex does not install language runtimes. If the developer wants those scanners, they install Ruby or Go the usual way for their system (for example `brew install ruby go` on a Mac) and run the review again.
|
|
155
|
-
- `untrusted`: a custom scanner from the repo's config that the developer has not approved. Tell the developer; approving it is their decision (`npx -y openqodex@0.
|
|
77
|
+
- `untrusted`: a custom scanner from the repo's config that the developer has not approved. Tell the developer; approving it is their decision (`npx -y openqodex@0.6.0 trust`).
|
|
156
78
|
- `failed`: the scanner ran and broke; the reason has its error. A scanner problem never changes the exit code.
|
|
157
79
|
|
|
158
80
|
## Inside a sandbox
|
|
159
81
|
|
|
160
|
-
Some agents run commands in a sandbox that cannot reach the network or write outside the project. There the first run cannot download the scanners, and
|
|
82
|
+
Some agents run commands in a sandbox that cannot reach the network or write outside the project. There the first run cannot download the scanners, and the reviewer may not reach its model. Tell the developer to run this once in their own terminal, outside the agent:
|
|
161
83
|
|
|
162
84
|
```
|
|
163
|
-
npx -y openqodex@0.
|
|
85
|
+
npx -y openqodex@0.6.0 doctor --install
|
|
164
86
|
```
|
|
165
87
|
|
|
166
|
-
It downloads every scanner that fits the machine into `~/.openqodex/tools/`.
|
|
88
|
+
It downloads every scanner that fits the machine into `~/.openqodex/tools/`. If the review still says "Full review unavailable" inside the sandbox, the developer runs `npx -y openqodex@0.6.0 review` in their own terminal.
|
|
167
89
|
|
|
168
90
|
## More
|
|
169
91
|
|
|
170
|
-
`npx -y openqodex@0.
|
|
92
|
+
`npx -y openqodex@0.6.0 guide` prints this guide. `npx -y openqodex@0.6.0 guide <topic>` prints a page of the docs, offline: `quickstart`, `config`, `scanners`, `custom-scanners`, `security`, `agents`, `cli`.
|
package/templates/README.md
CHANGED
|
@@ -8,11 +8,11 @@ Each file here is copied or merged by `openqodex init`. Three placeholders are f
|
|
|
8
8
|
|
|
9
9
|
## The instruction section
|
|
10
10
|
|
|
11
|
-
`instructions-section.md` is the marked section (between `<!-- openqodex:start -->` and `<!-- openqodex:end -->`) that tells an agent to review with the openqodex skill
|
|
11
|
+
`instructions-section.md` is the marked section (between `<!-- openqodex:start -->` and `<!-- openqodex:end -->`) that tells an agent to review with the openqodex skill when a feature or fix is done; OpenQodex starts its own reviewer process. `init` prints it before writing, records it, and `--uninstall` removes exactly that section. It goes into each agent's global instruction file in user scope, into the repo's `CLAUDE.md` and `AGENTS.md` in project scope, and inside the Cursor and Cline rules.
|
|
12
12
|
|
|
13
13
|
## The team section
|
|
14
14
|
|
|
15
|
-
`repo/team-section.md` is the marked section a user-scope `init` writes into the repository's own `CLAUDE.md` and `AGENTS.md` (creating a file that is not there), unless `--no-repo`, or a recorded "no" for that repository without `--yes`, says otherwise. It is for a teammate with nothing installed: it names only `npx -y openqodex@{{VERSION}} review
|
|
15
|
+
`repo/team-section.md` is the marked section a user-scope `init` writes into the repository's own `CLAUDE.md` and `AGENTS.md` (creating a file that is not there), unless `--no-repo`, or a recorded "no" for that repository without `--yes`, says otherwise. It is for a teammate with nothing installed: it names only `npx -y openqodex@{{VERSION}} review` and never the skill or the launcher. Unlike other repository files in user scope, it is not added to `.git/info/exclude`: the developer commits it. It replaces an instruction section found there exactly as written, is recorded with `createdFile`, and `--uninstall` removes exactly it. In project scope the same two files get the instruction section instead.
|
|
16
16
|
|
|
17
17
|
## The skill in user scope
|
|
18
18
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
How to run the review, before any `git push` and whenever you are asked to review the changes:
|
|
4
4
|
|
|
5
|
-
1. Run `npx -y openqodex@{{VERSION}} review
|
|
6
|
-
2.
|
|
7
|
-
3.
|
|
5
|
+
1. Run `npx -y openqodex@{{VERSION}} review` from the repository. It takes one to three minutes: allow it up to ten minutes, or run it in the background and wait for it to exit. If the skill is not loaded, run `npx -y openqodex@{{VERSION}} guide` to print it.
|
|
6
|
+
2. Show the developer the report it prints, exactly as printed, without rewording it.
|
|
7
|
+
3. When the verdict is `blocked` (exit 1), do not push unless the developer says so after seeing the findings. Exit 2 means there is no complete review: tell the developer what the output says is missing.
|
|
8
8
|
|
|
9
9
|
Never edit code during the review, never run `openqodex trust` without asking the developer, and never set `OPENQODEX_SKIP`.
|
|
@@ -8,8 +8,8 @@ alwaysApply: true
|
|
|
8
8
|
|
|
9
9
|
How to run the review, before any `git push` and whenever you are asked to review the changes:
|
|
10
10
|
|
|
11
|
-
1. Run `npx -y openqodex@{{VERSION}} review
|
|
12
|
-
2.
|
|
13
|
-
3.
|
|
11
|
+
1. Run `npx -y openqodex@{{VERSION}} review` from the repository. It takes one to three minutes: allow it up to ten minutes, or run it in the background and wait for it to exit. If the skill is not loaded, run `npx -y openqodex@{{VERSION}} guide` to print it.
|
|
12
|
+
2. Show the developer the report it prints, exactly as printed, without rewording it.
|
|
13
|
+
3. When the verdict is `blocked` (exit 1), do not push unless the developer says so after seeing the findings. Exit 2 means there is no complete review: tell the developer what the output says is missing.
|
|
14
14
|
|
|
15
15
|
Never edit code during the review, never run `openqodex trust` without asking the developer, and never set `OPENQODEX_SKIP`.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- openqodex:start -->
|
|
2
2
|
## Review with OpenQodex
|
|
3
3
|
- When a feature or fix is done, and before any push, review it with the openqodex skill: "review my change with openqodex".
|
|
4
|
-
-
|
|
4
|
+
- OpenQodex starts its own reviewer process for the review: the agent that wrote the code does not judge its own work.
|
|
5
5
|
- Do not push on a blocked verdict unless the developer says so after seeing the findings.
|
|
6
6
|
- The report is in `.openqodex/reviews/`.
|
|
7
7
|
<!-- openqodex:end -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- openqodex:start -->
|
|
2
2
|
## Review with OpenQodex before you push
|
|
3
|
-
- Before any `git push`, run `npx -y openqodex@{{VERSION}} review
|
|
4
|
-
-
|
|
3
|
+
- Before any `git push`, run `npx -y openqodex@{{VERSION}} review` from the repository root. It takes one to three minutes: allow it up to ten minutes, or run it in the background and wait for it to exit.
|
|
4
|
+
- Show the developer the report it prints, exactly as printed. OpenQodex starts its own reviewer process: the agent that wrote the code does not judge its own work.
|
|
5
5
|
- Do not push on a blocked verdict unless the developer says so after seeing the findings.
|
|
6
6
|
- The report is in `.openqodex/reviews/`.
|
|
7
7
|
<!-- openqodex:end -->
|