Skip to content

CI integration

OpenCodeHub is built for CI from day one. Every command that matters in a pipeline emits structured exit codes, supports --json, and runs offline against the committed index.

emit opinionated CI workflows
codehub ci-init

ci-init detects whether the repo is on GitHub or GitLab and writes the corresponding workflow file. Pass --platform github, --platform gitlab, or --platform both to override. Use --main-branch release to change the base branch, and --force to overwrite an existing workflow.

The emitted workflow runs codehub analyze, codehub detect-changes --scope compare --compare-ref origin/main --strict, codehub scan, and codehub verdict in that order.

compute a PR verdict
codehub verdict --base main --head HEAD

verdict returns one of five tiers with a deterministic exit code:

TierExit codeMeaning
auto_merge0Low-risk, no reviewer required by the graph.
single_review1One reviewer sufficient.
dual_review1Two reviewers recommended.
expert_review2Domain owner review required.
block3Do not merge — critical blast radius or policy fail.

Use the exit code directly in a CI step, or pass --json for the full envelope with reasoning and contributing signals.

map the diff to graph symbols and processes
codehub detect-changes --scope compare --compare-ref origin/main --strict

detect-changes returns the list of symbols, processes, and files touched by the diff, each tagged with a risk tier. Exit codes:

  • 0 — OK (no HIGH/CRITICAL; MEDIUM allowed unless --strict).
  • 1 — HIGH/CRITICAL found, or MEDIUM found with --strict.
  • 2 — the command itself crashed.
CommandExit 0Exit 1Exit 2Exit 3
analyzesuccesscaught error
detect-changesOKrisk foundcaught error
verdictauto_mergesingle_review / dual_reviewexpert_reviewblock
scancleanfindings at severityscanner crashed

If you already run another SAST tool, ingest its SARIF output into the graph so the same list_findings MCP tool surfaces both sets:

ingest an external SARIF file
codehub ingest-sarif path/to/report.sarif

The findings become Finding nodes with FOUND_IN edges to the symbol and file they reference.

  • CLI reference — every command, every flag.
  • Error codes — the fixed set of MCP error codes your CI tooling may encounter.