ScriptAudit reads package scripts and local command docs, then produces a deterministic safety map so developers and coding agents know which commands are reasonable to run.
It is local-first: it scans files, classifies command strings, and writes reports. It never executes discovered target scripts.
npm install
npm run buildUse the local CLI during development:
node dist/cli.js scan . --out docs/SCRIPTS.mdAfter package installation, the binary is:
scriptaudit scan . --out docs/SCRIPTS.mdscriptaudit scan . --out docs/SCRIPTS.md
scriptaudit scan examples/fixtures/risky --format json --fail-on dangerous
scriptaudit init --preset oss-clipackage.jsonscripts across the repository.pnpm-workspace.yamlworkspace hints.- Makefile targets.
- README, CONTRIBUTING, SECURITY, TASKS, and ORCHESTRATION fenced shell blocks.
- Justfile recipes and simple Taskfile commands.
safe: low-risk local verification such as tests, checks, builds, and smoke commands.caution: commands with possible local side effects, generated artifacts, containers, env-file references, or network-capable tools.dangerous: destructive cleanup, deploy, publish, permission changes, or policy-blocked commands.unknown: commands without enough evidence to recommend confidently.
Each report includes evidence, detected tools, side-effect hints, network hints, and a recommended verification sequence.
Create scriptaudit.config.json with:
{
"knownSafe": ["publish:dry"],
"blocked": ["deploy"],
"rules": [
{
"match": "clean",
"risk": "caution",
"reason": "Cleanup deletes generated files."
}
]
}Config matching is intentionally simple and deterministic: a pattern matches a command id, script name, or command string.
ScriptAudit is a static heuristic tool, not a shell sandbox. It does not prove that a command is safe, and it does not replace maintainer judgment. Treat reports as a review appendix before running commands in an unfamiliar repo.
- Run
scriptaudit scan . --out docs/SCRIPTS.md. - Read the recommended sequence first.
- Run
safeverification commands before broader checks. - Ask for human approval before running
dangerouscommands. - Keep generated reports in review artifacts when command choice matters.
npm test
npm run check
npm run build
npm run smoke
bash scripts/validate.shMIT