npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ai-code-audit

v0.1.0

Published

Security and quality linter for AI-generated code

Downloads

107

Readme

ai-code-audit

Security and quality linter specifically designed for AI-generated code.

The Problem

AI coding assistants can introduce security vulnerabilities and quality issues:

  • SQL injection through string concatenation
  • Command injection via unsanitized inputs
  • Hardcoded secrets and credentials
  • Missing error handling
  • Unsafe deserialization
  • Over-complex "clever" solutions

Traditional linters catch some of these, but AI code has unique patterns that need specific attention.

Installation

npm install -g ai-code-audit

Usage

Audit Files

# Audit a single file
aca src/api.ts

# Audit multiple files
aca src/**/*.ts

# Audit a git diff
git diff HEAD~1 | aca --stdin

# Audit staged changes
git diff --cached | aca --stdin

Options

Options:
  -s, --stdin           Read diff from stdin
  -f, --format <type>   Output format: text, json, sarif (default: text)
  -c, --config <file>   Config file path
  --severity <level>    Minimum severity: info, warning, error (default: warning)
  -q, --quiet           Only output errors
  -h, --help            Show help

Git Hook Integration

Add to .git/hooks/pre-commit:

#!/bin/bash
git diff --cached | aca --stdin --severity error
if [ $? -ne 0 ]; then
  echo "AI code audit found issues. Please review before committing."
  exit 1
fi

CI Integration

# GitHub Actions
- name: AI Code Audit
  run: |
    npm install -g ai-code-audit
    git diff ${{ github.event.before }} ${{ github.sha }} | aca --stdin --format sarif > results.sarif

- name: Upload SARIF
  uses: github/codeql-action/upload-sarif@v2
  with:
    sarif_file: results.sarif

Rules

Security Rules

| Rule | Severity | Description | |------|----------|-------------| | sql-injection | error | Detects SQL queries with string interpolation | | command-injection | error | Detects shell commands with unsanitized input | | hardcoded-secret | error | Detects hardcoded API keys, passwords, tokens | | unsafe-eval | error | Detects use of eval() or Function() | | unsafe-regex | warning | Detects potentially catastrophic regex | | path-traversal | error | Detects unsanitized file path operations | | xss-risk | warning | Detects potential XSS in HTML generation |

Quality Rules

| Rule | Severity | Description | |------|----------|-------------| | missing-error-handling | warning | Detects async operations without try/catch | | empty-catch | warning | Detects empty catch blocks that swallow errors | | console-log | info | Detects console.log left in code | | todo-fixme | info | Detects TODO/FIXME comments | | magic-number | info | Detects unexplained numeric literals | | deep-nesting | warning | Detects deeply nested code (>4 levels) |

AI-Specific Rules

| Rule | Severity | Description | |------|----------|-------------| | ai-placeholder | error | Detects placeholder text like "// Add implementation" | | incomplete-impl | warning | Detects throw new Error('Not implemented') | | excessive-comments | info | Detects over-commented obvious code | | type-any-abuse | warning | Detects excessive use of any type |

Configuration

Create .ai-code-audit.json:

{
  "rules": {
    "sql-injection": "error",
    "console-log": "off",
    "magic-number": "warning"
  },
  "ignore": [
    "**/*.test.ts",
    "**/fixtures/**"
  ],
  "languages": ["typescript", "javascript", "python"]
}

Output Example

src/api/users.ts
  12:5  error    SQL injection risk: query uses string interpolation     sql-injection
  24:3  warning  Missing error handling for async operation              missing-error-handling
  45:1  error    Hardcoded secret detected: API_KEY = "sk-..."           hardcoded-secret

src/utils/shell.ts
  8:12  error    Command injection: exec() with unsanitized input        command-injection

4 problems (3 errors, 1 warning)

License

MIT