kerf-dev
v0.2.1
Published
Find and fix third-party dependency risk — vulnerabilities your code actually reaches, provider API drift that breaks your usage, and risky upgrades. Read-only scan + an MCP fix channel your own coding agent drives.
Maintainers
Readme
kerf
Find and fix third-party dependency risk — vulnerabilities your code actually reaches, provider API drift that breaks your usage, and risky upgrades — without the noise. Read-only scanning by default; fixes are driven by your own coding agent.
npx kerf-dev scan [path]kerf scan runs entirely on your machine against a bundled snapshot — no
account, nothing uploaded, nothing installed beyond the CLI itself. It prints
which third-party providers your code talks to and any already-announced
deprecations that hit your call sites, in seconds. If you set
KERF_RUNWAY_URL, the CLI fetches a public deprecation snapshot from that URL
instead of the bundled one; it still never sends your code or any telemetry.
What scan does
kerf scan walks the given path (default: current directory), parses your
JS/TS source, and builds a Usage Map: which providers your code talks to,
and exactly which files and lines call them. It joins that against a snapshot
of already-announced deprecations (Stripe, OpenAI, Anthropic, Twilio, and more)
and reports which of your call sites are affected.
- SDK usage — high-confidence. Imports of provider SDK packages (
stripe,openai,twilio, …) and the methods/fields actually called on them are detected directly from the parsed source. - Direct REST usage — best-effort. Calls to known provider API hosts are detected where the URL is statically visible. Dynamically-built URLs are labelled best-effort — the CLI never implies complete raw-REST coverage.
Read-only, no code execution
kerf scan only reads and parses your source. It never executes your code,
never needs your secrets or API keys, and never sends your source anywhere. The
default scan is entirely local; the only optional network call is fetching a
public deprecation snapshot if you set KERF_RUNWAY_URL.
--json
npx kerf-dev scan --json [path]Emits the full Usage Map as a single JSON document on stdout — the same data the human-readable report is built from, for your own tooling or CI checks.
Fix inside Claude / Codex (MCP)
kerf ships an MCP server with four tools — audit, get_finding,
apply_upgrade, verify — so your coding agent can find vulnerable packages
your code actually reaches, surface risky upgrades backed by real usage, bump
them via your repo's own package manager, and re-verify — all without leaving
the chat. Kerf provides the deterministic facts (reachability, exact symbols,
target versions); your agent does the edits.
Claude Code: /plugin marketplace add <kerf-plugin repo> then
/plugin install kerf. (The plugin bundle lives at kerf-plugin/ in this repo.)
Claude Desktop / Codex / other MCP clients: add to your MCP config:
{ "mcpServers": { "kerf": { "command": "npx", "args": ["-y", "kerf-dev", "mcp"] } } }Then ask your agent to "audit my dependencies with kerf" — it finds vulnerable packages your code reaches and risky upgrades, and fixes them with your approval.
v0.2.0 breaking output change (Python support): reachability is no longer a boolean, since Python's import name often differs from its distribution name and a boolean can't express "could not determine" without silently claiming a CVE is safe. The
audittool's per-findingimportedfield (boolean) is nowreachability:"imported" | "not-imported" | "unknown".get_finding's nestedreachobject changed from{ imported, files }to{ status, files }for the same reason.v0.2.0 additive output change (Python support):
apply_upgradenow applies to Python dependencies too — it detectsuv/poetry/pipenvfrom their lockfile and re-locks with that same manager, or for a barerequirements.txt/pyproject.tomlrepo edits the manifest and runs no install (pip installwould target whichever interpreter happens to be active, which Kerf does not control). This is chosen automatically per finding — there's no new argument to pass. Each finding gained anecosystem: "npm" | "PyPI"field (visible inaudit's per-finding list and inget_finding).Separately,
auditandverifygained anokboolean and, on failure, anerrorsarray. Previously, if the scan itself threw (a malformed manifest, a registry/network hiccup) the tool silently returned zero findings — indistinguishable from a genuinely clean repo. Now that failure is reported asok: falsewith anoteexplicitly saying the audit is incomplete and should not be treated as clean, plus the specificerrors. Any findings that a partial failure didn't prevent are still returned, never discarded.A directory whose only Python manifest is a bare
pyproject.toml— PEP 621, or Poetry without a committed lock (Poetry's own guidance for libraries) — is now discovered rather than silently skipped. It has no resolved versions to check (only declared ranges), soauditreports it the same way it already reports an unpinnedrequirements.txt:ok: false, with anerrorsentry naming the manifest, never a silent "0 findings" clean bill. Apyproject.tomlnext to a lockfile that already resolves it (e.g.uv.lockin the same directory) is not reported this way — the lockfile is the real source of truth there and takes precedence, so nothing is double-reported.v0.2.0 breaking output change (noise reduction): a real audit can turn up dozens of separate advisories for one stale package (one
nextversion carrying 24 distinct CVEs is a real example) — pre-grouping,audit'sfindingsarray printed that many near-identical top-level rows, all sharing the samepackage/ecosystem/reachability.findingsis now grouped by package at its installed version: each entry is{ package, installedVersion, ecosystem, reachability, highestFixVersion, advisories: [{ id, type, severity, summary, targetVersion }, ...] }.highestFixVersionis the single upgrade that clears every advisory in the group that has a published fix (null if none does — never invented). No finding or advisory id is dropped, only re-shaped:get_findingandapply_upgradestill take an advisoryid/ apackagename exactly as before, now read from insideadvisoriesrather than the top level.auditalso gainedpackageCount(the number of groups) alongside the pre-existingcount(the total number of underlying findings/advisories, unchanged) — the two are labeled separately rather than collapsed into one ambiguous number.When
apply_upgraderefuses.{ok: false, changed: false}means the working tree is byte-identical to before the call —apply_upgradenever partially mutates a manifest. It refuses (rather than guessing) whenever: the package name is ambiguous — a comma-separated version range (>=1.0,<2.0), a hash-pinnedrequirements.txtline (--hash=...), an unpinned/upper-bound-only/===constraint, or a Poetry/Pipfile table entry in a shape it doesn't recognize; the package is declared only somewhere it deliberately doesn't rewrite — arequirements-*.txtvariant (e.g.requirements-dev.txt) or a file pulled in via a-r/--requirementinclude; the repo's Python manifest location itself is ambiguous — multiple distinct manifests found with none at the givenpath's root (a manifest AT the root always wins over a nested one, so this only fires when none is at the root); the package isn't declared in the root Python manifest but other Python manifests exist elsewhere in the repo —lognames those directories so you can re-run withpathpointed at the right one, rather than assuming the package is transitive; the package genuinely isn't declared in any Python manifest this scan found (the actual transitive case — there's nothing else to pointpathat); or the package name is ambiguous across ecosystems in a polyglot repo — an npm and a Python dependency share the name, or a cached finding's ecosystem can't be trusted as the one you meant.logalways names the specific reason and, where one exists, what to do next: edit the file by hand, re-runauditfirst so the right ecosystem is cached, or re-run withpathset to the specific manifest directory.v0.2.1 (security fix):
apply_upgrade'sversionargument is now validated — refused, never sanitized — before it touches any manifest, on both the npm and Python paths. Every manifest rewriter splicesversiondirectly into raw file text (a requirements.txt line, a quoted TOML string, a Poetry/Pipfile table value); prior to 0.2.1 aversioncontaining a quote, newline, or comma could break out of its quoting context or inject an extra line — e.g. a--extra-index-urlfor dependency confusion, or an appended fake dependency — which the very next re-lock would then resolve and pin.versionmust now look like a real PEP 440 or semver version (no quotes, whitespace, newlines, or commas) or the call is refused withchanged: falseand the working tree left untouched. Separately, a-r/--requirementinclude insiderequirements.txtis no longer followed if it path-traverses (../) outside the repo directory.
Continuous watch — the Kerf GitHub App
scan is a point-in-time snapshot. Providers ship breaking changes on their
own schedule, not yours — a repo that's clean today can be affected next week.
Install the Kerf GitHub App to watch your call sites continuously and get
told the moment a provider change actually hits them.
