skif-cli 0.2.0

Command-line interface for skif, a dependency and package-manager linter for JS/TS monorepos.
Documentation
---
source: crates/skif-cli/tests/cli.rs
expression: help.stdout
---
Command-line interface for skif, a dependency and package-manager linter for JS/TS monorepos.

Usage: skif [OPTIONS] [PATH]
       skif <COMMAND>

Commands:
  rules          List every rule with its category, default level and fixability
  schema         Print the JSON Schema of `skif.toml`
  init           Write a starter `skif.toml`; refuses to overwrite an existing configuration
  config         Show the configuration files a root is built from, the merged result, and where each key was set
  explain-usage  Explain why the JavaScript analysis counts a file, or one export of it, as used
  migrate        Translate the configuration of sherif, syncpack and knip into a `skif.toml`; never deletes a file
  update         Update dependencies to newer published versions from the npm registry; the only command that uses the network
  list           List every dependency the version groups govern, by version group, with its specifiers and states
  json           Print every dependency instance the version groups govern as one JSON object per line (NDJSON)
  format         Format every `package.json` as `[format]` describes (the `package-json-format` rule alone); never installs
  mcp            Run a Model Context Protocol server on stdin and stdout, for AI agents
  lsp            Run a Language Server Protocol server on stdin and stdout: diagnostics as you edit, fixes as code actions
  help           Print this message or the help of the given subcommand(s)

Arguments:
  [PATH]
          A path inside a project; the workspace root is the nearest ancestor workspace that lists the project as a member, else the project itself. Without a `package.json` here or above, every project below is linted
          
          [default: .]

Options:
  -r, --recursive
          Lint every workspace and standalone package at or below PATH, each with the `skif.toml` files that govern it

      --format <FORMAT[=FILE]>
          Output format, as FORMAT or FORMAT=FILE to write that rendering to FILE. Repeatable; at most one goes to stdout [default: human, or human plus GitHub annotations when `GITHUB_ACTIONS=true`]

          Possible values:
          - human:       Grouped, optionally coloured text
          - json:        One JSON document on stdout
          - sarif:       SARIF 2.1.0 for code scanning
          - github:      GitHub Actions workflow-command annotations
          - codeclimate: Code Climate JSON for GitLab Code Quality
          - compact:     One `path:line:col rule message` line per diagnostic
          - markdown:    Markdown tables per rule, for pull request comments
          - disclosure:  Markdown tables per rule, each in a collapsed `<details>` section
          - codeowners:  Compact lines grouped by owner, from the repository's CODEOWNERS file

      --output <FILE>
          Write the rendering to this file instead of stdout; needs exactly one --format, without `=FILE`

      --fix
          Apply safe fixes, then lint again and run the package manager's install command

      --fix-unsafe
          Apply safe and unsafe fixes; implies --fix

      --dry-run
          With --fix or --fix-unsafe: print the planned changes as a unified diff (JSON: the `fix` object with `changes`); no manifest is written and no install runs. Reports still go to stdout, --output and FORMAT=FILE

      --allow-remove-files
          Let fixes delete files (`unused-files`); without it they are skipped. Needs --fix or --fix-unsafe

      --fix-type <TYPE>
          Only apply the fixes of these rules: rule ids or knip issue types (`dependencies`, `exports`, `types`, `enumMembers`, `files`, `catalog`, ...). Comma separated or repeatable; needs --fix or --fix-unsafe

      --select <SELECT>
          Which version a version alignment fix targets, overriding `[policy] prefer` for this run
          
          [possible values: highest, lowest]

      --no-install
          Do not run the package manager after fixing

      --max-warnings <N>
          Exit 1 when there are more than N warnings (counted over all roots)

      --fail-on-warnings
          Same as --max-warnings 0

      --max-issues <N>
          Exit 1 only when there are more than N errors (counted over all roots); warnings still follow --max-warnings

      --max-show-issues <N>
          Show at most N findings of each rule in human and json output (not with --fix); the summary still counts all of them, and the exit code is unchanged

      --no-exit-code
          Exit 0 when the run finds problems; exit 2 when skif could not run is kept

      --no-prompt
          Never ask which alternative fix to apply; the diagnostic stays unfixed unless --select decides

      --rule <ID=LEVEL>
          Set a rule's level, as ID=off|info|warn|error. Repeatable

      --ignore-rule <ID>
          Turn a rule off. Repeatable

      --ignore-package <NAME>
          Ignore a package by name or glob in every rule; replaces the file's list. Repeatable

      --ignore-dependency <NAME>
          Ignore a dependency in every rule. Repeatable

      --ignore-rule-for-package <RULE:PACKAGE>
          Ignore one rule for one package, as RULE:PACKAGE. Repeatable

      --require-ignore-reasons
          Fail when an `[[ignore]]` entry of a configuration file has no `reason`

      --no-js
          Skip JavaScript analysis

      --config <FILE>
          Use this configuration file (and the files it extends) instead of discovering `skif.toml` files

      --no-config
          Read no configuration file: the defaults plus the flags

      --production
          Only analyse production code in JavaScript analysis

      --no-gitignore
          Also analyse the source files that `.gitignore` files hide (the git index is not used to list files then)

      --include-entry-exports
          Report unused exports of entry files too, overriding `[js] include-entry-exports`

  -t, --tsconfig <FILE>
          The TypeScript configuration of the root package, relative to the workspace root, used instead of its `tsconfig.json` (overrides `[js] tsconfig`)
          
          [alias: --tsConfig]

      --use-tsconfig-files
          Take the project files of each package from its `tsconfig.json` (`files`, `include`, `exclude`) instead of the `project` globs

      --strict
          knip's strict mode: --production, and each workspace package uses only the dependencies its own manifest lists, not those of a containing package or the root. Production code must import from `dependencies` or `peerDependencies`, type-only imports use no package, and unused required peer dependencies are reported

      --color <COLOR>
          When to colour human output
          
          [default: auto]
          [possible values: auto, always, never]

      --watch
          Lint again whenever a file below the root changes, until interrupted

      --cache
          Keep the parse results of source files between runs, so a run parses only the files that changed. The cache never changes the report

      --cache-location <DIR>
          The directory of the --cache store (default: `node_modules/.cache/skif` below the workspace root, or below the invocation directory of a multi-root run)

      --trace-dependency <NAME>
          Instead of linting, print where this dependency is listed, every import of it and the packages that count it as used

      --debug
          Print what the run loaded (roots, configuration files, packages) and the phase timings to stderr

      --performance
          Print the time each phase of the run took to stderr, as `SKIF_TIMINGS=1` does

      --duration
          Print the wall time of the run to stderr

      --memory
          Print the peak memory (resident set size) of the run to stderr; Linux only

  -W, --workspace <NAME|DIR>
          Report only the findings of these workspace packages, by name or directory relative to the root (globs, `!` to exclude). The analysis still covers every package. Repeatable

      --include <TYPE|RULE>
          Report only these knip issue types (`files`, `dependencies`, `exports`, ...) or skif rule ids; a rule that is off (by default or in the configuration) is turned on. Comma separated, repeatable

      --exclude <TYPE|RULE>
          Do not report these knip issue types or skif rule ids. Comma separated, repeatable

      --dependencies
          Shortcut for `--include` of knip's dependency issue types

      --exports
          Shortcut for `--include` of knip's export issue types

      --files
          Shortcut for `--include files`

      --cycles
          Shortcut for `--include cycles`

      --tags <-TAG>
          Do not report exports tagged with these `JSDoc` tags, written `-TAG` as in knip. Comma separated, repeatable

      --dependency <NAME>
          Only the dependencies whose name matches this name or glob (`react`, `@types/**`, `!eslint`), in the version-group and semver-group rules only. Repeatable. syncpack's `--dependencies`

      --dependency-types <TYPES>
          Only these dependency types (`prod,dev`, `peer`, `!local`, a custom type), in the version-group and semver-group rules only; also their default scope for this run. Comma separated

      --specifier-types <TYPES>
          Only instances with these specifier types (`exact,range`, `!workspace-protocol`), in the version-group and semver-group rules only. Comma separated

      --source <GLOB>
          Only instances declared in files matching this glob, relative to the root (`packages/app/package.json`), in the version-group and semver-group rules only. Repeatable

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version