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 @@
1
+ *{box-sizing:border-box}body{color:#e6e6e6;background:#0f1115;margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}.app{min-height:100vh;display:flex}.nav{border-right:1px solid #262a33;flex-shrink:0;width:200px;padding:20px}.nav h1{margin:0 0 20px;font-size:16px}.nav button{text-align:left;color:#b8bcc4;cursor:pointer;background:0 0;border:none;border-radius:6px;width:100%;margin-bottom:4px;padding:8px 10px;font-size:14px;display:block}.nav button.active,.nav button:hover{color:#fff;background:#1c2028}.main{flex:1;padding:24px 32px;overflow-x:auto}table{border-collapse:collapse;width:100%}th,td{text-align:left;border-bottom:1px solid #262a33;padding:8px 10px;font-size:14px}th{color:#8b8f98;font-weight:500}tr:hover td{background:#171a20}a,.link-btn{color:#6ea8fe;cursor:pointer;font-size:inherit;background:0 0;border:none;padding:0}.badge{border-radius:10px;padding:2px 8px;font-size:12px;display:inline-block}.badge.improving{color:#4ade80;background:#113a25}.badge.declining{color:#f87171;background:#3a1616}.badge.stable{color:#b8bcc4;background:#1c2028}.badge.insufficient-data{color:#6b7280;background:#1c2028}.card{background:#171a20;border:1px solid #262a33;border-radius:10px;margin-bottom:20px;padding:16px 20px}.finding{border-bottom:1px solid #262a33;padding:8px 0;font-size:13px}.finding:last-child{border-bottom:none}.thread{border-left:2px solid #262a33;margin:6px 0 0 12px;padding-left:8px;font-size:12px}.thread-note{margin:2px 0}.thread-note.nearby{color:#8b8f98;font-style:italic}.sev-critical{color:#f87171}.sev-major{color:#fbbf24}.sev-minor{color:#8b8f98}.btn{color:#e6e6e6;cursor:pointer;background:#1c2028;border:1px solid #262a33;border-radius:6px;padding:6px 14px;font-size:13px}.btn:hover{background:#262a33}.link-btn.danger,.btn.danger{color:#f87171}.card label{color:#8b8f98;margin-bottom:10px;font-size:12px;display:block}.vote-btn{cursor:pointer;background:#1c2028;border:1px solid #262a33;border-radius:6px;padding:4px 10px;font-size:15px;line-height:1}.vote-btn:hover{background:#262a33}.tag-chip{color:#b8bcc4;background:#1c2028;border:1px solid #262a33;border-radius:10px;margin-right:6px;padding:2px 8px;font-size:12px;display:inline-block}.card input,.card textarea{color:#e6e6e6;background:#0f1115;border:1px solid #262a33;border-radius:6px;width:100%;margin-top:4px;padding:6px 8px;font-family:inherit;font-size:13px;display:block}input:not([type=checkbox]):not([type=range]),select,textarea{color:#e6e6e6;background:#0f1115;border:1px solid #262a33;border-radius:6px;padding:6px 8px;font-family:inherit;font-size:13px}.card .inline input,.card.inline input,.card input[type=checkbox],.card input[type=range]{width:auto;margin-top:0;display:inline-block}.btn.active{background:#262a33;border-color:#5b8def}.btn:disabled{opacity:.5;cursor:default}
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Yolont panel</title>
7
+ <script type="module" crossorigin src="/assets/index-DreArTli.js"></script>
8
+ <link rel="stylesheet" crossorigin href="/assets/index-EIoh8Nro.css">
9
+ </head>
10
+ <body>
11
+ <div id="root"></div>
12
+ </body>
13
+ </html>
@@ -0,0 +1,191 @@
1
+ -- id is Yolont's own key (what every project_id column references). A project is identified
2
+ -- on its forge by (forge_host, forge_project_id): GitLab's numeric id / GitHub's repo id, as
3
+ -- text. Pre-Yolont rows used the GitLab id as `id` and get their host stamped on first run;
4
+ -- until then forge_host is NULL. Unique index is created in migrate() (columns may be new).
5
+ CREATE TABLE IF NOT EXISTS projects (
6
+ id INTEGER PRIMARY KEY,
7
+ path_with_namespace TEXT NOT NULL,
8
+ name TEXT NOT NULL,
9
+ forge_host TEXT,
10
+ forge_project_id TEXT
11
+ );
12
+
13
+ -- Unused since authors became (host, username): the list is derived from merge_requests +
14
+ -- projects (repo.ts listAuthors). Left in place so old DBs need no migration.
15
+ CREATE TABLE IF NOT EXISTS authors (
16
+ username TEXT PRIMARY KEY,
17
+ name TEXT
18
+ );
19
+
20
+ CREATE TABLE IF NOT EXISTS merge_requests (
21
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
22
+ project_id INTEGER NOT NULL,
23
+ mr_iid INTEGER NOT NULL,
24
+ author_username TEXT NOT NULL,
25
+ sha TEXT NOT NULL,
26
+ title TEXT NOT NULL,
27
+ merged_at TEXT,
28
+ source TEXT NOT NULL CHECK (source IN ('backfill', 'live')),
29
+ mined_discussions_at TEXT,
30
+ created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
31
+ UNIQUE (project_id, mr_iid)
32
+ );
33
+
34
+ CREATE TABLE IF NOT EXISTS human_review_comments (
35
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
36
+ merge_request_id INTEGER NOT NULL REFERENCES merge_requests (id),
37
+ author_username TEXT NOT NULL,
38
+ body TEXT NOT NULL,
39
+ file TEXT,
40
+ line INTEGER,
41
+ created_at TEXT NOT NULL
42
+ );
43
+
44
+ CREATE INDEX IF NOT EXISTS idx_human_review_comments_mr ON human_review_comments (merge_request_id);
45
+
46
+ CREATE TABLE IF NOT EXISTS scores (
47
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
48
+ merge_request_id INTEGER NOT NULL REFERENCES merge_requests (id),
49
+ scored_at TEXT NOT NULL,
50
+ final_score INTEGER NOT NULL,
51
+ category_scores_json TEXT NOT NULL,
52
+ findings_json TEXT NOT NULL,
53
+ source TEXT NOT NULL CHECK (source IN ('llm_backfill', 'llm_live')),
54
+ model_used TEXT,
55
+ -- size multiplier applied to finding penalties (see rubric volume_scaling); 1 for pre-scaling rows
56
+ volume_factor REAL NOT NULL DEFAULT 1,
57
+ -- machine category scores + weights before corrections (see refreshScores); NULL for old rows
58
+ base_json TEXT,
59
+ -- what kind of change (src/changeType.ts): feature, bugfix, refactor, …; NULL = not classified
60
+ change_type TEXT,
61
+ UNIQUE (merge_request_id, source)
62
+ );
63
+
64
+ CREATE TABLE IF NOT EXISTS corrections (
65
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
66
+ merge_request_id INTEGER NOT NULL REFERENCES merge_requests (id),
67
+ category TEXT,
68
+ original_score INTEGER NOT NULL,
69
+ corrected_score INTEGER NOT NULL,
70
+ reason TEXT NOT NULL,
71
+ corrected_note TEXT,
72
+ created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
73
+ );
74
+
75
+ CREATE INDEX IF NOT EXISTS idx_corrections_mr ON corrections (merge_request_id);
76
+
77
+ CREATE TABLE IF NOT EXISTS insights (
78
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
79
+ author_username TEXT,
80
+ -- git host the insight belongs to (repo.ts backfillInsightHosts fills older rows)
81
+ host TEXT,
82
+ project_id INTEGER REFERENCES projects (id),
83
+ category TEXT,
84
+ insight_text TEXT NOT NULL,
85
+ evidence_mr_ids_json TEXT NOT NULL,
86
+ created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
87
+ );
88
+
89
+ CREATE INDEX IF NOT EXISTS idx_insights_author ON insights (author_username);
90
+ -- idx_insights_project is created in db/client.ts's migrate(), after project_id is
91
+ -- guaranteed to exist (an existing DB predating this column doesn't have it yet here).
92
+
93
+ -- One row per finding posted as its own inline GitLab discussion thread (see
94
+ -- local/review/interactiveReview.ts), so a later `sync-replies` run knows which
95
+ -- discussion maps to which finding and can skip our own note when reading replies.
96
+ CREATE TABLE IF NOT EXISTS finding_discussions (
97
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
98
+ merge_request_id INTEGER NOT NULL REFERENCES merge_requests (id),
99
+ discussion_id TEXT NOT NULL,
100
+ category TEXT NOT NULL,
101
+ severity TEXT NOT NULL,
102
+ issue TEXT NOT NULL,
103
+ file TEXT,
104
+ line INTEGER,
105
+ posted_note_id INTEGER NOT NULL,
106
+ -- Our single vote/tag decision reply on this thread (local/review/syncDecision.ts),
107
+ -- edited in place on every change so the thread shows only the latest decision.
108
+ decision_note_id INTEGER,
109
+ decision_sync_error TEXT,
110
+ created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
111
+ UNIQUE (merge_request_id, file, line, issue)
112
+ );
113
+
114
+ CREATE INDEX IF NOT EXISTS idx_finding_discussions_mr ON finding_discussions (merge_request_id);
115
+
116
+ -- A contributor's reply on a finding_discussions thread, pulled back by `sync-replies`
117
+ -- and fed into local/memory/distill.ts alongside corrections.
118
+ CREATE TABLE IF NOT EXISTS finding_responses (
119
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
120
+ finding_discussion_id INTEGER NOT NULL REFERENCES finding_discussions (id),
121
+ note_id INTEGER NOT NULL UNIQUE,
122
+ author_username TEXT NOT NULL,
123
+ body TEXT NOT NULL,
124
+ created_at TEXT NOT NULL
125
+ );
126
+
127
+ CREATE INDEX IF NOT EXISTS idx_finding_responses_discussion ON finding_responses (finding_discussion_id);
128
+
129
+ -- One row per finding surfaced by a score (see local/db/repo.ts upsertFindingsForScore),
130
+ -- giving each finding a stable id so votes/tags can attach to it. Dedupe key matches
131
+ -- finding_discussions above — a finding reappearing across a re-review keeps its id.
132
+ CREATE TABLE IF NOT EXISTS findings (
133
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
134
+ merge_request_id INTEGER NOT NULL REFERENCES merge_requests (id),
135
+ category TEXT,
136
+ severity TEXT NOT NULL,
137
+ issue TEXT NOT NULL,
138
+ file TEXT,
139
+ line INTEGER,
140
+ created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
141
+ UNIQUE (merge_request_id, file, line, issue)
142
+ );
143
+ CREATE INDEX IF NOT EXISTS idx_findings_mr ON findings (merge_request_id);
144
+
145
+ CREATE TABLE IF NOT EXISTS finding_votes (
146
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
147
+ finding_id INTEGER NOT NULL UNIQUE REFERENCES findings (id),
148
+ vote TEXT NOT NULL CHECK (vote IN ('up', 'down')),
149
+ note TEXT NOT NULL,
150
+ correction_id INTEGER REFERENCES corrections (id),
151
+ insight_id INTEGER REFERENCES insights (id),
152
+ created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
153
+ );
154
+
155
+ CREATE TABLE IF NOT EXISTS finding_tags (
156
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
157
+ finding_id INTEGER NOT NULL REFERENCES findings (id),
158
+ tag TEXT NOT NULL CHECK (tag IN (
159
+ 'technical-debt', 'security', 'performance', 'bug-risk', 'breaking-change',
160
+ 'missing-tests', 'style', 'documentation', 'duplication', 'accessibility', 'danger-zone'
161
+ )),
162
+ created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
163
+ UNIQUE (finding_id, tag)
164
+ );
165
+ CREATE INDEX IF NOT EXISTS idx_finding_tags_finding ON finding_tags (finding_id);
166
+ CREATE INDEX IF NOT EXISTS idx_finding_tags_tag ON finding_tags (tag);
167
+
168
+ -- One row per performance zone a reviewed MR touched. Informational
169
+ -- only — never feeds the score. A re-review upserts; the human vote survives it.
170
+ CREATE TABLE IF NOT EXISTS zone_hits (
171
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
172
+ merge_request_id INTEGER NOT NULL REFERENCES merge_requests (id),
173
+ zone_id TEXT NOT NULL,
174
+ level TEXT NOT NULL CHECK (level IN ('red', 'amber', 'green')),
175
+ files_json TEXT NOT NULL,
176
+ impact TEXT CHECK (impact IN ('none', 'low', 'high')),
177
+ verdict TEXT,
178
+ vote TEXT CHECK (vote IN ('up', 'down')),
179
+ vote_note TEXT,
180
+ created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
181
+ UNIQUE (merge_request_id, zone_id)
182
+ );
183
+ CREATE INDEX IF NOT EXISTS idx_zone_hits_mr ON zone_hits (merge_request_id);
184
+
185
+ -- Team sync: which uids this DB has written to a source, so an export only deletes a shared
186
+ -- file for a row that was really deleted here (a fresh DB must not wipe the team repo).
187
+ CREATE TABLE IF NOT EXISTS sync_exported (
188
+ uid TEXT PRIMARY KEY,
189
+ source TEXT NOT NULL,
190
+ path TEXT NOT NULL
191
+ );
package/package.json CHANGED
@@ -1,6 +1,74 @@
1
1
  {
2
2
  "name": "yolont",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "description": "Yolont: LLM pull request reviewer for GitHub and GitLab. Guided setup, team conventions, sensitive zones, a 0-100 score and a local panel.",
5
+ "license": "FSL-1.1-ALv2",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/srcgrp/yolont.git"
9
+ },
10
+ "homepage": "https://github.com/srcgrp/yolont#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/srcgrp/yolont/issues"
13
+ },
14
+ "type": "module",
15
+ "engines": {
16
+ "node": ">=22.13"
17
+ },
18
+ "scripts": {
19
+ "build": "npm run typecheck && node esbuild.config.mjs",
20
+ "build:ci": "node esbuild.config.mjs ci",
21
+ "build:web": "npm --prefix local/backoffice/web ci --no-audit --no-fund && npm --prefix local/backoffice/web run build",
22
+ "prepack": "npm run build:web && node esbuild.config.mjs cli",
23
+ "typecheck": "tsc -p tsconfig.json --noEmit",
24
+ "test": "vitest run",
25
+ "start": "node dist/index.js"
26
+ },
27
+ "dependencies": {
28
+ "@anthropic-ai/sdk": "^0.124.0",
29
+ "@aws-sdk/client-s3": "^3.1127.0",
30
+ "@clack/prompts": "^1.8.0",
31
+ "@fastify/static": "^10.1.3",
32
+ "@gitbeaker/rest": "^43.8.0",
33
+ "@napi-rs/keyring": "^2.1.2",
34
+ "fastify": "^5.12.3",
35
+ "js-yaml": "^4.1.0",
36
+ "madge": "^8.0.0",
37
+ "picocolors": "^1.1.1",
38
+ "zod": "^3.25.76"
39
+ },
40
+ "devDependencies": {
41
+ "@types/js-yaml": "^4.0.9",
42
+ "@types/node": "^20.16.11",
43
+ "esbuild": "^0.28.2",
44
+ "typescript": "^5.9.3",
45
+ "vitest": "^3.2.7"
46
+ },
47
+ "allowScripts": {
48
+ "esbuild@0.28.2": true
49
+ },
50
+ "bin": {
51
+ "yolont": "dist/cli.js"
52
+ },
53
+ "files": [
54
+ "dist/cli.js",
55
+ "dist/cli.js.map",
56
+ "local/db/schema.sql",
57
+ "local/backoffice/web/dist/",
58
+ "conventions/default.md",
59
+ "templates/",
60
+ "action.yml",
61
+ ".pr-reviewer/rubric.yml",
62
+ "LICENSE.md",
63
+ "README.md",
64
+ "docs/"
65
+ ],
66
+ "keywords": [
67
+ "code-review",
68
+ "pull-request",
69
+ "merge-request",
70
+ "llm",
71
+ "github",
72
+ "gitlab"
73
+ ]
74
+ }
@@ -0,0 +1,42 @@
1
+ # Deprecated: use templates/yolont.gitlab-ci.yml. Kept unchanged for pipelines that include this file.
2
+ #
3
+ # Includable PR-Score job template.
4
+ #
5
+ # Usage from any other GitLab project:
6
+ #
7
+ # include:
8
+ # - project: '<group>/yolont'
9
+ # ref: main
10
+ # file: 'templates/pr-score.gitlab-ci.yml'
11
+ #
12
+ # Required CI/CD variables (Settings > CI/CD > Variables, masked/protected):
13
+ # GITLAB_API_TOKEN - project/group access token, scope: api (only this token posts notes/reads MRs)
14
+ # ANTHROPIC_API_KEY - Claude API key (default LLM provider)
15
+ # -- or, for a fully offline setup instead of the two above:
16
+ # OLLAMA_URL - e.g. http://ollama.internal:11434 (used only if ANTHROPIC_API_KEY is unset)
17
+ #
18
+ # Optional (enables cross-repo author history caching; falls back to scanning
19
+ # GitLab MR notes directly if omitted — slower, not broken):
20
+ # MINIO_ENDPOINT, MINIO_ACCESS_KEY, MINIO_SECRET_KEY, MINIO_BUCKET
21
+ #
22
+ # Optional overrides:
23
+ # PR_SCORE_IMAGE - defaults below; override to pin a specific tag
24
+ # RUBRIC_PATH - defaults to .yolont/rubric.yml (else .pr-reviewer/rubric.yml) in the target repo
25
+ # CONVENTIONS_PATH - defaults to .yolont/conventions.md (else CONVENTIONS.md) in the target repo
26
+ # ZONES_PATH - defaults to .yolont/zones.yaml (else .pr-reviewer/zones.yml) (optional)
27
+ # ZONES_GRAPH_PATH - defaults to .yolont/zones.graph.json (else .pr-reviewer/...) (optional; output of `cli.ts zones graph`)
28
+
29
+ variables:
30
+ PR_SCORE_IMAGE: "${CI_REGISTRY}/<group>/yolont/pr-score:latest"
31
+ PR_SCORE_GIT_DEPTH: "50"
32
+
33
+ pr-score:
34
+ stage: test
35
+ image: "$PR_SCORE_IMAGE"
36
+ rules:
37
+ - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
38
+ allow_failure: true # PR-Score is informational by default (see rubric.yml `gate:`); set to `false` once your team is ready to gate merges on it.
39
+ before_script:
40
+ - git fetch --depth="$PR_SCORE_GIT_DEPTH" origin "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
41
+ script:
42
+ - node /opt/pr-score/index.js
@@ -0,0 +1,31 @@
1
+ # Copy to .github/workflows/yolont.yml in the repo you want reviewed.
2
+ #
3
+ # Secrets (Settings > Secrets and variables > Actions): one LLM key, e.g. ANTHROPIC_API_KEY.
4
+ # The job token posts the comment; no extra GitHub token is needed.
5
+ name: Yolont
6
+
7
+ on:
8
+ pull_request:
9
+ types: [opened, synchronize, reopened, ready_for_review]
10
+ # Public repo taking fork PRs? Use this instead of `pull_request`. It runs with the base
11
+ # branch checked out (Yolont reads the PR only through the API and never runs its code), so
12
+ # the .yolont/ rubric and conventions come from your branch, not the PR.
13
+ # pull_request_target:
14
+ # types: [opened, synchronize, reopened, ready_for_review]
15
+
16
+ permissions:
17
+ contents: read
18
+ pull-requests: write
19
+ issues: write # the summary comment and the `llm-reviewed` label use the issues API
20
+ actions: read # lets job results (lint, tests) feed the score
21
+
22
+ jobs:
23
+ yolont:
24
+ runs-on: ubuntu-latest
25
+ # needs: [lint, test] # only jobs in this same workflow are visible to the score
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ - uses: srcgrp/yolont@main # pin a release tag or commit sha
29
+ env:
30
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
31
+ # YOLONT_CHANGE_TYPE: label # label (default) | steer (type-specific checks) | off
@@ -0,0 +1,40 @@
1
+ # Yolont MR review job for GitLab CI.
2
+ #
3
+ # Use it from any GitLab project:
4
+ #
5
+ # include:
6
+ # - project: '<group>/yolont' # where you host this repo and its image
7
+ # ref: main
8
+ # file: 'templates/yolont.gitlab-ci.yml'
9
+ #
10
+ # Required CI/CD variables (Settings > CI/CD > Variables, masked + protected):
11
+ # GITLAB_API_TOKEN project/group access token with scope `api` (reads the MR, posts the comment)
12
+ # One LLM key: ANTHROPIC_API_KEY, OPENCODE_ZEN_API_KEY, or OLLAMA_URL (self-hosted)
13
+ #
14
+ # Optional:
15
+ # YOLONT_IMAGE image to run (default below; pin a tag for stable runs)
16
+ # RUBRIC_PATH default .yolont/rubric.yml
17
+ # CONVENTIONS_PATH default .yolont/conventions.md
18
+ # ZONES_PATH default .yolont/zones.yaml
19
+ # YOLONT_CHANGE_TYPE label (default) | steer (type-specific checks) | off
20
+ # ZONES_GRAPH_PATH default .yolont/zones.graph.json
21
+ # MINIO_ENDPOINT, MINIO_ACCESS_KEY, MINIO_SECRET_KEY, MINIO_BUCKET
22
+ # cache author history (without it Yolont rescans past MR comments)
23
+ #
24
+ # The .yolont/ files are read from the MR's own checkout, so an MR can change its own rubric.
25
+ # Keep `allow_failure: true` (informational) unless you protect .yolont/ with CODEOWNERS.
26
+
27
+ variables:
28
+ YOLONT_IMAGE: "${CI_REGISTRY}/<group>/yolont/yolont:latest"
29
+ YOLONT_GIT_DEPTH: "50"
30
+
31
+ yolont:
32
+ stage: test
33
+ image: "$YOLONT_IMAGE"
34
+ rules:
35
+ - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
36
+ allow_failure: true # informational by default (rubric `gate:`); set false to gate merges
37
+ before_script:
38
+ - git fetch --depth="$YOLONT_GIT_DEPTH" origin "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
39
+ script:
40
+ - node /opt/yolont/index.js
@@ -0,0 +1,27 @@
1
+ # Yolont zone template: generic (applied to every stack, after the stack's own template).
2
+ zones:
3
+ - id: entrypoints
4
+ level: red
5
+ paths: ["main.*", "index.*", "app.*", "server.*", "src/main.*", "src/index.*", "src/app.*", "src/server.*", "cmd/**", "main.go", "manage.py", "wsgi.py", "asgi.py", "**/wsgi.py", "**/asgi.py", "src/main.rs", "src/lib.rs"]
6
+ why: "Process entry point: runs on every start; a mistake here takes everything down"
7
+ watch_for: ["new work at startup", "changed defaults or flags", "unhandled errors during boot"]
8
+ - id: migrations
9
+ level: red
10
+ paths: ["migrations/**", "**/migrations/**", "db/migrate/**", "alembic/**", "prisma/schema.prisma", "prisma/migrations/**"]
11
+ why: "Runs against production data and is hard to undo"
12
+ watch_for: ["locking or rewriting a large table", "no down/rollback path", "data loss on column drop or rename"]
13
+ - id: config
14
+ level: amber
15
+ paths: ["config/**", "src/config/**", "settings.py", "**/settings.py", "**/settings/**", ".env.example", "*.config.js", "*.config.ts", "*.config.mjs"]
16
+ why: "Read at startup by every code path; a wrong default affects all environments"
17
+ watch_for: ["changed defaults", "new required setting without a fallback", "secrets committed"]
18
+ - id: public-api
19
+ level: amber
20
+ paths: ["api/**", "proto/**", "**/*.proto", "openapi.yaml", "openapi.yml", "openapi.json", "**/openapi.yaml", "**/openapi.yml", "graphql/**", "**/*.graphql"]
21
+ why: "Contract with other services or clients; a change can break consumers"
22
+ watch_for: ["removed or renamed fields", "changed types", "no versioning for a breaking change"]
23
+ - id: build-deploy
24
+ level: amber
25
+ paths: [".github/workflows/**", ".gitlab-ci.yml", "Dockerfile", "**/Dockerfile", "docker-compose.yml", "docker-compose.yaml", "Makefile", "helm/**", "k8s/**", "deploy/**", "terraform/**"]
26
+ why: "Builds and ships every change; a mistake blocks releases or breaks production"
27
+ watch_for: ["removed checks or tests from CI", "changed base image", "secrets in plain text"]
@@ -0,0 +1,32 @@
1
+ # Yolont zone template: Next.js (app/ or pages/ router).
2
+ zones:
3
+ - id: root-layout
4
+ level: red
5
+ paths: ["app/layout.*", "src/app/layout.*", "pages/_app.*", "src/pages/_app.*", "pages/_document.*", "src/pages/_document.*"]
6
+ why: "Wraps every page and runs on every request or navigation"
7
+ watch_for: ["client component at the root", "blocking data fetch", "heavy import in the layout"]
8
+ - id: middleware
9
+ level: red
10
+ paths: ["middleware.*", "src/middleware.*"]
11
+ why: "Runs on every matched request, at the edge"
12
+ watch_for: ["network call per request", "Node-only API in edge code", "too broad a matcher"]
13
+ - id: next-config
14
+ level: red
15
+ paths: ["next.config.*"]
16
+ why: "Changes how the whole app builds and is served"
17
+ watch_for: ["disabled optimizations", "changed headers or redirects", "new experimental flag"]
18
+ - id: api-routes
19
+ level: amber
20
+ paths: ["app/api/**", "src/app/api/**", "pages/api/**", "src/pages/api/**"]
21
+ why: "Server endpoints on the request path"
22
+ watch_for: ["no input validation", "N+1 queries", "missing auth check"]
23
+ - id: shared
24
+ level: amber
25
+ paths: ["components/**", "src/components/**", "lib/**", "src/lib/**", "hooks/**", "src/hooks/**"]
26
+ why: "Used by many pages; a regression spreads"
27
+ watch_for: ["'use client' pulling server code into the bundle", "missing memoization"]
28
+ - id: pages
29
+ level: green
30
+ paths: ["app/**/page.*", "src/app/**/page.*", "pages/**", "src/pages/**"]
31
+ why: "Per-route code; only costs on that route"
32
+ watch_for: ["static page turned dynamic", "large client bundle on one route"]
@@ -0,0 +1,32 @@
1
+ # Yolont zone template: Node.js API (Express, Fastify, Koa, NestJS).
2
+ zones:
3
+ - id: startup
4
+ level: red
5
+ paths: ["server.*", "app.*", "index.*", "main.*", "src/server.*", "src/app.*", "src/index.*", "src/main.*", "src/bootstrap/**"]
6
+ why: "Runs at boot; a slow or failing start takes the service down"
7
+ watch_for: ["blocking work at import time", "unhandled promise at boot", "changed port or env handling"]
8
+ - id: middleware
9
+ level: red
10
+ paths: ["middleware/**", "middlewares/**", "src/middleware/**", "src/middlewares/**", "src/guards/**", "src/interceptors/**"]
11
+ why: "Runs on every request"
12
+ watch_for: ["I/O per request", "auth check bypass", "error swallowed before the handler"]
13
+ - id: migrations
14
+ level: red
15
+ paths: ["migrations/**", "src/migrations/**", "db/migrations/**", "src/db/migrations/**", "prisma/schema.prisma", "prisma/migrations/**"]
16
+ why: "Runs against production data and is hard to undo"
17
+ watch_for: ["locking a large table", "no rollback path", "data loss"]
18
+ - id: handlers
19
+ level: amber
20
+ paths: ["routes/**", "controllers/**", "src/routes/**", "src/controllers/**", "src/handlers/**", "src/api/**", "src/modules/**"]
21
+ why: "Request handlers on hot paths"
22
+ watch_for: ["no input validation", "unbounded query or loop", "missing auth check"]
23
+ - id: data-access
24
+ level: amber
25
+ paths: ["models/**", "src/models/**", "src/db/**", "src/repositories/**", "src/repository/**", "src/entities/**"]
26
+ why: "Queries shared by many endpoints"
27
+ watch_for: ["N+1 queries", "missing index for a new filter", "no pagination"]
28
+ - id: background-jobs
29
+ level: green
30
+ paths: ["jobs/**", "workers/**", "src/jobs/**", "src/workers/**", "src/queues/**"]
31
+ why: "Off the request path"
32
+ watch_for: ["job not idempotent on retry", "no timeout"]
@@ -0,0 +1,32 @@
1
+ # Yolont zone template: React single-page app.
2
+ zones:
3
+ - id: bootstrap
4
+ level: red
5
+ paths: ["index.html", "src/main.tsx", "src/main.jsx", "src/index.tsx", "src/index.jsx", "src/App.tsx", "src/App.jsx"]
6
+ why: "Runs before first paint; everything here is on the critical path"
7
+ watch_for: ["heavy import", "blocking fetch/await at mount", "new global CSS or polyfill"]
8
+ - id: root-providers
9
+ level: red
10
+ paths: ["src/providers/**", "src/context/**", "src/contexts/**"]
11
+ why: "Wraps every render; a new context value re-renders the whole tree"
12
+ watch_for: ["unmemoized context value", "fetch at mount", "new provider in the root"]
13
+ - id: app-shell
14
+ level: red
15
+ paths: ["src/layout/**", "src/layouts/**", "src/components/layout/**", "src/components/Layout/**"]
16
+ why: "App shell shown on every page and in the first viewport"
17
+ watch_for: ["layout shift", "large image or font", "heavy component in the header"]
18
+ - id: shared-state
19
+ level: amber
20
+ paths: ["src/hooks/**", "src/store/**", "src/stores/**", "src/state/**", "src/redux/**"]
21
+ why: "Shared hooks and stores; used by many components, so a slow one is slow everywhere"
22
+ watch_for: ["missing memoization", "subscribing to the whole store", "effects without cleanup"]
23
+ - id: shared-components
24
+ level: amber
25
+ paths: ["src/components/**", "src/ui/**"]
26
+ why: "Reused across pages; a regression spreads"
27
+ watch_for: ["re-render on every parent render", "large list without virtualization"]
28
+ - id: routes
29
+ level: green
30
+ paths: ["src/pages/**", "src/routes/**", "src/views/**", "src/features/**"]
31
+ why: "Per-page code, usually lazy-loaded; only costs when visited"
32
+ watch_for: ["route no longer lazy", "page code imported from the root"]