yolont 0.0.0-stage → 0.1.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,185 @@
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
+ LLM pull request reviewer for **GitHub and GitLab**. Yolont reviews an MR/PR against your
4
+ team's conventions and sensitive code zones, gives it a 0–100 score, and posts one comment.
5
+ It's informational by default: it posts a score and blocks nothing unless you turn gating on.
6
+
7
+ 📖 **[The full guide](docs/GUIDE.md)**: every feature, every command, and why it's called Yolont.
8
+
9
+ Two ways to run it:
10
+
11
+ - **On your machine:** the `yolont` CLI. A guided setup asks for the git host, the LLM,
12
+ conventions, zones and weights. Then you review an open PR interactively: keep, edit or
13
+ drop each finding before anything is posted. A local panel shows reviews, authors, memory
14
+ and settings.
15
+ - **In CI:** a GitHub Action or a GitLab CI job posts the score on every MR/PR.
16
+
17
+ ## How a review works
18
+
19
+ 1. Loads the rubric, conventions and zones. A repo's `.yolont/` folder wins over your user
20
+ settings, which win over the built-ins.
21
+ 2. Takes the diff from local `git diff`, falling back to the forge API.
22
+ 3. Runs `gitleaks` on the diff. A hit means the diff is never sent to an LLM and the job
23
+ fails, whatever `gate` says.
24
+ 4. Reads this pipeline's own job results (lint, tests, coverage) for the deterministic
25
+ categories. It never re-runs your build.
26
+ 5. Makes one LLM call for all LLM categories. The score is recomputed from the findings, so
27
+ the model's own number is only advisory.
28
+ 6. Posts (or edits) one comment with the score, a per-category breakdown, the top findings,
29
+ touched zones and the author's trend.
30
+
31
+ ## Quickstart: local CLI
32
+
33
+ Needs Node 22.13+ and [gitleaks](https://github.com/gitleaks/gitleaks#installing) on `PATH`.
34
+
35
+ ```bash
36
+ cd ~/code/your-project # any checkout, or anywhere and paste the repo address
37
+ npx yolont # no install: guided setup, then pick an open MR/PR to review
38
+ npx yolont panel # local web panel (prints a URL with a one-time token)
39
+
40
+ npm install -g yolont # or install it, then drop the `npx`
41
+ yolont
42
+ ```
43
+
44
+ `yolont --help` lists every command. [local/README.md](local/README.md) covers the
45
+ wizard, where settings live, and the panel.
46
+
47
+ ## Quickstart: GitHub Action
48
+
49
+ 1. Add one LLM key as a repository secret (Settings → Secrets and variables → Actions),
50
+ e.g. `ANTHROPIC_API_KEY`.
51
+ 2. Copy [templates/yolont.github-workflow.yml](templates/yolont.github-workflow.yml) to
52
+ `.github/workflows/yolont.yml` and set `uses:` to where this repo lives.
53
+ 3. Optionally commit `.yolont/conventions.md`, `.yolont/zones.yaml` and `.yolont/rubric.yml`
54
+ (the CLI's setup writes them for you to copy). Without them Yolont uses its built-in
55
+ rubric and generic conventions, and zones are off.
56
+
57
+ The job token posts the comment. The workflow needs these permissions:
58
+
59
+ | Permission | Why |
60
+ |---|---|
61
+ | `contents: read` | checkout |
62
+ | `pull-requests: write` | read the PR, post inline threads |
63
+ | `issues: write` | the summary comment and the `llm-reviewed` label use the issues API |
64
+ | `actions: read` | job results (lint, tests) feed the score |
65
+
66
+ **Fork PRs:** GitHub gives `pull_request` runs from forks no secrets and a read-only token,
67
+ so Yolont skips them with a message. On a public repo that takes fork PRs, use
68
+ `on: pull_request_target` instead (commented out in the template). Yolont then reads the PR
69
+ only through the API and never runs its code. Keep the default `actions/checkout`, which
70
+ checks out your base branch, and the rubric and conventions come from your branch, not from
71
+ the PR. Very large PRs may exceed GitHub's diff API limit.
72
+
73
+ Only jobs in the same workflow are visible to the score. Put lint and tests in that
74
+ workflow and have the Yolont job `needs:` them.
75
+
76
+ ## Quickstart: GitLab CI
77
+
78
+ 1. Create a project or group access token: scope `api`, role Developer.
79
+ 2. Add CI/CD variables (masked and protected): `GITLAB_API_TOKEN`, plus one LLM key.
80
+ 3. Build and push the image from this repo's `Dockerfile` (its own `.gitlab-ci.yml` does it
81
+ on the default branch), then include the job:
82
+
83
+ ```yaml
84
+ include:
85
+ - project: '<group>/yolont'
86
+ ref: main
87
+ file: 'templates/yolont.gitlab-ci.yml'
88
+ ```
89
+
90
+ A group token sees the author's MRs across every project in the group, so author history
91
+ spans repos. A project token only sees that one project. Don't use a personal token.
92
+
93
+ `templates/pr-score.gitlab-ci.yml`, the `pr-score` image and `/opt/pr-score/index.js` still
94
+ work for existing pipelines.
95
+
96
+ ## Tokens
97
+
98
+ | Where | Token | Minimum |
99
+ |---|---|---|
100
+ | GitHub CLI | PAT | classic `repo`, or fine-grained: Pull requests + Issues read & write, Contents + Actions read |
101
+ | GitHub Action | job token (automatic) | permissions table above |
102
+ | GitLab CLI | personal access token | `api` |
103
+ | GitLab CI | project/group access token | `api`, role Developer |
104
+
105
+ The CLI stores tokens in the OS keychain (a `0600` file where there is none). Each token is
106
+ only ever sent to the host it was saved for.
107
+
108
+ ## LLM providers (CI)
109
+
110
+ Set one of these. The first one set wins:
111
+
112
+ | Variable | Notes |
113
+ |---|---|
114
+ | `ANTHROPIC_API_KEY` (+ `ANTHROPIC_MODEL`) | Claude API |
115
+ | `OPENCODE_ZEN_API_KEY` (+ `OPENCODE_ZEN_MODEL`) | free-tier gateway, key at [opencode.ai/auth](https://opencode.ai/auth) |
116
+ | `OPENCODE_ZEN_GO_API_KEY` (+ `OPENCODE_ZEN_GO_MODEL`) | second gateway |
117
+ | `OMNI_API_KEY` + `OMNI_BASE_URL` (+ `OMNI_MODEL`) | any OpenAI-compatible gateway |
118
+ | `OLLAMA_URL` (+ `OLLAMA_MODEL`) | self-hosted, fully offline |
119
+
120
+ Optional: `MINIO_ENDPOINT`, `MINIO_ACCESS_KEY`, `MINIO_SECRET_KEY` and `MINIO_BUCKET` cache
121
+ author history. Without them, Yolont rebuilds history from its past comments.
122
+
123
+ `YOLONT_CHANGE_TYPE` sets how the change type (feature, bugfix, refactor, performance, tests, docs,
124
+ chore, ci, revert, mixed) is used, and it's shown on the comment:
125
+ - `label` (default): the review call also names the type. The review is unchanged; no extra cost.
126
+ - `steer`: the type is settled first, from the title prefix (`fix:`), branch (`feat/…`) or labels,
127
+ else one small extra LLM call, and the review gets that type's checks (a refactor must not
128
+ change behavior, a bug fix needs a regression test, …). Scores and weights don't change.
129
+ - `off`.
130
+
131
+ Locally the same choice is the wizard menu's **Change type**, and you confirm the suggested type
132
+ during each review.
133
+
134
+ ## Rubric
135
+
136
+ `.yolont/rubric.yml` (built-in default: [.pr-reviewer/rubric.yml](.pr-reviewer/rubric.yml)):
137
+
138
+ - `threshold`: the passing score.
139
+ - `gate`: `false` (the default) only posts. Set it to `true` **and** make the CI job blocking
140
+ (`allow_failure: false` on GitLab, a required check on GitHub) to block merges.
141
+ - Each category has a `weight` (weights sum to 100) and a `type` (`deterministic` | `llm` |
142
+ `hybrid`). Non-LLM categories also have a `source`: `diff_size`, `secrets`, `test_report`,
143
+ or `job:<substring>` matched against your job names.
144
+
145
+ A category whose source has no data in a run is excluded, and its weight is shared out
146
+ among the rest. The comment shows this.
147
+
148
+ ## Security notes
149
+
150
+ - `gitleaks` runs before any LLM call. If it finds a secret, or can't run, the diff is not
151
+ sent.
152
+ - Tokens and keys come from CI variables or the keychain and are never logged.
153
+ - In CI, `.yolont/` is read from the checked-out code. With `pull_request` (GitHub) or a
154
+ GitLab MR pipeline, that's the MR's own code, so an MR can change its own rubric. If you
155
+ gate merges, protect `.yolont/` with CODEOWNERS, or use `pull_request_target` on GitHub.
156
+ - On GitHub, only comments from a bot or a repo member count as earlier Yolont comments.
157
+ Pasting the marker into a comment doesn't fake one.
158
+ - The local panel listens on `127.0.0.1` only and needs the per-start token. It never
159
+ returns saved secrets.
160
+
161
+ ## Development
162
+
163
+ ```bash
164
+ npm ci
165
+ npm run typecheck
166
+ npm test # vitest
167
+ npm run build # typecheck, then bundle dist/index.js (CI) and dist/cli.js (CLI)
168
+ cd local && npx tsx cli.ts # run the CLI from source
169
+ ```
170
+
171
+ To dry-run the CI entry against a real MR, fill in a copy of `.env.example` and run
172
+ `node --env-file=<that file> dist/index.js` from inside the checkout being reviewed.
173
+
174
+ On GitLab, the local diff first fetches `CI_MERGE_REQUEST_DIFF_BASE_SHA` directly. This
175
+ needs `uploadpack.allowReachableSHA1InWant`, which is on at gitlab.com but often off on
176
+ self-hosted instances. Without it, Yolont fetches the target branch at depth 50, so the merge
177
+ base must be within that range. If the diff can't be built locally, Yolont uses the API diff.
178
+
179
+ ## License
180
+
181
+ Yolont is **source-available** under the [Functional Source License 1.1 (FSL-1.1-ALv2)](LICENSE.md),
182
+ not an OSI open-source license. You may use, modify and redistribute it for any purpose
183
+ except offering a competing commercial product or service. Internal use at your company,
184
+ education and research are all fine. Two years after each version is released, that version
185
+ also becomes available under the Apache License 2.0.
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.