Skip to main content

CLI Flags

cfv check [flags] [<search_path>...]

Bare cfv [flags] [<search_path>...] also works and is equivalent to cfv check.

If no search path is provided, cfv searches the current directory. Use - to read from stdin (requires --file-types).

Subcommands​

SubcommandDescription
checkValidate config files. Default when omitted.
formatCheck or fix formatting of config files.
versionPrint the version and exit.
helpShow help for a subcommand.

check flags​

All flags below apply to the check subcommand.

FlagTypeDefaultDescription
-depthintunlimitedMaximum recursion depth. 0 disables recursion.
-exclude-dirsstring—Comma-separated list of directory names to skip.
-exclude-file-typesstring—Comma-separated list of file types to ignore. Cannot be used with -file-types.
-file-typesstringallComma-separated list of file types to validate. Cannot be used with -exclude-file-types.
-fixboolfalseApply safe fixes automatically (trailing commas, schema coercion, formatting).
-unsafeboolfalseApply unsafe fixes. Requires -fix.
-gitignoreboolfalseSkip files matched by .gitignore patterns. Only active inside a Git repository.
--ignore-filestring—Apply gitignore-style patterns from a file relative to each search path. Repeatable.
-globbingboolfalseTreat positional arguments as glob patterns.
-groupbystring—Group output by: filetype, directory, pass-fail, error-type. Comma-separated.
-merge-sarifstring—External SARIF file to append to SARIF output. Repeatable. Requires -reporter=sarif.
-merge-sarif-dirstring—Directory tree of .sarif or .sarif.json files to append to SARIF output. Requires -reporter=sarif.
-quietboolfalseSuppress all stdout output. Errors still print to stderr.
-reporterstringstandardOutput format and optional path. Format: <type>:<path>. Types: standard, json, junit, sarif, github. Repeatable.
-require-schemaboolfalseFail files that support schema validation but don't declare a schema.
-no-schemaboolfalseDisable all schema validation. Cannot be combined with -require-schema, -schema-map, or -schemastore.
-schema-mapstring—Map a glob pattern to a schema file. Format: <pattern>:<schema_path>. Repeatable.
-schemastoreboolfalseEnable automatic schema lookup by filename using the SchemaStore catalog.
-schemastore-pathstring—Path to a local SchemaStore clone. Implies -schemastore.
-configstringautoPath to a .cfv.toml configuration file.
-no-configboolfalseDisable all config file discovery (.cfv.toml, .prettierrc, taplo.toml, .yamlfmt, .editorconfig).
-type-mapstring—Map a glob pattern to a file type. Format: <pattern>:<type>. Repeatable.
-watchboolfalseWatch search paths for file changes and re-run validation on each changed file.

format flags​

cfv format [flags] [<search_path>...]

Checks formatting of config files. With --fix, rewrites files in place. With --diff, prints a unified diff of what would change.

Format-specific flags​

FlagTypeDefaultDescription
-fixboolfalseRewrite files in place. Mutually exclusive with -diff.
-diffboolfalsePrint unified diff of formatting changes. Mutually exclusive with -fix.
-indentint0Override indent width. 0 uses format default (2 for JSON/JSONC/YAML/XML).
-use-tabsboolfalseUse tabs for indentation.
-sort-keysboolfalseSort mapping keys alphabetically.
-no-sort-keysboolfalseDisable key sorting (overrides config file setting).
-line-endingstring—Line ending style: lf or crlf.
-max-line-widthint0Max line width hint. 0 uses format default (80 for JSON/JSONC/YAML).
-quote-stylestring—Quote style: double, single, or preserve (YAML only).
-no-configboolfalseDisable all config file discovery (.cfv.toml, .prettierrc, taplo.toml, .yamlfmt, .editorconfig).
-no-editorconfigboolfalseIgnore .editorconfig files when resolving format options.

Shared flags​

These flags work the same as in check.

FlagTypeDefaultDescription
-depthintunlimitedMaximum recursion depth. 0 disables recursion.
-exclude-dirsstring—Comma-separated list of directory names to skip.
-exclude-file-typesstring—Comma-separated list of file types to ignore. Cannot be used with -file-types.
-file-typesstringallComma-separated list of file types to format. Cannot be used with -exclude-file-types.
-gitignoreboolfalseSkip files matched by .gitignore patterns.
--ignore-filestring—Apply gitignore-style patterns from a file relative to each search path. Repeatable.
-globbingboolfalseTreat positional arguments as glob patterns.
-groupbystring—Group output by: filetype, directory, pass-fail. Comma-separated.
-reporterstringstandardOutput format and optional path. Format: <type>:<path>. Types: standard, json, junit, sarif, github. Repeatable.
-quietboolfalseSuppress stdout output when writing to file.
-configstringautoPath to a .cfv.toml configuration file.
-type-mapstring—Map a glob pattern to a file type. Format: <pattern>:<type>. Repeatable.