@0xcraft/powershot 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.
Files changed (87) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +306 -0
  3. package/dist/agents.js +82 -0
  4. package/dist/bench.js +179 -0
  5. package/dist/budget.js +59 -0
  6. package/dist/bundle.js +173 -0
  7. package/dist/cache.js +155 -0
  8. package/dist/cli/agent-command.js +27 -0
  9. package/dist/cli/app.js +31 -0
  10. package/dist/cli/args.js +76 -0
  11. package/dist/cli/bench-command.js +89 -0
  12. package/dist/cli/dismiss-command.js +42 -0
  13. package/dist/cli/environment.js +32 -0
  14. package/dist/cli/reports.js +64 -0
  15. package/dist/cli/review-command.js +268 -0
  16. package/dist/cli/session-command.js +62 -0
  17. package/dist/cli.js +7 -0
  18. package/dist/config.js +130 -0
  19. package/dist/delegate.js +84 -0
  20. package/dist/dismissed.js +130 -0
  21. package/dist/fspolicy.js +62 -0
  22. package/dist/git.js +238 -0
  23. package/dist/ground.js +286 -0
  24. package/dist/judges/judge.js +85 -0
  25. package/dist/judges/llm.js +234 -0
  26. package/dist/judges/prompts.js +86 -0
  27. package/dist/judges/tools.js +125 -0
  28. package/dist/lang/packs.js +557 -0
  29. package/dist/lang/pyright.js +108 -0
  30. package/dist/lang/python-deps.js +174 -0
  31. package/dist/lang/ruby-deps.js +77 -0
  32. package/dist/langtest.js +248 -0
  33. package/dist/manifest.js +209 -0
  34. package/dist/otel.js +75 -0
  35. package/dist/package-meta.js +13 -0
  36. package/dist/package-smoke.js +110 -0
  37. package/dist/plan.js +134 -0
  38. package/dist/position.js +94 -0
  39. package/dist/report/ansi.js +18 -0
  40. package/dist/report/codequality.js +19 -0
  41. package/dist/report/compact.js +15 -0
  42. package/dist/report/highlight.js +54 -0
  43. package/dist/report/markdown.js +113 -0
  44. package/dist/report/sarif.js +66 -0
  45. package/dist/report/terminal.js +170 -0
  46. package/dist/report/viewer.js +148 -0
  47. package/dist/review.js +355 -0
  48. package/dist/scan.js +67 -0
  49. package/dist/selftest.js +1928 -0
  50. package/dist/session.js +140 -0
  51. package/dist/snapshot.js +101 -0
  52. package/dist/text.js +50 -0
  53. package/dist/types.js +2 -0
  54. package/dist/verifiers/assertion-drift.js +137 -0
  55. package/dist/verifiers/contract-drift.js +140 -0
  56. package/dist/verifiers/copy-paste-drift.js +106 -0
  57. package/dist/verifiers/dead-on-arrival.js +92 -0
  58. package/dist/verifiers/dropped-guard.js +144 -0
  59. package/dist/verifiers/foreign-contract-drift.js +114 -0
  60. package/dist/verifiers/foreign-copy-paste-drift.js +83 -0
  61. package/dist/verifiers/foreign-dropped-guard.js +78 -0
  62. package/dist/verifiers/foreign-phantom-api.js +36 -0
  63. package/dist/verifiers/foreign-phantom-config.js +40 -0
  64. package/dist/verifiers/foreign-phantom-dep.js +82 -0
  65. package/dist/verifiers/foreign-reinvented.js +65 -0
  66. package/dist/verifiers/foreign-scope-creep.js +42 -0
  67. package/dist/verifiers/foreign-swallowed-error.js +36 -0
  68. package/dist/verifiers/foreign-tests.js +143 -0
  69. package/dist/verifiers/foreign-tokens.js +94 -0
  70. package/dist/verifiers/foreign.js +16 -0
  71. package/dist/verifiers/index.js +38 -0
  72. package/dist/verifiers/lying-comment.js +90 -0
  73. package/dist/verifiers/phantom-api.js +88 -0
  74. package/dist/verifiers/phantom-config.js +93 -0
  75. package/dist/verifiers/phantom-dep.js +110 -0
  76. package/dist/verifiers/reinvented.js +74 -0
  77. package/dist/verifiers/scope-creep.js +77 -0
  78. package/dist/verifiers/swallowed-error.js +110 -0
  79. package/dist/verifiers/vacuous-test.js +138 -0
  80. package/docs/architecture.md +191 -0
  81. package/docs/assets/cli-preview.svg +68 -0
  82. package/docs/assets/powershot-logo.png +0 -0
  83. package/docs/ci.md +151 -0
  84. package/examples/github-actions/action.yml +23 -0
  85. package/examples/github-actions/cli.yml +43 -0
  86. package/examples/gitlab/.gitlab-ci.yml +21 -0
  87. package/package.json +65 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 PowerShot contributors
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,306 @@
1
+ <p align="center">
2
+ <img src="docs/assets/powershot-logo.png" width="156" alt="PowerShot logo">
3
+ </p>
4
+
5
+ <h1 align="center">PowerShot</h1>
6
+
7
+ <p align="center">
8
+ <strong>Oracle-first code review for machine-written code.</strong><br>
9
+ Verify with code. Judge with the model.
10
+ </p>
11
+
12
+ <p align="center">
13
+ <a href="https://github.com/xcrft/powershot/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/xcrft/powershot/actions/workflows/ci.yml/badge.svg"></a>
14
+ <a href="https://www.npmjs.com/package/@0xcraft/powershot"><img alt="npm version" src="https://img.shields.io/npm/v/@0xcraft/powershot.svg?logo=npm"></a>
15
+ <img alt="Node.js 24 or newer" src="https://img.shields.io/badge/Node.js-24%2B-5FA04E.svg">
16
+ <a href="LICENSE"><img alt="Apache-2.0 license" src="https://img.shields.io/badge/license-Apache--2.0-3B82F6.svg"></a>
17
+ </p>
18
+
19
+ PowerShot reviews the failure modes that plausible-looking generated code tends to
20
+ hide: invented APIs, undeclared dependencies, dropped guards, swallowed errors,
21
+ tests that prove nothing, bent expectations, stale callers, and duplicated helpers.
22
+
23
+ It asks compilers, parsers, manifests, reference graphs, and pre/post ASTs first.
24
+ Optional model judges only handle questions that still require judgement.
25
+
26
+ <table>
27
+ <tr>
28
+ <td width="33%"><strong>Deterministic first</strong><br>Local checks need no model, key, tokens, or network calls.</td>
29
+ <td width="33%"><strong>Honest completion</strong><br>A partial run cannot present itself as a clean verdict.</td>
30
+ <td width="33%"><strong>CI-native output</strong><br>One run emits terminal, Markdown, JSON, SARIF, manifest, and Code Quality reports.</td>
31
+ </tr>
32
+ </table>
33
+
34
+ ## See it in action
35
+
36
+ This is real output from a deterministic scan of an empty `catch` block:
37
+
38
+ ![PowerShot CLI reporting a proven swallowed error](docs/assets/cli-preview.svg)
39
+
40
+ ## Quick start
41
+
42
+ PowerShot requires Node.js 24 or newer.
43
+
44
+ ```bash
45
+ npm install --global @0xcraft/powershot
46
+ psh review --verify-only
47
+ ```
48
+
49
+ The package also installs the longer `powershot` command:
50
+
51
+ ```bash
52
+ powershot scan src/ --verify-only
53
+ ```
54
+
55
+ ## How a review moves
56
+
57
+ ```mermaid
58
+ flowchart LR
59
+ subgraph input["Change"]
60
+ DIFF["Workspace · range · commit · scan"]
61
+ end
62
+
63
+ subgraph engine["PowerShot engine"]
64
+ SNAP["Target snapshot"]
65
+ GROUND["Ground<br/>parsers · types · symbols"]
66
+ PLAN["Plan<br/>file-level capabilities"]
67
+ VERIFY["Verify<br/>deterministic oracles"]
68
+ JUDGE["Judge<br/>optional model"]
69
+ MANIFEST["Manifest<br/>authoritative state"]
70
+ end
71
+
72
+ subgraph output["Reports"]
73
+ HUMAN["Terminal · Markdown"]
74
+ MACHINE["SARIF · JSON · Code Quality"]
75
+ end
76
+
77
+ DIFF --> SNAP --> GROUND --> PLAN --> VERIFY --> MANIFEST
78
+ PLAN -. only when enabled .-> JUDGE --> MANIFEST
79
+ MANIFEST --> HUMAN
80
+ MANIFEST --> MACHINE
81
+
82
+ classDef change fill:#172033,stroke:#57a6ff,color:#f0f6fc,stroke-width:2px
83
+ classDef core fill:#251a20,stroke:#ff675c,color:#f0f6fc,stroke-width:2px
84
+ classDef report fill:#17251f,stroke:#4ac58b,color:#f0f6fc,stroke-width:2px
85
+ class DIFF change
86
+ class SNAP,GROUND,PLAN,VERIFY,JUDGE,MANIFEST core
87
+ class HUMAN,MACHINE report
88
+ ```
89
+
90
+ 1. **Snapshot** resolves the exact tree the review is about.
91
+ 2. **Ground** builds the available type, syntax, dependency, and reference oracles.
92
+ 3. **Plan** assigns checks and missing capabilities to each file individually.
93
+ 4. **Verify** runs deterministic checks and records what actually executed.
94
+ 5. **Judge** optionally reviews bounded bundles of related files.
95
+ 6. **Manifest** decides whether the result is complete, partial, or failed.
96
+ 7. **Report** renders the same result for people and CI consumers.
97
+
98
+ Read the full [architecture guide](docs/architecture.md) for module boundaries,
99
+ runtime sequence, invariants, and extension paths.
100
+
101
+ ## Findings you can calibrate
102
+
103
+ Every finding says where it came from:
104
+
105
+ | Class | Confidence | Meaning |
106
+ |---|---|---|
107
+ | `verified` | `proven` | An oracle answered the exact question |
108
+ | `verified` | `firm` | A deterministic heuristic fired; inspect the evidence |
109
+ | `judged` | `firm` or `tentative` | A model supplied the judgement and provenance |
110
+
111
+ PowerShot stays silent when a required oracle is unavailable. The missing capability
112
+ is written to the manifest instead of being counted as a pass.
113
+
114
+ ## Deterministic checks
115
+
116
+ | Check | Detects | Evidence |
117
+ |---|---|---|
118
+ | `phantom-api` | Missing members, invalid calls, incompatible APIs | Type checker |
119
+ | `phantom-dep` | Imports absent from project manifests | Dependency manifests |
120
+ | `phantom-config` | Configuration keys with no declared source | Repository config index |
121
+ | `contract-drift` | Signature changes with callers left behind | Types and references |
122
+ | `reinvented` | New helpers duplicating existing symbols | Symbol index |
123
+ | `dropped-guard` | Removed guards, early returns, protective branches | Pre/post AST |
124
+ | `swallowed-error` | Empty or ineffective error handling | AST shape |
125
+ | `vacuous-test` | Tests that do not assert behavior | Test AST |
126
+ | `assertion-drift` | Expectations changed under stable behavior | Pre/post test AST |
127
+ | `copy-paste-drift` | Clones with an inconsistent rename | Token and AST comparison |
128
+ | `dead-on-arrival` | Added code with no reachable reference | Reference graph |
129
+ | `scope-creep` | Files touched without a program-level change | Token comparison |
130
+ | `lying-comment` | Documentation contradicted by a signature | Signature and comment parser |
131
+
132
+ ## CLI
133
+
134
+ ```bash
135
+ # Staged, unstaged, and untracked work
136
+ psh review --verify-only
137
+
138
+ # Branch range or single commit
139
+ psh review --verify-only --from main --to HEAD
140
+ psh review --verify-only --commit <sha>
141
+
142
+ # Existing files without Git history
143
+ psh scan src/
144
+
145
+ # Select checks and severity
146
+ psh review --verify-only --checks phantom-api,swallowed-error
147
+ psh review --verify-only --min-severity high
148
+
149
+ # Create several artifacts from one verdict
150
+ psh review --verify-only \
151
+ --report sarif=out/powershot.sarif \
152
+ --report markdown=out/powershot.md \
153
+ --report json=out/powershot.json
154
+ ```
155
+
156
+ Useful options:
157
+
158
+ | Option | Purpose |
159
+ |---|---|
160
+ | `--verify-only` | Run deterministic checks only |
161
+ | `--checks a,b` | Run only named checks |
162
+ | `--min-severity <level>` | Filter below `info`, `low`, `medium`, `high`, or `critical` |
163
+ | `--format <format>` | Select the primary output format |
164
+ | `--report <format>=<path>` | Add an output artifact; repeat as needed |
165
+ | `--max-bundle <lines>` | Bound each optional judge unit |
166
+ | `--budget k=v,...` | Bound requests, tokens, tools, elapsed time, or units |
167
+ | `--resume <id>` | Continue a compatible saved session |
168
+ | `--no-cache` | Ignore cached judge answers |
169
+
170
+ Run `psh --help` for sessions, dismissals, delegation, agent setup, and benchmark
171
+ commands.
172
+
173
+ ## Completion is a contract
174
+
175
+ ```mermaid
176
+ flowchart LR
177
+ START["Selected files and checks"] --> ACCOUNT{"Everything accounted for?"}
178
+ ACCOUNT -- "yes" --> FINDINGS{"Findings?"}
179
+ FINDINGS -- "no" --> CLEAN["exit 0 · complete and clean"]
180
+ FINDINGS -- "yes" --> FOUND["exit 1 · complete with findings"]
181
+ ACCOUNT -- "capability or budget gap" --> PARTIAL["exit 3 · partial"]
182
+ ACCOUNT -- "required stage failed" --> FAILED["exit 3 · failed"]
183
+
184
+ classDef neutral fill:#172033,stroke:#57a6ff,color:#f0f6fc,stroke-width:2px
185
+ classDef good fill:#17251f,stroke:#4ac58b,color:#f0f6fc,stroke-width:2px
186
+ classDef warn fill:#2a2117,stroke:#f2b84b,color:#f0f6fc,stroke-width:2px
187
+ classDef bad fill:#2a191b,stroke:#ff675c,color:#f0f6fc,stroke-width:2px
188
+ class START,ACCOUNT,FINDINGS neutral
189
+ class CLEAN good
190
+ class FOUND,PARTIAL warn
191
+ class FAILED bad
192
+ ```
193
+
194
+ | Exit | Contract |
195
+ |---:|---|
196
+ | `0` | Review completed and found nothing at the selected severity |
197
+ | `1` | Review completed and reported findings |
198
+ | `2` | Command or Git input was invalid |
199
+ | `3` | Review is incomplete; findings may be missing |
200
+
201
+ “No findings” and “PowerShot could not look” are intentionally different pipeline
202
+ outcomes. Use `--format manifest` to inspect file dispositions, executed checks,
203
+ skips, failures, judge units, and `notLookedAt`.
204
+
205
+ ## CI integration
206
+
207
+ The composite action is the shortest setup for GitHub:
208
+
209
+ ```yaml
210
+ - uses: actions/checkout@v7
211
+ with:
212
+ fetch-depth: 0
213
+
214
+ - uses: xcrft/powershot@v1
215
+ with:
216
+ verify-only: 'true'
217
+ comment: 'true'
218
+ fail-on-findings: 'true'
219
+ ```
220
+
221
+ `@v1` follows compatible `1.x` releases. Pin the action to a full commit SHA in a
222
+ protected required workflow when immutable dependencies are required.
223
+
224
+ The [CI guide](docs/ci.md) covers exit handling, Git history, one-run/many-report
225
+ artifacts, GitLab Code Quality, local parity, and recommended gate policies.
226
+
227
+ Copy-paste examples:
228
+
229
+ - [GitHub composite Action](examples/github-actions/action.yml)
230
+ - [GitHub direct CLI workflow](examples/github-actions/cli.yml)
231
+ - [GitLab Code Quality job](examples/gitlab/.gitlab-ci.yml)
232
+
233
+ ## Optional model judges
234
+
235
+ Judges cover plausible logic, test adequacy, change intent, and repository conventions.
236
+ Anthropic, OpenAI, and Gemini providers are supported.
237
+
238
+ ```json
239
+ {
240
+ "provider": "anthropic",
241
+ "model": "claude-sonnet-5",
242
+ "verifiers": { "enable": ["*"] },
243
+ "judges": {
244
+ "enable": ["plausible-logic", "test-adequacy", "intent"]
245
+ },
246
+ "minSeverity": "low",
247
+ "ignore": ["**/generated/**"],
248
+ "promptCache": true
249
+ }
250
+ ```
251
+
252
+ Save this as `powershot.config.json`, set the provider key in the surrounding
253
+ environment, and omit `--verify-only`:
254
+
255
+ ```bash
256
+ export ANTHROPIC_API_KEY=...
257
+ psh review --from main --to HEAD
258
+ ```
259
+
260
+ If your coding agent already has a model, delegate the judgement instead of paying for
261
+ another call:
262
+
263
+ ```bash
264
+ psh delegate > /tmp/powershot-brief.md
265
+ # Follow the brief and write its JSON array to /tmp/powershot-findings.json
266
+ psh review --verify-only --absorb /tmp/powershot-findings.json
267
+ ```
268
+
269
+ ## Language coverage
270
+
271
+ | Language | Available oracles |
272
+ |---|---|
273
+ | TypeScript, JavaScript | Compiler types, references, manifests, syntax, pre/post AST |
274
+ | Python | Tree-sitter syntax and dependencies; optional `pyright` adds semantic checks |
275
+ | Ruby | Tree-sitter syntax and dependency manifests |
276
+ | Go, Java, C#, C++, PHP, Kotlin, Rust | Declared syntax-backed checks |
277
+ | C | Syntax-backed checks that do not require exception semantics |
278
+ | Solidity | Declared syntax-backed checks |
279
+
280
+ PowerShot loads a bounded number of grammars per run. Unsupported or unavailable
281
+ coverage is named in the manifest.
282
+
283
+ ## Project guide
284
+
285
+ | Document | Use it for |
286
+ |---|---|
287
+ | [Architecture](docs/architecture.md) | Module boundaries, runtime sequence, invariants, extensions |
288
+ | [CI integration](docs/ci.md) | Gate policy, GitHub, GitLab, artifacts, exit handling |
289
+ | [Contributing](CONTRIBUTING.md) | Setup, change placement, verification, pull requests |
290
+ | [Security policy](SECURITY.md) | Reporting a vulnerability |
291
+
292
+ ## Development
293
+
294
+ ```bash
295
+ npm ci
296
+ npm test
297
+ node dist/cli.js review --verify-only
298
+ ```
299
+
300
+ `npm test` builds the project, runs the core self-check suite, and validates every
301
+ enabled language pack. `npm run smoke` packs the project, installs the tarball into a
302
+ clean repository, and exercises the public binary.
303
+
304
+ ## License
305
+
306
+ PowerShot is available under the [Apache License 2.0](LICENSE).
package/dist/agents.js ADDED
@@ -0,0 +1,82 @@
1
+ const BODY = `## Reviewing a change with PowerShot
2
+
3
+ Before committing, before opening a pull request, or whenever asked to check a diff:
4
+
5
+ \`\`\`bash
6
+ psh review --verify-only
7
+ \`\`\`
8
+
9
+ This runs deterministic checks only — no model, no tokens. Every finding came from an
10
+ oracle (the TypeScript checker, the package manifest, the reference graph, the
11
+ pre/post AST), so treat it as fact rather than opinion.
12
+
13
+ Read the confidence on each finding:
14
+
15
+ - **proven** — the oracle answered exactly. Fix it.
16
+ - **firm** — a heuristic with judgement left in it. Read the code before acting.
17
+
18
+ For a whole branch: \`psh review --verify-only --from main --to HEAD\`.
19
+ For files with no git history: \`psh scan src/\`.
20
+
21
+ ### Do the judging yourself
22
+
23
+ You already have a model, so do not spend a second one. Ask for the judging work and
24
+ perform it:
25
+
26
+ \`\`\`bash
27
+ psh delegate > /tmp/brief.md
28
+ \`\`\`
29
+
30
+ Follow that brief, write your findings as the JSON array it specifies, then merge them
31
+ back into the report:
32
+
33
+ \`\`\`bash
34
+ psh review --verify-only --absorb /tmp/findings.json
35
+ \`\`\`
36
+
37
+ ### What it looks for
38
+
39
+ Failure modes that machine-written code makes common: APIs that do not exist, helpers
40
+ the repository already has, dependencies that were never installed, guards lost in a
41
+ rewrite, error handling that discards the error, tests that assert nothing, an
42
+ expectation edited to match new output, and callers left behind by a signature change.
43
+ `;
44
+ export const TARGETS = [
45
+ {
46
+ name: 'agents',
47
+ path: 'AGENTS.md',
48
+ serves: 'Codex, Cursor, Copilot, Gemini CLI, Grok, Windsurf, Zed, Aider, and others reading the AGENTS.md standard',
49
+ render: () => '# Agent instructions\n\n' + BODY,
50
+ },
51
+ {
52
+ name: 'claude',
53
+ path: '.claude/skills/powershot-review/SKILL.md',
54
+ serves: 'Claude Code, and Grok (which also reads .claude/)',
55
+ render: () => [
56
+ '---',
57
+ 'name: powershot-review',
58
+ 'description: Review the current change for the failure modes of machine-written code — hallucinated APIs, helpers that already exist, guards lost in a rewrite, tests that assert nothing. Use before committing, before opening a pull request, or when asked to check a diff. Deterministic and costs no tokens.',
59
+ '---',
60
+ '',
61
+ '# PowerShot review',
62
+ '',
63
+ BODY.replace('## Reviewing a change with PowerShot\n\n', ''),
64
+ ].join('\n'),
65
+ },
66
+ {
67
+ name: 'copilot',
68
+ path: '.github/copilot-instructions.md',
69
+ serves: 'GitHub Copilot, for repositories not using AGENTS.md',
70
+ render: () => '# Copilot instructions\n\n' + BODY,
71
+ },
72
+ {
73
+ name: 'cursor',
74
+ path: '.cursor/rules/powershot.mdc',
75
+ serves: 'Cursor, for repositories not using AGENTS.md',
76
+ render: () => ['---', 'description: Reviewing a change with PowerShot', 'alwaysApply: false', '---', '', BODY].join('\n'),
77
+ },
78
+ ];
79
+ export function findTarget(name) {
80
+ return TARGETS.find((t) => t.name === name);
81
+ }
82
+ //# sourceMappingURL=agents.js.map