CLI command

critiq rules validate

Validate rule YAML contract and semantic checks before relying on rules in automation.

#Syntax

bash
critiq rules validate <glob> [--format pretty|json]

#Arguments

  • glob: Exactly one glob that selects rule YAML files.

#Flags

  • --format pretty|json: Output format. Defaults to pretty.

#Examples

bash
npx critiq rules validate ".critiq/rules/*.rule.yaml"
npx critiq rules validate "packages/rules/**/*.rule.yaml" --format json

#Defaults

  • The command expects exactly one target glob.

#JSON output

json
{
  "command": "rules validate",
  "format": "json",
  "exitCode": 1,
  "target": ".critiq/rules/*.rule.yaml",
  "matchedFileCount": 1,
  "results": [],
  "diagnostics": []
}

#Exit behavior

  • 0: every matched rule validated successfully.
  • 1: invalid arguments or validation diagnostics.
  • 2: internal/runtime errors.

#Notes

  • Use this before sharing a rule pack or depending on local rules in CI.