judgelint 0.1.1-aarch64-linux → 0.1.5-aarch64-linux
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +59 -24
- data/README.md +189 -133
- data/lib/judgelint/cli.rb +26 -15
- data/lib/judgelint/client.rb +5 -1
- data/lib/judgelint/config.rb +3 -3
- data/lib/judgelint/glob.rb +24 -1
- data/lib/judgelint/paint.rb +46 -0
- data/lib/judgelint/protocol.rb +42 -8
- data/lib/judgelint/question.rb +62 -61
- data/lib/judgelint/reporter.rb +60 -19
- data/lib/judgelint/rule.rb +22 -2
- data/lib/judgelint/runner.rb +98 -28
- data/lib/judgelint/scaffold.rb +44 -45
- data/lib/judgelint/source.rb +8 -2
- data/lib/judgelint/spec.rb +78 -27
- data/lib/judgelint/verdict.rb +11 -7
- data/lib/judgelint/version.rb +1 -1
- data/lib/judgelint.rb +1 -0
- data/libexec/judgelint +0 -0
- metadata +7 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d7c0f0bfa265c9e179b8fd32a007061644a4765b80dce31b1fca07da74563ba2
|
|
4
|
+
data.tar.gz: 694fda3bb7386eceeab3db51294a44d0f23eb6681b461af058f8a7320f6fe4ba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eede5f57ad9040f0ebc4e0c7c987b1fe42c6599254c8570a425b14d14d906089c6a0744540c04b282a1e2726ce649abdbc5997b147ddab8e7a458ddee9805c7a
|
|
7
|
+
data.tar.gz: c5f0300a8fbf211f7d2191f3eee3b47cf370dba391ef415a4a23af93036e7b68644b4ee7cbd2cb9be4440ba32e215152629762cd5c47335868494209f1162e26
|
data/CHANGELOG.md
CHANGED
|
@@ -1,32 +1,67 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.5 (2026-10-26)
|
|
4
|
+
|
|
5
|
+
- The text report is in color in a terminal: errors in red, warnings and
|
|
6
|
+
uncertain findings in yellow, and file names in bold. `judgelint test`
|
|
7
|
+
marks hits green and misses red. `NO_COLOR` turns color off and
|
|
8
|
+
`FORCE_COLOR` turns it on. Piped output is unchanged.
|
|
9
|
+
|
|
10
|
+
## 0.1.4 (2026-10-24)
|
|
11
|
+
|
|
12
|
+
- `Bad:` and `Good:` code blocks under a bullet are examples. The model reads
|
|
13
|
+
them with the spec, and `judgelint test` judges each one, along with the
|
|
14
|
+
files in `.judgelint/examples/`.
|
|
15
|
+
- `judgelint init` writes a `CONVENTIONS.md` with examples in it.
|
|
16
|
+
- `examples/conventions` has complete specs for Ruby, TypeScript, Python, and
|
|
17
|
+
Postgres migrations.
|
|
18
|
+
|
|
19
|
+
## 0.1.3 (2026-10-24)
|
|
20
|
+
|
|
21
|
+
- No setup beyond `TYPESAFE_API_KEY`. A `CONVENTIONS.md` of bullets is a
|
|
22
|
+
spec with no frontmatter, and it covers the files in its directory and
|
|
23
|
+
below, except Markdown and lockfiles. A README still needs `paths:`.
|
|
24
|
+
- The cost line names the model.
|
|
25
|
+
- Full runs skip files git ignores, and binary files.
|
|
26
|
+
- `judgelint init` no longer writes `.judgelint.yml`.
|
|
27
|
+
- A run the cache answers in full needs no API key.
|
|
28
|
+
|
|
29
|
+
## 0.1.2 (2026-10-24)
|
|
30
|
+
|
|
31
|
+
- Each bullet is one choice between breaking the rule, following it, and the
|
|
32
|
+
rule not applying, in place of two yes/no questions. On the demo app, Jev
|
|
33
|
+
finds 13 of 14 known violations, up from 12, with half the questions.
|
|
34
|
+
- Findings name the line that breaks the rule, or the file in a directory,
|
|
35
|
+
when the model is sure of one.
|
|
36
|
+
- Both the System One and OpenAI Decisions protocols send choice questions.
|
|
37
|
+
|
|
3
38
|
## 0.1.1 (2026-10-23)
|
|
4
39
|
|
|
5
|
-
- `judgehint:` comments replace `judgelint:disable`. A hint
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
-
|
|
40
|
+
- `judgehint:` comments replace `judgelint:disable`. A hint explains why code
|
|
41
|
+
breaks a rule. judgelint asks each rule whether the hint gives a reason that
|
|
42
|
+
applies to it, and reports the finding as excused if it does.
|
|
43
|
+
- Each GitHub release has native binaries for macOS and Linux. Install them
|
|
9
44
|
with Homebrew (`brew install jpcamara/tap/judgelint`) or `install.sh`.
|
|
10
45
|
|
|
11
46
|
## 0.1.0 (2026-10-23)
|
|
12
47
|
|
|
13
|
-
- Specs
|
|
14
|
-
|
|
15
|
-
with the file and is asked
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
- `check`, `test`
|
|
22
|
-
`
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
48
|
+
- Specs: a README or `*.judgelint.md` with `paths:` in its frontmatter,
|
|
49
|
+
where each top-level bullet is a rule. The model reads
|
|
50
|
+
the spec with the file, and each bullet is asked both ways and averaged.
|
|
51
|
+
`violation:` and `compliant:` lines under a bullet describe it more
|
|
52
|
+
precisely. Rules that don't fit in a bullet can be written as questions in
|
|
53
|
+
`.judgelint/rules/`.
|
|
54
|
+
- Rules can apply to every 40 lines, a whole file, or a whole directory.
|
|
55
|
+
`context:` adds files the model reads but doesn't judge.
|
|
56
|
+
- Commands: `check`, `test`, `rules`, `providers`, and `init`. `--base` and
|
|
57
|
+
`--pr` check only what changed. Output as text, JSON, GitHub annotations,
|
|
58
|
+
or SARIF.
|
|
59
|
+
- Requests are planned and priced before any are sent, and `max_cost_usd`
|
|
60
|
+
stops an expensive run. Every run prints its cost, and answers are cached
|
|
61
|
+
per model.
|
|
62
|
+
- 16 providers over the System One and OpenAI Decisions APIs. List more than
|
|
63
|
+
one in `models:` to average their answers.
|
|
64
|
+
- `judgelint:disable` comments, with a required reason.
|
|
65
|
+
- No runtime dependencies. The macOS and Linux gems include a native binary
|
|
66
|
+
built with Spinel.
|
|
67
|
+
- `examples/scoop-society`, a TypeScript demo app with known violations.
|
data/README.md
CHANGED
|
@@ -1,58 +1,96 @@
|
|
|
1
1
|
# judgelint
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
judgelint checks code against conventions written in plain English. You write
|
|
4
|
+
them as bullets in a README. judgelint asks a decision model, such as
|
|
5
|
+
TypeSafe's Jev, whether each file breaks each bullet, and reports violations
|
|
6
|
+
with line numbers and an exit code like any other linter. Each answer takes a
|
|
7
|
+
few hundred milliseconds and costs a fraction of a cent.
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
One decision model, such as TypeSafe's Jev, whether each file breaks each
|
|
7
|
-
one, and reports violations with line ranges and exit codes, like a linter.
|
|
8
|
-
Answers take a few hundred milliseconds and cost a fraction of a cent.
|
|
9
|
-
|
|
10
|
-
Inspired by [praxis](https://github.com/zarpay/praxis-cli), which reads the
|
|
11
|
-
same kind of specs with chat models. judgelint trades praxis's written
|
|
12
|
-
findings for speed and cost, and reads praxis's specs as they are. Written in
|
|
13
|
-
Ruby with no dependencies, and compiled to a native binary with
|
|
14
|
-
[Spinel](https://github.com/matz/spinel), so it doesn't need Ruby to run.
|
|
15
|
-
|
|
16
|
-
## Quick start
|
|
9
|
+
## Install
|
|
17
10
|
|
|
18
11
|
```sh
|
|
19
12
|
brew install jpcamara/tap/judgelint
|
|
20
|
-
# or
|
|
21
|
-
|
|
13
|
+
# or
|
|
14
|
+
curl -fsSL https://raw.githubusercontent.com/jpcamara/judgelint/main/install.sh | sh
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The script installs to `~/.local/bin`, or to `$JUDGELINT_INSTALL_DIR`. The
|
|
18
|
+
binaries are on the [releases page](https://github.com/jpcamara/judgelint/releases)
|
|
19
|
+
for macOS and Linux, on arm64 and x86_64. Linux needs glibc 2.35 or newer
|
|
20
|
+
(Ubuntu 22.04, Debian 12). `gem install judgelint` works too, and runs as
|
|
21
|
+
plain Ruby on Windows.
|
|
22
|
+
|
|
23
|
+
## Getting started
|
|
24
|
+
|
|
25
|
+
Write your conventions as bullets in a `CONVENTIONS.md`:
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
- **No silent rescues.** A rescue logs the error, re-raises it, or returns a
|
|
29
|
+
failure the caller sees.
|
|
30
|
+
- **Error messages say what to do next.** A raised error names what was wrong
|
|
31
|
+
and what would work instead.
|
|
32
|
+
```
|
|
22
33
|
|
|
23
|
-
|
|
34
|
+
Then set your TypeSafe API key and run it:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
24
37
|
export TYPESAFE_API_KEY=...
|
|
25
|
-
judgelint
|
|
26
|
-
judgelint --base main
|
|
27
|
-
judgelint # or every file the specs govern
|
|
38
|
+
judgelint # checks every file
|
|
39
|
+
judgelint --base main # checks only what changed since main
|
|
28
40
|
```
|
|
29
41
|
|
|
30
|
-
|
|
42
|
+
```text
|
|
43
|
+
lib/profile.rb
|
|
44
|
+
x error root/no-silent-rescues 5 0.99 No silent rescues.
|
|
45
|
+
x error root/error-messages-say-what-to-do 9 0.97 Error messages say what to do next.
|
|
46
|
+
|
|
47
|
+
1 file, 2 violations
|
|
48
|
+
judgelint: 1 request, 940 input tokens, $0.0000, typesafe:jev-latest
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
That's all the setup there is. A `CONVENTIONS.md` covers the files in its
|
|
52
|
+
directory and below, except Markdown and lockfiles. In a git repository,
|
|
53
|
+
judgelint skips what git ignores. It also skips binary files.
|
|
54
|
+
|
|
55
|
+
judgelint asks Jev on TypeSafe. To use another provider, set `models` in
|
|
56
|
+
`.judgelint.yml` (see [Configuration](#configuration)).
|
|
57
|
+
|
|
58
|
+
Here's a run on the [demo app](examples/scoop-society), with the messages shortened:
|
|
31
59
|
|
|
32
60
|
```text
|
|
33
61
|
$ judgelint src/services/apply-refund.ts src/features/flavor-of-day
|
|
34
62
|
src/services/apply-refund.ts
|
|
35
|
-
|
|
36
|
-
x error src/services/
|
|
37
|
-
x error src/services/
|
|
63
|
+
? uncertain src/services/a-service-module-exports-exactly-one 1-21 0.47 A service module exports exactly one entry point.
|
|
64
|
+
x error src/services/domain-failures-are-values-never-exceptions 13 1.00 Domain failures are values, never exceptions.
|
|
65
|
+
x error src/services/error-messages-are-written-for-the 13 1.00 Error messages are written for the API consumer.
|
|
66
|
+
? uncertain src/services/input-is-validated-before-any-work 10 0.51 Input is validated before any work happens.
|
|
67
|
+
x error src/services/every-service-has-a-doc-comment 1-21 1.00 Every service has a doc comment …
|
|
38
68
|
src/features/flavor-of-day
|
|
39
|
-
x error src/features/exactly-one-entry-point-index-ts
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
69
|
+
x error src/features/exactly-one-entry-point-index-ts old-rotation.ts 1.00 Exactly one entry point, `index.ts`, …
|
|
70
|
+
? uncertain src/features/types-live-in-a-dedicated-feature flavor.ts 0.53 Types live in a dedicated `<feature>-types.ts` file.
|
|
71
|
+
x error src/features/logic-files-are-verb-first-kebab flavor.ts 0.99 Logic files are verb-first kebab-case …
|
|
72
|
+
x error src/features/no-orphaned-files old-rotation.ts 0.79 No orphaned files.
|
|
43
73
|
|
|
44
|
-
2 files,
|
|
45
|
-
judgelint: 2 requests,
|
|
74
|
+
2 files, 6 violations, 3 uncertain
|
|
75
|
+
judgelint: 2 requests, 6,437 input tokens, $0.0003, typesafe:jev-latest
|
|
46
76
|
```
|
|
47
77
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
78
|
+
A finding names the line that breaks the rule, or the file in a directory,
|
|
79
|
+
when the model is sure of one. Otherwise it shows the lines it was asked
|
|
80
|
+
about.
|
|
81
|
+
|
|
82
|
+
It exits 1 when there are violations, and 2 on a usage, config, or model
|
|
83
|
+
error. Config problems are caught before any request is sent.
|
|
51
84
|
|
|
52
|
-
|
|
85
|
+
In a terminal, the report is in color. Set `NO_COLOR` to turn color off, or
|
|
86
|
+
`FORCE_COLOR` to keep it when the output is piped.
|
|
53
87
|
|
|
54
|
-
|
|
55
|
-
|
|
88
|
+
## Writing specs
|
|
89
|
+
|
|
90
|
+
A spec is a `CONVENTIONS.md`, a file ending in `.judgelint.md`, or a README
|
|
91
|
+
with `paths:` in its frontmatter. Each top-level bullet is a rule. Put a spec
|
|
92
|
+
in a subdirectory for conventions that apply only there, or use `paths:` to
|
|
93
|
+
choose the files:
|
|
56
94
|
|
|
57
95
|
```markdown
|
|
58
96
|
---
|
|
@@ -66,16 +104,13 @@ excludes: ["src/services/legacy-import.ts"]
|
|
|
66
104
|
- **No I/O except through the injected Store.** No timers, no fetch, no console.
|
|
67
105
|
```
|
|
68
106
|
|
|
69
|
-
The model
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
are
|
|
74
|
-
and a bullet that says "should" or "prefer" is a warning, anything else an
|
|
75
|
-
error.
|
|
107
|
+
The model gets the spec and the numbered file. For each bullet, it chooses
|
|
108
|
+
whether the code breaks it, follows it, or isn't covered by it, and which line
|
|
109
|
+
breaks it most clearly. A rule's id comes from the spec's directory and the start of its bullet, like
|
|
110
|
+
`src/services/no-i-o-except-through-the`. Bullets that say "should" or
|
|
111
|
+
"prefer" are warnings, and the rest are errors.
|
|
76
112
|
|
|
77
|
-
|
|
78
|
-
indented lines under it:
|
|
113
|
+
If the model misreads a bullet, describe breaking and following it:
|
|
79
114
|
|
|
80
115
|
```markdown
|
|
81
116
|
- **No I/O except through the injected Store.** No timers, no fetch, no console.
|
|
@@ -83,22 +118,51 @@ indented lines under it:
|
|
|
83
118
|
compliant: reads and writes only through the Store it's given
|
|
84
119
|
```
|
|
85
120
|
|
|
86
|
-
They make the model more decisive
|
|
87
|
-
|
|
121
|
+
They make the model more decisive. A loose description can also flag code
|
|
122
|
+
you meant to allow, so check them against examples.
|
|
123
|
+
|
|
124
|
+
### Examples
|
|
125
|
+
|
|
126
|
+
Show the model what breaking and following a rule looks like. Under a bullet,
|
|
127
|
+
put code blocks after a `Bad:` or `Good:` line:
|
|
128
|
+
|
|
129
|
+
````markdown
|
|
130
|
+
- **Jobs take ids, not records.** Arguments to `perform_later` are ids and
|
|
131
|
+
plain values. A record can change or disappear before the job runs.
|
|
132
|
+
|
|
133
|
+
Bad:
|
|
134
|
+
|
|
135
|
+
```ruby
|
|
136
|
+
WelcomeEmailJob.perform_later(user)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Good:
|
|
140
|
+
|
|
141
|
+
```ruby
|
|
142
|
+
WelcomeEmailJob.perform_later(user.id, locale: user.locale)
|
|
143
|
+
```
|
|
144
|
+
````
|
|
145
|
+
|
|
146
|
+
The model reads them with the rest of the spec, and `judgelint test` checks
|
|
147
|
+
that it gets each one right. [examples/conventions](examples/conventions) has
|
|
148
|
+
complete specs for Ruby, TypeScript, Python, and Postgres migrations, with
|
|
149
|
+
code to run them on.
|
|
88
150
|
|
|
89
|
-
| Frontmatter | |
|
|
151
|
+
| Frontmatter | What it does |
|
|
90
152
|
|---|---|
|
|
91
|
-
| `paths`, `excludes` | Globs for the files the spec
|
|
92
|
-
| `context` | Files the model reads
|
|
93
|
-
| `scope` | `window
|
|
94
|
-
| `severity`, `threshold` |
|
|
153
|
+
| `paths`, `excludes` | Globs for the files the spec covers, relative to the project root. A README needs `paths`. |
|
|
154
|
+
| `context` | Files the model reads along with each file, like shared types. They're never judged. |
|
|
155
|
+
| `scope` | `window`, the default, asks about every 40 lines so findings have line numbers. `file` asks once per file. `directory` asks once per directory, shows the model every file in it, and names the file that breaks the rule. |
|
|
156
|
+
| `severity`, `threshold` | Set the severity or threshold for every rule in the spec. |
|
|
95
157
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
158
|
+
Each answer is the probability that the code breaks the rule. At 0.7 or above
|
|
159
|
+
it's a violation. Between 0.4 and 0.7 it's reported as uncertain, which
|
|
160
|
+
doesn't fail the run.
|
|
99
161
|
|
|
100
|
-
|
|
101
|
-
|
|
162
|
+
### Rules written as questions
|
|
163
|
+
|
|
164
|
+
When a convention doesn't fit in a bullet, write it as a question in
|
|
165
|
+
`.judgelint/rules/<id>.md`:
|
|
102
166
|
|
|
103
167
|
```markdown
|
|
104
168
|
---
|
|
@@ -111,90 +175,92 @@ paths: ["src/features/*"]
|
|
|
111
175
|
Every file in a feature is reachable from index.ts.
|
|
112
176
|
```
|
|
113
177
|
|
|
114
|
-
`fail_when: no`
|
|
115
|
-
input first?"
|
|
178
|
+
Add `fail_when: no` when a "no" is the violation, as in "Does this service
|
|
179
|
+
validate its input first?"
|
|
180
|
+
|
|
181
|
+
## Explaining exceptions
|
|
116
182
|
|
|
117
|
-
|
|
183
|
+
When code breaks a rule on purpose, explain why in a `judgehint:` comment. Any
|
|
184
|
+
comment style works.
|
|
118
185
|
|
|
119
186
|
```ts
|
|
120
187
|
// judgehint: throwing is intentional. Only the nightly job calls this, after
|
|
121
188
|
// checking the review, so a bad id here is a programmer error.
|
|
122
189
|
```
|
|
123
190
|
|
|
124
|
-
For each rule,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
191
|
+
For each rule, judgelint asks whether a hint in the same 40 lines gives a
|
|
192
|
+
reason the code can break it. If it does, the finding is reported as excused
|
|
193
|
+
and doesn't fail the run. A hint only excuses the rule it explains, and a hint
|
|
194
|
+
with no reason, like "this is intentional", doesn't excuse anything.
|
|
128
195
|
|
|
129
|
-
##
|
|
196
|
+
## Testing rules
|
|
130
197
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
`.judgelint/examples/<rule id>/pass/` (must not be violations) and `fail/`
|
|
134
|
-
(must be), and `judgelint test` reports what the model gets wrong:
|
|
198
|
+
`judgelint test` judges each rule's examples and shows which ones the model
|
|
199
|
+
gets wrong:
|
|
135
200
|
|
|
136
201
|
```text
|
|
137
|
-
|
|
138
|
-
ok
|
|
139
|
-
|
|
140
|
-
|
|
202
|
+
root/jobs-take-ids-not-records 2/2
|
|
203
|
+
ok fail 1.00 CONVENTIONS.md:67
|
|
204
|
+
ok pass 0.00 CONVENTIONS.md:73
|
|
205
|
+
root/no-silent-rescues 2/3
|
|
206
|
+
ok pass 0.03 .judgelint/examples/root/no-silent-rescues/pass/logs_and_reraises.rb
|
|
207
|
+
MISS pass 0.79 .judgelint/examples/root/no-silent-rescues/pass/retries_then_raises.rb
|
|
208
|
+
ok fail 0.94 .judgelint/examples/root/no-silent-rescues/fail/assigns_default.rb
|
|
141
209
|
```
|
|
142
210
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
211
|
+
`Bad:` and `Good:` blocks in the spec are the quickest examples to write. The
|
|
212
|
+
model also reads them during every check, so passing them shows it
|
|
213
|
+
understands the rule, not that it gets the rule right on code it hasn't seen.
|
|
214
|
+
For that, and for longer examples, put whole files that follow the rule in
|
|
215
|
+
`.judgelint/examples/<rule id>/pass/` and files that break it in `fail/`. The
|
|
216
|
+
model doesn't see the `pass/` or `fail/` part of the path. For a directory
|
|
217
|
+
rule, each example is a directory.
|
|
218
|
+
|
|
219
|
+
When an example fails, reword the bullet or split it into narrower rules.
|
|
220
|
+
`judgelint init` writes a spec with examples to start from.
|
|
148
221
|
|
|
149
|
-
##
|
|
222
|
+
## CI
|
|
150
223
|
|
|
151
224
|
```sh
|
|
152
|
-
judgelint --base main # since the merge base with main, uncommitted work
|
|
153
|
-
judgelint --pr # the pull request
|
|
154
|
-
judgelint --pr --format github # annotations on the changed lines (
|
|
225
|
+
judgelint --base main # changes since the merge base with main, plus uncommitted work
|
|
226
|
+
judgelint --pr # changes in the current pull request
|
|
227
|
+
judgelint --pr --format github # GitHub annotations on the changed lines (json and sarif work too)
|
|
155
228
|
```
|
|
156
229
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
230
|
+
These only ask about the 40-line windows that changed, so existing code
|
|
231
|
+
doesn't block a new pull request. `--pr` gets the base branch from GitHub
|
|
232
|
+
Actions, GitLab, Buildkite, Bitbucket, Azure Pipelines,
|
|
233
|
+
`JUDGELINT_BASE_BRANCH`, or `gh`. Fetch enough history for git to find the
|
|
234
|
+
merge base.
|
|
162
235
|
|
|
163
236
|
## Configuration
|
|
164
237
|
|
|
165
|
-
`.judgelint.yml` has four settings:
|
|
238
|
+
judgelint runs without a config file. `.judgelint.yml` has four settings:
|
|
166
239
|
|
|
167
240
|
```yaml
|
|
168
|
-
models: [typesafe] #
|
|
241
|
+
models: [typesafe] # provider or provider:model; list two to average them
|
|
169
242
|
threshold: 0.7
|
|
170
|
-
ignore: ["vendor/**"] # files no rule
|
|
171
|
-
max_cost_usd: 1.00 # refuse a run estimated
|
|
243
|
+
ignore: ["vendor/**"] # files no rule checks, and READMEs that aren't specs
|
|
244
|
+
max_cost_usd: 1.00 # refuse a run estimated to cost more, unless --yes
|
|
172
245
|
```
|
|
173
246
|
|
|
174
|
-
|
|
175
|
-
|
|
247
|
+
Every run prints what it cost. Answers are cached in `.judgelint/cache.json`,
|
|
248
|
+
so a file that hasn't changed costs nothing. Commit the cache to share it.
|
|
249
|
+
`judgelint --help` lists the flags.
|
|
176
250
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
cache to share it.
|
|
180
|
-
|
|
181
|
-
**Two models are more certain than one.** On praxis's demo, Jev alone leaves
|
|
182
|
-
9 to 11 findings uncertain; averaging Jev and Cloudflare's Clef leaves 4, with
|
|
183
|
-
the same 12 of 14 violations found and none false, for $0.02 a run
|
|
184
|
-
(`models: [typesafe, cloudflare]`). Each model's answers are cached on their
|
|
185
|
-
own, and all of a file's requests go out at once. The
|
|
186
|
-
[example](examples/scoop-society) compares the models one at a time.
|
|
251
|
+
List two models to average their answers, like `models: [typesafe,
|
|
252
|
+
cloudflare]`. Each model's answers are cached separately.
|
|
187
253
|
|
|
188
254
|
### Providers
|
|
189
255
|
|
|
190
|
-
`judgelint providers` lists them.
|
|
191
|
-
`openrouter`, `celeris`, `cloudflare`, and `openai
|
|
192
|
-
their docs: `perplexity`, `vercel`, `digitalocean`, `upstage`,
|
|
193
|
-
`foundry`, `databricks`,
|
|
194
|
-
`litellm`. Each reads its key from the usual variable
|
|
195
|
-
`
|
|
256
|
+
`judgelint providers` lists them. Tested against the live APIs: `typesafe`
|
|
257
|
+
(Jev, the default), `openrouter`, `celeris`, `cloudflare`, and `openai`.
|
|
258
|
+
Set up from their docs: `perplexity`, `vercel`, `digitalocean`, `upstage`,
|
|
259
|
+
`hanzo`, `foundry`, `databricks`, `ollama`, `llamacpp`, `vllm`, and
|
|
260
|
+
`litellm`. Each one reads its key from the provider's usual variable, like
|
|
261
|
+
`TYPESAFE_API_KEY`.
|
|
196
262
|
|
|
197
|
-
|
|
263
|
+
For any other System One or Decisions endpoint, add a mapping to `models`:
|
|
198
264
|
|
|
199
265
|
```yaml
|
|
200
266
|
models:
|
|
@@ -205,36 +271,26 @@ models:
|
|
|
205
271
|
# headers: {} provider_options: {} price_per_million: 0.04 batch_size: 32
|
|
206
272
|
```
|
|
207
273
|
|
|
208
|
-
##
|
|
274
|
+
## Building from source
|
|
209
275
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
SPINEL=../spinel/bin/spinel rake spinel # build/judgelint
|
|
213
|
-
SPINEL=../spinel/bin/spinel rake test:spinel # the tests, against it too
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
Homebrew and `install.sh` (which installs to `~/.local/bin`, or
|
|
217
|
-
`$JUDGELINT_INSTALL_DIR`, and takes `JUDGELINT_VERSION=v0.1.0`) install the
|
|
218
|
-
binary from the [releases](https://github.com/jpcamara/judgelint/releases),
|
|
219
|
-
for macOS and Linux on arm64 and x86_64; the Linux builds need glibc 2.35 or
|
|
220
|
-
newer. On those platforms `gem install` picks a platform gem with the same
|
|
221
|
-
binary inside and links the `judgelint` command straight to it; elsewhere,
|
|
222
|
-
Windows included, the gem runs as plain Ruby. The binary starts in
|
|
223
|
-
4 ms against CRuby's 110, and in a 300-file benchmark it was 1.4x faster than
|
|
224
|
-
CRuby on one thread and 2x on eight. Under Bundler, `bundle exec` spends about
|
|
225
|
-
100 ms loading Bundler first; to skip it, link the binary
|
|
226
|
-
(`ln -s "$(bundle info judgelint --path)/libexec/judgelint" bin/judgelint`). The code stays inside what Spinel
|
|
227
|
-
compiles: plain classes instead of `Data.define`, a hand-written option
|
|
228
|
-
parser, no gems.
|
|
229
|
-
|
|
230
|
-
## Development
|
|
276
|
+
judgelint is written in Ruby and compiled with
|
|
277
|
+
[Spinel](https://github.com/matz/spinel).
|
|
231
278
|
|
|
232
279
|
```sh
|
|
233
280
|
bundle install
|
|
234
281
|
bundle exec rake test
|
|
235
|
-
|
|
282
|
+
git clone https://github.com/matz/spinel ../spinel && (cd ../spinel && make deps && make)
|
|
283
|
+
SPINEL=../spinel/bin/spinel bundle exec rake spinel # builds build/judgelint
|
|
284
|
+
SPINEL=../spinel/bin/spinel bundle exec rake test:spinel # runs the tests against the binary
|
|
285
|
+
bundle exec rake example # asks Jev about the demo app again
|
|
236
286
|
```
|
|
237
287
|
|
|
288
|
+
## Credits
|
|
289
|
+
|
|
290
|
+
judgelint was inspired by [praxis](https://github.com/zarpay/praxis-cli), and
|
|
291
|
+
it reads praxis specs, including `cohort: by_file` and `by_directory`. The
|
|
292
|
+
demo app in [examples/scoop-society](examples/scoop-society) comes from praxis.
|
|
293
|
+
|
|
238
294
|
## License
|
|
239
295
|
|
|
240
|
-
MIT
|
|
296
|
+
MIT. The demo app keeps praxis's MIT license.
|