Skip to content

CLI

@kitbase/cli lets you manage your Kitbase projects from the terminal. Currently supports building and pushing Ionic/Capacitor web apps for OTA updates.

Installation

bash
npm install -g @kitbase/cli
bash
npx @kitbase/cli ionic push

Setup

Initialize your project with an SDK key:

bash
kitbase init

This creates a .kitbasecli file in your project root and adds it to .gitignore.

You can also pass values directly:

bash
kitbase init --api-key sk_live_xxx

For self-hosted instances, provide your API URL:

bash
kitbase init --api-key sk_live_xxx --base-url https://api.mycompany.com

This writes both values to .kitbasecli:

KITBASE_API_KEY=sk_live_xxx
KITBASE_API_URL=https://api.mycompany.com

Configuration Resolution

Both the SDK key and API base URL are resolved in the same priority order (first match wins):

SettingCLI flagEnvironment variableConfig file key
SDK key--api-keyKITBASE_API_KEYKITBASE_API_KEY
API URL--base-urlKITBASE_API_URLKITBASE_API_URL

If no API URL is configured, it defaults to https://api.kitbase.dev.

Commands

kitbase init

Initialize Kitbase CLI config in the current project.

bash
kitbase init                        # Interactive prompt for SDK key
kitbase init --api-key sk_live_xxx  # Non-interactive
kitbase init --force                # Overwrite existing config

kitbase ionic push

Build and upload your Ionic/Capacitor web app to Kitbase for OTA updates.

bash
# Build and upload
kitbase ionic push

# Skip build, upload existing output
kitbase ionic push --skip-build

# Upload a pre-built zip
kitbase ionic push --file ./build.zip --version 1.0.0

# CI/CD usage (non-interactive)
kitbase ionic push --api-key $KITBASE_API_KEY --skip-build

Flags:

FlagShortDescription
--skip-build-sSkip building, use existing build output
--output-dir-oCustom web build output directory
--file-fPath to an existing zip file to upload
--version-vOverride app version
--api-key-kSDK key for authentication
--base-urlOverride API base URL
--commitOverride git commit hash
--branchOverride git branch name
--messageOverride git commit message

CI/CD

Set KITBASE_API_KEY as an environment variable in your CI pipeline:

yaml
# GitHub Actions
- name: Push to Kitbase
  env:
    KITBASE_API_KEY: ${{ secrets.KITBASE_API_KEY }}
  run: npx @kitbase/cli ionic push --skip-build

For self-hosted instances, also set KITBASE_API_URL:

yaml
- name: Push to Kitbase (self-hosted)
  env:
    KITBASE_API_KEY: ${{ secrets.KITBASE_API_KEY }}
    KITBASE_API_URL: ${{ secrets.KITBASE_API_URL }}
  run: npx @kitbase/cli ionic push --skip-build

Released under the MIT License.