@methiu/raigal 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.
- package/LICENSE +1 -0
- package/README.md +499 -0
- package/dist/AgentApp-CIiRfOun.js +389 -0
- package/dist/adapters/astro.d.ts +22 -0
- package/dist/adapters/astro.js +20 -0
- package/dist/adapters/expo.d.ts +24 -0
- package/dist/adapters/expo.js +33 -0
- package/dist/adapters/nuxt.d.ts +33 -0
- package/dist/adapters/nuxt.js +41 -0
- package/dist/adapters/sveltekit.d.ts +15 -0
- package/dist/adapters/sveltekit.js +19 -0
- package/dist/adapters/vite.d.ts +26 -0
- package/dist/adapters/vite.js +33 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +29887 -0
- package/dist/core-BpOFk2i9.d.ts +34 -0
- package/dist/core-kJtASBYe.js +110 -0
- package/dist/finding-assessment-M5fUTE-C.js +321 -0
- package/dist/index.d.ts +351 -0
- package/dist/index.js +20257 -0
- package/dist/json-C2IwKr9o.js +35 -0
- package/dist/json-C9fBWj3V.js +35 -0
- package/dist/mask-secrets-BXn-ZSEh.js +71 -0
- package/dist/mcp.js +15035 -0
- package/dist/mount-DTc8WaIt.js +18 -0
- package/dist/report-pr-closed-CDdQjRWj.js +44 -0
- package/dist/sarif--DI_2p2r.js +66 -0
- package/dist/sarif-Do8E1xhZ.js +66 -0
- package/dist/version-v4OAaBLZ.js +6 -0
- package/package.json +135 -0
- package/scripts/check-licenses.mjs +45 -0
- package/scripts/check-tarball-keys.mjs +110 -0
- package/scripts/gen-config-schema.mjs +35 -0
- package/scripts/install-tools.mjs +383 -0
- package/scripts/polyfill.cjs +10 -0
- package/scripts/release-guard.mjs +29 -0
- package/tools/jb/README.md +45 -0
- package/tools/jb/aislop.DotSettings +3 -0
package/LICENSE
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
PROPRIETARY. All rights reserved. Use is permitted only under a written agreement with Raigal.
|
package/README.md
ADDED
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
# Raigal
|
|
2
|
+
|
|
3
|
+
**Catch the slop AI coding agents leave in your code.**
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@methiu/raigal) [](https://www.npmjs.com/package/@methiu/raigal) [](https://github.com/meethiu/raigal/actions/workflows/ci.yml) [](https://nodejs.org)
|
|
6
|
+
The patterns Claude Code, Cursor, Codex, and OpenCode leave behind: narrative comments above self-explanatory code, swallowed exceptions, hidden fallbacks, `as any` casts, hallucinated imports, duplicated helpers, dead code, todo stubs, oversized functions. Tests pass. Lint passes. The code rots anyway.
|
|
7
|
+
|
|
8
|
+
Raigal catches them. 50+ rules across 10 language targets (TypeScript, JavaScript, Expo / React Native, Python, Go, Rust, Ruby, PHP, C#, C/C++). Scores every change 0-100. Sub-second. Deterministic: no LLM in the runtime path, same code in, same score out.
|
|
9
|
+
|
|
10
|
+
## Quick start
|
|
11
|
+
|
|
12
|
+
Raigal is demo software licensed to organizations on an admin-managed allowlist. Runs require authentication via organization credentials (`raigal login` or `RAIGAL_TOKEN`).
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# 1. Sign in with your organization account
|
|
16
|
+
raigal login
|
|
17
|
+
|
|
18
|
+
# 2. Score your repository
|
|
19
|
+
raigal scan
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
In CI and automated workflows, provide your organization API key via the `RAIGAL_TOKEN` environment variable.
|
|
23
|
+
|
|
24
|
+
Also available on npm, Yarn, Bun, and Homebrew:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install -g @methiu/raigal
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
See [Installation](#installation) for all options.
|
|
31
|
+
|
|
32
|
+
## Language support
|
|
33
|
+
|
|
34
|
+
Raigal supports TypeScript, JavaScript, Expo / React Native, Python, Go, Rust, Ruby, PHP, C#, and C/C++.
|
|
35
|
+
|
|
36
|
+
Coverage includes formatting, linting, complexity, AI-slop detection, and security checks. Some checks use optional system tools; see [Installation](https://raigal.gitbook.io/raigal-docs/getting-started/installation).
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
raigal agent # repair with your coding agent (Codex/Claude/OpenCode)
|
|
40
|
+
raigal fix # auto-fix the mechanical issues
|
|
41
|
+
raigal fix -f # aggressive fixes (deps, unused files)
|
|
42
|
+
raigal ci # CI mode (JSON + gate)
|
|
43
|
+
raigal hook install --claude # per-edit hook
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## See it in action
|
|
47
|
+
|
|
48
|
+
### Scan
|
|
49
|
+
|
|
50
|
+

|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
The same CLI is published to npm and Homebrew. Pick whichever fits your stack.
|
|
57
|
+
|
|
58
|
+
**Node / npm**
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Run without installing
|
|
62
|
+
npx @methiu/raigal@latest scan
|
|
63
|
+
|
|
64
|
+
# npm
|
|
65
|
+
npm install --save-dev @methiu/raigal
|
|
66
|
+
|
|
67
|
+
# yarn
|
|
68
|
+
yarn add --dev @methiu/raigal
|
|
69
|
+
|
|
70
|
+
# pnpm
|
|
71
|
+
pnpm add -D @methiu/raigal
|
|
72
|
+
|
|
73
|
+
# bun
|
|
74
|
+
bun add -d @methiu/raigal
|
|
75
|
+
|
|
76
|
+
# Global
|
|
77
|
+
npm install -g @methiu/raigal
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Package installation does not run dependency lifecycle scripts. After installing, run `raigal-tools` once if you want bundled Ruff and golangci-lint coverage; the core scanner works without it.
|
|
81
|
+
|
|
82
|
+
**Homebrew** (macOS / Linux)
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
brew install meethiu/tap/raigal
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Homebrew installs Node.js as a dependency if it isn't already present. Details: [homebrew-tap](https://github.com/meethiu/homebrew-tap).
|
|
89
|
+
|
|
90
|
+
**Python / pipx**
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
pipx install raigal
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`pipx` keeps `raigal` in its own isolated environment. Needs Node.js on `PATH`.
|
|
97
|
+
|
|
98
|
+
Full reference for every channel, optional bundled tooling, and external tools: [Installation Docs](https://raigal.gitbook.io/raigal-docs/getting-started/installation).
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Usage
|
|
103
|
+
|
|
104
|
+
Examples below use the installed `raigal` binary. For a one-off latest run, prefix the command with `npx @methiu/raigal@latest`, for example `npx @methiu/raigal@latest scan`.
|
|
105
|
+
|
|
106
|
+
### Command reference
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
raigal --help # clean overview
|
|
110
|
+
raigal commands # every public command and major flag
|
|
111
|
+
raigal <command> --help # detailed help for one command
|
|
112
|
+
raigal version # installed version
|
|
113
|
+
raigal -V # installed version
|
|
114
|
+
raigal update # current and latest npm versions
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Scan
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
raigal scan # current directory
|
|
121
|
+
raigal scan ./src # specific directory
|
|
122
|
+
raigal scan --changes # changed files from HEAD
|
|
123
|
+
raigal scan --changes --base origin/main # changed vs a base branch (PRs)
|
|
124
|
+
raigal scan --staged # staged files only
|
|
125
|
+
raigal scan -d # verbose file/rule detail
|
|
126
|
+
raigal scan --json # JSON output
|
|
127
|
+
raigal scan --sarif # SARIF 2.1.0 output (GitHub code scanning)
|
|
128
|
+
raigal scan --format json # alternate JSON form
|
|
129
|
+
raigal scan --include "src/**" # only matching paths
|
|
130
|
+
raigal scan --exclude "dist,gen" # skip extra paths
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Exclude files**: `node_modules`, `.git`, `dist`, `build`, `coverage` excluded by default. Add more in `.raigal/config.yml`:
|
|
134
|
+
|
|
135
|
+
```yaml
|
|
136
|
+
exclude:
|
|
137
|
+
- "**/*.test.ts"
|
|
138
|
+
- src/generated
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Or via CLI: `raigal scan --exclude "**/*.test.ts,dist"`
|
|
142
|
+
|
|
143
|
+
**Unsupported languages**: Raigal only analyses the 10 language targets above. If a repo is mostly something else (Swift, Kotlin, Java, ...), scoring a handful of incidental files would misrepresent it, so Raigal **withholds the score** and says so rather than printing a number off code it never read. `--json` returns `score: null`, `scoreable: false`, and a `coverage` breakdown.
|
|
144
|
+
|
|
145
|
+
**Per-rule severity**: Override the severity of any rule by id, or turn it off:
|
|
146
|
+
|
|
147
|
+
```yaml
|
|
148
|
+
# .raigal/config.yml
|
|
149
|
+
rules:
|
|
150
|
+
ai-slop/narrative-comment: warning # error | warning | off
|
|
151
|
+
ai-slop/trivial-comment: "off" # drop this rule entirely
|
|
152
|
+
security/hardcoded-secret: error
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
`off` drops matching diagnostics; `error`/`warning` rewrites severity before scoring and reporting. Absent map keeps default behavior.
|
|
156
|
+
|
|
157
|
+
**Suppress findings inline**: Silence a specific line when you know better, with an optional reason after `--`:
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
// raigal-ignore-next-line ai-slop/hidden-fallback -- options is validated upstream
|
|
161
|
+
const opts = { ...defaults, ...(input || {}) };
|
|
162
|
+
|
|
163
|
+
const legacy = doThing(); // raigal-ignore-line
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
`raigal-ignore-next-line` covers the line below, `raigal-ignore-line` the line it sits on, and `raigal-ignore-file` (place anywhere in the file) the whole file. Name one or more rules to scope the suppression, or omit them to silence every rule on that line. The directive works in any comment syntax (`//`, `#`, `<!-- -->`). Suppressed findings are removed before scoring, and the run reports how many were silenced.
|
|
167
|
+
|
|
168
|
+
**Ignore whole paths**: Add an `.raigalignore` at the project root (same glob semantics as `exclude`, `#` comments allowed):
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
src/generated
|
|
172
|
+
**/*.snap
|
|
173
|
+
legacy
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Extend config**: Project config can extend a parent:
|
|
177
|
+
|
|
178
|
+
```yaml
|
|
179
|
+
# .raigal/config.yml
|
|
180
|
+
extends: ../../.raigal/base.yml
|
|
181
|
+
ci:
|
|
182
|
+
failBelow: 80 # override specific keys
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Editor validation**: Point your editor at the JSON Schema in [`schema/raigal.config.schema.json`](schema/raigal.config.schema.json) for autocomplete and validation of `.raigal/config.yml`. Regenerate it from the source config schema with `pnpm gen:schema`.
|
|
186
|
+
|
|
187
|
+
### Fix
|
|
188
|
+
|
|
189
|
+
The deterministic layer beneath [`raigal agent`](#run-a-local-repair-agent): auto-fix what's purely mechanical (formatters, unused imports, dead code). For anything that needs judgement, reach for `raigal agent` or hand off to your coding agent with full diagnostic info.
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
raigal fix # auto-fixes
|
|
193
|
+
raigal fix --dry-run # preview planned steps without writing files
|
|
194
|
+
raigal fix --changes # only rewrite files changed vs HEAD
|
|
195
|
+
raigal fix --staged # only rewrite staged files
|
|
196
|
+
raigal fix -d # detailed fix progress
|
|
197
|
+
raigal fix --safe # only reversible fixes (imports, comment removal, safe formatters)
|
|
198
|
+
raigal fix -f # aggressive: deps, unused files
|
|
199
|
+
raigal fix -p # print an agent handoff prompt
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
`--safe` restricts the run to fixes that cannot change behaviour - unused-import removal, import merging, narrative-comment removal, and formatter runs that do not execute project-controlled configuration. Anything that deletes code, rewrites behaviour/attributes, or can load executable formatter configuration (console/dead-code removal, lint autofixes, Ruby/PHP formatter config, unused-declaration and dependency pruning) is skipped, so a `--safe` run is genuinely "apply and commit".
|
|
203
|
+
|
|
204
|
+
### Run a local repair agent
|
|
205
|
+
|
|
206
|
+
`raigal agent` keeps the deterministic scanner in charge while using the coding agent you already have installed. It creates a local git worktree, runs safe fixes, streams a headless Codex / Claude Code / OpenCode repair session, verifies the result with `raigal scan --json`, writes a local session transcript, and leaves the diff for review.
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
raigal agent providers # see installed providers and setup hints
|
|
210
|
+
raigal agent connect codex # run the provider's own local login flow
|
|
211
|
+
raigal agent use codex # save a repo-local default provider
|
|
212
|
+
raigal agent use auto # clear the default and auto-detect
|
|
213
|
+
raigal agent plan # preview provider, worktree, findings, PR/apply behavior
|
|
214
|
+
raigal agent monitor # stream scans when local git changes settle
|
|
215
|
+
raigal agent monitor --background
|
|
216
|
+
raigal agent monitor list # list background monitors
|
|
217
|
+
raigal agent monitor stop # stop the latest background monitor
|
|
218
|
+
raigal agent monitor --repair --in-place
|
|
219
|
+
raigal agent # auto-pick an installed provider
|
|
220
|
+
raigal agent --provider codex # switch provider
|
|
221
|
+
raigal agent --background # run locally in the background
|
|
222
|
+
raigal agent --apply # apply verified diff back to this repo
|
|
223
|
+
raigal agent --pr # commit, push, and open a draft PR
|
|
224
|
+
raigal agent sessions # list recent local repair sessions
|
|
225
|
+
raigal agent show # show the latest session timeline and summary
|
|
226
|
+
raigal agent apply # apply a reviewed worktree session later
|
|
227
|
+
raigal agent watch # stream the latest session transcript
|
|
228
|
+
raigal agent stop # stop the latest running background session
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
No OpenAI or Anthropic API key is requested by `raigal`; provider CLIs use their own existing local auth. A saved provider default lives in `.raigal/agent/provider.json` and is kept out of commits through the repo's local Git exclude. Session transcripts live under `.raigal/agent/sessions/`, and agent sessions/worktrees are also excluded locally. Provider JSONL is normalized in the terminal stream while raw lines stay in the transcript.
|
|
232
|
+
|
|
233
|
+
### Hand off to agent
|
|
234
|
+
|
|
235
|
+
When auto-fix can't solve it, pass the remaining issues to your coding agent with full context:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
raigal fix --claude # Claude Code
|
|
239
|
+
raigal fix --codex # Codex CLI
|
|
240
|
+
raigal fix --cursor # Cursor (copies to clipboard)
|
|
241
|
+
raigal fix --gemini # Gemini CLI
|
|
242
|
+
raigal fix --prompt # print prompt (agent-agnostic)
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Other fix handoff flags: `--windsurf`, `--vscode`, `--amp`, `--antigravity`, `--deep-agents`, `--kimi`, `--opencode`, `--warp`, `--aider`, `--goose`, `--pi`, `--crush`.
|
|
246
|
+
|
|
247
|
+
### Install hook
|
|
248
|
+
|
|
249
|
+
Runs after every agent edit. Feedback flows back immediately.
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
raigal hook install --claude # Claude Code
|
|
253
|
+
raigal hook install --cursor # Cursor
|
|
254
|
+
raigal hook install --gemini # Gemini CLI
|
|
255
|
+
raigal hook install --pi # pi
|
|
256
|
+
raigal hook install # pick agents interactively
|
|
257
|
+
raigal hook install claude cursor # specific agents
|
|
258
|
+
raigal hook install --agent claude,pi # comma-separated agents
|
|
259
|
+
raigal install claude cursor # alias for hook install
|
|
260
|
+
raigal install hooks --claude # natural alias for hook install
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**Runtime adapters** (scan + feedback): `claude`, `cursor`, `gemini`, `pi`.
|
|
264
|
+
**Rules-only** (agent reads rules): `codex`, `windsurf`, `cline`, `kilocode`, `antigravity`, `copilot`.
|
|
265
|
+
|
|
266
|
+
Hook install flags: `--agent <names>`, `-g, --global`, `--project`, `--dry-run`, `--yes`, `--quality-gate`, plus per-agent shortcuts `--claude`, `--cursor`, `--gemini`, `--pi`, `--codex`, `--windsurf`, `--cline`, `--kilocode`, `--antigravity`, `--copilot`.
|
|
267
|
+
|
|
268
|
+
**Quality-gate mode**: Blocks if score regresses below baseline.
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
raigal hook install --claude --quality-gate
|
|
272
|
+
raigal hook baseline # re-capture baseline
|
|
273
|
+
raigal hook status # list installed
|
|
274
|
+
raigal hook uninstall --claude # remove
|
|
275
|
+
raigal uninstall claude # alias for hook uninstall
|
|
276
|
+
raigal uninstall hooks --claude # natural alias for hook uninstall
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### MCP server
|
|
280
|
+
|
|
281
|
+
Expose Raigal as MCP tools for Claude Desktop, Cursor, Codex:
|
|
282
|
+
|
|
283
|
+
```jsonc
|
|
284
|
+
// ~/.cursor/mcp.json or Claude Desktop config
|
|
285
|
+
{
|
|
286
|
+
"mcpServers": {
|
|
287
|
+
"raigal": {
|
|
288
|
+
"command": "npx",
|
|
289
|
+
"args": ["-y", "@methiu/raigal-mcp"]
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**Tools**: `raigal_scan`, `raigal_fix`, `raigal_why`, `raigal_baseline`.
|
|
296
|
+
|
|
297
|
+
### CI
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
raigal ci # JSON output, exits 1 if score < threshold
|
|
301
|
+
raigal ci --changes --base origin/main # gate only the files a PR changes
|
|
302
|
+
raigal ci --human # human-friendly CI output
|
|
303
|
+
raigal ci --sarif # SARIF output for code scanning
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
`ci` accepts the same `--changes` / `--staged` / `--base <ref>` scoping as `scan`. Use `--changes --base origin/<target>` to gate a pull request on only the files it touches; the score gate and exit code still apply.
|
|
307
|
+
|
|
308
|
+
### Other commands
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
raigal # interactive menu
|
|
312
|
+
raigal init # create .raigal/config.yml
|
|
313
|
+
raigal init --strict # enterprise-grade gate: all engines, typecheck, failBelow 85
|
|
314
|
+
raigal doctor # check which engines can run here
|
|
315
|
+
raigal rules # list rules with severity, fixability, and score impact
|
|
316
|
+
raigal rules --search # searchable rule explorer
|
|
317
|
+
raigal trend # show score history over time
|
|
318
|
+
raigal trends # alias for trend
|
|
319
|
+
raigal trend --limit 20
|
|
320
|
+
raigal update # show current and latest npm versions
|
|
321
|
+
raigal upgrade # alias for update
|
|
322
|
+
raigal commands # full command list
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
**Score history**: a normal (full-project, interactive) `scan` appends a compact record to `.raigal/history.jsonl` (timestamp, score, error/warning counts, file count, CLI version). `raigal trend` and `raigal trends` read it and print a relative-time table plus an ASCII sparkline of recent scores. History is a local side effect only: it is never written for `--json`/`--sarif` output, in CI, or when `RAIGAL_NO_HISTORY=1` is set, so machine output stays clean.
|
|
326
|
+
|
|
327
|
+
Docs: [Commands Reference](https://raigal.gitbook.io/raigal-docs/cli-reference/commands)
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## CI integration
|
|
332
|
+
|
|
333
|
+
### Pre-commit
|
|
334
|
+
|
|
335
|
+
Run directly on staged files:
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
raigal scan --staged
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
By default, `scan` exits 1 only on error-severity findings. To block commits on warnings, pass `--fail-on warning`.
|
|
342
|
+
|
|
343
|
+
Or wire it into the [pre-commit](https://pre-commit.com) framework via the bundled hook:
|
|
344
|
+
|
|
345
|
+
```yaml
|
|
346
|
+
# .pre-commit-config.yaml
|
|
347
|
+
repos:
|
|
348
|
+
- repo: https://github.com/meethiu/raigal
|
|
349
|
+
rev: v1
|
|
350
|
+
hooks:
|
|
351
|
+
- id: raigal
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### GitHub Actions
|
|
355
|
+
|
|
356
|
+
Add `.github/workflows/raigal.yml` to your repository. Provide your organization token via the `RAIGAL_TOKEN` secret. Setting `id-token: write` enables GitHub OIDC verification so the server can verify the repository owner:
|
|
357
|
+
|
|
358
|
+
```yaml
|
|
359
|
+
name: raigal
|
|
360
|
+
on:
|
|
361
|
+
pull_request:
|
|
362
|
+
push:
|
|
363
|
+
branches: [main]
|
|
364
|
+
permissions:
|
|
365
|
+
contents: read
|
|
366
|
+
id-token: write
|
|
367
|
+
jobs:
|
|
368
|
+
raigal:
|
|
369
|
+
runs-on: ubuntu-latest
|
|
370
|
+
steps:
|
|
371
|
+
- uses: actions/checkout@v4
|
|
372
|
+
with:
|
|
373
|
+
fetch-depth: 0
|
|
374
|
+
- uses: actions/setup-node@v4
|
|
375
|
+
with:
|
|
376
|
+
node-version: 24
|
|
377
|
+
- name: Raigal Quality Gate
|
|
378
|
+
run: npx --yes @methiu/raigal@latest ci
|
|
379
|
+
env:
|
|
380
|
+
RAIGAL_TOKEN: ${{ secrets.RAIGAL_TOKEN }}
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
**GitHub code scanning (SARIF)**: emit a SARIF 2.1.0 report and upload it so findings appear in the Security tab:
|
|
384
|
+
|
|
385
|
+
```yaml
|
|
386
|
+
- run: npx @methiu/raigal@latest scan . --sarif > raigal.sarif
|
|
387
|
+
- uses: github/codeql-action/upload-sarif@v3
|
|
388
|
+
with:
|
|
389
|
+
sarif_file: raigal.sarif
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
### Bitbucket Pipelines
|
|
393
|
+
|
|
394
|
+
Bitbucket clones shallow by default, so fetch the PR target branch and gate on only the changed files with `ci --changes --base`:
|
|
395
|
+
|
|
396
|
+
```yaml
|
|
397
|
+
# bitbucket-pipelines.yml
|
|
398
|
+
pipelines:
|
|
399
|
+
pull-requests:
|
|
400
|
+
"**":
|
|
401
|
+
- step:
|
|
402
|
+
name: raigal gate
|
|
403
|
+
image: node:24
|
|
404
|
+
clone:
|
|
405
|
+
depth: full # branch diffs need history
|
|
406
|
+
script:
|
|
407
|
+
- git fetch origin "$BITBUCKET_PR_DESTINATION_BRANCH"
|
|
408
|
+
- npx --yes @methiu/raigal@latest ci --changes --base FETCH_HEAD
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
`ci` applies the score gate and exit code, so no JSON parsing or hand-rolled threshold is needed. More providers: [CI/CD Documentation](https://raigal.gitbook.io/raigal-docs/automation-and-ci-cd/ci-cd).
|
|
412
|
+
|
|
413
|
+
### Quality gate
|
|
414
|
+
|
|
415
|
+
Set minimum score in `.raigal/config.yml`:
|
|
416
|
+
|
|
417
|
+
```yaml
|
|
418
|
+
ci:
|
|
419
|
+
failBelow: 70
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
`raigal ci` exits 1 when score < threshold. Docs: [CI/CD Documentation](https://raigal.gitbook.io/raigal-docs/automation-and-ci-cd/ci-cd)
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
## For teams
|
|
427
|
+
|
|
428
|
+
[Raigal](https://raigal.dev) is the hosted platform for teams:
|
|
429
|
+
|
|
430
|
+
- PR gates with score thresholds
|
|
431
|
+
- Standards hierarchy (org -> team -> project)
|
|
432
|
+
- Dashboards and agent attribution
|
|
433
|
+
- Visual rules manager
|
|
434
|
+
|
|
435
|
+
Same engines, same scores. Central policy and audit. [Learn more](https://raigal.dev)
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
## Why Raigal
|
|
440
|
+
|
|
441
|
+
AI coding tools generate code that compiles and passes tests but ships with patterns no engineer would write. `raigal` gives you one score, one gate, and auto-fixes what it can.
|
|
442
|
+
|
|
443
|
+
- **One score**: 0-100, enforced in CI. Weighted so sloppy patterns hit harder than style noise.
|
|
444
|
+
- **Auto-fix first**: Clears formatters, unused imports, dead code mechanically. Hands off the rest to your agent with full context.
|
|
445
|
+
- **Deterministic**: Regex + AST + standard tooling. No LLMs, no API calls. Same code in, same score out.
|
|
446
|
+
- **Fast onboarding**: Runs with your organization session (`raigal login`) or CI token (`RAIGAL_TOKEN`). Add `.raigal/config.yml` to tune.
|
|
447
|
+
|
|
448
|
+
## What it catches
|
|
449
|
+
|
|
450
|
+
Six deterministic engines run in parallel:
|
|
451
|
+
|
|
452
|
+
| Engine | What it checks | How |
|
|
453
|
+
|---|---|---|
|
|
454
|
+
| **Formatting** | Code style consistency | Biome, ruff, gofmt, cargo fmt, rubocop, php-cs-fixer, dotnet format, clang-format |
|
|
455
|
+
| **Linting** | Language-specific issues | oxlint, ruff, golangci-lint, clippy, expo-doctor, Roslynator, JetBrains InspectCode, cppcheck, clang-tidy |
|
|
456
|
+
| **Code Quality** | Complexity and dead code | Function/file size limits, deep nesting, unused files/deps (knip), AST-based unused-declaration removal |
|
|
457
|
+
| **AI Slop** | AI-authored code patterns | Narrative comments, trivial comments, dead patterns, unused imports, `as any`, `console.log` leftovers, TODO stubs, generic names |
|
|
458
|
+
| **Security** | Vulnerabilities and risky code | eval, innerHTML, SQL/shell injection, dependency audits for JavaScript, Python, Rust, Go, and .NET |
|
|
459
|
+
| **Architecture** | Structural rules (opt-in) | Custom import bans, layering rules, required patterns |
|
|
460
|
+
|
|
461
|
+
See the full [Rules Reference](https://raigal.gitbook.io/raigal-docs/core-concepts/rules).
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
## Research
|
|
466
|
+
|
|
467
|
+
Raigal rules are shaped by public scans and benchmark-derived failure modes, not only local fixtures. The [documentation](https://raigal.gitbook.io/raigal-docs) defines how to run repeatable open-source scans: pin the cohort, store raw JSON, classify findings, fix noisy rules with regression tests, and publish the limits.
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
471
|
+
## Docs
|
|
472
|
+
|
|
473
|
+
Read the complete documentation at [raigal.gitbook.io/raigal-docs](https://raigal.gitbook.io/raigal-docs):
|
|
474
|
+
|
|
475
|
+
[Installation](https://raigal.gitbook.io/raigal-docs/getting-started/installation) · [Commands](https://raigal.gitbook.io/raigal-docs/cli-reference/commands) · [Rules](https://raigal.gitbook.io/raigal-docs/core-concepts/rules) · [Configuration](https://raigal.gitbook.io/raigal-docs/cli-reference/configuration) · [Scoring](https://raigal.gitbook.io/raigal-docs/core-concepts/scoring) · [CI/CD](https://raigal.gitbook.io/raigal-docs/automation-and-ci-cd/ci-cd) · [Pull Requests](https://raigal.gitbook.io/raigal-docs/automation-and-ci-cd/pull-requests) · [Agent Repairs](https://raigal.gitbook.io/raigal-docs/automation-and-ci-cd/agent-repairs)
|
|
476
|
+
|
|
477
|
+
## Community
|
|
478
|
+
|
|
479
|
+
[Discussions](https://github.com/meethiu/raigal/discussions) for questions, rule requests, and false-positive triage · [Issues](https://github.com/meethiu/raigal/issues) for bugs
|
|
480
|
+
|
|
481
|
+
## Contributing
|
|
482
|
+
|
|
483
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md). AI assistants: [AGENTS.md](AGENTS.md).
|
|
484
|
+
|
|
485
|
+
## Acknowledgments
|
|
486
|
+
|
|
487
|
+
Built on: [Biome](https://biomejs.dev/), [oxlint](https://oxc.rs/), [knip](https://knip.dev/), [ruff](https://docs.astral.sh/ruff/), [golangci-lint](https://golangci-lint.run/), [expo-doctor](https://docs.expo.dev/)
|
|
488
|
+
|
|
489
|
+
## Contributors
|
|
490
|
+
|
|
491
|
+
<!-- CONTRIBUTORS-START -->
|
|
492
|
+
- [@meethiu](https://github.com/meethiu)
|
|
493
|
+
<!-- CONTRIBUTORS-END -->
|
|
494
|
+
|
|
495
|
+
Auto-updated by `.github/workflows/contributors.yml`. [Link commit email](https://github.com/settings/emails) or add to [`.github/contributors-overrides.json`](.github/contributors-overrides.json).
|
|
496
|
+
|
|
497
|
+
## License
|
|
498
|
+
|
|
499
|
+
Proprietary. All rights reserved. Use is permitted only under a written agreement with Raigal. See [LICENSE](LICENSE) and [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|