@0xcraft/powershot 1.1.1 → 1.1.2
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 +36 -25
- package/dist/cli/reports.js +3 -0
- package/dist/cli/review-command.js +8 -2
- package/dist/cli/session-command.js +2 -0
- package/dist/config.js +5 -0
- package/dist/ground.js +61 -8
- package/dist/lang/packs.js +97 -14
- package/dist/lang/parse-worker.js +15 -0
- package/dist/lang/python-deps.js +21 -8
- package/dist/manifest.js +49 -0
- package/dist/plan.js +7 -0
- package/dist/report/markdown.js +18 -2
- package/dist/report/terminal.js +12 -1
- package/dist/report/viewer.js +11 -1
- package/dist/review.js +39 -18
- package/dist/selftest.js +250 -8
- package/dist/session.js +2 -0
- package/dist/verifiers/foreign-phantom-dep.js +8 -2
- package/docs/architecture.md +37 -11
- package/docs/ci.md +20 -12
- package/examples/github-actions/action.yml +0 -5
- package/examples/github-actions/cli.yml +1 -1
- package/examples/gitlab/.gitlab-ci.yml +1 -1
- package/package.json +1 -1
package/docs/architecture.md
CHANGED
|
@@ -64,7 +64,7 @@ engine. The engine does not depend on a workflow provider or terminal layout.
|
|
|
64
64
|
| `src/manifest.ts` | Completion state and the authoritative run record | Rendering |
|
|
65
65
|
| `src/verifiers/` | Deterministic check implementations | Model calls |
|
|
66
66
|
| `src/judges/` | Prompt data, bounded model loop, tool adapter | Git target selection |
|
|
67
|
-
| `src/lang/` | Language-pack data
|
|
67
|
+
| `src/lang/` | Language-pack data, isolated parser workers, optional language oracles | Cross-run policy |
|
|
68
68
|
| `src/report/` | Pure output adapters | Re-running or reinterpreting a review |
|
|
69
69
|
| `src/bench.ts` | Historical and labelled evaluation | Production command dispatch |
|
|
70
70
|
| `src/session.ts`, `src/cache.ts` | Reuse of completed judge work | Completion decisions |
|
|
@@ -107,7 +107,7 @@ sequenceDiagram
|
|
|
107
107
|
Plan->>Judge: bounded related-file bundles
|
|
108
108
|
Judge-->>Manifest: judged findings + usage
|
|
109
109
|
end
|
|
110
|
-
Manifest->>Manifest: compute
|
|
110
|
+
Manifest->>Manifest: compute full or portable completion / partial / failed
|
|
111
111
|
Manifest->>Report: one result, many formats
|
|
112
112
|
Report-->>User: terminal, Markdown, SARIF, JSON
|
|
113
113
|
```
|
|
@@ -126,6 +126,12 @@ A run can contain a typed TypeScript file beside a Python file or a TypeScript f
|
|
|
126
126
|
excluded from `tsconfig`. Capabilities therefore live on each selected file. A checker
|
|
127
127
|
available somewhere in the run is not evidence that it inspected every file.
|
|
128
128
|
|
|
129
|
+
The policy decides what an absent capability means. Under default `portable` coverage,
|
|
130
|
+
self-contained syntax and manifest oracles remain a complete verdict while unavailable
|
|
131
|
+
`types`, `references`, and `python-types` are recorded as optional depth. Under
|
|
132
|
+
`strict` coverage, or when a check is named explicitly, the same gap is required and
|
|
133
|
+
makes the review partial.
|
|
134
|
+
|
|
129
135
|
### Monorepo grounding follows the change
|
|
130
136
|
|
|
131
137
|
For each changed TypeScript or JavaScript file, grounding inspects only its ancestor
|
|
@@ -140,21 +146,40 @@ exists, only changed files are parsed and type-dependent capabilities remain abs
|
|
|
140
146
|
That keeps a configless or mixed-language monorepo proportional to the review rather
|
|
141
147
|
than to the repository.
|
|
142
148
|
|
|
149
|
+
Python dependency grounding follows the same rule. Local modules are discovered from
|
|
150
|
+
direct entries on each changed file's ancestor chain and conventional `src`, `lib`, or
|
|
151
|
+
`python` roots. It never recursively crawls an unrelated monorepo tree.
|
|
152
|
+
|
|
153
|
+
### Grammar memory is isolated by language
|
|
154
|
+
|
|
155
|
+
Tree-sitter WASM compilation outlives its JavaScript parser objects. Keeping every
|
|
156
|
+
declared grammar in one process pushed measured RSS past 690MB. Production parsing
|
|
157
|
+
therefore groups changed files by language, sends at most 128 files or 8MB of source to
|
|
158
|
+
one disposable worker, hydrates plain AST data in the parent, and terminates the worker.
|
|
159
|
+
Compiled-grammar memory is bounded by one language batch rather than by the
|
|
160
|
+
repository's language count; hydrated AST data remains proportional to the selected
|
|
161
|
+
diff, not the whole repository. A parser failure for a declared language fails
|
|
162
|
+
selection instead of quietly waiving the file.
|
|
163
|
+
|
|
143
164
|
### The manifest owns completion
|
|
144
165
|
|
|
145
166
|
Findings alone cannot distinguish a clean review from an interrupted or unsupported
|
|
146
|
-
one. `RunManifest` accounts for selected files, executed checks, judge
|
|
147
|
-
limits, and skips.
|
|
148
|
-
|
|
167
|
+
one. `RunManifest` accounts for selected files, executed and unavailable checks, judge
|
|
168
|
+
units, failures, limits, and skips. `state` answers whether required work completed;
|
|
169
|
+
`coverage` separately says `full` or `portable`. Renderers and the CLI consume that
|
|
170
|
+
record instead of deriving their own verdict.
|
|
149
171
|
|
|
150
172
|
```mermaid
|
|
151
173
|
stateDiagram-v2
|
|
152
174
|
[*] --> Selected
|
|
153
|
-
Selected -->
|
|
154
|
-
Selected -->
|
|
175
|
+
Selected --> Full: every file, unit, and enriched oracle accounted for
|
|
176
|
+
Selected --> Portable: required work complete; enriched gaps named
|
|
177
|
+
Selected --> Partial: required oracle, budget, or cancellation gap
|
|
155
178
|
Selected --> Failed: required stage or file failed
|
|
156
|
-
|
|
157
|
-
|
|
179
|
+
Full --> Exit0: no findings
|
|
180
|
+
Full --> Exit1: findings
|
|
181
|
+
Portable --> Exit0: no findings
|
|
182
|
+
Portable --> Exit1: findings
|
|
158
183
|
Partial --> Exit3
|
|
159
184
|
Failed --> Exit3
|
|
160
185
|
```
|
|
@@ -178,8 +203,9 @@ and duplicated runs waste both time and tokens.
|
|
|
178
203
|
### Add a language pack
|
|
179
204
|
|
|
180
205
|
Add grammar data and conventions in `src/lang/packs.ts`, then add a dedicated fixture
|
|
181
|
-
to `src/langtest.ts
|
|
182
|
-
|
|
206
|
+
to `src/langtest.ts` and include it in the all-languages review regression. Development
|
|
207
|
+
fixtures and production parsing both isolate grammars by process, so no supported pack
|
|
208
|
+
shares one unbounded WASM heap with the rest.
|
|
183
209
|
|
|
184
210
|
### Add a report format
|
|
185
211
|
|
package/docs/ci.md
CHANGED
|
@@ -16,6 +16,11 @@ There are two independent decisions:
|
|
|
16
16
|
2. Do findings block the change? Set this per repository. Exit `1` is a complete
|
|
17
17
|
verdict with findings, not an engine failure.
|
|
18
18
|
|
|
19
|
+
A completed verdict has a separate coverage level. `full` means every applicable
|
|
20
|
+
configured oracle ran. `portable` means every self-contained oracle ran while missing
|
|
21
|
+
compiler/reference depth was named. Set `"coverage": "strict"` in
|
|
22
|
+
`powershot.config.json` when portable depth must become exit `3` instead.
|
|
23
|
+
|
|
19
24
|
| Exit | Meaning | Recommended CI handling |
|
|
20
25
|
|---:|---|---|
|
|
21
26
|
| `0` | Complete, no findings | Pass |
|
|
@@ -49,8 +54,6 @@ jobs:
|
|
|
49
54
|
with:
|
|
50
55
|
fetch-depth: 0
|
|
51
56
|
|
|
52
|
-
- run: npm ci --ignore-scripts
|
|
53
|
-
|
|
54
57
|
- uses: xcrft/powershot@v1
|
|
55
58
|
with:
|
|
56
59
|
verify-only: 'true'
|
|
@@ -60,12 +63,16 @@ jobs:
|
|
|
60
63
|
fail-on-findings: 'true'
|
|
61
64
|
```
|
|
62
65
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
Portable coverage deliberately needs no repository install. This keeps fork and
|
|
67
|
+
private-monorepo pull requests free of registry credentials while still running each
|
|
68
|
+
declared language's syntax-backed oracles. When a trusted job already has dependencies,
|
|
69
|
+
PowerShot uses the available declarations and can reach `full` coverage. Do not pass a
|
|
70
|
+
private package token into a pull-request job merely to enrich review depth.
|
|
71
|
+
|
|
72
|
+
PowerShot finds nested `tsconfig.json` and `tsconfig.*.json` files along changed-file
|
|
73
|
+
ancestor chains; the workflow does not list projects. Python local-module discovery is
|
|
74
|
+
bounded the same way. Foreign-language grammars run in disposable per-language workers
|
|
75
|
+
and bounded batches, so all declared languages can coexist in one monorepo review.
|
|
69
76
|
|
|
70
77
|
Set `upload-sarif: 'false'` and omit `security-events: write` when GitHub code scanning
|
|
71
78
|
is unavailable or the workflow should not publish SARIF.
|
|
@@ -94,10 +101,10 @@ lives at [`examples/github-actions/action.yml`](../examples/github-actions/actio
|
|
|
94
101
|
| `comment` | `true` | Maintain a pull-request comment |
|
|
95
102
|
| `inline-comments` | `false` | Post up to ten proven verified findings as one inline review |
|
|
96
103
|
| `fail-on-findings` | `false` | Turn a complete finding verdict into a failed job |
|
|
97
|
-
| `approve` | `false` | Approve only a complete, clean review |
|
|
104
|
+
| `approve` | `false` | Approve only a complete, clean, full-coverage review |
|
|
98
105
|
|
|
99
|
-
The outputs are `findings` and `
|
|
100
|
-
|
|
106
|
+
The outputs are `findings`, `complete`, and `coverage`. Gate infrastructure on
|
|
107
|
+
`complete`; use `coverage == 'full'` for decisions that require semantic depth.
|
|
101
108
|
|
|
102
109
|
## Direct CLI on GitHub Actions
|
|
103
110
|
|
|
@@ -108,7 +115,7 @@ step inside a larger quality job. The complete example is
|
|
|
108
115
|
The core pattern is:
|
|
109
116
|
|
|
110
117
|
```bash
|
|
111
|
-
npm install --global --ignore-scripts @0xcraft/powershot@1.1.
|
|
118
|
+
npm install --global --ignore-scripts @0xcraft/powershot@1.1.2
|
|
112
119
|
|
|
113
120
|
STATUS=0
|
|
114
121
|
psh review --verify-only \
|
|
@@ -156,6 +163,7 @@ and artifact declaration.
|
|
|
156
163
|
- Run `--verify-only` as the fast required check; add model judges only where their
|
|
157
164
|
cost and latency are intentional.
|
|
158
165
|
- Treat exit `2`, `3`, and `130` as infrastructure or completeness failures.
|
|
166
|
+
- Read the manifest or Action `coverage` output before treating portable depth as full.
|
|
159
167
|
- Generate every report from one invocation.
|
|
160
168
|
- Publish the Markdown report for humans and SARIF or Code Quality for annotations.
|
|
161
169
|
- Pin the PowerShot source version in protected workflows.
|
|
@@ -16,11 +16,6 @@ jobs:
|
|
|
16
16
|
with:
|
|
17
17
|
fetch-depth: 0
|
|
18
18
|
|
|
19
|
-
# Type-aware checks need the repository's declared types. Keep lifecycle
|
|
20
|
-
# scripts disabled when pull-request code is not trusted. In a monorepo,
|
|
21
|
-
# install at the workspace root or set working-directory to the package root.
|
|
22
|
-
- run: npm ci --ignore-scripts
|
|
23
|
-
|
|
24
19
|
- uses: xcrft/powershot@v1
|
|
25
20
|
with:
|
|
26
21
|
verify-only: 'true'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xcraft/powershot",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Oracle-first code review for machine-written code, with deterministic verification and CI-ready reports.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "aglumova <alina.glumova@gmail.com>",
|