@otakit/cli
v1.1.2
Published
CLI for uploading and releasing OtaKit OTA bundles
Maintainers
Readme
@otakit/cli
Upload and release CLI for OtaKit.
What it does
- reads project config from
capacitor.config.* - authenticates with login or env tokens
- zips the build output
- computes the bundle SHA-256 checksum
- creates an upload session
- uploads the zip directly to object storage
- finalizes the bundle
- optionally releases it to the unnamed channel or a named channel
The normal hosted flow is dashboard-first. Create the app in the dashboard,
paste its appId into plugins.OtaKit.appId, then ship:
otakit login
npm run build
otakit upload --releaseIf you want to create the app from the CLI instead:
otakit register --slug com.example.appThere is no otakit init.
Config model
The CLI reads these files when present:
capacitor.config.tscapacitor.config.jscapacitor.config.mjscapacitor.config.cjscapacitor.config.json
Important values:
webDir: "out",
plugins: {
OtaKit: {
appId: "app_xxxxxxxx",
// Optional:
// channel: "staging",
// serverUrl: "https://your-server.com/api/v1"
}
}Resolution order:
- CLI flags
- environment variables
capacitor.config.*- built-in defaults
Main rules:
appId:--app-id->OTAKIT_APP_ID->plugins.OtaKit.appIdserverUrl:--server->OTAKIT_SERVER_URL->plugins.OtaKit.serverUrl->https://otakit.app/api/v1outputDir: upload path arg ->OTAKIT_BUILD_DIR/OTAKIT_OUTPUT_DIR->webDir- release channel:
--release-> unnamed channel,--release <channel>-> named channel
Auth precedence:
OTAKIT_TOKEN- stored token from
otakit login
Version precedence:
--versionOTAKIT_VERSION- auto-generated
<base>+otk.<commit>.<run>
Release model
otakit uploadupload onlyotakit upload --releaseupload and release to the unnamed channelotakit upload --release stagingupload and release to a named channelotakit release <bundleId> --channel stagingpromote an existing bundle later
Releases are append-only. The newest release for (appId, channel) is what
devices see on manifest checks.
Common commands
otakit loginotakit logoutotakit whoamiotakit register --slug <slug>otakit upload [path] [--release [channel]]otakit release [bundleId] [--channel <channel>]otakit releases [--channel <channel> | --base]otakit listotakit delete <bundleId> --forceotakit config validateotakit config resolve --jsonotakit generate-signing-key
CI
export OTAKIT_TOKEN=otakit_sk_...
export OTAKIT_APP_ID=app_xxxxxxxx
export OTAKIT_BUILD_DIR=out
otakit upload --releaseSet OTAKIT_SERVER_URL only for custom or self-hosted servers.
Upload flow
- resolve the build output directory
- require
index.html - zip the output
- compute SHA-256 and size
- call
bundles/initiate - upload directly to object storage
- call
bundles/finalize - optionally call
releases
The CLI does not own app creation or channel strategy. It packages the build, uploads it, and optionally promotes it.
Build locally
pnpm --filter @otakit/cli build
pnpm --filter @otakit/cli typecheck
pnpm --filter @otakit/cli dev