local API · live
Drive the binary you ship.
The complete LocalNika surface: check, dry-run plan, event stream, test, resume and trace verification.
The local driver is deliberately thin. It never reimplements the language or its boundary. It starts the binary without a shell and types the machine output the engine owns.
Choose the binary and working directory.
The default constructor reads NIKA_BIN and then PATH. Set cwd when traces and relative workflow paths should belong to another project root.
import { LocalNika } from '@supernovae-st/nika-client/local'
const nika = new LocalNika({
bin: '/opt/nika/bin/nika',
cwd: '/srv/workflows',
})
console.log(await nika.version())Ask for the audit and the dry-run plan.
check returns findings, permits, requirements, waves and the honest cost floor. dryRunPlan returns the machine plan or rejects with the check report when the file is dirty.
const report = await nika.check('release.nika.yaml', {
model: 'mock/echo',
nativeStrict: true,
})
const plan = report.clean
? await nika.dryRunPlan('release.nika.yaml')
: null
console.log(plan?.waves, plan?.permits)Stream or collect.
run exposes events as they arrive and an outcome promise for the final exit contract. runToEnd drains the same stream and returns one buffered outcome.
const handle = nika.run('release.nika.yaml', {
vars: { environment: 'staging' },
maxCostUsd: 0.5,
})
for await (const event of handle) {
console.log(event.kind)
}
const outcome = await handle.outcome
console.log(outcome.exitCode, outcome.ok)Test and verify the receipt.
The offline test lane and trace verifier are first-class methods. The returned verdict keeps the engine exit code and the chain head.
const golden = await nika.test('release.nika.yaml')
const trace = await nika.traceVerify()
if (!golden.passed || !trace.intact) process.exit(1)
console.log(trace.head)