Skip to content

CLI ​

edgefit <command> [options]
CommandWhat it does
checkScan a project from its entry point
compareShow the reached APIs side by side across targets
packageCheck a published package or a local one
diffShow what changed between two check --format json reports
targetsList the supported targets and the data behind each
helpShow the help text

check ​

sh
edgefit check [options]
OptionDescription
--target <name>Target runtime: workerd, bun, deno, deno-deploy, netlify-edge, vercel-edge. Repeat it for more than one. Default: the config's targets, then workerd
--entry <file>Entry point or glob. Repeat it for more than one. Default: the config's entry, then each target's own, such as wrangler's main
--built <path>Scan build output instead of source: its entry file or directory. See build output
--root <dir>Project root. Default: the current directory
--config <file>Config file. Default: edgefit.config.{ts,mts,js,mjs} in the root
--format <format>text, json or github. Default: text
--verboseList every finding in full: guarded ones and the unknown warnings that are otherwise folded
--no-colorDisable colors

--entry and --built cannot be combined.

sh
edgefit check
edgefit check --entry src/index.ts --target workerd --target bun
edgefit check --built .output/server
edgefit check --format json > report.json

compare ​

sh
edgefit compare [target...] [options]
OptionDescription
[target...]Targets to compare. Default: workerd, bun, deno
--allInclude APIs that every target supports
--verboseList the packages and findings behind each row
--format <format>text or json. Default: text

--entry, --root, --config and --no-color work as for check. See Comparing targets.

diff ​

sh
edgefit diff <base.json> <head.json> [options]
OptionDescription
--fail-on <when>new-errors, errors or never. Default: new-errors
--format <format>text, json or github. github annotates only the new findings. Default: text
--no-colorDisable colors

Both files must be written by edgefit check --format json with the same edgefit version. See Pull request checks.

package ​

sh
edgefit package <name[@version]|directory|file.tgz> [options]

Installs the package into a temporary project with npm install --ignore-scripts, then checks each public entry point with every export used. name, name@1.2.3, name@^1, @scope/name and @scope/name@tag are accepted. A directory is packed with npm pack first, from a copy without its prepare script. The files are the ones you would publish, but no script of the package runs, so build the package before you check it. See Check an npm package's compatibility for what a result means.

OptionDescription
--target <name>Target runtime, repeatable. Default: workerd, bun, deno
--export <subpath>Check only this exports subpath, such as ./client. Repeatable
--skip <subpath>Leave out a subpath. Repeatable
--badge <file>Also write a badge SVG
--registry <url>npm registry to install from
--keepKeep the temporary project and print where it is
--format <format>text or json. Default: text

Exits with 1 if any target fails or could not be checked.

targets ​

sh
edgefit targets

Prints every target with its export conditions and data, then every data source with its version and license.

Version ​

sh
edgefit --version   # or -v

Prints the installed version and exits with 0. With pnpm dlx or npx, pin a version (pnpm dlx edgefit@0.2.0 check) when you need to be sure which one runs, since the package manager may reuse a cached copy of latest.

Output formats ​

FormatUse it for
textReading in a terminal
jsonTools and edgefit diff. The shape is versioned, see JSON reports
githubGitHub Actions. Prints ::error and ::warning workflow commands that become annotations

Colors ​

Colors are on when stdout is a terminal. They are off when --no-color is passed or the NO_COLOR environment variable is set to a non-empty value.

Tracing exports ​

To see why a finding reaches an export, set the EDGEFIT_DEBUG_TRACE environment variable. edgefit then prints to stderr, for each run of the trace, the files that it loads. For each file, it prints what is asked of it, the file that first asked for all of it, and the units that are live: the count of the units that run at load, then the name of each declared unit that something uses, such as a function, a class, a variable or an imported name. A file that edgefit cannot trace is marked opaque and counts in full. Set the variable to * for every run, or to an export name for the runs of package that ask for that export alone:

sh
EDGEFIT_DEBUG_TRACE=errors edgefit package undici --target workerd

check traces the whole graph, so it prints with * only.

Exit codes ​

CodeMeaning
0No error-level findings (for diff: nothing that matches --fail-on)
1Error-level findings (for diff: findings that match --fail-on)
2Invalid arguments or config, a project that could not be resolved, or a target that could not be checked while others were

Released under the MIT License.