@otakit/cli
v1.6.0
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://console.otakit.appoutputDir: 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
Organization rules:
- organization API keys stay bound to their organization
- app-scoped commands use the organization that owns the app
- app-less commands use the default chosen during login; automation can set
OTAKIT_ORGANIZATION_ID otakit organization selectchanges the local default without changing the dashboard workspace
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, runtimeVersion) is what devices see on manifest checks.
Common commands
otakit loginotakit logoutotakit whoamiotakit organization selectotakit register --slug <slug>otakit upload [path] [--release [channel]]otakit upload --release --auto-revert [--auto-revert-rate <1-95>] [--auto-revert-min-sample <10-100000>]— server reverts the release if too many devices roll back within 24h (defaults: 20% of ≥50)otakit release [bundleId] [--channel <channel>]otakit releases [--channel <channel> | --base]otakit listotakit delete <bundleId> --forceotakit config validateotakit config resolve --jsonotakit generate-signing-keyotakit mcp [--project-root <path>]
MCP server
Run the local stdio server from the Capacitor project it should access:
npx -y @otakit/cli@latest mcpThe project root and organization are fixed when the server starts. For a configured
project, the CLI uses plugins.OtaKit.appId to select its owning organization and
the server verifies current membership. An organization key is already fixed to its
owning organization. For app-less projects, otakit login stores a named default;
change it with otakit organization select and restart the MCP connection. Users do
not need an organization ID for interactive setup.
Do not put an OtaKit token in tool arguments. The server reuses OTAKIT_TOKEN or the
stored otakit login session and honors OTAKIT_SERVER_URL for self-hosted
installations. App-less automation may set OTAKIT_ORGANIZATION_ID; the
--organization-id flag remains an advanced per-process override.
The hosted remote server is https://console.otakit.app/mcp. It is a separate,
deployment-enabled surface for account operations and cannot read or upload files
from your local project. A deployment that has not enabled it returns a clear
503 response; local stdio MCP continues to work independently. See the
MCP and Agent Skills guide for Claude Code, Codex,
OAuth scopes, and remote setup.
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