# keryn ci

Describes Keryn 0.5.2 and keryn-rules 0.8.0.

> source checks plus requested SCA/DAST stages, artifacts and one CI exit

Source: https://keryn.dev/docs/reference/cli/ci/

> **Caution: Next release: keryn ci**
> On main; not in Keryn 0.5.2, the latest release.

Source checks plus requested SCA/DAST stages, artifacts and one CI exit.

```text
keryn ci [path] --out <dir>
```

## Options

```text
Usage: keryn ci [path] --out <new-directory> [--base <ref-or-result>] [--rules <packs>] [--policy <file>]
  Source analysis runs by default with Deep; unavailable or failed Deep returns incomplete (3).
  --no-deep explicitly chooses pattern checks only.
  --dependencies <file>       supply a build-produced resolved list to the source scan (repeatable, without an application profile).
  --ai-baseline <receipt> --ai-baseline-suite <suite>  compare the current AI run with reproduced before evidence
  --capabilities <config> --capabilities-base <snapshot> --fail-on-expansion  gate configuration authority changes
  --sca-collect                collect all OSV packages/advisories in one offline invocation
  --sca-context <deployment>   bind explicit AI roles; --sca-snapshot <file> and --sca-as-of <UTC ISO> preserve freshness context
  --dast-ownership <challenge.json> required with --dast-active; fresh proof before execution
  --dast-auth <auth.json>      header-env authenticated ZAP discovery and verification
  --ai-tests <suite.json>       run authenticated AI security regressions; suite bytes pinned at preflight
  --application <id> --revision <id>  optional caller binding; must match the AI test suite when supplied
  --sca-inventory <report>     import OSV JSON/CycloneDX inventory instead of a vulnerability report
  --sca-bindings <file>        explicit AI roles for --sca-inventory; --sca-inventory-complete attests input report collection
  --sca                       also run installed OSV-Scanner offline (--sca-online permits advisory requests)
  --sca-report <report>        import SCA instead; --sca-parser <id>; --sca-completion complete|partial|unknown|failed
  --dast-url <url>             run installed ZAP spider/passive checks; --dast-active opts into active checks; --dast-ajax adds the AJAX spider
  --dast-report <report.xml>   import instead; requires --dast-url and --dast-parser burp|zap
  --dast-completion complete|partial|unknown|failed  import completion (default unknown)
  --application-file <file>    run every stage an application profile (keryn.dev/application/v1) declares: each source (+ secrets)
                               and its dependencies, each artifact through artifact analyze, each web target through dast scan.
                               Default: <path>/.keryn/application.yml when present; --no-application-file ignores it. A profile
                               replaces --sca*/--dast-url/--base; --revision labels the run; evidence.json binds it profile-declared.
                               Packages (.deb/.rpm/AppImage/archives) are unpacked and every member analysed. A source whose
                               manifests are locked by a workspace lockfile above it (Cargo, npm/pnpm/yarn/bun) is covered by one
                               stage per such lockfile, scanned once and attributed; a Deno project gets a keryn sca deno stage;
                               a source with no manifest or lockfile gets no dependency stage ("no dependency inputs").
                               Each source is scanned as part of its repository (scan --repo-root): rule paths:, roles,
                               include/exclude and the repository's .keryn.yml see repository-relative paths; dependency roles too.
                               sources[n].deepTimeout (seconds) gives one source's Deep longer than the 300 s default; a source
                               whose Deep stops at the limit is incomplete and its error names that key.
                               Active web targets require a locally minted ownership challenge and fresh verification before execution.
  --max-artifact-size <bytes>  per-artifact cap for profile artifacts without maxBytes (default 64 MiB; see artifact --help)
  --jobs <n>                   stages at a time, each in a child process (default a quarter of the cores, at most 4; 1-64).
                               Outputs are the same bytes at any --jobs. Progress (start, end, every 30 s) goes to stderr.
  --fail-on error|warning|info|none (default error, or the profile's output.failOn); --json prints the aggregate summary.
  Writes per-stage artifacts, summaries, ledger.json (the merged findings ledger, see keryn ledger --help), evidence.json digests
  (covering ledger.json; timing.json files are listed as undigested) and associations.json with explicit evidence bases.
  evidence.json and summary.json carry the CLI's build provenance; summary.md states a dirty or unrecorded build. Only requested
  analyzers run.
  --base records changes; the gate still evaluates current findings, not only additions. Fetch the base revision in CI.
  Exit precedence: 4 execution > 2 usage/config > 3 incomplete > 1 findings > 10 warnings > 0 pass.
```

## Examples

```sh
# Source analysis with cross-file analysis; if cross-file analysis is incomplete, it exits 3.
keryn ci . --out out/ci --base origin/main

# Add dependency and web stages.
keryn ci . --out out/ci --sca --dast-url https://staging.example.com

# Run every stage an application profile declares.
keryn ci . --out out/ci --application-file .keryn/application.yml --jobs 2
```

## Exit codes

| Code | Meaning |
|---|---|
| 0 | pass |
| 1 | findings |
| 2 | usage or configuration error |
| 3 | incomplete |
| 4 | execution failure |
| 10 | warnings |
