cardinal-core
v0.1.4
Published
Static, database-aware analysis engine for TypeScript/JavaScript — detects N+1 loops, unbounded reads, and over-fetching. Powers the Cardinal CLI and VS Code extension.
Downloads
488
Maintainers
Readme
cardinal-core
The static, database-aware analysis engine behind Cardinal. Parses TypeScript/JavaScript with ts-morph, normalizes query calls (Prisma, Drizzle, Mongoose, raw SQL) into descriptors, runs rules, and emits diagnostics. 100% static — no LLM, no network, no database connection.
import { analyzeSource } from "cardinal-core";
const diagnostics = analyzeSource(
`for (const u of users) { await prisma.post.findMany({ where: { authorId: u.id } }); }`,
);
// → [{ ruleId: "n-plus-one", severity: "error", ... }]analyzeSource(code, filePath?, knowledge?, config?) optionally takes a parsed
knowledge file (data-scale facts) and config (rule on/off + severity). See the
main README for the full model.
MIT.
