> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nika.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# CI gate

> Audit, inspect and rehearse a workflow before protected CI receives provider authority.

> [!TIP]
>
> **One client, local by default.** Import `Nika` from
> the package root and omit `url`. The client takes the engine
> from `bin`, then `NIKA_BIN` (both absolute paths), then
> the platform package npm installed with it; it never uses a
> `nika` found on your `PATH`. These examples target
> the published [0.124.1 SDK release](https://github.com/supernovae-st/nika-client/tree/v0.124.1).

The pull-request job should prove the file is clean, inspect the authority and
spend shape, then rehearse the graph with the mock provider.

## Admission script

```ts theme={"system"}
import { Nika } from '@supernovae-st/nika'

const nika = new Nika()
const file = process.argv[2]
const report = await nika.check(file, {
  model: 'mock/echo',
  nativeStrict: true,
})

if (!report.clean) {
  console.error(report)
  process.exit(2)
}

const run = await nika.run(file, {
  model: 'mock/echo',
  maxCostUsd: 0,
})

for await (const event of run.events()) console.log(event.kind, event.task ?? '', event.status ?? '')
const result = await run.result()
if (result.status !== 'succeeded') process.exit(result.exitCode ?? 1)
```

`model: 'mock/echo'` replaces only the workflow's default `model:`. A task
that pins its own `infer.model`, and a child workflow it invokes, keep their
models: the mock does not make those calls offline. `maxCostUsd: 0` is what
refuses a priced pin before it spends (`NIKA-1709`, thrown by `run()`); a
local-model pin still runs. Keep both options in pull-request jobs. A refused
run throws `NikaOperationError` with the engine's exit code on `error.status`:
let it fail the job.

## Authority ladder

CI ADMISSION · SECRETS ARRIVE LAST

<pre tabIndex="0">
  pull request
  &#x20;     │
  &#x20;     ├── check ───── engine-owned admission report
  &#x20;     └── mock run ── graph behavior · receipt
  &#x20;                          │ approved
  &#x20;                          ▼
  &#x20;   protected job ───── provider secrets + deployment authority
</pre>

The shown mock workflow needs no provider key. Rehearsal fixtures must also
have safe tool boundaries: a mock model does not disable external effects.
Protected execution receives only the authority its environment and workflow
declare.

## Pin and print both versions

```sh theme={"system"}
./node_modules/.bin/nika --version
npm ls @supernovae-st/nika
```

Keep the engine and SDK release train visible in logs. Do not debug skew from
an implicit global binary — and do not `npm exec -- nika` an uninstalled
name: with no locked local package, npm would download whatever that name
resolves to. The direct `node_modules/.bin` path only ever runs the
lockfile's payload.

> [!NOTE]
>
> Commit the package lockfile and keep optional platform dependencies enabled.
> The local npm executable above resolves the project's installed package;
> it does not require a global CLI. Pin the SDK and native payload together.
> A newer standalone engine release does not update an existing npm install.

## Continue

> [card] [GitHub Actions](https://docs.nika.sh/integrations/github-actions.md)
>
> Use the Nika action for PR comments and receipts.

> [card] [Check and plan](https://docs.nika.sh/sdk/local/check-and-plan.md)
>
> Read every admission field.

> [card] [Security](https://docs.nika.sh/sdk/operations/security.md)
>
> Keep authority explicit.

> [card] [Testing](https://docs.nika.sh/guides/testing.md)
>
> Design deterministic mock goldens.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.