@0xcraft/powershot 1.1.0 → 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 +43 -18
- 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 +297 -95
- package/dist/judges/tools.js +7 -7
- 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 +43 -20
- package/dist/selftest.js +402 -8
- package/dist/session.js +2 -0
- package/dist/verifiers/foreign-phantom-dep.js +8 -2
- package/dist/verifiers/phantom-config.js +7 -6
- package/docs/architecture.md +52 -12
- package/docs/ci.md +21 -4
- 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
|
@@ -59,12 +59,12 @@ engine. The engine does not depend on a workflow provider or terminal layout.
|
|
|
59
59
|
|---|---|---|
|
|
60
60
|
| `src/cli/` | Argument parsing, command dispatch, report publication, exit mapping | Review algorithms |
|
|
61
61
|
| `src/review.ts` | One review run and its stage orchestration | CLI parsing or presentation |
|
|
62
|
-
| `src/ground.ts` | TypeScript
|
|
62
|
+
| `src/ground.ts` | Change-scoped TypeScript projects, parse trees, manifests, symbol index | Check selection |
|
|
63
63
|
| `src/plan.ts` | File selection and per-file capability accounting | Finding generation |
|
|
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,21 +126,60 @@ 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
|
+
|
|
135
|
+
### Monorepo grounding follows the change
|
|
136
|
+
|
|
137
|
+
For each changed TypeScript or JavaScript file, grounding inspects only its ancestor
|
|
138
|
+
directories for `tsconfig.json` and `tsconfig.*.json`. The nearest config that owns
|
|
139
|
+
the file wins. Empty solution configs yield to their leaf configs, and an excluded
|
|
140
|
+
test can reuse the closest non-empty leaf project when its type environment resolves.
|
|
141
|
+
Projects and directory listings are cached across files, then their source closures
|
|
142
|
+
are deduplicated for syntax searches and symbol indexing.
|
|
143
|
+
|
|
144
|
+
There is deliberately no repository-wide fallback glob. When no relevant config
|
|
145
|
+
exists, only changed files are parsed and type-dependent capabilities remain absent.
|
|
146
|
+
That keeps a configless or mixed-language monorepo proportional to the review rather
|
|
147
|
+
than to the repository.
|
|
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
|
+
|
|
129
164
|
### The manifest owns completion
|
|
130
165
|
|
|
131
166
|
Findings alone cannot distinguish a clean review from an interrupted or unsupported
|
|
132
|
-
one. `RunManifest` accounts for selected files, executed checks, judge
|
|
133
|
-
limits, and skips.
|
|
134
|
-
|
|
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.
|
|
135
171
|
|
|
136
172
|
```mermaid
|
|
137
173
|
stateDiagram-v2
|
|
138
174
|
[*] --> Selected
|
|
139
|
-
Selected -->
|
|
140
|
-
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
|
|
141
178
|
Selected --> Failed: required stage or file failed
|
|
142
|
-
|
|
143
|
-
|
|
179
|
+
Full --> Exit0: no findings
|
|
180
|
+
Full --> Exit1: findings
|
|
181
|
+
Portable --> Exit0: no findings
|
|
182
|
+
Portable --> Exit1: findings
|
|
144
183
|
Partial --> Exit3
|
|
145
184
|
Failed --> Exit3
|
|
146
185
|
```
|
|
@@ -164,8 +203,9 @@ and duplicated runs waste both time and tokens.
|
|
|
164
203
|
### Add a language pack
|
|
165
204
|
|
|
166
205
|
Add grammar data and conventions in `src/lang/packs.ts`, then add a dedicated fixture
|
|
167
|
-
to `src/langtest.ts
|
|
168
|
-
|
|
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.
|
|
169
209
|
|
|
170
210
|
### Add a report format
|
|
171
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 |
|
|
@@ -58,6 +63,17 @@ jobs:
|
|
|
58
63
|
fail-on-findings: 'true'
|
|
59
64
|
```
|
|
60
65
|
|
|
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.
|
|
76
|
+
|
|
61
77
|
Set `upload-sarif: 'false'` and omit `security-events: write` when GitHub code scanning
|
|
62
78
|
is unavailable or the workflow should not publish SARIF.
|
|
63
79
|
|
|
@@ -85,10 +101,10 @@ lives at [`examples/github-actions/action.yml`](../examples/github-actions/actio
|
|
|
85
101
|
| `comment` | `true` | Maintain a pull-request comment |
|
|
86
102
|
| `inline-comments` | `false` | Post up to ten proven verified findings as one inline review |
|
|
87
103
|
| `fail-on-findings` | `false` | Turn a complete finding verdict into a failed job |
|
|
88
|
-
| `approve` | `false` | Approve only a complete, clean review |
|
|
104
|
+
| `approve` | `false` | Approve only a complete, clean, full-coverage review |
|
|
89
105
|
|
|
90
|
-
The outputs are `findings` and `
|
|
91
|
-
|
|
106
|
+
The outputs are `findings`, `complete`, and `coverage`. Gate infrastructure on
|
|
107
|
+
`complete`; use `coverage == 'full'` for decisions that require semantic depth.
|
|
92
108
|
|
|
93
109
|
## Direct CLI on GitHub Actions
|
|
94
110
|
|
|
@@ -99,7 +115,7 @@ step inside a larger quality job. The complete example is
|
|
|
99
115
|
The core pattern is:
|
|
100
116
|
|
|
101
117
|
```bash
|
|
102
|
-
npm install --global --ignore-scripts @0xcraft/powershot@1.1.
|
|
118
|
+
npm install --global --ignore-scripts @0xcraft/powershot@1.1.2
|
|
103
119
|
|
|
104
120
|
STATUS=0
|
|
105
121
|
psh review --verify-only \
|
|
@@ -147,6 +163,7 @@ and artifact declaration.
|
|
|
147
163
|
- Run `--verify-only` as the fast required check; add model judges only where their
|
|
148
164
|
cost and latency are intentional.
|
|
149
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.
|
|
150
167
|
- Generate every report from one invocation.
|
|
151
168
|
- Publish the Markdown report for humans and SARIF or Code Quality for annotations.
|
|
152
169
|
- Pin the PowerShot source version in protected workflows.
|
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>",
|