Practical examples showing different ways to use ai-scanner.
Shell script — clone and scan any public repo in one command:
chmod +x examples/scan-github-repo.sh
./examples/scan-github-repo.sh https://github.com/langchain-ai/langchainjs
./examples/scan-github-repo.sh https://github.com/user/repo --tokens-onlyNode.js script — scan programmatically and save a JSON report:
node examples/scan-github-repo.js https://github.com/langchain-ai/langchainjsEdit the REPOS array in the script, then run:
node examples/scan-multiple-repos.jsOutputs a summary table + batch-scan-report.json.
GitHub Actions — copy into your repo to scan every PR:
cp examples/ai-scan-pr.yml .github/workflows/ai-scan.ymlPre-commit hook — block commits with exposed tokens:
cp examples/pre-commit-hook.sh .git/hooks/pre-commit
chmod +x .git/hooks/pre-commitImport the scanner in your own Node.js code:
node examples/use-as-library.js ./my-projectSee use-as-library.js for the full API — access findings by type, check severity counts, generate custom reports.