Skip to content

Docs: document vg scan / vg build exit codes for CI gating #234

Open

Description

@vibgrate-team

Context

CI users gate pipelines on vg scan / vg build exit status but the public docs do not spell out which codes mean success, findings-above-budget, hard failure, or misconfiguration. Actionable, local-first CLI behavior needs an explicit exit-code table.

What to do

  1. Document exit codes for vg scan and vg build (and note related report/sbom commands if they share the same convention).
  2. Give a minimal CI snippet (shell or GitHub Actions) that treats “findings” differently from “tool crashed”.
  3. Cross-link GitHub Action: expand CI drift-gate example with failure semantics and badges #152 (Action drift-gate example) without duplicating that issue’s scope.

Acceptance

  • Exit-code table is in public docs
  • Distinguishes config/runtime failure from “findings present”
  • Example uses vg
  • DCO sign-off

Refs: #152 · #150 · roadmap #144

Activity

  1. added
    documentation
    good first issue
    on Sep 18, 2026
  2. vibgrate-team commented on Oct 4, 2026

    @vibgrate-team
    ContributorAuthor

    Spec notes for implementers

    Source of truth. src/util/exit.ts defines ExitCode: 0 OK, 1 ERROR, 2 GATE_FAILED, 3 NOT_FOUND, 4 NON_DETERMINISTIC, 5 USAGE_ERROR, 6 ENGINE_UNAVAILABLE (a missing optional module, kept separate from 2 so a CI gate can never read "engine missing" as pass or fail). Graph verbs throw CliError with one of these.

    vg scan specifics (src/reporting/commands/scan.ts):

    • 2 for every gate that trips: --drift-budget / --drift-worsening, --fail-on (including architecture-finding and iac-finding), and the security gate. Some gate preconditions also exit 2, e.g. --fail-on architecture-finding with --no-graph.
    • 1 for operational errors, e.g. a missing scan path or an unreadable --package-manifest (thrown as CliError(..., ExitCode.ERROR)).
    • 5 for usage errors caught before scanning, e.g. an unknown --fail-on value.
    • --strict only changes upload behaviour: without it a failed push warns and the scan exits on its own result; with it the push failure exits 1. Worth one sentence, because people assume --strict tightens the gates.

    Existing doc gap. DOCS.md "Generic Pipelines" says the CLI "Returns meaningful exit codes (see below)", but there is no table below it. That sentence is the natural anchor for this table.

    Suggested shape. One table for the shared codes, then a short per-command note for vg scan and vg build listing which flags can produce 2. The CI snippet should branch on $?: 0 pass, 2 findings/gate (fail the job with a clear message), anything else treat as a tool or config error. Keep #152 for the Action example itself and link to it.

    Verify before writing. Run vg scan --drift-budget 0 and vg scan --package-manifest ./missing.zip on a toy repo and paste the observed exit codes in the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions