supercov 0.0.55 โ†’ 1.0.1

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 CHANGED
@@ -1,10 +1,16 @@
1
- ![Coverage for coding agents and software factories ๐ŸŒ™](https://raw.githubusercontent.com/supercorp-ai/supercov/main/supercov.jpg)
1
+ ![Code quality and coverage for coding agents](https://raw.githubusercontent.com/supercorp-ai/supercov/main/supercov.jpg)
2
2
 
3
- **Coverage for coding agents and software factories ๐ŸŒ™**
3
+ **Code quality and coverage for coding agents**
4
4
 
5
- **Supercov gives your coding agent the next useful test to write.** It runs the test command you already use, records local coverage evidence, and turns uncovered paths into small, actionable queries. Your agent writes a focused test, reruns the suite, proves what improved, and keeps going while useful gaps remain.
5
+ **Supercov tells your coding agent what to fix and what to test.** It scores your code quality with [Jev](https://typesafe.ai), runs the test command you already use, and turns uncovered paths into small, actionable queries. Your agent picks a target, writes a focused test or a focused refactor, proves what improved, and keeps going.
6
6
 
7
- No account, config file, import, custom reporter, or hosted service is required. Supercov is local, free, open source, and MIT licensed.
7
+ Paste this to your coding agent to start:
8
+
9
+ ```text supercov-prompt
10
+ Measure code quality with npx supercov and show me the weakest files.
11
+ ```
12
+
13
+ Scoring needs a [TypeSafe AI](https://typesafe.ai) API key, and your coding agent will usually ask you for it. It costs about a cent per megabyte of source. Coverage needs no account, config file, import, custom reporter, or hosted service. Supercov is local, free, open source, and MIT licensed.
8
14
 
9
15
  [Website](https://supercov.com) ยท [Documentation](https://supercov.com/docs) ยท [npm](https://www.npmjs.com/package/supercov) ยท [GitHub](https://github.com/supercorp-ai/supercov)
10
16
 
@@ -13,6 +19,41 @@ Supported by [Supercorp](https://supercorp.ai).
13
19
  [Agent workflow](https://supercov.com/docs/agent-loop): ask your coding agent
14
20
  to add a test in your own project, with a recorded example to follow along.
15
21
 
22
+ ## Score your code
23
+
24
+ ```bash
25
+ export TYPESAFE_API_KEY=... # get one at https://typesafe.ai
26
+ npx supercov quality
27
+ ```
28
+
29
+ No arguments and no configuration. It finds your source, asks Jev a set of
30
+ yes/no questions about each file, and does the arithmetic itself, so every part
31
+ of a score is a claim you can check against the file.
32
+
33
+ ```
34
+ Quality weak (3.8/10) over 163 files.
35
+ 11 good, 52 fair, 100 weak.
36
+
37
+ Weakest:
38
+ weak runtime/python/supercov_runtime.py
39
+ long_method 0.96, deep_nesting 0.92, complex_conditional 0.89, +9 more
40
+ weak crates/supercov-engine/src/assertion_store.rs
41
+ long_method 0.96, deep_nesting 0.91, complex_conditional 0.86, +8 more
42
+ ```
43
+
44
+ Narrow to what fired, read one file in full, or review a change:
45
+
46
+ ```bash
47
+ npx supercov quality gaps
48
+ npx supercov quality file src/server.ts
49
+ npx supercov quality patch # your uncommitted work, or your branch
50
+ npx supercov quality patch --annotate github # workflow annotations, no token
51
+ ```
52
+
53
+ Jev charges for what it reads and nothing for what it writes, so a megabyte of
54
+ source costs a little over a cent. Answers are cached by content, so a second
55
+ run pays only for what changed. See [Understanding quality](docs/quality.md).
56
+
16
57
  ## Start with the suite you already have
17
58
 
18
59
  ```bash
@@ -25,12 +66,33 @@ github.com/supercorp-ai/supercov/cmd/supercov@latest`.
25
66
 
26
67
  Everything after `--` is your test command. Supercov runs it without changing your source, tests, runner configuration, or normal build output.
27
68
 
28
- Then ask what is still uncovered:
69
+ Then read the result and ask what is still uncovered:
70
+
71
+ ```bash
72
+ npx supercov runs latest
73
+ ```
74
+
75
+ ```
76
+ run run_7fc676ba671d42be
77
+ command: npm test
78
+
79
+ Coverage
80
+ Lines 100.00% (5/5)
81
+ Branches 66.67% (4/6)
82
+ MC/DC 33.33% (1/3)
83
+ ```
29
84
 
30
85
  ```bash
31
86
  npx supercov runs latest gaps --limit 10
32
87
  ```
33
88
 
89
+ ```
90
+ Coverage gaps โ€” only files with unresolved obligations
91
+
92
+ src/pricing.js
93
+ uncovered: lines 0 statements 1 functions 0 branch outcomes 0 MC/DC conditions 2
94
+ ```
95
+
34
96
  After your agent adds a test, rerun the complete suite and prove the gain:
35
97
 
36
98
  ```bash
@@ -243,6 +305,7 @@ npx supercov clean # remove all runs and the build cache
243
305
  ## Documentation
244
306
 
245
307
  - [Getting started](https://supercov.com/docs/getting-started)
308
+ - [Understanding quality](https://supercov.com/docs/quality)
246
309
  - [Agent workflow](https://supercov.com/docs/agent-loop)
247
310
  - [Understanding assertions](docs/assertions.md)
248
311
  - [Troubleshooting](https://supercov.com/docs/troubleshooting)
package/docs/cli.md CHANGED
@@ -24,8 +24,70 @@ npx supercov --help
24
24
  | Find the tests a change affects | `npx supercov runs latest tests affected` |
25
25
  | Combine shards | `npx supercov merge <id> <id> [...]` |
26
26
  | Remove local data | `npx supercov clean` |
27
+ | Assess code quality with Jev | `npx supercov quality` |
28
+ | See only files with findings | `npx supercov quality gaps` |
29
+ | Review what a change introduced | `npx supercov quality patch` |
27
30
  | Read bundled guides | `npx supercov docs` |
28
31
 
32
+ ## Assess source quality
33
+
34
+ ```sh supercov-example
35
+ supercov quality # this repository
36
+ supercov quality src/ # one directory
37
+ supercov quality gaps # only files something fired on
38
+ supercov quality file src/a.ts # one file, every check
39
+ supercov quality scope # which files are assessed, and why
40
+ supercov quality snapshots # saved assessments
41
+ supercov quality diff <older> <newer>
42
+ ```
43
+
44
+ With no argument the subject is the repository you are standing in. Every
45
+ assessment saves a snapshot, so the reading commands work afterwards with no key
46
+ and no network.
47
+
48
+ Twelve yes/no questions about named code properties go to [Jev](https://typesafe.ai);
49
+ the score is arithmetic this command does over the answers. Text reports a band,
50
+ `good`, `fair` or `weak`; `--json` carries the number and every check with what
51
+ is known about it. `--all` includes test files, generated output and anything
52
+ outside a source root, all of which are left out by default. `--dry-run` prints
53
+ the exact requests and contacts nothing.
54
+
55
+ `quality diff` reports what declined between two assessments: which files lost
56
+ health, which properties appeared, and which files entered or left the scope.
57
+
58
+ Assessing needs a TypeSafe AI API key in `TYPESAFE_API_KEY`; reading a saved
59
+ assessment does not. The command prints a cost estimate before sending anything
60
+ and caches answers by content, so a second run pays only for what changed.
61
+
62
+ See [Understanding quality](https://supercov.com/docs/quality) for what the
63
+ number is worth and which files get assessed.
64
+
65
+ ## Review what a change introduced
66
+
67
+ ```sh supercov-example
68
+ supercov quality patch
69
+ supercov quality patch --base origin/main
70
+ supercov quality patch --base origin/main --annotate github --run latest
71
+ ```
72
+
73
+ The same twelve properties asked of a change, plus six risk checks that only
74
+ apply to one: a credential in source, untrusted input in a query, a change to
75
+ who may do what, a test that now checks less, a schema migration, and debugging
76
+ left behind.
77
+
78
+ With no range it reviews uncommitted work when the tree is dirty and everything
79
+ since this branch left its default branch when it is clean. `--unstaged`,
80
+ `--staged` and `--base <ref>` say so explicitly; `--base` uses the merge base,
81
+ like `runs patch`, so commits other people landed after you branched are not
82
+ your change.
83
+
84
+ `--annotate github` prints workflow annotations on stdout, needing no token and
85
+ posting no comment. `--run <id>` reads a saved coverage run and marks any file
86
+ where a property appeared and the run left lines uncovered.
87
+
88
+ Output lists only files where something appeared. A change that introduces
89
+ nothing prints one line saying so. About $0.0005 per changed file.
90
+
29
91
  ## Measure a test command
30
92
 
31
93
  ```sh supercov
@@ -12,6 +12,15 @@ added and the before-and-after coverage.
12
12
  Your agent can install Supercov if needed. It runs the commands and edits the
13
13
  tests; you don't need to do those steps yourself.
14
14
 
15
+ To score the code itself rather than its tests, set a [Jev](https://typesafe.ai)
16
+ key and ask:
17
+
18
+ ```text supercov-prompt
19
+ Measure code quality with npx supercov and show me the weakest files.
20
+ ```
21
+
22
+ See [Understanding quality](https://supercov.com/docs/quality).
23
+
15
24
  When it finishes, review the test change and coverage comparison in your
16
25
  conversation. Ask separately if you want a commit or pull request.
17
26
 
@@ -0,0 +1,208 @@
1
+ # Understanding quality
2
+
3
+ `supercov quality` tells you what is in your code: twelve named properties,
4
+ checked file by file, so a score is never a number you have to take on faith.
5
+
6
+ Judgments come from [Jev](https://typesafe.ai), which answers typed questions
7
+ rather than generating prose. Supercov asks the questions and does the
8
+ arithmetic, so every part of a score is a claim you can check against the file.
9
+
10
+ ## Set your key
11
+
12
+ Assessing needs a TypeSafe AI API key, and your coding agent will usually ask
13
+ you for it. Get one at [typesafe.ai](https://typesafe.ai).
14
+
15
+ Supercov looks for it in `TYPESAFE_API_KEY`:
16
+
17
+ ```bash
18
+ export TYPESAFE_API_KEY=... # for this shell
19
+ TYPESAFE_API_KEY=... npx supercov quality # for one command
20
+ ```
21
+
22
+ The environment variable is the only way to pass it. A key given on the command
23
+ line ends up in your shell history and in the process list, where anyone on the
24
+ machine can read it.
25
+
26
+ Set it the way your environment already sets secrets:
27
+
28
+ | Where | How |
29
+ | --- | --- |
30
+ | GitHub Actions | `env: { TYPESAFE_API_KEY: ${{ secrets.TYPESAFE_API_KEY }} }` |
31
+ | GitLab CI | a masked CI/CD variable named `TYPESAFE_API_KEY` |
32
+ | Docker | `docker run -e TYPESAFE_API_KEY ...` |
33
+ | Local development | a `.env` loaded by `direnv`, `dotenv` or your shell profile |
34
+
35
+ Reading a saved assessment never needs a key, and `--dry-run` prints the exact
36
+ requests without sending them.
37
+
38
+ ## Start with the repository
39
+
40
+ ```bash
41
+ npx supercov quality
42
+ ```
43
+
44
+ No arguments, no configuration. It finds your source, asks twelve questions of
45
+ each file, and saves a snapshot you can read afterwards without a key or a
46
+ network.
47
+
48
+ ```
49
+ Quality fair (5.0/10) over 163 files.
50
+ 11 good, 53 fair, 99 weak.
51
+
52
+ Weakest:
53
+ weak src/lib/modernHttp.ts
54
+ long_method 0.93, duplicated_logic 0.88, complex_conditional 0.87, +7 more
55
+ ```
56
+
57
+ `good` is 8 and above, `fair` is 5 to 8, `weak` is below 5. `--json` carries the
58
+ number when something needs to sort.
59
+
60
+ ## The twelve properties
61
+
62
+ god class, long method, deep nesting, complex conditional, long parameter list,
63
+ duplicated logic, primitive obsession, dead code, feature envy, temporary field,
64
+ message chains, magic values.
65
+
66
+ They come from Fowler and Beck's refactoring smells and the class-scope smells
67
+ CodeScene's Code Health is built from. Each is a yes/no question with a
68
+ definition and a stated exception, so two careful readers would agree on the
69
+ answer.
70
+
71
+ Three of them fire on more than half the files in a typical repository, so the
72
+ summary shows the three strongest per file. To see all twelve with what is known
73
+ about each:
74
+
75
+ ```bash
76
+ npx supercov quality file src/lib/modernHttp.ts
77
+ npx supercov quality gaps # only files something fired on
78
+ ```
79
+
80
+ ## Reading the score
81
+
82
+ Health is the mean of the twelve answers, done by this command rather than by
83
+ the model. A directory or a whole repository counts its larger files for more,
84
+ so a folder of one-line re-exports cannot outvote the file everything depends
85
+ on.
86
+
87
+ Use it to find the code that is hardest to change, and `quality gaps` to jump
88
+ straight to the files something fired on.
89
+
90
+ ## What a change introduced
91
+
92
+ ```bash
93
+ npx supercov quality patch
94
+ ```
95
+
96
+ With no range it reviews your uncommitted work when the tree is dirty, and
97
+ everything since your branch left its default branch when it is clean. Say so
98
+ explicitly with `--unstaged`, `--staged`, or `--base origin/main`, which uses
99
+ the merge base so commits other people landed after you branched are not
100
+ counted as yours.
101
+
102
+ It asks the twelve properties differentially, whether the new version shows
103
+ something the old one did not, and adds six checks that only make sense for a
104
+ change:
105
+
106
+ - a credential written into source
107
+ - untrusted input interpolated into a query
108
+ - a change to how the system decides who may do what
109
+ - a test that now checks less than it did
110
+ - a database schema or data migration
111
+ - debugging left behind
112
+
113
+ Output lists only files where something appeared. A change that introduces
114
+ nothing says so in one line.
115
+
116
+ ```bash
117
+ npx supercov quality patch --base origin/main --annotate github
118
+ ```
119
+
120
+ `--annotate github` prints workflow annotations on stdout. It needs no token and
121
+ posts no comment.
122
+
123
+ ## Which files get looked at
124
+
125
+ ```bash
126
+ npx supercov quality scope
127
+ ```
128
+
129
+ Source roots come from your package manifests and from what they declare, so a
130
+ `bin` or `exports` entry counts even when it is not in a conventional directory.
131
+ Test files, generated output, tool scripts, examples, benchmarks and
132
+ documentation are left out, each with its reason. `--all` includes everything.
133
+
134
+ If some of your code sits somewhere none of that recognises, Supercov asks Jev
135
+ about those paths with your whole tree as context, and says how many it decided
136
+ that way. To decide yourself:
137
+
138
+ ```bash
139
+ SUPERCOV_SOURCE_ROOTS=src,packages npx supercov quality
140
+ ```
141
+
142
+ A declaration is never second-guessed.
143
+
144
+ ## Tracking it over time
145
+
146
+ ```bash
147
+ npx supercov quality snapshots
148
+ npx supercov quality diff <older> <newer>
149
+ ```
150
+
151
+ Which files lost health, which gained, which properties appeared, and which
152
+ files entered or left the scope. A file whose contents did not change is marked,
153
+ so a small movement does not send you looking for an edit that was never made.
154
+
155
+ ## What it costs
156
+
157
+ Jev charges for what it reads and nothing for what it writes, at $42 per billion
158
+ input tokens. What that means in practice, measured rather than estimated:
159
+
160
+ | | source | cost |
161
+ | --- | ---: | ---: |
162
+ | Supercov's CLI crate | 0.5 MB | $0.007 |
163
+ | a TypeScript gateway, 197 files | 0.9 MB | $0.02 |
164
+ | one changed file in a review | โ€” | $0.0005 |
165
+
166
+ About a cent per megabyte of source, a little more when the files are small,
167
+ because each one carries its own questions.
168
+
169
+ The command prints its estimate before sending anything, so a number that looks
170
+ wrong can be stopped rather than discovered on an invoice:
171
+
172
+ ```
173
+ [supercov] quality: 35 requests, about 111840 input tokens ($0.0047) if none is cached
174
+ ```
175
+
176
+ **Most runs cost far less than that estimate.** Answers are cached by content
177
+ under `.supercov/quality/requests/`, so a second run pays only for files that
178
+ actually changed. The cache follows content rather than paths, which means
179
+ switching branches, rebasing or checking out an old commit reuses everything
180
+ unchanged: assessing the same directory 400 commits back in a real repository
181
+ answered every file from cache and sent nothing.
182
+
183
+ Three ways to spend less:
184
+
185
+ - **Assess a directory, not the tree**, while you are iterating:
186
+ `npx supercov quality src/api`.
187
+ - **Review the change, not the repository**, in CI: `npx supercov quality patch`
188
+ costs about $0.0005 per changed file, so a typical pull request is a fraction
189
+ of a cent.
190
+ - **Keep `.supercov/` between CI runs** if your runner supports a cache. An
191
+ unchanged file then costs nothing on every run after the first.
192
+
193
+ `--refresh` asks again and bypasses the cache. `--dry-run` prints the exact
194
+ requests, sends nothing and costs nothing.
195
+
196
+ ## Reference
197
+
198
+ ```bash
199
+ npx supercov quality # this repository
200
+ npx supercov quality gaps # only files something fired on
201
+ npx supercov quality file src/server.ts # one file, every check
202
+ npx supercov quality scope # which files, and why
203
+ npx supercov quality snapshots # saved assessments
204
+ npx supercov quality diff <older> <newer> # what declined
205
+ npx supercov quality patch # what a change introduced
206
+ ```
207
+
208
+ Full options are in the [CLI reference](https://supercov.com/docs/cli).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "supercov",
3
- "version": "0.0.55",
4
- "description": "Coverage for coding agents and software factories \ud83c\udf19",
3
+ "version": "1.0.1",
4
+ "description": "Code quality and coverage for coding agents",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -18,6 +18,7 @@
18
18
  "docs/getting-started.md",
19
19
  "docs/agent-loop.md",
20
20
  "docs/assertions.md",
21
+ "docs/quality.md",
21
22
  "docs/assertion-evidence.md",
22
23
  "docs/assertion-maps.md",
23
24
  "docs/assertion-agent.md",
@@ -98,14 +99,14 @@
98
99
  "test:launcher": "go vet ./cmd/... && go test ./cmd/..."
99
100
  },
100
101
  "optionalDependencies": {
101
- "@supercov/cli-darwin-arm64": "0.0.55",
102
- "@supercov/cli-darwin-x64": "0.0.55",
103
- "@supercov/cli-linux-arm64-gnu": "0.0.55",
104
- "@supercov/cli-linux-arm64-musl": "0.0.55",
105
- "@supercov/cli-linux-x64-gnu": "0.0.55",
106
- "@supercov/cli-linux-x64-musl": "0.0.55",
107
- "@supercov/cli-win32-arm64": "0.0.55",
108
- "@supercov/cli-win32-x64": "0.0.55"
102
+ "@supercov/cli-darwin-arm64": "1.0.1",
103
+ "@supercov/cli-darwin-x64": "1.0.1",
104
+ "@supercov/cli-linux-arm64-gnu": "1.0.1",
105
+ "@supercov/cli-linux-arm64-musl": "1.0.1",
106
+ "@supercov/cli-linux-x64-gnu": "1.0.1",
107
+ "@supercov/cli-linux-x64-musl": "1.0.1",
108
+ "@supercov/cli-win32-arm64": "1.0.1",
109
+ "@supercov/cli-win32-x64": "1.0.1"
109
110
  },
110
111
  "peerDependencies": {
111
112
  "@playwright/test": ">=1.55.0",