Skip to content
THE OTA MANUALCLI & compatibility
Updatedv0.1.0 ↗

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.

sh
ota-ns keygen --key-id prod-2026 --out-dir ~/.ota-keys
FlagRequiredDescription
--key-id <id>NoKey identifier embedded in signatures and ota.config.json (defaults to ota-key-<year>).
--out-dir <dir>NoTarget directory outside your app repo (defaults to ~/.ota-keys).
--forceNoOverrides the guard that refuses writing keys inside src/, app/, App_Resources/ or platforms/.
--jsonNoEmit structured JSON output.

ota-ns fingerprint ​

Computes a per-platform runtime compatibility fingerprint and optionally compares against a store-binary baseline.

sh
ota-ns fingerprint --platform ios --project . \
  --write-baseline ./ota.baseline.ios.json --write-config
FlagRequiredDescription
--platform <ios|android>YesTarget NativeScript platform.
--project <dir>NoNativeScript app root (defaults to process.cwd()).
--bundle-dir <dir>NoExplicit prepared bundle directory override.
--baseline <path>NoCompare against a saved baseline; exits 0 if compatible, 2 if native drift is detected.
--write-baseline <path>NoWrite the computed fingerprint JSON to disk.
--write-configNoUpdate runtimeContract for this platform in <project>/ota.config.json.
--jsonNoEmit 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.

sh
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-105

Safety checks enforced automatically:

  • Diffs current project against --baseline and refuses on native drift unless --allow-drift is 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-snapshot is 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.json main (stripping leading ./) resolves to an existing entry (main, ${main}.mjs, ${main}.js, or ${main}.cjs).
FlagRequiredDescription
--platform <ios|android>YesTarget platform.
--release-id <id>YesUnique immutable release identifier.
--private-key <pem>YesPath to Ed25519 PKCS8 private key PEM.
--key-id <id>YesMatching keyId configured in ota.config.json.
--out <dir>YesOutput directory (manifest.json + files/).
--project <dir>NoNativeScript app root (auto-discovers prepared bundle or .ns-vite-build/<platform> + ota.config.json defaults).
--bundle-dir <dir>NoExplicit bundle directory override.
--baseline <path>NoBaseline fingerprint for drift enforcement and default targetBuild/runtimeContract.
--app-id, --target-build, --runtime-contractNoExplicit manifest metadata overrides.
--allow-driftNoOverride baseline drift refusal (use only when intentionally testing mismatched contracts).
--allow-snapshotNoOverride 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.

sh
ota-ns verify \
  --bundle ./dist-ota/ota-105 \
  --config ./ota.config.json \
  --baseline ./ota.baseline.ios.json

Verifies:

  • manifest.json schema and Ed25519 signature against --public-key (raw base64 or PEM) or --config.
  • Optional --baseline, --app-id, --platform, --target-build, --runtime-contract assertions.
  • Exact 1:1 match between manifest.files and <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.

sh
ota-ns publish --bundle ./dist-ota --endpoint https://otto.getcortexlabs.com/api/publish --channel beta

New 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:

sh
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.