Skip to content

Modernize CLI config and drop configkit - #117

Merged
BacchusJackson merged 3 commits into
mainfrom
cli-config-modernize
Nov 4, 2026
Merged

BacchusJackson merged 3 commits into
mainfrom
cli-config-modernize

Conversation

@BacchusJackson

Copy link
Copy Markdown
Member

This covers the #73 plan, plus the bugs listed in that issue's comment. The tree is built fresh on every call, settings go flag → env → default, and configkit and Viper are gone.

Behavior changes

  • Exit codes: 0 ok, 1 threshold failure, 2 usage, IO, or decode error, 3 EPSS or KEV data error (gatecheck.ErrExternalData). Most of these used to be 255.
  • --audit only forgives threshold failures. An unsupported report, a decode error, or a fetch error still fails.
  • --silent now shows warnings. --log-level debug|info|warn|error and --log-format text|json are new, each with an env var. Color is used only on a TTY, and NO_COLOR turns it off.
  • --format table|markdown|json on list, list-all, and validate. For list, JSON comes from a custom tablewriter renderer, so every report type gets it without its own code. list-all JSON is one array keyed by file. validate --format prints a pass/fail summary.
  • validate: --input-type, stdin when FILE is omitted, --epss-url, and --kev-url. It warns when there's no config or when the config has unknown keys (strict decode for each format).
  • list-all: --epss-filename and --epss-url. EPSS loads once per run. It exits 2 when a file couldn't be listed.
  • Coverage thresholds over 1 are read as percents, with a warning.
  • One config encoder and decoder, indented output, and file handles closed.

Fixes: the panics on GATECHECK_VERBOSE, GATECHECK_SILENT, and GATECHECK_AUDIT; --audit=false losing to the env var; the KEV file reading GATECHECK_EPSS_FILENAME; bundle create not truncating, and add/remove leaving stale tail bytes; bundle remove of a missing label exiting 0; the case-sensitive Grype KEV compare (related CVE ids are now checked too); EPSS headers with a +0000 offset.

Tests: cmd/cli_test.go runs the real tree end to end. It covers each exit path, env precedence, logging, formats, stdin, bundle truncation, and config output. There are also new config round-trip and unknown-key tests in pkg/gatecheck.

The docs, the agent guide, AGENTS.md, and the changelog are updated, including a breaking-changes list for the next minor release.

This is stacked on #115 and #116.

Fixes #73

🤖 Generated with Claude Code

validate --vex, GATECHECK_VEX, and the config's vex.files read OpenVEX
and CycloneDX VEX. Grype, CycloneDX, Trivy, and osv-scanner findings
marked not exploitable are dropped after the deny list, so they skip the
KEV, EPSS, and severity rules. Statements that name packages match by
package URL, and the latest statement wins.

Fixes #102
The license config section checks Syft JSON and CycloneDX components
against deny and allow glob patterns, with SPDX AND, OR, and WITH
expressions evaluated. denyUnknown fails packages with no license, and
packageRiskAcceptance skips packages by purl or name. Syft JSON now
lists its packages and validates with these rules instead of erroring.

Fixes #103
Build a fresh command tree per call and read every setting flag, then
environment variable, then default. Remove configkit and Viper.

- Exit 2 for usage, IO, and decode errors and 3 for EPSS or KEV data
  errors. --audit only ignores threshold failures.
- --log-level and --log-format on every command. --silent keeps warnings.
- --format table|markdown|json on list, list-all, and validate.
- validate gains --input-type (with stdin), --epss-url, and --kev-url.
  list-all gains --epss-filename and --epss-url.
- One config encoder and decoder. config init indents, and unknown keys
  are reported as warnings. validate warns when there is no config.
- Coverage thresholds over 1 are read as percents.
- Fix the env var panics, the KEV file reading GATECHECK_EPSS_FILENAME,
  bundle create not truncating, bundle remove of a missing label exiting
  0, and the case-sensitive Grype KEV compare.

Fixes #73
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying gatecheck-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: 307061e
Status: ✅  Deploy successful!
Preview URL: https://6c8bc309.gatecheck-website.pages.dev
Branch Preview URL: https://cli-config-modernize.gatecheck-website.pages.dev

View logs

This branch was successfully deployed

1 active deployment
github-pages — 307061ef Deployed Nov 4, 2026 by BacchusJackson via deploy #73
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modernize CLI config and drop configkit

1 participant