@methiu/raigal 0.2.5 → 0.2.7
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 +6 -1
- package/README.md +75 -37
- package/THIRD_PARTY_NOTICES.md +70 -0
- package/dist/cli.js +588 -185
- package/dist/index.d.ts +1 -0
- package/dist/index.js +536 -177
- package/dist/{json-B8XGYwMv.js → json-B2Kc7_rw.js} +1 -1
- package/dist/mcp.js +187 -72
- package/dist/{sarif-DqH4dGEo.js → sarif-CpMse0iL.js} +1 -1
- package/dist/{version-BlgPglaO.js → version-CXMYu17z.js} +1 -1
- package/package.json +7 -4
- package/scripts/check-tarball-keys.mjs +26 -0
package/LICENSE
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
Copyright (c) 2026 Raigal. All rights reserved.
|
|
2
|
+
|
|
3
|
+
PROPRIETARY. Use is permitted only under a written agreement with Raigal.
|
|
4
|
+
|
|
5
|
+
This software includes third-party components licensed under their own terms.
|
|
6
|
+
See THIRD_PARTY_NOTICES.md for those components and their licences.
|
package/README.md
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
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
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
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.
|
|
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. No LLM in the scoring path: the same code and tool versions give the same score.
|
|
9
9
|
|
|
10
10
|
## Quick start
|
|
11
11
|
|
|
12
|
-
Raigal is
|
|
12
|
+
Raigal is licensed to organizations on an admin-managed allowlist. Runs require authentication via organization credentials (`raigal login` or `RAIGAL_TOKEN`).
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
15
|
# 1. Sign in with your organization account
|
|
@@ -21,7 +21,7 @@ raigal scan
|
|
|
21
21
|
|
|
22
22
|
In CI and automated workflows, provide your organization API key via the `RAIGAL_TOKEN` environment variable.
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Install it with npm, pnpm, Yarn, or Bun:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
27
|
npm install -g @methiu/raigal
|
|
@@ -33,7 +33,7 @@ See [Installation](#installation) for all options.
|
|
|
33
33
|
|
|
34
34
|
Raigal supports TypeScript, JavaScript, Expo / React Native, Python, Go, Rust, Ruby, PHP, C#, and C/C++.
|
|
35
35
|
|
|
36
|
-
Coverage includes formatting, linting, complexity, AI-slop detection, and security checks. Some checks use optional system tools; see [Installation](https://raigal.
|
|
36
|
+
Coverage includes formatting, linting, complexity, AI-slop detection, and security checks. Some checks use optional system tools; see [Installation](https://docs.raigal.dev/getting-started/installation).
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
39
|
raigal agent # repair with your coding agent (Codex/Claude/OpenCode)
|
|
@@ -53,7 +53,7 @@ raigal hook install --claude # per-edit hook
|
|
|
53
53
|
|
|
54
54
|
## Installation
|
|
55
55
|
|
|
56
|
-
The
|
|
56
|
+
The CLI is published to npm as `@methiu/raigal`. The unscoped `raigal` package is an official alias that installs the same CLI.
|
|
57
57
|
|
|
58
58
|
**Node / npm**
|
|
59
59
|
|
|
@@ -79,23 +79,7 @@ npm install -g @methiu/raigal
|
|
|
79
79
|
|
|
80
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
81
|
|
|
82
|
-
|
|
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).
|
|
82
|
+
Full reference for every channel, optional bundled tooling, and external tools: [Installation Docs](https://docs.raigal.dev/getting-started/installation).
|
|
99
83
|
|
|
100
84
|
---
|
|
101
85
|
|
|
@@ -286,7 +270,7 @@ Expose Raigal as MCP tools for Claude Desktop, Cursor, Codex:
|
|
|
286
270
|
"mcpServers": {
|
|
287
271
|
"raigal": {
|
|
288
272
|
"command": "npx",
|
|
289
|
-
"args": ["-y", "@methiu/raigal
|
|
273
|
+
"args": ["-y", "@methiu/raigal@latest", "mcp"]
|
|
290
274
|
}
|
|
291
275
|
}
|
|
292
276
|
}
|
|
@@ -309,8 +293,8 @@ raigal ci --sarif # SARIF output for code scanning
|
|
|
309
293
|
|
|
310
294
|
```bash
|
|
311
295
|
raigal # interactive menu
|
|
312
|
-
raigal init #
|
|
313
|
-
raigal init --strict #
|
|
296
|
+
raigal init # interactive setup: engines, threshold, and CI pipeline (GitHub, GitLab, Bitbucket)
|
|
297
|
+
raigal init --strict # strict gate: all engines, typecheck, failBelow 85
|
|
314
298
|
raigal doctor # check which engines can run here
|
|
315
299
|
raigal rules # list rules with severity, fixability, and score impact
|
|
316
300
|
raigal rules --search # searchable rule explorer
|
|
@@ -324,12 +308,14 @@ raigal commands # full command list
|
|
|
324
308
|
|
|
325
309
|
**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
310
|
|
|
327
|
-
Docs: [Commands Reference](https://raigal.
|
|
311
|
+
Docs: [Commands Reference](https://docs.raigal.dev/cli-reference/commands)
|
|
328
312
|
|
|
329
313
|
---
|
|
330
314
|
|
|
331
315
|
## CI integration
|
|
332
316
|
|
|
317
|
+
Running `raigal init` automatically inspects your repository, detects your CI provider (GitHub Actions, GitLab CI, or Bitbucket Pipelines), and scaffolds your CI workflow with zero guesswork.
|
|
318
|
+
|
|
333
319
|
### Pre-commit
|
|
334
320
|
|
|
335
321
|
Run directly on staged files:
|
|
@@ -353,7 +339,7 @@ repos:
|
|
|
353
339
|
|
|
354
340
|
### GitHub Actions
|
|
355
341
|
|
|
356
|
-
|
|
342
|
+
Scaffolded via `raigal init` as `.github/workflows/raigal.yml`. Setting `id-token: write` enables zero-token GitHub OIDC entitlement verification against your organization allowlist. Alternatively, pass an organization machine token via the `RAIGAL_TOKEN` secret:
|
|
357
343
|
|
|
358
344
|
```yaml
|
|
359
345
|
name: raigal
|
|
@@ -378,6 +364,7 @@ jobs:
|
|
|
378
364
|
run: npx --yes @methiu/raigal@latest ci
|
|
379
365
|
env:
|
|
380
366
|
RAIGAL_TOKEN: ${{ secrets.RAIGAL_TOKEN }}
|
|
367
|
+
# RAIGAL_ORG_ID: ${{ vars.RAIGAL_ORG_ID }} # Required only if repository owner belongs to multiple Raigal orgs
|
|
381
368
|
```
|
|
382
369
|
|
|
383
370
|
**GitHub code scanning (SARIF)**: emit a SARIF 2.1.0 report and upload it so findings appear in the Security tab:
|
|
@@ -389,26 +376,61 @@ jobs:
|
|
|
389
376
|
sarif_file: raigal.sarif
|
|
390
377
|
```
|
|
391
378
|
|
|
379
|
+
### GitLab CI
|
|
380
|
+
|
|
381
|
+
Scaffolded via `raigal init` as `.gitlab-ci.yml`. Gating merge requests on changed code and default branch pushes on full repository analysis:
|
|
382
|
+
|
|
383
|
+
```yaml
|
|
384
|
+
# .gitlab-ci.yml
|
|
385
|
+
raigal_quality_gate:
|
|
386
|
+
image: node:24
|
|
387
|
+
stage: test
|
|
388
|
+
script:
|
|
389
|
+
- if [ -n "$CI_MERGE_REQUEST_IID" ]; then npx --yes @methiu/raigal@latest ci --changes --base "$CI_MERGE_REQUEST_DIFF_BASE_SHA"; else npx --yes @methiu/raigal@latest ci .; fi
|
|
390
|
+
variables:
|
|
391
|
+
RAIGAL_TOKEN: $RAIGAL_TOKEN
|
|
392
|
+
# RAIGAL_ORG_ID: $RAIGAL_ORG_ID # Required only if repository owner belongs to multiple Raigal orgs
|
|
393
|
+
rules:
|
|
394
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
395
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
Set `RAIGAL_TOKEN` under **Settings > CI/CD > Variables**.
|
|
399
|
+
|
|
392
400
|
### Bitbucket Pipelines
|
|
393
401
|
|
|
394
|
-
|
|
402
|
+
Scaffolded via `raigal init` as `bitbucket-pipelines.yml`. Full clone is configured so branch diffs against the pull request destination branch resolve cleanly:
|
|
395
403
|
|
|
396
404
|
```yaml
|
|
397
405
|
# bitbucket-pipelines.yml
|
|
398
406
|
pipelines:
|
|
407
|
+
default:
|
|
408
|
+
- step:
|
|
409
|
+
name: raigal quality gate
|
|
410
|
+
image: node:24
|
|
411
|
+
script:
|
|
412
|
+
- npx --yes @methiu/raigal@latest ci .
|
|
413
|
+
secrets:
|
|
414
|
+
- RAIGAL_TOKEN
|
|
415
|
+
# - RAIGAL_ORG_ID
|
|
399
416
|
pull-requests:
|
|
400
417
|
"**":
|
|
401
418
|
- step:
|
|
402
|
-
name: raigal gate
|
|
419
|
+
name: raigal quality gate
|
|
403
420
|
image: node:24
|
|
404
421
|
clone:
|
|
405
|
-
depth: full # branch diffs need history
|
|
422
|
+
depth: full # branch diffs need full history
|
|
406
423
|
script:
|
|
407
424
|
- git fetch origin "$BITBUCKET_PR_DESTINATION_BRANCH"
|
|
408
425
|
- npx --yes @methiu/raigal@latest ci --changes --base FETCH_HEAD
|
|
426
|
+
secrets:
|
|
427
|
+
- RAIGAL_TOKEN
|
|
428
|
+
# - RAIGAL_ORG_ID
|
|
409
429
|
```
|
|
410
430
|
|
|
411
|
-
`
|
|
431
|
+
Set `RAIGAL_TOKEN` under **Repository settings > Repository variables**.
|
|
432
|
+
|
|
433
|
+
`ci` applies the score gate and exit code, so no JSON parsing or hand-rolled threshold is needed. More providers: [CI/CD Documentation](https://docs.raigal.dev/automation-and-ci-cd/ci-cd).
|
|
412
434
|
|
|
413
435
|
### Quality gate
|
|
414
436
|
|
|
@@ -419,7 +441,12 @@ ci:
|
|
|
419
441
|
failBelow: 70
|
|
420
442
|
```
|
|
421
443
|
|
|
422
|
-
`raigal ci`
|
|
444
|
+
`raigal ci` evaluates PRs with a calibrated 3-state verdict:
|
|
445
|
+
- **`PASSED`**: Score $\ge$ threshold (default 70) and 0 blocker errors or warnings.
|
|
446
|
+
- **`PASSED (WITH WARNINGS)`**: Score $\ge$ threshold and 0 blocker errors, but actionable warnings present. Merges proceed without blocking.
|
|
447
|
+
- **`FAILED / BLOCKED`**: Score $<$ threshold, non-zero exit code, or blocker errors present. Merges are blocked.
|
|
448
|
+
|
|
449
|
+
When using GitHub Actions OIDC in multi-tenant organizations, set `RAIGAL_ORG_ID: org_...` in your workflow environment if your repository owner is mapped across multiple organizations.
|
|
423
450
|
|
|
424
451
|
---
|
|
425
452
|
|
|
@@ -442,9 +469,20 @@ AI coding tools generate code that compiles and passes tests but ships with patt
|
|
|
442
469
|
|
|
443
470
|
- **One score**: 0-100, enforced in CI. Weighted so sloppy patterns hit harder than style noise.
|
|
444
471
|
- **Auto-fix first**: Clears formatters, unused imports, dead code mechanically. Hands off the rest to your agent with full context.
|
|
445
|
-
- **
|
|
472
|
+
- **No LLM in scoring**: Regex + AST + standard tooling. The same code and tool versions give the same score. See [Network access](#network-access) for the calls a run does make.
|
|
446
473
|
- **Fast onboarding**: Runs with your organization session (`raigal login`) or CI token (`RAIGAL_TOKEN`). Add `.raigal/config.yml` to tune.
|
|
447
474
|
|
|
475
|
+
## Network access
|
|
476
|
+
|
|
477
|
+
Raigal scores code on your machine, but a run is not offline. It contacts:
|
|
478
|
+
|
|
479
|
+
- **Raigal Cloud** (`app.raigal.dev`): sign-in, the organization licence check, and the upload of run results while you are signed in. In GitHub Actions it also requests an OIDC token from GitHub.
|
|
480
|
+
- **Package registries**, through dependency audits (`npm audit`, `pnpm audit`, `bun audit`, `pip-audit` when installed). On by default; set `security.audit: false` to turn them off.
|
|
481
|
+
- **npm registry**, to check for a newer CLI version. Turn off with `RAIGAL_NO_UPDATE_NOTIFIER=1`.
|
|
482
|
+
- **Usage telemetry** (PostHog, EU host). Off in CI; turn off with `RAIGAL_NO_TELEMETRY=1` or `DO_NOT_TRACK=1`.
|
|
483
|
+
|
|
484
|
+
`raigal-tools` downloads Ruff and golangci-lint only when you run it.
|
|
485
|
+
|
|
448
486
|
## What it catches
|
|
449
487
|
|
|
450
488
|
Six deterministic engines run in parallel:
|
|
@@ -458,21 +496,21 @@ Six deterministic engines run in parallel:
|
|
|
458
496
|
| **Security** | Vulnerabilities and risky code | eval, innerHTML, SQL/shell injection, dependency audits for JavaScript, Python, Rust, Go, and .NET |
|
|
459
497
|
| **Architecture** | Structural rules (opt-in) | Custom import bans, layering rules, required patterns |
|
|
460
498
|
|
|
461
|
-
See the full [Rules Reference](https://raigal.
|
|
499
|
+
See the full [Rules Reference](https://docs.raigal.dev/core-concepts/rules).
|
|
462
500
|
|
|
463
501
|
---
|
|
464
502
|
|
|
465
503
|
## Research
|
|
466
504
|
|
|
467
|
-
Raigal rules are shaped by public scans and benchmark-derived failure modes, not only local fixtures. The [documentation](https://raigal.
|
|
505
|
+
Raigal rules are shaped by public scans and benchmark-derived failure modes, not only local fixtures. The [documentation](https://docs.raigal.dev) 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
506
|
|
|
469
507
|
---
|
|
470
508
|
|
|
471
509
|
## Docs
|
|
472
510
|
|
|
473
|
-
Read the complete documentation at [raigal.
|
|
511
|
+
Read the complete documentation at [docs.raigal.dev](https://docs.raigal.dev):
|
|
474
512
|
|
|
475
|
-
[Installation](https://raigal.
|
|
513
|
+
[Installation](https://docs.raigal.dev/getting-started/installation) · [Commands](https://docs.raigal.dev/cli-reference/commands) · [Rules](https://docs.raigal.dev/core-concepts/rules) · [Configuration](https://docs.raigal.dev/cli-reference/configuration) · [Scoring](https://docs.raigal.dev/core-concepts/scoring) · [CI/CD](https://docs.raigal.dev/automation-and-ci-cd/ci-cd) · [Pull Requests](https://docs.raigal.dev/automation-and-ci-cd/pull-requests) · [Agent Repairs](https://docs.raigal.dev/automation-and-ci-cd/agent-repairs)
|
|
476
514
|
|
|
477
515
|
## Community
|
|
478
516
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Third-Party Software Notices and Information
|
|
2
|
+
|
|
3
|
+
This product contains components subject to open source licenses.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## aislop
|
|
8
|
+
|
|
9
|
+
Portions of this software are derived from aislop (https://github.com/scanaislop/aislop),
|
|
10
|
+
used under the MIT License. Raigal's own code is not covered by this notice; see `LICENSE`.
|
|
11
|
+
|
|
12
|
+
MIT License
|
|
13
|
+
|
|
14
|
+
Copyright (c) 2025 heavykenny
|
|
15
|
+
|
|
16
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
17
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
18
|
+
in the Software without restriction, including without limitation the rights
|
|
19
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
20
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
21
|
+
furnished to do so, subject to the following conditions:
|
|
22
|
+
|
|
23
|
+
The above copyright notice and this permission notice shall be included in all
|
|
24
|
+
copies or substantial portions of the Software.
|
|
25
|
+
|
|
26
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
27
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
28
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
29
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
30
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
31
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
32
|
+
SOFTWARE.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Third-Party Package Dependencies
|
|
37
|
+
|
|
38
|
+
The following third-party packages may be bundled into or used by distributions of this software:
|
|
39
|
+
|
|
40
|
+
- `@biomejs/biome` (MIT OR Apache-2.0) - https://github.com/biomejs/biome
|
|
41
|
+
- `@clack/prompts` (MIT) - https://github.com/natemoo-re/clack
|
|
42
|
+
- `@modelcontextprotocol/sdk` (MIT) - https://github.com/modelcontextprotocol/typescript-sdk
|
|
43
|
+
- `adm-zip` (MIT) - https://github.com/cthackers/adm-zip
|
|
44
|
+
- `commander` (MIT) - https://github.com/tj/commander.js
|
|
45
|
+
- `expo-doctor` (MIT) - https://github.com/expo/expo
|
|
46
|
+
- `ink` (MIT) - https://github.com/vadimdemedes/ink
|
|
47
|
+
- `ink-select-input` (MIT) - https://github.com/vadimdemedes/ink-select-input
|
|
48
|
+
- `knip` (ISC) - https://github.com/webpro-nl/knip
|
|
49
|
+
- `micromatch` (MIT) - https://github.com/micromatch/micromatch
|
|
50
|
+
- `oxlint` (MIT) - https://github.com/oxc-project/oxc
|
|
51
|
+
- `picocolors` (ISC) - https://github.com/alexeyraspopov/picocolors
|
|
52
|
+
- `react` (MIT) - https://github.com/facebook/react
|
|
53
|
+
- `smol-toml` (BSD-3-Clause) - https://github.com/cyyynthia/smol-toml
|
|
54
|
+
- `tar` (BlueOak-1.0.0 / ISC) - https://github.com/isaacs/node-tar
|
|
55
|
+
- `typescript` (Apache-2.0) - https://github.com/microsoft/TypeScript
|
|
56
|
+
- `wcwidth` (MIT) - https://github.com/timoxley/wcwidth
|
|
57
|
+
- `yaml` (ISC) - https://github.com/eemeli/yaml
|
|
58
|
+
- `zod` (MIT) - https://github.com/colinhacks/zod
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## External Tools (Downloaded Standalone Binaries)
|
|
63
|
+
|
|
64
|
+
The following external tools are downloaded separately as standalone binaries by `raigal-tools` and executed as separate child processes. They are NOT bundled or redistributed inside the Raigal JavaScript library:
|
|
65
|
+
|
|
66
|
+
- `ruff` (MIT / Apache-2.0) - https://github.com/astral-sh/ruff
|
|
67
|
+
- `golangci-lint` (GPL-3.0) - https://github.com/golangci/golangci-lint
|
|
68
|
+
- `AsyncFixer` (Apache-2.0) - https://github.com/semihokur/AsyncFixer
|
|
69
|
+
- `Meziantou.Analyzer` (MIT) - https://github.com/meziantou/Meziantou.Analyzer
|
|
70
|
+
- `IDisposableAnalyzers` (MIT) - https://github.com/DotNetAnalyzers/IDisposableAnalyzers
|