CLI & Binary Distribution
Last updated: 2025-11-30CLI wrapper (kanban-ai on npm)
- The
cli/workspace publishes a thin Node-based wrapper installed askanban-ai. - The wrapper:
- Detects your platform/architecture.
- Resolves which KanbanAI binary version to run (using cached binaries and GitHub Releases).
- Downloads the binary if needed and caches it under:
$XDG_CACHE_HOME/kanban-ai/binary- or
~/.cache/kanban-ai/binaryby default.
- Spawns the resolved binary with any pass-through flags.
- Typical usage:
npx kanban-ai -- --helpnpx kanban-ai --binary-version 0.4.0
CLI flags
--binary-version <semver>– pick a specific KanbanAI release.--no-update-check– skip GitHub lookups and reuse the newest cached binary.--no-auto-open– do not automatically open the browser when the server starts.--cli-version– print the wrapper version (fromcli/package.json) and exit.--version/--help– standard inspection flags; do not launch the server.- Any arguments after
--are passed directly through to the KanbanAI binary.
Server options (forwarded to the binary)
The CLI wrapper forwards these options to the KanbanAI server:--host <host>– set the host to bind to (default:127.0.0.1).--port, -p <port>– set the port to listen on (default:3000).--migrations-dir <path>– set the migrations directory.--no-auto-open– do not automatically open the browser.
Environment variables
KANBANAI_BINARY_VERSION– equivalent to--binary-version.KANBANAI_HOME– overrides the base home directory (defaults to$HOMEfrom the OS).KANBANAI_GITHUB_REPO– overrides the GitHub repo used for releases (defaults toactivadee/kanban-ai).KANBANAI_NO_UPDATE_CHECK– equivalent to--no-update-check.KANBANAI_ASSUME_YES/KANBANAI_ASSUME_NO– automate update prompts for non-interactive usage.XDG_CONFIG_HOME– overrides the config directory (default:~/.config/kanban-ai).XDG_CACHE_HOME– overrides the cache directory (default:~/.cache/kanban-ai).- For higher GitHub rate limits, the wrapper also respects:
GITHUB_TOKEN/GH_TOKEN– used when contacting the GitHub Releases API.
GitHub release lookups
- Release metadata fetched from the GitHub API is now cached on disk under
github-apiin the config directory (e.g.~/.config/kanban-ai/github-apiwhen using the defaults). Cached entries use ETags/If-None-Matchheaders, respect a 30‑minute TTL, and are refreshed transparently when the release data changes. - When the API returns
304 Not Modifiedor requests are made within the TTL, the CLI reads the stored JSON instead of counting against your rate limit. - If a rate-limit error (
403/429) occurs, the CLI logs a warning (the same message suggests providingGITHUB_TOKEN/GH_TOKENfor higher limits), keeps using the cached metadata if available, and continues the flow. Without cached data, it falls back to resolving the release download URL through GitHub’sreleases/downloadredirect, which still succeeds even when the API is temporarily blocked. - The same redirect-based fallback happens when a pinned release lookup (
--binary-version) hits the rate limit: the CLI follows the download redirect for the requested version and proceeds with that asset to avoid an unnecessary failure.
Directory structure
The CLI follows the XDG Base Directory Specification:- Config:
$XDG_CONFIG_HOME/kanban-ai(default:~/.config/kanban-ai) - Cache:
$XDG_CACHE_HOME/kanban-ai(default:~/.cache/kanban-ai) - Binary cache:
$XDG_CACHE_HOME/kanban-ai/binary - GitHub API cache:
$XDG_CONFIG_HOME/kanban-ai/github-api
APPDATA for config and LOCALAPPDATA for cache as conventional locations.
Migration from legacy directory
If you previously used KanbanAI with the legacy.kanbanAI directory (~/.kanbanAI), the CLI includes migration utilities to move your data to the new XDG-compliant locations.
The migration:
- Detects the legacy directory automatically.
- Copies
github-apito the new config location. - Copies
binaryand other cache items to the new cache location. - Does not delete the legacy directory (manual cleanup is required).
Production server entrypoint
- The production server entrypoint lives at
server/src/entry/prod.ts. - At the root,
bun run prod:- Runs the
build:prodpipeline:- Runs
scripts/build-drizzle-migration-bundle.tsto generate the bundled Drizzle migration data consumed at runtime. - Builds the client (
client/dist) and server. - Copies
client/distintoserver/static. - Generates an embedded static bundle.
- Runs
- Starts the compiled production server, which:
- Serves the API under
/api/v1(with a compatibility shim at/api). - Serves the built React app and static assets from the embedded bundle.
- Serves the API under
- Runs the
- The prod entry supports flags when run directly:
bun run server/src/entry/prod.ts --help– print usage.--host <host>– overrideHOST(default127.0.0.1).--port <port>– overridePORT(default3000).--migrations-dir <path>– overrideKANBANAI_MIGRATIONS_DIR.--no-auto-open– do not automatically open the browser.
Environment configuration
- Server configuration is derived from environment variables with sensible defaults:
HOST– interface to bind (defaults to127.0.0.1).PORT– port to listen on (defaults to3000).DATABASE_URL– SQLite database path (e.g.,sqlite:/absolute/path/to/kanban.db); defaults to an OS data directory such as~/.local/share/kanbanai/kanban.db.KANBANAI_MIGRATIONS_DIR– directory containing Drizzle migrations (a folder of ordered.sqlfiles, e.g. a copy ofserver/drizzle); used when not relying solely on the embedded bundle.KANBANAI_STATIC_DIR– optional override for static assets (useful for custom branding or externalclient/dist).LOG_LEVEL–debug|info|warn|error(defaultinfo).KANBANAI_DEBUG/DEBUG– enable additional per-request traces when set to truthy values or appropriate namespaces.
- Example:
Binary builds
- Self-contained binaries are produced via:
bun run build:binary
- This pipeline:
- Runs the production build (
build:prod). - Uses
bun build --compileto emit executables for common platforms:dist/kanban-ai-linux-x64dist/kanban-ai-linux-arm64dist/kanban-ai-darwin-arm64dist/kanban-ai-win-x64.exe
- Runs the production build (
- Each binary:
- Embeds the Drizzle migration bundle (the generated
server/drizzle/migration-data.generated.ts) and static assets by default. - Serves the API and React UI on a single origin (respecting
HOST,PORT,DATABASE_URL,KANBANAI_MIGRATIONS_DIR, andKANBANAI_STATIC_DIR).
- Embeds the Drizzle migration bundle (the generated
- In most self-hosted setups:
- The CLI wrapper downloads and runs the appropriate binary.
- You configure environment variables exactly as you would for
bun run prod.
Release automation
- Semantic-release runs on
mainvia.github/workflows/release.yml, which is now triggered manually (workflow_dispatch) rather than by push events; use the GitHub Actions tab orgh workflow run release.ymlto start it. - The job still versions, tags, publishes the CLI to npm, and creates GitHub Releases with binaries attached.
- PR titles must follow Conventional Commits;
.github/workflows/semantic-pr.ymlenforces this check (require it in branch protection for effect). - Release steps: analyze commits → bump versions (
package.json,cli/package.json) → updateCHANGELOG.md→ build binaries withbun run build:binary→ publish npm fromcli/→ uploaddist/kanban-ai-*to the GitHub release. - npm publish uses npm Trusted Publishing (OIDC) — no long-lived
NPM_TOKENrequired; workflow hasid-token: writeand runs withNPM_CONFIG_PROVENANCE=true. - Existing manual jobs (
release-binary.yml,release-cli.yml) remain as fallbacks.