CLI reference (ota-ns)
@getcortexlabs/ota-cli provides the ota-ns command for key generation, per-platform compatibility fingerprinting, Webpack release packaging, offline verification and local fault-injection testing.
All commands support --json for machine-readable CI output and --help for usage.
ota-ns keygen
Generates an Ed25519 PKCS8 private key (0600), SPKI public key PEM, and raw 32-byte base64 publicKeys snippet for ota.config.json.
ota-ns keygen --key-id prod-2026 --out-dir ~/.ota-keys| Flag | Required | Description |
|---|---|---|
--key-id <id> | No | Key identifier embedded in signatures and ota.config.json (defaults to ota-key-<year>). |
--out-dir <dir> | No | Target directory outside your app repo (defaults to ~/.ota-keys). |
--force | No | Overrides the guard that refuses writing keys inside src/, app/, App_Resources/ or platforms/. |
--json | No | Emit structured JSON output. |
ota-ns fingerprint
Computes a per-platform runtime compatibility fingerprint and optionally compares against a store-binary baseline.
ota-ns fingerprint --platform ios --project . \
--write-baseline ./ota.baseline.ios.json --write-config| Flag | Required | Description |
|---|---|---|
--platform <ios|android> | Yes | Target NativeScript platform. |
--project <dir> | No | NativeScript app root (defaults to process.cwd()). |
--bundle-dir <dir> | No | Explicit prepared bundle directory override. |
--baseline <path> | No | Compare against a saved baseline; exits 0 if compatible, 2 if native drift is detected. |
--write-baseline <path> | No | Write the computed fingerprint JSON to disk. |
--write-config | No | Update runtimeContract for this platform in <project>/ota.config.json. |
--json | No | Emit full JSON fingerprint (and diff when --baseline is set). |
ota-ns pack
Packages a prepared NativeScript Webpack 5 or @nativescript/vite release bundle (auto-discovering platforms/<platform>/.../app or .ns-vite-build/<platform>) into <out>/files/ and writes an Ed25519-signed <out>/manifest.json.
ota-ns pack \
--platform android \
--project . \
--baseline ./ota.baseline.android.json \
--release-id ota-105 \
--private-key ~/.ota-keys/prod-2026.private.pem \
--key-id prod-2026 \
--out ./dist-ota/ota-105Safety checks enforced automatically:
- Diffs current project against
--baselineand refuses on native drift unless--allow-driftis explicitly set. - Detects legacy Android V8 heap snapshot artifacts or configuration (
libsnapshot.so,libTNSSnapshot.so,snapshot-build/,TNSSnapshot.blob,android.useV8Snapshot: true) and refuses packing unless--allow-snapshotis explicitly set. - Rejects symbolic links anywhere inside the bundle directory.
- Rejects compiled native binary artifacts (
.dex,.jar,.aar,.so,.dylib,.blob,.apk,.aab,.ipa,.framework,.xcframework,AndroidManifest.xml,Info.plist,metadata-*.bin,treeNodeStream.dat,TNSSnapshot.blob). - Validates
package.jsonmain(stripping leading./) resolves to an existing entry (main,${main}.mjs,${main}.js, or${main}.cjs).
| Flag | Required | Description |
|---|---|---|
--platform <ios|android> | Yes | Target platform. |
--release-id <id> | Yes | Unique immutable release identifier. |
--private-key <pem> | Yes | Path to Ed25519 PKCS8 private key PEM. |
--key-id <id> | Yes | Matching keyId configured in ota.config.json. |
--out <dir> | Yes | Output directory (manifest.json + files/). |
--project <dir> | No | NativeScript app root (auto-discovers prepared bundle or .ns-vite-build/<platform> + ota.config.json defaults). |
--bundle-dir <dir> | No | Explicit bundle directory override. |
--baseline <path> | No | Baseline fingerprint for drift enforcement and default targetBuild/runtimeContract. |
--app-id, --target-build, --runtime-contract | No | Explicit manifest metadata overrides. |
--allow-drift | No | Override baseline drift refusal (use only when intentionally testing mismatched contracts). |
--allow-snapshot | No | Override Android V8 heap snapshot refusal (only for custom runtimes that bypass snapshot loading when OTA is active). |
ota-ns verify
Offline CI verification gate auditing signature, schema, baseline compatibility and every file on disk.
ota-ns verify \
--bundle ./dist-ota/ota-105 \
--config ./ota.config.json \
--baseline ./ota.baseline.ios.jsonVerifies:
manifest.jsonschema and Ed25519 signature against--public-key(raw base64 or PEM) or--config.- Optional
--baseline,--app-id,--platform,--target-build,--runtime-contractassertions. - Exact 1:1 match between
manifest.filesand<bundle>/files/(exact byte sizes, exact SHA-256 digests, no symlinks, no missing files, no extra unmanifested files).
ota-ns serve
Starts the local HTTP/TLS fixture server for device and simulator testing. See Fault-injection server for full mode documentation.
ota-ns publish
In Otto Console, register the application ID, pin the release public key from ota-ns keygen, and create an app publishing token. Set OTTO_TOKEN in your shell or CI secret store, then send a bundle previously produced by ota-ns pack.
ota-ns publish --bundle ./dist-ota --endpoint https://otto.getcortexlabs.com/api/publish --channel betaNew apps start with beta and production. Owners can create more channels in Settings → App. Use a registered, active channel name: lowercase letters, numbers and hyphens, beginning with a letter, up to 48 characters; all is reserved. The SDK must use the same channel name. The CLI checks the signed inventory against the files before sending them. Otto verifies the manifest signature with the pinned key. The server accepts up to 32 MiB of files per bundle. Retrying the same publication keeps subsequent pauses and rollbacks in effect. Use --json for a machine-readable receipt.
Attach the fingerprint for the exact native build when publishing:
ota-ns publish --bundle ./dist-ota --endpoint https://otto.getcortexlabs.com/api/publish --channel internal --fingerprint ./ota.baseline.ios.json--fingerprint accepts the raw JSON saved by ota-ns fingerprint --write-baseline. The CLI checks its section hashes, runtime contract, platform and target build before sending it. Otto repeats those checks and saves the report with the publication. The optional report is separate from the signed bundle and does not change its signature. Up to 2 MiB and 10,000 fingerprint entries are accepted. Private signing keys stay local.
Operating a release in Console
Releases → Compare compares two signed file inventories from the same platform: added, changed, removed and identical files, bundle sizes, signing key IDs and native targets. Identical bytes are a potential reuse opportunity; actual reuse depends on files present on each device.
Releases → Compatibility shows native delivery routes, recent real check outcomes and a simulation using the same decision rules as /api/check. The simulation issues no directive and stores no report. Real checks are aggregated by UTC hour and outcome, with up to 2,000 groups per app for 7 days; the Console shows the latest 200 groups. Installation IDs are used for rollout calculations but are not stored in these diagnostics. These counts are requests, not unique devices.
Import another fingerprint in this view to compare runtime, native plugins, native resources, generated metadata and static bindings. Browser import also accepts the { fingerprint, diff } output of fingerprint --json. A static-only report is incomplete: rebuild natively and regenerate it before deciding compatibility. Reports are supplied by the team and are not attestation of an installed binary. Each app retains up to 100 distinct native reports.
Activity retains SDK download bytes, reused bytes/files, staging duration, startup attempts and fallback destination. Aggregates follow the active filters across all retained matching events, not just the current page; Overview uses the last 24 hours. Older reports without metrics remain visible and are excluded from those aggregates. Lifecycle reports are best effort, not unique-device adoption or billing metrics.
Archiving a channel stops new publishing and update directives through it, while preserving history and downloaded bundles. Restoring resumes its saved delivery rules. Owners manage channels; publishers can dispatch releases and import native reports; viewers can inspect and simulate. Up to 20 channels, including archived channels, can exist per app.
