Skip to main content

Commands Overview

The tk-ota-push CLI (alias tkushpatch) is powered by TkOtaPushRunner (lib/src/cli/runner.dart) and addCommonOptions (lib/src/cli/publisher.dart). It exposes 7 subcommands covering authentication, Release and Patch lifecycles, cross-channel promotion, and symbol downloads.

Subcommands Summary Table​

SubcommandSyntaxPurposeDedicated Documentation
logintk-ota-push login [options]Authenticates the developer workstation via the Web Console (PKCE flow on 127.0.0.1)Authentication
whoamitk-ota-push whoamiDisplays the logged-in user, Tenant, Subject UUID, roles, and token expirationAuthentication
logouttk-ota-push logoutDeletes the local session file ~/.tk_ota_push/credentials.jsonAuthentication
releasetk-ota-push release [version] [options] [-- <flutter-args>]Builds the app and locks the reference binary (application binary / diff_base) + .symbolsRelease
patchtk-ota-push patch [version] [options] [-- <flutter-args>]Builds, verifies native integrity, and publishes a differential OTA patch (binary diff + optimized compression)Patch
promotetk-ota-push promote --patch-id <uuid> [options]Promotes an APPROVED_AND_SIGNED patch to another channel without recompilingPromote
symbolstk-ota-push symbols --patch-id <uuid> [options]Downloads the archived .symbols file of a patch to deobfuscate a crash stack traceSymbols

Global Options​

OptionAbbr.TypeDefaultDescription (runner.dart)
--help-hFlag (negatable: false)falseDisplays general usage information and command options

Common Options for release and patch (addCommonOptions)​

These options are registered on both the release and patch subcommands:

Option / FlagAbbr.TypeAllowed ValuesDefaultDescription in Code
--platform-pOptionandroid, ios, allallTarget platform.
--arch-aOptionaarch64, arm, allallTarget architecture (aarch64 for 64-bit, arm for 32-bit, all for both).
--channel-cOptionFree string (stable, staging, beta…)null (resolved to shorebird.yaml or stable)Target channel (stable, staging, beta - default: read from shorebird.yaml or stable).
--[no-]obfuscate—Flag (negatable: true)true, falsetrueCompiles with --obfuscate --split-debug-info and archives .symbols files.
--split-debug-info—OptionDirectory pathnull (build/ota_symbols/<version>)Directory for .symbols files (default: build/ota_symbols/<version>).
--json—Flag (negatable: false)falsefalseOutputs raw JSON response (useful for CI/CD scripts).
--server—OptionHTTP/HTTPS URLnull (shorebird.yaml / env / http://localhost:8080)OTA server URL (default: read from shorebird.yaml, $OTA_SERVER_URL, or localhost:8080).
--tenant-id—OptionIdentifiernull (shorebird.yaml / session / env / default)Tenant identifier (default: read from shorebird.yaml or active session).
--app-id—OptionIdentifiernull (resolution cascade)app_id (default: read from shorebird.yaml or auto-detected).
--project—OptionDirectory path.Flutter project directory.
--env-eOptionString (dev, staging, prod, uat)nullApplication environment (e.g., dev, staging, prod, uat).
--flavor—OptionString (dev, staging, prod)nullFlutter / Gradle / Xcode build flavor (e.g., dev, staging, prod).
--target-tOption.dart file pathnullSpecific Dart entry point (e.g., lib/main_dev.dart).
--dart-define—MultiOptionKEY=VALUE (repeatable)[]Dart environment variables in KEY=VALUE format (repeatable).
--dart-define-from-file—MultiOption.json / .env path (repeatable)[]Dart define file .json or .env (repeatable).
--artifact—Optionapk, aab, ipa, iosapkArtifact type to build (apk or aab for Android, ipa or ios for iOS).
--export-method—Optionad-hoc, app-store, enterprise, developmentnulliOS IPA export method (ad-hoc, app-store, etc.).
--export-options-plist—Option.plist file pathnullPath to a custom ExportOptions.plist file for iOS.
--build-name—OptionVersion x.y.znullAlternative Flutter version name (overrides x.y.z in pubspec.yaml).
--build-number—OptionInteger / stringnullAlternative Flutter build number (overrides +build in pubspec.yaml).
Positional Arguments and Pass-Through (--)

On release and patch, the first positional argument not starting with - is treated as the explicit version (e.g., 1.0.0+3) and written to pubspec.yaml. All remaining arguments (especially after --) are forwarded directly to flutter build via passThroughArgs.

patch-Specific Options​

In addition to the common options above, the patch command accepts:

Option / FlagAbbr.TypeDefaultDescription (runner.dart)
--countries—Optionnull (fallback shorebird.yaml or worldwide)Comma-separated ISO-2 country codes (e.g., "CI,SN,CM") or "all" for worldwide (default: worldwide).
--rollout—Option'100'Rollout percentage (0-100).
--staged—Flag (negatable: false)falseDo not auto-approve: leaves the patch in STAGED state (4-eyes review).
--force-fFlag (negatable: false)falseForces patch publication even if pubspec.lock changed slightly or if a native code divergence is detected.
--message-mOptionnullBusiness changelog / patch description for security reviewers.

Options Specific to login, promote, and symbols​

login Subcommand​

OptionAbbr.TypeMandatoryDefaultDescription (runner.dart)
--web-url—OptionNonull (shorebird.yaml / $OTA_WEB_CONSOLE_URL / http://localhost:3000)Web portal URL (default read from shorebird.yaml or http://localhost:3000)
--project—OptionNo.Flutter project path.

promote Subcommand​

Option / FlagAbbr.TypeMandatoryDefaultDescription (runner.dart)
--patch-id—OptionYes (mandatory: true)—UUID of the source patch to promote.
--to-channel—OptionNo'stable'Destination channel (e.g., stable).
--tenant-id—OptionNonullTenant identifier (default: read from shorebird.yaml or active session).
--json—Flag (negatable: false)NofalseOutputs raw JSON response.
--server—OptionNonullOTA server URL (default: read from shorebird.yaml or localhost:8080).
--project—OptionNo.Flutter project path (to read shorebird.yaml).

symbols Subcommand​

OptionAbbr.TypeMandatoryDefaultDescription (runner.dart)
--patch-id—OptionYes (mandatory: true)—UUID of the patch whose .symbols file should be downloaded.
--output-oOptionNonull (patch_<patchId>.symbols)Output .symbols file path.
--tenant-id—OptionNonullTenant identifier (default: read from shorebird.yaml or active session).
--server—OptionNonullOTA server URL (default: read from shorebird.yaml or localhost:8080).
--project—OptionNo.Flutter project path (to read shorebird.yaml).

Recognized Environment Variables​

VariablePurposePriority
OTA_API_KEYBearer token for API / CI authenticationOverrides the local session ~/.tk_ota_push/credentials.json
OTA_SERVER_URLTkushPatch Server OTA server URLUsed when neither --server nor base_url (shorebird.yaml) is set
SHOREBIRD_BASE_URLFallback alias for the OTA server URLEvaluated right after OTA_SERVER_URL
OTA_TENANT_IDTenant identifierEvaluated after --tenant-id, shorebird.yaml, and session.tenantId
OTA_APP_ID / APP_IDApplication identifierEvaluated before native Gradle/Xcode detection if not set in shorebird.yaml
OTA_WEB_CONSOLE_URLNext.js Web Console URLUsed by tk-ota-push login if --web-url and web_console_url are omitted

Exit Codes​

The CLI follows POSIX sysexits.h conventions in TkOtaPushRunner.run:

CodePOSIX ConstantTrigger Condition
0EX_OKSuccessful execution, or called with --help, or invoked without arguments (arguments.isEmpty).
1EXIT_FAILURERuntime error: CliException (HTTP 409 conflict, unreachable server, native code divergence, flutter build failure), OtaApiException on promote/symbols, or login failure.
64EX_USAGECommand-line syntax error (ArgParser FormatException), unknown subcommand, missing app_id, or --rollout outside 0..100.
66EX_NOINPUTTarget project directory (--project) does not contain a pubspec.yaml file.
69EX_UNAVAILABLEShorebird toolchain not found in ~/.shorebird/bin/cache/flutter.