import-guardian

v0.3.0
io.github.Baneado98/import-guardian Checked 4 days ago Published 5 months ago

Catch AI-hallucinated (slopsquatted) npm imports in generated code before npm install.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

scan_code_imports

Scan a block of JS/TS source code for HALLUCINATED / slopsquatted npm imports BEFORE you install anything or commit. Extracts every npm package the code imports/requires and checks each against the live npm registry: flags packages that DO NOT EXIST (AI hallucinations — the #1 slopsquatting attack vector in 2026, where attackers register the plausible fake name to ship malware) and packages that exist but look freshly-squatted (brand-new, no repo, near-typo of a popular lib, near-zero usage). Returns a CLEAN / REVIEW / BLOCK verdict with a 'did you mean' suggestion for each bad import. ALWAY…

ParameterTypeDescription
code *stringThe JS/TS source code to scan (the code an AI agent just generated).
probooleanForce the PREMIUM unlimited/batch scan (runs server-side behind payment). Auto-enabled when the code exceeds the free fragment cap. Requires IMPORT_GUARDIAN_KEY; without one you'll get instructions to…

check_packages

Check an explicit list of npm package names for hallucination / slopsquatting (e.g. a dependency list you are about to install). Returns CLEAN / REVIEW / BLOCK per package with a 'did you mean' for fakes. The free tier verifies a small handful (≤5 names); a full dependency manifest or pro=true routes to the premium unlimited batch verify (requires IMPORT_GUARDIAN_KEY).

ParameterTypeDescription
names *arraynpm package names to verify.
probooleanForce the PREMIUM unlimited batch verify (runs server-side behind payment). Auto-enabled when the list exceeds the free cap. Requires IMPORT_GUARDIAN_KEY; without one you'll get instructions to unlock…

verify_package

Verify a single npm package name exists and is not a slopsquat: registry existence, age, version history, repo, weekly downloads, and edit-distance to popular packages. Use right before adding a dependency you are not 100% sure is real. Always free.

ParameterTypeDescription
name *stringThe npm package name, e.g. 'lodash' or '@scope/pkg'.

audit_lockfile

DEEP supply-chain audit of a RESOLVED lockfile — the premium product. Works across NINE ecosystems: npm (package-lock.json v1/v2/v3, yarn.lock classic/berry, pnpm-lock.yaml), Python/PyPI (requirements.txt, poetry.lock, Pipfile.lock), Go (go.mod, go.sum), Rust/Cargo (Cargo.lock, Cargo.toml), Java (Maven pom.xml, Gradle build.gradle/.kts + gradle.lockfile), PHP/Composer (composer.json, composer.lock), Ruby/RubyGems (Gemfile.lock, Gemfile), and .NET/NuGet (packages.lock.json, .csproj/Directory.Packages.props). It resolves the dependency graph and cross-checks each name against that ecosystem's…

ParameterTypeDescription
lockfile *stringThe full contents of the lockfile to audit (package-lock.json / yarn.lock / pnpm-lock.yaml / requirements.txt / poetry.lock / Pipfile.lock / go.mod / go.sum / Cargo.lock / Cargo.toml / pom.xml / compo…
filenamestringOptional filename so the ecosystem is detected reliably (e.g. 'pnpm-lock.yaml', 'Cargo.lock', 'go.sum', 'Gemfile.lock', 'packages.lock.json', 'App.csproj'). Defaults to package-lock.json.