NAME

Cavil::CLI - Check code against known open source and commercial code indexed by Cavil

SYNOPSIS

Usage: cavil-cli <command> [DIR] [OPTIONS]

  # Save the URL and token once (prompts for the token without echoing it)
  cavil-cli config --url https://legaldb.suse.de

  # Confirm the URL and token are set up right (and time the round trip)
  cavil-cli whoami

  # With no path, check the current git change set
  cavil-cli check

  # With a path, scan that whole tree
  cavil-cli check ./project

  # Machine-readable output for CI (URL and token from the environment)
  CAVIL_URL=https://legaldb.suse.de CAVIL_API_KEY=1234 cavil-cli check --format json

Commands:
  check [DIR]              Check a change set or tree for known code (the default workflow)
  whoami                   Show the user the token belongs to, to verify login
  config                   Save the URL and token to ~/.config/cavil-cli (--show to display, token masked)

The URL and token are resolved from --url/--token, then CAVIL_URL/CAVIL_API_KEY, then the saved config.

Options:
      --url <url>          Cavil server URL (or CAVIL_URL)
      --token <token>      Cavil API token (or CAVIL_API_KEY)
      --all                Whole-tree scan of the current directory (a path already scans the whole tree)
      --since <ref>        Check the diff against this ref instead of the default branch
      --staged             Check staged changes only
      --fail-on-risk <n>   Exit non-zero at risk n or above (default 5; only risk 1-2 is truly safe,
                           3-4 is acceptable copyleft, escalation begins at 5)
      --fail-on-unknown    Exit non-zero if any code has no known provenance
      --exclude-package <name>
                           Ignore matches carried only by this package, so a working copy of an
                           open source project does not match its own indexed package. Repeatable;
                           also read from CAVIL_EXCLUDE_PACKAGES (comma or space separated)
      --exclude-path <glob>
                           Skip files under this path entirely (e.g. test-fixture directories). A bare
                           path excludes it and everything under it; otherwise a shell glob (as Cavil's
                           ignore globs: * matches across /, so *.pattern matches anywhere). Repeatable;
                           also read from CAVIL_EXCLUDE_PATHS
      --format <format>    Output format, "text" (default) or "json"
      --hidden             Also scan hidden files (dotfiles and dot-directories); skipped by default
      --no-color           Disable coloured output
      --quiet              Do not show the progress line while working
  -h, --help               Show this summary of available options

DESCRIPTION

A command-line client that checks whether the code in a git change set or a directory already exists in the open source Cavil has indexed, reporting its license and risk. It is meant for a developer's laptop and for CI; see docs/Architecture.md for the design.