yolont 0.0.0-stage → 0.2.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.
@@ -0,0 +1,116 @@
1
+ # Yolont rubric — versioned like code, reviewed like code.
2
+ #
3
+ # `gate: false` means Yolont is informational only (job runs with
4
+ # allow_failure: true): it posts a score/comment but never blocks a merge.
5
+ # Set `gate: true` to turn `threshold` into an actual pipeline failure.
6
+ # Secret-detection failures are ALWAYS hard-fail, independent of `gate`.
7
+ #
8
+ # category.source (required for type: deterministic | hybrid):
9
+ # diff_size - computed in-job from the diff itself
10
+ # test_report - pulled from this pipeline's GitLab test report
11
+ # job:<name> - pulled from this pipeline's job status/coverage,
12
+ # matched by substring against job names
13
+ #
14
+ # Note: there is no "secrets" source. The gitleaks scan is an unconditional
15
+ # pre-check (see index.ts) that runs before any category is scored — a hit
16
+ # short-circuits the whole run, independent of the rubric, before category
17
+ # scoring is ever reached. Rubric weights can't affect it either way.
18
+ #
19
+ # If a deterministic/hybrid category's source has no matching job/report in
20
+ # this pipeline run, it is scored neutral (50) and its weight is
21
+ # redistributed across the remaining categories — never silently dropped.
22
+
23
+ version: 1
24
+ gate: false
25
+ threshold: 80
26
+ max_diff_bytes: 102400
27
+ max_lines: 500
28
+ severity_penalties:
29
+ minor: 3
30
+ major: 8
31
+ critical: 20
32
+
33
+ # LLM findings are scored as density (issues per size of change), not raw count.
34
+ # Each severity penalty is multiplied by:
35
+ # factor = clamp((reference_size / mr_size) ^ exponent, min_factor, max_factor)
36
+ # mr_size = added + deleted lines + lines_per_file * changed_files
37
+ # (measured after generated/lock files are stripped, before truncation)
38
+ #
39
+ # reference_size - MR size at which penalties apply at face value (factor 1)
40
+ # lines_per_file - how much each touched file counts, in line-equivalents
41
+ # exponent - 0 = no size scaling, 1 = fully linear density; <1 keeps big
42
+ # MRs from diluting findings away entirely
43
+ # min_factor - floor: even huge MRs pay at least this share of a penalty
44
+ # max_factor - cap: tiny MRs pay at most this multiple of a penalty
45
+ #
46
+ # With these defaults: 1 file/30 lines -> x2.32, 5 files/200 lines -> x0.68,
47
+ # 30 files/600 lines -> x0.25 (floor). So one major in a 1-file change (-19)
48
+ # costs more than two criticals spread over 30 files (-10).
49
+ volume_scaling:
50
+ reference_size: 200
51
+ lines_per_file: 30
52
+ exponent: 0.7
53
+ min_factor: 0.25
54
+ max_factor: 3
55
+
56
+ categories:
57
+ # tests / lint_and_types (hybrid/deterministic, pipeline-sourced) intentionally
58
+ # removed for now — not reviewing pipeline test/lint results here. Re-add with
59
+ # source: test_report / "job:lint" if that's wanted back later.
60
+
61
+ - name: ai_authenticity
62
+ weight: 20
63
+ type: llm
64
+ description: >
65
+ Detect code that reads as raw, unedited AI output rather than
66
+ human-polished work: generic/placeholder naming, boilerplate comments
67
+ explaining the obvious, unnecessary defensive try/catch or validation
68
+ for cases that can't happen, over-engineered abstractions beyond what
69
+ the diff needs, inconsistent style vs. the surrounding codebase, and
70
+ any leftover LLM tells (filler comments, unexplained scaffolding, dead
71
+ half-finished branches). Flag specific lines and explain what a human
72
+ would have simplified or adapted.
73
+
74
+ - name: conventions
75
+ weight: 30
76
+ type: llm
77
+ description: >
78
+ Naming, file/module structure, and style conventions as defined in
79
+ CONVENTIONS.md. Flag deviations with the specific rule violated.
80
+ Explicitly check every touched file's own directory path against any
81
+ structural/placement rules (folder-file pairing, single- vs
82
+ multi-consumer nesting, tree-mirroring, naming case) — this is a path
83
+ check, not a content check, so it applies even when the diff only
84
+ edits lines inside the file and never touches its path. Where a rule
85
+ gives a numeric threshold (e.g. a max path depth), count the actual
86
+ segments for each touched file's path and compare — don't eyeball it.
87
+
88
+ - name: maintainability
89
+ weight: 30
90
+ type: llm
91
+ description: >
92
+ Readability, complexity, duplication, and architectural drift. Flag
93
+ code that will be hard to change safely six months from now.
94
+
95
+ # Not `hybrid` with source: secrets — the gitleaks scan is already an
96
+ # unconditional hard-fail gate in index.ts, run before this category is even
97
+ # reached (a hit skips the LLM call and fails the job outright, independent
98
+ # of `gate`). Blending that constant-pass signal into a hybrid score here
99
+ # would just dilute the LLM's actual finding; `llm` alone is more honest.
100
+ # This weight is therefore purely the LLM's narrative security review —
101
+ # it does not "cover" the automated secret scan, which sits outside the
102
+ # rubric entirely and already blocks the pipeline on its own.
103
+ - name: security
104
+ weight: 12
105
+ type: llm
106
+ description: >
107
+ Beyond the automated secret scan: injection risks, unsafe
108
+ deserialization, missing auth checks, and other OWASP-style issues
109
+ visible in the diff.
110
+
111
+ # Not reviewed by the LLM: purely a size check. 100 if added+deleted lines
112
+ # <= max_lines, then drops linearly to 0 at 2x max_lines. Rewards small MRs.
113
+ - name: pr_hygiene
114
+ weight: 8
115
+ type: deterministic
116
+ source: diff_size
package/LICENSE.md ADDED
@@ -0,0 +1,105 @@
1
+ # Functional Source License, Version 1.1, ALv2 Future License
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-ALv2
6
+
7
+ ## Notice
8
+
9
+ Copyright 2026 Saeed Akasteh
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the Apache License, Version 2.0 that is effective on the second anniversary of
91
+ the date we make the Software available. On or after that date, you may use the
92
+ Software under the Apache License, Version 2.0, in which case the following
93
+ will apply:
94
+
95
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
96
+ this file except in compliance with the License.
97
+
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software distributed
103
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
+ specific language governing permissions and limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,225 @@
1
- # Temporary Holding Version
1
+ # Yolont
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **PR reviews that look twice.** An LLM reviewer for GitHub and GitLab that knows *your* team's
4
+ rules, looks harder where mistakes hurt, scores every MR/PR 0–100, and learns when you tell it
5
+ it's wrong.
6
+
7
+ ```bash
8
+ cd ~/code/your-project
9
+ npx yolont
10
+ ```
11
+
12
+ The first run offers to install the `yolont` command (`npm install -g`), so from then on
13
+ it's just:
14
+
15
+ ```bash
16
+ yolont
17
+ ```
18
+
19
+ You need Node 22.13+ and [gitleaks](https://github.com/gitleaks/gitleaks#installing). No config
20
+ files to write: the wizard asks for what it needs.
21
+
22
+ *(YOLO + n't = **yolont**: you only live once, so don't merge like it.
23
+ [The long story](docs/GUIDE.md#0-why-yolont).)*
24
+
25
+ ---
26
+
27
+ ## What it looks like
28
+
29
+ ### 1. The wizard sets you up
30
+
31
+ ```
32
+ ██╗ ██╗ ██████╗ ██╗ ██████╗ ███╗ ██╗████████╗
33
+ ╚██╗ ██╔╝██╔═══██╗██║ ██╔═══██╗████╗ ██║╚══██╔══╝
34
+ ╚████╔╝ ██║ ██║██║ ██║ ██║██╔██╗ ██║ ██║
35
+ ╚██╔╝ ██║ ██║██║ ██║ ██║██║╚██╗██║ ██║
36
+ ██║ ╚██████╔╝███████╗╚██████╔╝██║ ╚████║ ██║
37
+ ╚═╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝
38
+ PR reviews that look twice · Esc = back · Ctrl-C = quit
39
+
40
+ ╭─ Yolont ─────────────────────────────────────────────╮
41
+ │ Project acme/shop · github.com │
42
+ │ LLM anthropic · claude-sonnet-5-5 │
43
+ │ Memory frontend · 2 to send │
44
+ │ Change type Label │
45
+ ╰──────────────────────────────────────────────────────╯
46
+
47
+ ◆ acme/shop · github.com
48
+ │ ● Review an open MR/PR
49
+ │ ○ ✓ Git host & token
50
+ │ ○ ✓ LLM
51
+ │ ○ ✓ Conventions
52
+ │ ○ ✓ Zones
53
+ │ ○ ✓ Scoring weights
54
+ │ ○ Memory repo · frontend · 2 to send
55
+ │ ○ Change type: Label
56
+ │ ○ Remove saved…
57
+ │ ○ Exit
58
+ ```
59
+
60
+ On the first run it walks you through: **git host + token** (checked against the project),
61
+ **LLM** (a real test call before anything is saved), **conventions** (drafted from your repo,
62
+ and you approve them), **zones** and **weights** (optional). After that, plain `yolont`
63
+ goes straight to this menu.
64
+
65
+ ### 2. It reviews
66
+
67
+ ```
68
+ ◇ Anything specific to emphasize for this review?
69
+ │ the retry logic in the payment client
70
+
71
+ Score: 74/100 (fail vs threshold 80)
72
+ conventions 85/100 ok
73
+ - [minor] src/pay/client.ts:12 Imports from '../../lib' — conventions say use the '@/lib' alias
74
+ maintainability 70/100 ok
75
+ - [major] src/pay/retry.ts:41 Retries a non-idempotent POST; a timeout can charge the card twice
76
+ suggestion: send an Idempotency-Key header, or retry only on connection errors
77
+ ai_authenticity 80/100 ok
78
+ - [minor] src/pay/retry.ts:8 try/catch around a pure function that can't throw
79
+ security 100/100 ok
80
+ pr_hygiene 90/100 ok
81
+
82
+ Zones touched:
83
+ [red] payments — impact high: retry change runs on every checkout
84
+ src/pay/retry.ts, src/pay/client.ts
85
+ ```
86
+
87
+ gitleaks scans the diff first. If it finds a secret, nothing is sent to the LLM.
88
+
89
+ ### 3. You get the last word
90
+
91
+ ```
92
+ ◆ Agree with the computed score (74/100)?
93
+ │ No
94
+ ◆ Which should be corrected?
95
+ │ ◼ ai_authenticity (80/100)
96
+ ◆ [ai_authenticity] Corrected score (was 80, Enter to keep)
97
+ │ 95
98
+ ◆ [ai_authenticity] Why? (becomes memory context for future reviews of this author)
99
+ │ The try/catch is our logging convention for this module, it's intentional.
100
+ ◆ Post this score as a comment on PR #42?
101
+ │ Yes
102
+ ```
103
+
104
+ That "why" is remembered. Corrections go into this author's next reviews, and
105
+ `yolont distill` turns a batch of them into lasting lessons. Nothing is posted unless you say
106
+ yes.
107
+
108
+ ### 4. The comment on the PR
109
+
110
+ > ## 🟡 PR Score: 77 / 100
111
+ > **Type:** Bug fix (title prefix "fix:")
112
+ >
113
+ > | Category | Score | Weight | Status |
114
+ > |---|---|---|---|
115
+ > | conventions | 85/100 | 30% | ok |
116
+ > | maintainability | 70/100 | 30% | ok |
117
+ > | ai_authenticity | 95/100 | 20% | ok |
118
+ > | security | 100/100 | 12% | ok |
119
+ > | pr_hygiene | 90/100 | 8% | ok |
120
+ >
121
+ > ### Top findings
122
+ > - **major** `src/pay/retry.ts:41`: Retries a non-idempotent POST; a timeout can charge the card twice
123
+ >
124
+ > ### Author trend
125
+ > Last 5 score(s): 68, 71, 75, 74, 77.
126
+
127
+ Findings with a file and line also go up as inline threads, so the author can reply right on
128
+ the code. Later runs edit this comment instead of adding new ones.
129
+
130
+ ### 5. The panel
131
+
132
+ ```bash
133
+ yolont panel # → http://127.0.0.1:4173/?token=… (local only, new token every start)
134
+ ```
135
+
136
+ All your reviews, per-author trends, memory, findings, a conventions editor, and weight sliders
137
+ that replay your last 20 reviews with the new weights before you save.
138
+
139
+ ---
140
+
141
+ ## Why use it
142
+
143
+ - **Your rules, not generic advice.** Conventions are drafted from your own repo, edited by
144
+ you, and checked rule by rule, including where files live.
145
+ - **Looks harder where it hurts.** Zones mark what runs on every request or can't be undone
146
+ (middleware, migrations, root layouts), and the review gets extra checks for those parts.
147
+ - **The score is math, not vibes.** It's recomputed from the findings and scaled to the
148
+ change's size, so the LLM can't wave a PR through.
149
+ - **It learns.** Corrections become memory per author and per project. Share that memory with
150
+ your team through a git repo, using merge requests.
151
+ - **It knows a refactor from a feature.** A refactor that changes behavior gets flagged. A bug
152
+ fix without a regression test gets asked for one.
153
+ - **Fails closed.** No gitleaks, no LLM call. Tokens are only ever sent to their own host.
154
+ No telemetry.
155
+
156
+ ---
157
+
158
+ ## In CI (2 minutes)
159
+
160
+ **GitHub Actions**: add an `ANTHROPIC_API_KEY` secret, then
161
+ [`templates/yolont.github-workflow.yml`](templates/yolont.github-workflow.yml) →
162
+ `.github/workflows/yolont.yml`:
163
+
164
+ ```yaml
165
+ permissions: { contents: read, pull-requests: write, issues: write, actions: read }
166
+ jobs:
167
+ yolont:
168
+ runs-on: ubuntu-latest
169
+ steps:
170
+ - uses: actions/checkout@v4
171
+ - uses: srcgrp/yolont@main # pin a tag or sha
172
+ env:
173
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
174
+ ```
175
+
176
+ **GitLab CI**: add `GITLAB_API_TOKEN` (project/group token, `api`) and one LLM key as CI/CD
177
+ variables, build the image from this repo's `Dockerfile`, then:
178
+
179
+ ```yaml
180
+ include:
181
+ - project: '<group>/yolont'
182
+ ref: main
183
+ file: 'templates/yolont.gitlab-ci.yml'
184
+ ```
185
+
186
+ It's informational by default: it posts a score and blocks nothing until you
187
+ [turn on gating](docs/GUIDE.md#gating). Fork PRs, permissions and self-hosted GitLab are covered
188
+ in the guide: [GitHub](docs/GUIDE.md#13-ci-github-actions) · [GitLab](docs/GUIDE.md#14-ci-gitlab).
189
+
190
+ ---
191
+
192
+ ## Everything else
193
+
194
+ 📖 **[The Yolont Guide](docs/GUIDE.md)** has the full story, and a few jokes.
195
+
196
+ | I want to… | Read |
197
+ |---|---|
198
+ | Write or generate conventions | [Conventions](docs/GUIDE.md#6-conventions) |
199
+ | Mark risky parts of the code | [Zones](docs/GUIDE.md#7-zones-where-the-dragons-live) |
200
+ | Change how the score is weighted, or block merges | [Weights and the rubric](docs/GUIDE.md#8-weights-and-the-rubric) |
201
+ | Review a refactor differently from a feature | [Change type](docs/GUIDE.md#9-change-type) |
202
+ | Teach it, and share that with my team | [Memory](docs/GUIDE.md#10-memory-yolont-learns-from-you) · [Memory repos](docs/GUIDE.md#11-memory-repos-share-it-with-your-team) |
203
+ | Use Ollama, OpenRouter or another LLM | [LLM providers](docs/GUIDE.md#15-llm-providers) |
204
+ | Know exactly what leaves my machine | [Security model](docs/GUIDE.md#17-security-model-the-paranoid-chapter) |
205
+ | See every command | [Command reference](docs/GUIDE.md#18-command-reference) |
206
+ | Fix something | [Troubleshooting](docs/GUIDE.md#20-troubleshooting--faq) |
207
+
208
+ ---
209
+
210
+ ## Development
211
+
212
+ ```bash
213
+ git clone https://github.com/srcgrp/yolont.git && cd yolont
214
+ npm ci
215
+ npm test # vitest
216
+ npm run build # typecheck + bundle dist/index.js (CI) and dist/cli.js (CLI)
217
+ cd local && npx tsx cli.ts # run the CLI from source
218
+ ```
219
+
220
+ ## License
221
+
222
+ Source-available under the [Functional Source License 1.1 (FSL-1.1-ALv2)](LICENSE.md). Use,
223
+ modify and redistribute it for anything except a competing commercial product or service.
224
+ Internal company use, education and research are all fine. Each version becomes Apache-2.0
225
+ two years after its release.
package/action.yml ADDED
@@ -0,0 +1,21 @@
1
+ name: Yolont PR review
2
+ description: Scores a pull request 0-100 (deterministic checks + LLM rubric) and posts one summary comment.
3
+ author: Saeed Akasteh
4
+ branding:
5
+ icon: check-circle
6
+ color: blue
7
+
8
+ inputs:
9
+ github-token:
10
+ description: Token that reads the PR and posts the comment. The default job token is enough with the permissions in the README.
11
+ default: ${{ github.token }}
12
+
13
+ runs:
14
+ using: docker
15
+ image: Dockerfile
16
+ # git refuses a workspace owned by another uid ("dubious ownership"), which would silently
17
+ # push Yolont onto the API diff; mark it safe first.
18
+ entrypoint: sh
19
+ args:
20
+ - -c
21
+ - git config --global --add safe.directory "$GITHUB_WORKSPACE" && exec node /opt/yolont/index.js
@@ -0,0 +1,43 @@
1
+ # Team Conventions — default
2
+
3
+ Seed defaults, used for any repo that doesn't have its own file in this
4
+ directory. This content is fed directly into the LLM's `conventions` and
5
+ `maintainability` category prompts (see `.pr-reviewer/rubric.yml`), so keep
6
+ it specific and example-driven rather than generic ("write clean code").
7
+
8
+ ## Naming
9
+
10
+ - Functions/variables: `camelCase`. Classes/types: `PascalCase`. Constants: `UPPER_SNAKE_CASE`.
11
+ - Names describe *what*, not *how*: `getActiveUsers`, not `filterArray`.
12
+ - Booleans read as a question: `isReady`, `hasPermission`, not `ready`, `permission`.
13
+
14
+ ## Structure
15
+
16
+ - One exported concept per file where reasonable; avoid god-modules.
17
+ - No circular imports between top-level modules.
18
+ - Keep functions under ~50 lines; extract when a function does more than one thing.
19
+
20
+ ## Tests
21
+
22
+ - New logic ships with tests in the same PR, not "added later."
23
+ - Test names describe behavior: `it("returns 404 when the user does not exist")`, not `it("test1")`.
24
+
25
+ ## Error handling
26
+
27
+ - Don't swallow errors silently (empty `catch {}`) — log or rethrow with context.
28
+ - Validate only at system boundaries (user input, external APIs); trust internal code.
29
+
30
+ ## PR hygiene
31
+
32
+ - PR description explains *why*, not just *what* (the diff already shows what).
33
+ - Diffs stay focused — unrelated refactors go in a separate PR.
34
+
35
+ ## Security
36
+
37
+ - No secrets, tokens, or credentials in code or comments (enforced automatically via gitleaks).
38
+ - Auth/permission checks are not skipped "temporarily."
39
+
40
+ ## AI tooling files
41
+
42
+ - Don't add out-of-the-box agent skills (`.claude/skills/`, `SKILL.md`, etc.) or AI instruction markdown (`CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, `.cursorrules`, `.github/copilot-instructions.md`, etc.) unless the file itself states which part of the project and which code needs it (concrete paths/modules).
43
+ - Flag any such file that is generic/copy-pasted with no project-specific scope.