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

@redproof/knip

v0.12.0

Published

Redproof adapter for Knip unused-code and dependency evidence.

Readme

@redproof/knip

Turn Knip issue categories into independently provable Redproof Rules. Requires Node 24 and Knip 6.35.1 or later in the 6.x series.

npm install --save-dev redproof @redproof/knip knip
import { knip } from '@redproof/knip';
import { defineGate } from 'redproof';

const adapter = knip({
  configFile: 'knip.json',
  rules: {
    unusedFiles: 'files',
    unusedExports: 'exports',
    unusedDependencies: 'dependencies',
    missingDependencies: 'unlisted',
  },
});

export default defineGate({ id: 'unused-code', adapter });

Aliases are local property names; values remain Knip's native category keys. Generated Rule IDs describe the finding, independently of the alias. For example, adapter.rules.unusedFiles.id is knip/unused-files.

| Native selector | Generated Rule ID | |---|---| | files | knip/unused-files | | dependencies | knip/unused-dependencies | | devDependencies | knip/unused-dev-dependencies | | optionalPeerDependencies | knip/referenced-optional-peer-dependencies | | unlisted | knip/undeclared-dependencies | | binaries | knip/undeclared-command-dependencies | | unresolved | knip/unresolved-imports | | exports | knip/unused-exports | | types | knip/unused-exported-types | | nsExports | knip/unreferenced-exports-in-used-namespaces | | nsTypes | knip/unreferenced-types-in-used-namespaces | | enumMembers | knip/unused-exported-enum-members | | namespaceMembers | knip/unused-exported-namespace-members | | duplicates | knip/duplicate-exports | | catalog | knip/unused-catalog-entries | | catalogReferences | knip/unresolved-catalog-references | | cycles | knip/circular-imports |

Optional-peer findings concern referenced optional peers without a direct dependency or development-dependency declaration, not unused peers. Namespace import findings mean an individual export lacks a reference even though the namespace object is used; they do not establish that dynamic consumers never use that export. These differ from exported TypeScript namespace members.

Breach diagnostic codes retain the native category (for example, exports), so reports can still be compared directly with Knip evidence. Generated IDs replace the pre-release knip/<native-category> names; update any hard-coded Rule references or proof expectations. Native selectors are unchanged.

Knip configuration determines analysis scope, plugins, ignore patterns and enabled categories. Selection here does not override disabled Knip rules. For cycles, explicitly enable cycles in the Knip config's include list. An enabled warning still breaches a selected zero-issue Rule even if Knip exits zero. Unselected issues never become breaches.

Options:

| Option | Meaning | |---|---| | cwd | Project working directory, relative to the Gate root; default .. | | configFile | Explicit config path relative to the Gate root; otherwise native discovery. | | cli | Optional Node CLI entry relative to the Gate root, for checking Knip source itself. Normally resolves installed Knip from the selected project. | | workspace | Native Knip workspace selector. | | production, strict | Native production/strict analysis; strict implies production in Knip. | | includeEntryExports | Also inspect public entrypoint exports. | | treatConfigHintsAsErrors | Require attention to native configuration hints. | | timeoutMs | Execution deadline, default 60 seconds. | | maxOutputBytes | Captured stdout/stderr limit and separate report-size limit; default 10 MiB each. |

Explicit filesystem paths are confined inside the Gate root, including symlink targets. The installed executable may live in shared node_modules. This is not a sandbox for Knip configuration code or plugin imports.

The bundled custom reporter records structured issues, processed-file counts, enabled categories and incomplete configuration status into a fresh private artifact. Plain Knip JSON lacks the metadata needed to distinguish a healthy empty result from disabled inspection. Configuration logs are captured separately and cannot overwrite report evidence. The adapter does not enable Knip's cache or fix mode.

Malformed/incomplete evidence, disabled selected categories, blocking hints, configuration errors, unexplained failing exits and unavailable execution REFUSE. Timeouts, signals and output overflow use Redproof's shared command process-tree handling. A valid zero-file report remains subject to the Gate's emptyEvidence policy.

Trust is scoped to Knip's configured analysis. Ignored code and custom preprocessors can intentionally suppress findings. This adapter does not prove whole-repository reachability or validate arbitrary configuration code.

Development: the package owns its Adapter TCK registration, native tests and pure parser tests. The repository's unused-code Gate supplies RED proofs for six categories plus GREEN and REFUSE.