@asyncinnovator/hallint-cli
v0.1.7
Published
CLI for hallint
Readme
@asyncinnovator/hallint-cli
CLI for hallint — detect security and quality issues in AI-generated code.
Install
Or run without installing:
npx @asyncinnovator/hallint-cli ./srcRequirements: Node.js >= 18
Usage
npx @asyncinnovator/hallint-cli [files] [options]files accepts directories, file paths, and glob patterns:
npx @asyncinnovator/hallint-cli ./src
npx @asyncinnovator/hallint-cli "./src/**/*.ts"
npx @asyncinnovator/hallint-cli ./src/api.ts ./src/auth.tsOptions
| Flag | Description | Default |
|---|---|---|
| --rules | Rule set: recommended or all | recommended |
| --min-severity | Minimum severity: critical high medium low info | info |
| --no-color | Disable colored output | off |
| --help | Show help | |
| --version | Show version | |
Examples
# Scan a directory
npx @asyncinnovator/hallint-cli ./src
# Only critical and high findings
npx @asyncinnovator/hallint-cli ./src --min-severity high
# Run all available rules
npx @asyncinnovator/hallint-cli ./src --rules all
# Disable color (for CI logs)
npx @asyncinnovator/hallint-cli ./src --no-color
# Glob pattern
npx @asyncinnovator/hallint-cli "./src/**/*.ts" --min-severity highOutput
hallint scanning ./src...
/path/to/src/api/users.ts
users.ts:14 CRITICAL [hardcoded-secret]
Hardcoded secret detected — API key, token, or password in source code
> const API_KEY = "sk-abc123defgh456789xyz"
fix: Move to environment variables: process.env.YOUR_SECRET_NAME
users.ts:31 HIGH [missing-auth-check]
Route handler may be missing authentication middleware
> router.get("/users", async (req, res) => {
fix: Add auth middleware: router.get('/route', authenticate, handler)
Summary: 2 issue(s) in 1 file(s) — 18ms
2 critical
1 highExit codes
| Code | Meaning |
|---|---|
| 0 | No issues found |
| 1 | One or more critical or high findings |
| 2 | Unexpected error |
Exit code 1 on critical/high makes hallint suitable as a hard CI gate.
CI — GitHub Actions
name: hallint
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
hallint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npx @asyncinnovator/hallint-cli ./src --min-severity highCI — Pre-commit hook
Install husky:
npm install --save-dev husky
npx husky init
echo "npx @asyncinnovator/hallint-cli ./src --min-severity high" > .husky/pre-commit