kinhin logo

kinhin

0

by Rabin Apps

Skills for installing, configuring, operating and troubleshooting kinhin, and for making product videos with it, the autoscaling pool of ephemeral CI runners on an Apple Silicon Mac.

9 skills

kinhin-add-forge-account

Connect an existing kinhin install to a CI forge account - GitHub, Gitea, Forgejo or GitLab CE. Use when the user wants kinhin to serve jobs from another repo, org, project or forge.

# Add a forge account One fleet can serve several forges at once. Run `kinhin help` for the current flags. **Beta status:** GitHub, Gitea, Forgejo and GitLab CE are supported. Buildkite, Azure DevOps and Bitbucket are planned and not supported yet: tell the user so instead of setting one up. ## Steps 1. Pick a name (lowercase letters, digits, `-`, `_`) and the scope (see the `kinhin-configure` skill for the scope shape per forge). 2. Add the account: ```bash kinhin auth add NAME --<github|gitlab|gitea|forgejo> --scope SCOPE [--instance URL] ``` `--instance` is required for Gitea, Forgejo and GitLab CE, and optional for GitHub (GHES or GHEC hosts). The command prints the token permissions that forge needs. 3. Store the token: `kinhin auth set --account NAME`. Do not paste tokens into chat, and avoid `--token X` (pipe it with `--token-stdin` if a script must). 4. `kinhin config validate`, then `kinhin auth status --account NAME`. A good check means the token reaches the forge and the scope is valid. 5. Add the job targeting in the repo's workflow or pipeline (`runs-on` labels, or GitLab tags; see the `kinhin-configure` skill). The job must request every label on the account. 6. If the image was built before this account existed, re-run `kinhin image prepare`. Runner agents are baked in only for forges that have a token. 7. Verify with `kinhin doctor`, then trigger a job and watch `kinhin watch`. ## Caveats - Self-hosted forges need `https://` unless loopback or `allow_insecure_http: true`. - A repo `.kinhin/config.yml` (or `.kinhin.yml`) is honored only on GitHub, Gitea/Forgejo and GitLab. - Host mode needs `consent: true` on the route. - Remove an account with `kinhin auth remove NAME`. `kinhin auth list` shows what is connected. ## More - [Forge guide](https://github.com/RabinApps/kinhin/blob/main/docs/forges.md) - [Forge API notes](https://github.com/RabinApps/kinhin/blob/main/docs/forges/README.md)

kinhin-configure

Edit or write a kinhin config.yaml safely - accounts per forge, labels, capacity, runtimes and routes, token scopes. Use when the user wants to connect a forge, change labels, runners or VM sizing, or fix a config that fails validation.

# Configure kinhin **Beta status:** GitHub, Gitea, Forgejo and GitLab CE are supported. Gitea, Forgejo and GitLab CE have run real jobs on every runtime; GitHub on Tart macOS VMs and apple/container. Buildkite, Azure DevOps and Bitbucket are planned. ## Rules - The config is `~/Library/Application Support/Kinhin/config.yaml` (capital K). `kinhin config init` writes a commented starter. Edits made through the CLI or app preserve comments. Routes, projects and labels reload live in a running daemon. - **Never put tokens in the config.** Tokens live in the Keychain: `kinhin auth set [--account NAME]`. - Every forge goes under `accounts:`. The old top-level `repo:`, `gitea:` and `forgejo:` keys are rejected. - After every edit run `kinhin config validate`. It exits 3 when the config is invalid. - Prefer `kinhin help` and `kinhin config init` output over this page if they disagree. - **Public repository?** Fork pull requests must not reach the fleet: follow `docs/open-source.md` (runner group without public repos, fork PRs routed to hosted runners, approval for external contributors). For such a fleet set `tart_softnet: true` and `runners_per_vm: 1`, keep `share_cache` and `repo_file` off, scope the account to `owner/name`, and never add a `host` route. ## Account entries Account names use lowercase letters, digits, `-` and `_`. `github`, `gitea` and `forgejo` are the primary names. ```yaml accounts: # GitHub: scope is owner/repo, or a bare org name - {name: github, forge: github, scope: "owner/repo"} # Gitea or Forgejo (forge: forgejo for Forgejo) - {name: gitea, forge: gitea, instance: "https://gitea.example.com", scope: "owner/name", labels: ["macos:host"]} # GitLab CE (16.0+). A job's tags must include every label. - {name: gitlab, forge: gitlab, instance: "https://gitlab.example.com", scope: "group/project", labels: ["macos"]} ``` Buildkite, Azure DevOps and Bitbucket are planned and not supported yet; do not configure them. Self-hosted Gitea, Forgejo and GitLab must use `https://` unless the host is loopback or the account sets `allow_insecure_http: true`. ## Token scopes | Forge | Token needs | | --- | --- | | GitHub | PAT with `repo` (org runner-admin for an org scope) | | Gitea / Forgejo | Access token with runner-management rights | | GitLab | `create_runner`, `manage_runner`, `read_api` or `api`; Maintainer on a project or Owner on a group | `kinhin auth add NAME --<forge> --scope S` prints the exact requirements for that forge. ## How a job reaches the fleet | Forge | Job targeting | | --- | --- | | GitHub, Gitea, Forgejo | `runs-on:` labels | | GitLab | Runner tags | A job must request all of the account's labels (default `["self-hosted","macos","arm64"]`). A repo `.kinhin/config.yml` (or `.kinhin.yml`) is only honored on GitHub, Gitea/Forgejo and GitLab. ## Capacity and VM settings | Key | Default / notes | | --- | --- | | `min_runners` / `max_runners` | 0 / 2. `min_runners` is fleet-wide, counts busy runners and fills `runtimes.default` | | `min_idle` | 0. Idle registered runners kept per pool or image: on `container:`, `docker:`, each `images:` entry; `image_min_idle` for `image:` | | `container.docker` / `container.flags` | false / []. Docker inside each Apple container runner (re-bake with `kinhin image prepare --container`), pulling Docker Hub images through kinhin's cache container `registry-cache-kinhin`; `docker: { cache: false }` keeps Docker without the cache (on `container:` or a pool); `docker: { build_cache: true }` keeps each runner's /var/lib/docker in a volume between jobs (trusted pools only); `container.registry_cache_ttl_hours` (336, `0` = never expire) sets the cache's TTL; extra `container run` arguments, one list element each, never `--cpus`/`-c`, `--memory`/`-m`, `--name`, `--rm`, `--detach`/`-d`, `--platform`, `--arch`/`-a`, `--os`, `--help`/`-h`, `--version` or a bare `--` | | `container.platform` | `linux/arm64`. `linux/amd64` runs x86_64 runners under Rosetta, registered with `x64` instead of `arm64`; also per pool. Re-bake with `kinhin image prepare --container` after changing it. With `docker: true`, builds go through the `kinhin` buildx builder (`BUILDX_BUILDER`), since dockerd's built-in builder fails under Rosetta | | `container.pools` | none. Named Linux pools (`NAME: {image, labels, cpus, memory_gb, min_idle, docker, flags, max, platform}`; top-level `container:` keys are the defaults). A job goes to the pool whose labels it carries, `kinhin-container-NAME` targets one; pools share Apple container's CPU and RAM. Bake with `kinhin image prepare --container --pool NAME` or `--all` | | `enabled` | true. On `container:`, a `container.pools` entry, `docker:` and `runtimes.tart.enabled`: false keeps the pool's settings but takes it out of routing and scheduling (running instances drain). The default pool and pools a route names cannot be disabled | | `runners_per_vm` | 1 to 8. Packs several jobs into one VM. | | `poll_interval` | 20 seconds, minimum 5 | | `vm` | `cpu: 4`, `memory_gb: 8`, `ephemeral: true` | | `reserve` | `cpu: 2`, `memory_gb: 4`, `disk_gb: 10` left for the host | | `image` / `base_image` | `tahoe-base`, and a Tart image ref (optionally `@sha256:` pinned) or local VM name | | `auto_resume` | false | Capacity is `min(max_runners, (cores - reserve.cpu)/vm.cpu, (RAM - reserve.memory_gb)/vm.memory_gb, free_disk/disk_per_vm)`. `disk_per_vm` is 50 GB for Tart and 8 GB for container slots. macOS allows only two macOS VMs per Mac. `kinhin doctor` prints the cap and which constraint binds. ## Runtimes and routes Runtimes: `tart` (default), `appleContainer`, `docker`, `host`. Route precedence: workflow route, repo route, `runs-on:` label, default. ```yaml runtimes: default: tart budget: {tart: 0.6, appleContainer: 0.4} routes: - {pattern: "acme/api", runtime: appleContainer} - {pattern: "acme/scripts", runtime: host, consent: true} ``` Or use the CLI: `kinhin runtimes route add <pattern> <tart|appleContainer|docker|host> [--consent]`. To move **one workflow** to a runtime (editing its `runs-on:` and reconciling the route automatically), use the `kinhin-route-workflow` skill — it also decides *which* runtime fits the workflow. Host mode runs jobs unisolated on the Mac. It needs `consent: true`, `default: host` is rejected, every account must be scoped to one `owner/name`, it works for GitHub, Gitea and Forgejo only, and workflows opt in with `runs-on: [kinhin-host]` after `kinhin setup repair host-agent`. Warn the user before suggesting it for untrusted code. ## Alerts `alerts:` pushes a message to webhooks when a fleet problem is raised or clears. Off by default. `alerts.webhooks` is a list of `{name, url, format, headers_keychain, min_severity, events, notify_on_resolve}`; `format` is `generic`, `slack`, `discord` or `ntfy`, `url` is https (http only for localhost) and `events` picks from `disk`, `credentials`, `queue`, `spawn-backoff`, `orphans`, `startup` (omit for all). `alerts.enabled: true` needs at least one webhook; the old single `webhook:` still works as a webhook named `default`. Store a token with `kinhin alerts set-token NAME`, check it with `kinhin alerts test [--webhook NAME]`. Details: [Alerts](https://github.com/RabinApps/kinhin/blob/main/docs/alerts.md). ## Common validation failures - Old top-level `repo:`, `gitea:` or `forgejo:` key: move it under `accounts:`. - `default: host` in `runtimes`: pick `tart`, `appleContainer` or `docker`. - `http://` instance on a self-hosted forge: use `https://` or set `allow_insecure_http: true` deliberately. - Image names starting with `kinhin-` or `orchard-` are reserved. ## More - [Forge setup](https://github.com/RabinApps/kinhin/blob/main/docs/forges.md) - [Runtimes](https://github.com/RabinApps/kinhin/blob/main/docs/runtimes.md) - [Scaling](https://github.com/RabinApps/kinhin/blob/main/docs/scaling.md)

kinhin-images-toolchains

Build and manage kinhin VM and container images and per-project toolchains - image prepare, base_image pinning, Xcode images, .kinhin.yml, toolchains detect, Linux runtimes. Use when the user needs Xcode, specific tool versions, a Linux runner, or image maintenance.

# Images and toolchains **Beta status:** the Tart macOS and Apple container paths have run for real. The other Linux runtimes (Docker, Tart Linux) are unit-tested against fakes only. Run `kinhin help image` or `kinhin help toolchains` if a flag here is rejected. ## Images | Task | Command | | --- | --- | | Build the base image | `kinhin image prepare [--provision-script F]` | | Build a named extra image | `kinhin image prepare --image NAME` (or `--all`) | | Pre-bake a project image | `kinhin image prepare --project owner/name [--ref R]` | | Apple container image | `kinhin image prepare --container [--target NAME]` | | Docker image | `kinhin image prepare --docker [--platform linux/amd64] [--target NAME]` | | Tart Linux VM | `kinhin image prepare --linux --target NAME [--iso F] [--from [ref]]`, then `--source NAME` to bake the agents in | | Pin an image by digest | `kinhin image digest <registry>/<repo>:<tag>` | - `image prepare` is slow and large (about 40 to 60 GB for macOS). Re-run it after upgrading kinhin, and after adding an account for a forge whose runner agent is not yet baked in (agents are baked in only if a token for that forge exists). - `base_image` takes a Tart ref (optionally `@sha256:` pinned) or a local VM name. `kinhin doctor` warns on mutable tags, so pin with `image digest`. - `provision_script` is a host script baked into the image. It is the version pin. A failed run keeps the previous image. - Extra images go under `images:` (`name`, `base_image`). Names must not start with `kinhin-` or `orchard-`. - **Xcode is never a toolchain.** Use a Cirrus `-xcode` base image, for example `ghcr.io/cirruslabs/macos-tahoe-xcode:latest`: ```yaml images: [{name: xcode, base_image: "ghcr.io/cirruslabs/macos-tahoe-xcode:latest"}] ``` then `kinhin image prepare --image xcode`. ## Toolchains `kinhin toolchains` shows the catalog. Stacks: flutter, expo, react-native, vercel, cloudflare. Resolution order for a job: `.kinhin/config.yml` (or the older `.kinhin.yml`) at the job's ref, then `projects[].toolchains` in the config, then the plain base image. ```yaml projects: - {pattern: "acme/api", toolchains: {specs: ["go@1.23.4","node@22"], stacks: ["flutter@3.24.0"]}, share_cache: false} - {pattern: "acme/*", repo_file: true} # read .kinhin/config.yml from the repo ``` - Generate a repo file: `kinhin toolchains detect [path] [--json] [--write] [--force]` in a checkout. - A repo `.kinhin/config.yml` (or `.kinhin.yml`, read when the new one is absent) accepts only catalog `toolchains.specs` and `stacks`, capped at 16 KB. It is honored only on GitHub, Gitea/Forgejo and GitLab. Other forges use `projects[].toolchains`. - Per-job install, and the only option on container and Docker runtimes: `run: kinhin-toolchain install node@22 pnpm`. - Housekeeping: `kinhin toolchains list-images`, `kinhin toolchains prune [--dry-run]`. See every installed image (tart, container, docker) with `kinhin image list [--json]` — `--runtime tart|container|docker` narrows it to one — and remove one by name with `kinhin image delete <name> [--yes]` — it reports without `--yes` and refuses images runners are using. Sweep the whole machine in one confirmed pass with `kinhin image prune [--yes]` — stale derived records plus unused local images; configured images, the `base_image` and anything in use are never touched. The same numbers come to you without asking: `kinhin doctor` reports per-runtime totals (`imageTotalGB`) and the reclaimable sweep (`imagePrune`), and the app's Diagnostics tab shows both rows. Config `toolchain_cache` sets `auto_prune`, `max_age_days` (30) and `max_gb` (50). `max_project_images` defaults to 8. ## Linux and host runtimes | Runtime | Setup | Workflow opt-in | | --- | --- | --- | | Apple container | `brew install container && container system start`, `image prepare --container`, a `container:` block, a route | `runs-on: [kinhin-container]` | | Docker | Install and start Docker yourself (kinhin never starts it), `image prepare --docker`, a `docker:` block | `runs-on: [kinhin-docker]` | | Tart Linux VM | `image prepare --linux ...`, then `--source NAME` to bake the agents in; a Linux-named image strips the fleet's `macos` label automatically so macOS and Linux Tart VMs can share one fleet | labels | | Host (unisolated) | `kinhin setup repair host-agent`, route with `consent: true` | `runs-on: [kinhin-host]` | Route with `kinhin runtimes route add acme/api appleContainer`. Pass `--target <name>` to the container and Docker prepare commands when routing to a named image. Check readiness with `kinhin setup status` and `kinhin runtimes`. Host mode runs jobs directly on the Mac, so warn the user before enabling it. ## More - [Toolchains](https://github.com/RabinApps/kinhin/blob/main/docs/toolchains.md) - [Runtimes](https://github.com/RabinApps/kinhin/blob/main/docs/runtimes.md)

kinhin-install

Install kinhin and its prerequisites (Tart) on an Apple Silicon Mac, locally or on a rented or remote Mac, and run the first-time setup sequence. Use when the user wants to install, set up or bootstrap kinhin, or get a new Mac serving CI jobs.

# Install kinhin kinhin turns an Apple Silicon Mac into an autoscaling pool of ephemeral self-hosted CI runners: one fresh VM or container per job, deleted afterwards. This skill covers install and first run. **Beta status (tell the user):** GitHub, Gitea, Forgejo and GitLab CE are supported. Gitea, Forgejo and GitLab CE have run real jobs on every runtime; GitHub on Tart macOS VMs and apple/container. Buildkite, Azure DevOps and Bitbucket are planned. Findings are welcome as GitHub issues ("Forge report"). ## Requirements - Apple Silicon and macOS 15 or newer (Intel is unsupported). - About 60 GB free disk and at least 16 GB RAM. An 8 GB Mac should use Linux containers only. - A forge token (see the `kinhin-configure` skill). - Tart, for macOS VMs. Check the machine first: `uname -m` must print `arm64`, and `sw_vers -productVersion` must be 15 or newer. ## 1. Install Tart ```bash kinhin setup repair tart ``` (The `kinhin` CLI comes from step 2, so install kinhin first if the command is missing.) If `kinhin doctor` later reports `tart: INSTALLED BUT KILLED ON LAUNCH`, the bottle is un-notarized; `kinhin doctor` prints the exact rollback commands, and the manual brew equivalents are in `docs/install.md#installing-tart`. ## 2. Install kinhin ```bash curl -fsSL https://github.com/RabinApps/kinhin/releases/latest/download/install.sh | bash ``` - Pin a version: `... | bash -s -- v0.1.0` (use a real release tag). - Air-gapped: download `scripts/install.sh` and the DMG, then `bash install.sh /path/to/kinhin-<version>-arm64.dmg`. - The installer verifies the DMG against the release `checksums.txt` and the code signature, copies `kinhin.app` to `/Applications`, and symlinks the `kinhin` CLI into the first writable of `/opt/homebrew/bin`, `/usr/local/bin`, `~/.local/bin`. Overrides: `REPO`, `INSTALL_DIR`, `BIN_DIR`. - Old or locally built copies may need `xattr -cr /Applications/kinhin.app`. Official releases are notarized. ### Optional: a Linux runtime Only needed for Linux jobs. Use apple/container first; choose Docker only if the user already runs a Docker provider. ```bash kinhin setup repair container # apple/container (recommended): CLI + service, with the default Linux kernel kinhin setup repair docker # Docker: Docker Desktop by default; --method orbstack or --method colima ``` The manual equivalent of the apple/container repair is `brew install container` followed by `container system start --enable-kernel-install`. The `--enable-kernel-install` flag is required; without it `container run` fails. Details: `docs/install.md#installing-a-linux-runtime`. ## 3. First-run sequence Run these in order, stopping to fix any failure before the next step: 1. `kinhin config init` writes a commented starter config to `~/Library/Application Support/Kinhin/config.yaml`. 2. Edit `accounts:` and `labels` (use the `kinhin-configure` skill), then `kinhin config validate`. 3. `kinhin auth set` stores the token in the Keychain. Never put tokens in the config or on the command line if you can avoid it. `--token-stdin` reads it from stdin; `--token X` still works but prints a warning. 4. `kinhin doctor` checks Tart, disk, the token and the capacity cap. 5. `kinhin image prepare` builds the base image. It runs once, is slow and uses roughly 40 to 60 GB. 6. `kinhin start` runs in the foreground. `kinhin daemon install` installs a LaunchAgent that survives reboots. 7. Trigger a workflow with `runs-on: [self-hosted, macos, arm64]` and watch with `kinhin watch` or `kinhin status`. ## Second Mac with the same setup On the Mac that already works: `kinhin config export kinhin-config.yaml`. On the new Mac, after installing: `kinhin config import kinhin-config.yaml`, then store each token it lists with `kinhin auth set --account NAME`, then `kinhin setup status` for the images to prepare. Tokens and images are never copied. Over SSH in one step: `kinhin config export | ssh other-mac kinhin config import - --yes` (ask before `--yes` replaces an existing config). ## Rented or remote Mac From your own machine: ```bash ssh admin@host 'bash -s' < scripts/bootstrap-rented-mac.sh ``` The script is idempotent: it checks arm64 and macOS 15+, installs Tart and kinhin if missing, runs `kinhin config init` if there is no config, and prints next steps. It never touches a token. Then, on the Mac: - Run `security unlock-keychain ~/Library/Keychains/login.keychain-db` in the SSH session, or the Keychain stays locked. - Enable automatic login and keep FileVault off, because the LaunchAgent needs a GUI session. - Run `kinhin daemon install` from a VNC or Screen Sharing session. - Use one customer per Mac. Never pass tokens as arguments or environment variables. ## Update and uninstall - Update: re-run the install command (the CLI has no update command), then re-run `kinhin image prepare`. - Uninstall, in this order: stop the fleet, `kinhin cleanup --all --yes`, `kinhin daemon uninstall`, then `bash install.sh --uninstall`. The config and Keychain token are kept. Delete the config directory and the Keychain entries by hand if the user wants them gone. ## More - [Install guide](https://github.com/RabinApps/kinhin/blob/main/docs/install.md) - [Rented Mac guide](https://github.com/RabinApps/kinhin/blob/main/docs/rented-mac.md) - [Hardware sizing](https://github.com/RabinApps/kinhin/blob/main/docs/hardware.md) - If a command here fails or differs, trust `kinhin help` and `kinhin <command> --help` over this page.

kinhin-mobile-fastlane

Set up fastlane store releases (TestFlight, App Store, Google Play) for iOS, Android, Flutter, React Native, Expo, Capacitor, Kotlin Multiplatform or .NET MAUI projects, and run them from a kinhin runner - `kinhin mobile init` scaffolding, lanes, App Store Connect API keys, match, Play service accounts, the mobile-release workflow, and Expo EAS. Use when the user wants to ship a mobile app, automate TestFlight or Play uploads, or fix a failing fastlane lane.

# Mobile releases with fastlane The full reference is `docs/mobile-fastlane.md` in the kinhin repo. Read it for secrets, lanes and framework notes. Use this skill to pick the right path and run the steps. ## Pick the path 1. **Expo** (`"expo"` in `package.json`): use EAS Build and EAS Submit by default. `kinhin mobile init` writes only `eas.json` for Expo. For fastlane, run `npx expo prebuild` first, then scaffold as React Native. 2. **Capacitor / Ionic** (`"@capacitor/core"` in `package.json`): fastlane goes in `ios/` and `android/`. The CI jobs run `npx cap sync`. Capacitor keeps its Xcode project in `ios/App/`, so the iOS lane needs `IOS_PROJECT=App/App.xcodeproj` (the CI job sets it). Capacitor 8 needs Java 21 for Android. 3. **Kotlin Multiplatform** (an `iosApp/` folder with the multiplatform Gradle plugin): fastlane goes in `iosApp/` and `androidApp/`. The Android lane needs `ANDROID_GRADLE_DIR=..` and `ANDROID_GRADLE_MODULE=androidApp`. 4. **.NET MAUI** (a `.csproj` with `<UseMaui>true</UseMaui>`, at the root or one folder down): fastlane goes in `ios/` and `android/`, and the lanes run `dotnet publish` (`MAUI_PROJECT`). The iOS signing identity and profile come from `MAUI_CODESIGN_KEY` and `MAUI_PROVISIONING_PROFILE`. 5. **Flutter, React Native (bare), native iOS or Android**: scaffold with fastlane. ## Scaffold Run this from any machine with kinhin installed. It never overwrites existing files unless `--force` is given: ```bash kinhin mobile init --dry-run /path/to/app kinhin mobile init /path/to/app ``` Override detection with `--framework ios|android|flutter|react-native|expo|capacitor|kmp|maui|native` when the layout is unusual. Then in the project: ```bash bundle install # From the folder that holds fastlane/ (ios/ or android/ for Flutter and React Native) cd ios && bundle exec fastlane lanes ``` ## Before the first upload - Create an App Store Connect **team** API key. The `.p8` downloads once only. Store it as the `ASC_KEY_P8` secret. - Set up `match` once, from a trusted machine: `MATCH_READONLY=false bundle exec fastlane match appstore`. Keep `MATCH_PASSWORD` in secrets. - Create a Play service account, invite it in Play Console with release permissions, and store its JSON as `PLAY_SERVICE_ACCOUNT_JSON`. - Create the upload keystore and store it base64-encoded as `ANDROID_KEYSTORE_BASE64`. The workflow asks for `runs-on: [self-hosted, kinhin-xcode]`. Change the label if the pool uses another name. ## Run Trigger the `mobile-release` workflow manually with `lane: beta` first. Use `release` only after a `beta` build has processed. Confirm the build appears in TestFlight or the Play internal track before going further. ## Troubleshooting - **`match` fails on CI with no matching profile**: the template runs `match` readonly, so CI never creates certificates. Run `MATCH_READONLY=false bundle exec fastlane match appstore` once from a trusted machine to create them, then re-run the workflow. - **`upload_to_play_store` fails with 403**: the service account lacks release permissions for this app in Play Console. - **Flutter `ipa` build fails**: it needs a distribution certificate, not a development one. - **Expo local build ignores `fastlane` in `eas.json`**: this is expected. Local builds ignore it. - **`Missing environment variables: ...`**: the lane checks its secrets first and stops before any store call. Set the listed names in CI. - **`No release AAB at ...`**: Gradle did not produce the bundle. Check `AAB_PATH` if another step builds it. - **`bundler could not find compatible versions for gem "ruby"`**: fastlane needs Ruby 3.2+ (the `~> 2.240` pin resolves to 2.241). The macOS system Ruby is 2.6. Use Ruby 3.2 or newer locally, and the workflow's Homebrew Ruby step on CI. - Gradle prints secrets: the template sets `print_command: false`. Keep it that way.

kinhin-operate

Run and monitor a kinhin fleet - start, stop, pause, status, logs, pipeline view, daemon, cleanup, the healing journal, scaling and capacity. Use when the user asks about fleet status, what kinhin fixed on its own, scaling runners, running kinhin as a daemon, or freeing disk.

# Operate kinhin Run `kinhin help` for the full, current command list. If it disagrees with this page, trust it. ## Exit codes Scripts can branch on them: `0` success, `1` general, `2` usage (bad command line), `3` config, `4` runtime, `5` auth. `auth status --json` and `setup status` exit 1 until setup is ready, and `doctor --json` reports `ready=false`. ## Running the fleet | Command | Use | | --- | --- | | `kinhin start` | Run in the foreground | | `kinhin daemon` | Headless, foreground | | `kinhin daemon install` / `uninstall` | LaunchAgent (`com.kinhin.daemon`), survives reboots | | `kinhin pause` / `resume` / `stop` | Control a running fleet | | `kinhin status [--json]` | Fleet state. JSON includes `daemonRunning`, `paused`, `autoResume`, `pollInterval`, `queueAgeSeconds`. | | `kinhin watch` | Live stream (prose only, no JSON) | | `kinhin logs [-n N]` | Recent log lines. The log file is `~/Library/Application Support/Kinhin/logs/kinhin.log`. | | `kinhin jobs [--running\|--queued] [--forge NAME] [--json]` | Running and queued jobs and the forge each came from; the queue is oldest-created first. Needs the daemon. | | `kinhin pipeline [VM] [--job NAME\|ID] [--watch] [--json]` | Job and step view. Add `--step N\|NAME` or `--log [--follow]`. Needs the daemon. | | `kinhin runtimes [--json] [--no-health]` | Runtime availability and health | | `kinhin heal [--json]` | What the healing agent fixed on its own, fixes waiting for approval, problems only the user can fix. Exits 1 while something waits on the user. Needs the daemon. | `--json` is supported on `status`, `doctor`, `setup status`, `auth status`, `auth list`, `runtimes`, `pipeline`, `jobs`, `heal`, `workflow test`, `workflow route`, `toolchains detect`, `config validate` and `cleanup` (report-only; it refuses `--yes`). Stdout carries only command output, so JSON stays parseable. ## Scaling - Tune `max_runners`, `runners_per_vm`, `vm.cpu`, `vm.memory_gb` and `reserve` in the config, then `kinhin config validate` and `kinhin doctor`. Doctor prints the capacity cap, the binding constraint and each runtime's image disk usage (`imageTotalGB`; `imagePrune` names the reclaimable space and the command when unused images are wasting disk). - macOS allows two concurrent macOS VMs per Mac. Beyond that, raise `runners_per_vm` (1 to 8) or add Macs. - For several Macs, give each its own label (for example `mac-a`, `mac-b`). Nothing coordinates between Macs. - Rough sizing: 16 GB gives 1 to 2 VMs of 3 to 4 CPUs and 6 GB; 24 GB gives 2 x (4 CPU / 8 GB); 32 GB gives 2 x (4 to 6 CPU / 10 to 12 GB). See the hardware guide. ## Cleanup `kinhin cleanup [--vms] [--image] [--cache] [--all] [--yes] [--json]` - Without `--yes` it only reports what it would remove. Show the report, then ask before re-running with `--yes`. - `--json` is that report as a machine document (empty, targets, would-remove lists, summary); it refuses `--yes`. - Stop the fleet first (`kinhin stop`), or it may delete things in use. - `--all` removes VMs, images and caches. Uninstall order: stop, `cleanup --all --yes`, `daemon uninstall`, then `bash install.sh --uninstall`. ## Reset `kinhin reset [--scope config|daemon|all] [--yes]` - Wipes local state irreversibly: `config` = config file + tokens + logs + state + app preferences; `daemon` = stops the fleet and removes the LaunchAgent; `all` = everything, including VMs, images and the toolchain cache. There is no undo and no backup. - Never run `kinhin reset` without the user explicitly asking for it, and never add `--yes` yourself: interactive runs confirm twice (plan + typed `reset`), and scripts must opt in deliberately. ## Safety - Do not run `cleanup --yes`, `stop` or `daemon uninstall` on a fleet serving live jobs without confirming with the user. - Never run `kinhin heal approve` or `kinhin heal dismiss` yourself: show the entry and let the user decide. A fix waiting for approval can prune images or reinstall a runtime. - Untrusted pull requests: keep `tart_softnet: true`, leave `share_cache` off (it is always off for fork PRs), and avoid host mode. `kinhin doctor` reports the isolation posture. ## More - [Scaling](https://github.com/RabinApps/kinhin/blob/main/docs/scaling.md) - [Hardware](https://github.com/RabinApps/kinhin/blob/main/docs/hardware.md) - [Security](https://github.com/RabinApps/kinhin/blob/main/docs/security.md)

kinhin-route-workflow

Choose the right kinhin runtime for a workflow (macOS tart vs appleContainer vs Docker vs tart Linux vs host) and route it with one command, `kinhin workflow route`. Use when the user wants a workflow or CI job to run on a different runtime — appcontainer, a Linux container, Docker, a Linux VM, host, or "somewhere cheaper".

# Route a workflow to a runtime **Beta status:** GitHub, Gitea, Forgejo and GitLab CE are supported. Gitea, Forgejo and GitLab CE have run real jobs on every runtime; GitHub on Tart macOS VMs and apple/container. Buildkite, Azure DevOps and Bitbucket are planned. ## Rules - **One command does the work:** `kinhin workflow route <FILE|workflow name> <tart|appleContainer|docker|host> [--job NAME] [--dry-run] [--json] [--consent]`. It edits the workflow's `runs-on:` comment-preservingly and, *only when routing precedence needs it*, writes an `owner/repo@Workflow` route through the validated config editor; a running daemon reloads it live. Never hand-edit `runs-on:` when this command can do it. - **Always `--dry-run` first** when the change wasn't explicitly approved, then report the before/after and `git diff <file>` after applying. - "appcontainer" or "apple container" means **`appleContainer`** — not Docker, and not the job-level `container:` key (that runs the job's steps in a container *inside* the VM, it doesn't choose the pool). - The command refuses what it can't safely edit: `${{ … }}` expressions, `{group:, labels:}` mappings, and reusable-workflow (`uses:`) jobs. Those route through config instead: `kinhin runtimes route add <owner/repo>@<Workflow> <runtime>`. - GitLab jobs target by tags, not `runs-on:` — the command refuses them and points at `kinhin runtimes route add`. Label forges: GitHub, Gitea, Forgejo. - On Gitea and Forgejo, workflow routes (`owner/repo@Workflow`) do not match (their APIs don't name a job's workflow); use a repo route or the `runs-on:` marker instead. ## Decide the runtime, in order 1. **Read the workflow's steps, not just its name.** - `xcodebuild`, `fastlane`, `codesign`, Keychain, `.app`/`.dmg` → **must be macOS tart VMs** (no Linux runtime can run these). - `apt-get`, Debian-only binaries, glibc-only toolchains → **Linux** — continue to step 2. - An `x86_64`/`amd64` matrix requirement → **Docker** is the only Linux runtime with amd64 (emulated; JIT/Go/ Java/.NET caveats apply). - Nothing architecture- or OS-specific → any runtime; recommend from evidence (step 3). 2. **If the user said "appcontainer" / "apple container" explicitly** → `appleContainer`, don't re-ask; just verify setup (step 3) and apply. If they only said "a Linux container" or "somewhere cheaper", ask which Linux type, quoting `docs/runtimes.md#choosing-a-linux-runtime`: - **apple/container** — the docs' default for Linux CI: VM-grade isolation, no daemon, high density, 8 GB per instance; cons: Debian/Ubuntu-based image only, no amd64; live-tested (beta). - **Docker** — adopt free if Docker Desktop/OrbStack/colima already runs; highest density; amd64 via Rosetta/QEMU (JIT caveats); shared kernel. - **Tart Linux VM** — full control: your distro, kernel modules, long `sudo`; cons: lowest density, 50 GB per instance, needs an ISO or published image. 3. **Recommend from machine-readable state**, never from guesses: - `kinhin runtimes --json` → `pools` (configured + labels), `routes`, `defaultRuntime`, `health`, and `availability` (what's installed on this Mac: `ready` / `missing:<tool>` / `broken:<reason>`). - `kinhin doctor --json` → prerequisites and whether the runtime is prepared. The recommended option must be *available on this Mac* (`availability`) and its pool configured (`pools`). If two options genuinely fit, present the trade-off and recommend one before writing anything. 4. **Apply:** ```bash kinhin workflow route "<file>" <runtime> --dry-run # show the plan kinhin workflow route "<file>" <runtime> # apply git diff <file> # report the change kinhin workflow test --list # verify: jobs now show their runs-on: ``` Report per-job before/after, any route the command reconciled, and the `git diff`. `--json` gives the same as a machine-readable object (`jobs`, `route`, `dryRun`). ## Traps | Trap | What happens / what to do | | --- | --- | | Precedence is **workflow route → repo route → `runs-on:` marker → default** | A repo route *outranks* the marker: if `owner/repo` is routed elsewhere, a marker-only edit is ignored and the job queues forever. `workflow route` detects this and writes the overriding workflow route itself — never "fix" it by editing labels by hand. | | Fleet defaults to containers (a `container:` section with no `runtimes:` section) | Every unrouted job already lands on `appleContainer`. Routing *to tart* needs a config route; the command writes it (tart has no marker). | | tart has **no marker** | `runs-on:` alone can only send jobs *away* from the default onto marker pools (`kinhin-container`, `kinhin-docker`, `kinhin-host`) — tart targeting off the default is route-only. The command reconciles this. | | Matrix jobs use `runs-on: ${{ matrix.os }}` | Refused by the editor (it's resolved by the forge at queue time). Route via `kinhin runtimes route add <owner/repo>@<Workflow> <runtime>`. | | Reusable-workflow jobs (`uses:` with no `runs-on:`) | Refused — writing `runs-on:` would invalidate the job. Route via config. | | A GitHub-hosted label (`ubuntu-latest`) in the list | Runners AND-match every label, so keeping it would strand the job. The command replaces unmatchable labels with the target pool's exact labels. | | Org-wide account scope (`scope: acme`) | Route patterns need `owner/repo`. If precedence needs a route the command refuses with the exact `kinhin runtimes route add <owner/repo>@<Workflow> <runtime>` to run first. | | `host` | Requires `--consent` (jobs run unisolated on this Mac) and every account scoped to a single repository; also `kinhin setup repair host-agent` once. | | After a route edit, jobs still land wrong | Routes reload live in a daemon, but an *in-process* engine picks the config up on its next poll; check `kinhin runtimes` shows the route, then re-queue with `kinhin requeue <forge>`. | ## More - [Runtimes & routing](../../docs/runtimes.md) — the three-way Linux comparison and route reference. - `kinhin workflow route --help` — the command's own usage.

kinhin-troubleshoot

Diagnose kinhin problems - jobs queued but no VMs, runner never registers, token rejected, Tart killed on launch, Keychain prompts on a remote Mac, disk filling, config rejected. Use when something in a kinhin fleet is not working.

# Troubleshoot kinhin ## Diagnose in this order 1. `kinhin heal` (add `--json` to parse it): what the healing agent already fixed, fixes waiting for approval, and problems only the user can fix. Never approve a fix for the user: show the entry and let them run `kinhin heal approve ID` themselves. 2. `kinhin doctor` (add `--json` to parse it). It checks Tart, disk, tokens, isolation posture and the capacity cap — and reports each runtime's image disk usage (`imageTotalGB`), with `imagePrune` naming what `kinhin image prune` would reclaim when unused images are wasting disk. Doctor is offline by default and only says whether a token is *stored*; add `--check-tokens` to probe every account's token against its forge (a revoked GitLab/Gitea token otherwise looks fine). A failed check makes doctor not ready and names the `kinhin auth set` fix. 3. `kinhin setup status` and `kinhin auth status`. 4. `kinhin logs -n 200`, and `~/Library/Application Support/Kinhin/logs/kinhin.log`. 5. `kinhin status` and `kinhin pipeline` to see what the fleet thinks is happening. 6. For a bug report: `kinhin doctor --bundle [FILE]` writes a redacted support bundle. Tell the user to review it before attaching it to a GitHub issue. ## Symptoms | Symptom | Likely cause and fix | | --- | --- | | `tart: NOT FOUND` | Install Tart (see the `kinhin-install` skill). | | `tart: INSTALLED BUT KILLED ON LAUNCH` | Un-notarized bottle. `kinhin doctor` prints the exact rollback commands (manual equivalents: `docs/install.md#installing-tart`); then re-run `kinhin doctor`. | | Jobs queue but no VMs start | The job's `runs-on` (or tags) must include every configured label. The scaler counts only runnable jobs. Check `labels` and the forge's targeting rules. | | Jobs land on the wrong runtime, or queue forever after a `runs-on:` edit | Precedence is workflow route → repo route → `runs-on:` marker → default: a repo route outranks the marker, and a GitHub-hosted label (`ubuntu-latest`) matches no kinhin runner. `kinhin workflow route <file> <runtime> --dry-run` shows the fix and reconciles a conflicting route — see the `kinhin-route-workflow` skill. | | VM boots but the runner never registers | The image predates the runner agent or its forge account. Re-run `kinhin image prepare`, then check `kinhin logs -n 200`. | | `status` says a fix needs approval (`healing` alert) | The healing agent queued a destructive fix (pruning images, installing a runtime). Show the entry from `kinhin heal`; the user runs `kinhin heal approve ID` or `kinhin heal dismiss ID`. | | Token rejected | Re-run `kinhin auth set [--account NAME]`. Check the token's scopes and repo access (`kinhin auth status`). | | One account detached | A bad token detaches only that account, with the reason in `status`. Others keep serving. Fix the token. | | GitHub scale set: second job queued, VM has idle runners | Set `runners_per_vm: 1` and size the Tart pool for two VMs (`kinhin runtimes` shows `cap 2`); restart the daemon when no jobs run. See `docs/forges/github.md`. | | Config rejected, exit 3 | `kinhin config validate`. Usual causes: old top-level `repo:`/`gitea:`/`forgejo:` keys, `default: host`, `http://` on a self-hosted forge. | | Fleet refuses to start with `tart_softnet: true` | Install `softnet` and make the resolved binary setuid root (`chown root`, `chmod u+s`). Repeat after each `brew upgrade softnet`. | | First launch blocked (old or local build) | Right-click Open, or `xattr -cr /Applications/kinhin.app`. Official releases are notarized. | | Remote Mac keeps prompting for the Keychain | `security unlock-keychain ~/Library/Keychains/login.keychain-db`, enable auto-login, keep FileVault off. | | Tart: `VZErrorDomain Code=-9` / `Failed to create new HostKey` (`tart ip`: `no IP address found`) | Often the login keychain's password differs from the account password. Check with `security unlock-keychain ~/Library/Keychains/login.keychain-db`; if it says the passphrase is not correct, reset the default keychain in Keychain Access (this deletes saved passwords, so re-enter them; check the kinhin token with `kinhin doctor --check-tokens`). Details: [troubleshooting guide](https://github.com/RabinApps/kinhin/blob/main/website/guide/troubleshooting.md) and [Tart FAQ, Keychain password mismatch](https://tart.run/faq/#keychain-password-mismatch). | | Linux jobs queue after a reboot (apple/container or Docker) | Neither container runtime starts at login by itself. See [Start at login](https://github.com/RabinApps/kinhin/blob/main/docs/runtimes.md#start-at-login). | | Disk filling | Stop the fleet, then `kinhin cleanup --all` (review the report), then `--yes`. For image bloat specifically: the doctor's `prune:` row shows the waste, then `kinhin image prune` (report-only) and `--yes`. | | Older images allow SSH passwords | Re-run `kinhin image prepare`. A fresh prepare turns that off. | | I want to run Windows containers or a Windows VM on my Mac | **Windows containers are not possible on macOS.** `microsoft/windows` images need a Windows host kernel (Docker Desktop on Mac has none and no Windows-container mode), and "Windows in a container" projects like `dockur/windows` are full QEMU/KVM VMs that need `/dev/kvm` from a Linux host — Docker Desktop on Mac and Apple's `container` CLI do not provide that, and Macs have no Linux KVM to pass down. If you need Windows CI on a Mac fleet, the realistic local path is a [Windows VM on Apple Silicon](https://github.com/RabinApps/kinhin/blob/main/docs/plans/windows-vms-apple-silicon.md) (substrate-probed, not implemented; gated on a bootable Windows ARM guest source and the per-forge Windows runner story). If you do not need to run Windows locally, route Windows jobs to GitHub-hosted Windows runners (`windows-11-arm` for public repos, or standard Windows hosted runners) with the right `runs-on` label instead.\n ## Rules for the agent - Read-only commands first. Do not run `cleanup --yes`, `stop` or reinstall steps without telling the user what they remove. - Never ask the user to paste a token into chat. Point them to `kinhin auth set`. - If the forge is Buildkite, Azure DevOps or Bitbucket, say it is planned and not supported yet. For a supported forge (GitHub, Gitea, Forgejo, GitLab CE) that misbehaves, ask for a "Forge report" issue with `kinhin doctor --bundle`. - If the symptom is not listed, run `kinhin help` for the current commands and read the troubleshooting guide. ## More - [Troubleshooting guide](https://github.com/RabinApps/kinhin/blob/main/website/guide/troubleshooting.md) - [Support](https://github.com/RabinApps/kinhin/blob/main/docs/support.md)

kinhin-video

Make a narrated product video (launch film, feature clip, vertical cut, README GIF) from a config in the user's repository with `kinhin video` - write .kinhin/videos/*.yml, pick themes, captions and music, search CC0 music, build in a container, or build on the fleet. Use when the user wants a demo, launch or marketing video of their own product.

# Make a video of the user's product **Beta status:** `kinhin video` builds on this Mac in a container (Apple `container` or Docker) from a published image that holds the whole video suite, so the user copies nothing into their repository. `--on-fleet` (GitHub only) is unit-tested but has not run against a real runner. Run `kinhin help video` if a flag here is rejected. Full guide: `docs/videos-for-your-project.md`. ## The loop | Task | Command | | --- | --- | | Create a starter video | `kinhin video init <name> [--dir PATH]` (writes `.kinhin/videos/<name>.yml` and a `.gitignore`) | | List the videos | `kinhin video list [--json]` | | Build one | `kinhin video build <name> [--fast] [--quality draft\|standard\|high] [--fps 24\|30\|60] [--theme T] [--format 16:9\|9:16\|4:5\|1:1] [--captions on\|off\|all] [--music TRACK\|off] [--scene IDS] [--watch]` | | Pick the runtime or image | `--runtime container\|docker`, `--image REF` (or `KINHIN_VIDEO_IMAGE`) | | Build on a runner | `kinhin video init --workflow --runs-on LABELS`, commit and push it, then `kinhin video build <name> --on-fleet` | | Record an app clip | `kinhin video record <app or title> [--seconds N] [--out PATH]`, or `--window ID`; `--list-windows` shows the choices. One window, the pointer left out; needs Screen Recording permission once | The result is in `.kinhin/videos/out/<name>/` (`<name>.mp4`, `.webm`, `-poster.png`, `-hero.gif`, `.srt`). Use `--fast` while iterating; unchanged scenes, sentences and framed clips come from the cache (delete `.kinhin/videos/.cache/` to start clean). `--scene a,b` builds only those scenes as a preview and `--watch` rebuilds when the files change; every build prints each step's time. `--quality` sets the encode (`draft` is `--fast`; `high` is slower and larger) and `--fps` the frame rate (30 by default). Never open the MP4 and judge it blind: run a build, then read the log and the `.srt`, and tell the user where the files are. ## The config (`.kinhin/videos/<name>.yml`) A video is a name, a theme, a format, a voice and typed scenes, each with the words the narrator says (`narration`). The pictures follow the voice, so editing a line re-times the scene. - **Scene types:** `title`, `statement`, `queue`, `parallel`, `map`, `outro`, `stats`, `steps`, `code`, `compare` (drawn, no recording needed), and `device` / `terminal` / `split` (recorded clips from an adapter). Every scene needs an `id`, a `type`, `props` and `narration` (or timed `cues`). `docs/videos-for-your-project.md` lists each type's props. - **Voice:** `voice: {engine: kokoro, name: af_heart}` (the only engine in the image). - **Captions:** `captions: {burn: true|false, style: outline|box|shadow|bold|minimal|karaoke}`; the `.srt` is always written. - **Camera and transitions:** a `device` or `terminal` scene can set `props.camera` (zoom and pan keyframes), `props.focus` (a spotlight box) and `props.cursor` (a pointer with click rings), all positions 0 to 1 across the recording. `transition: fade|dissolve|push|slide|wipe|circle` at the top level (or on a scene, for how it comes in) replaces the default fade between scenes. Positions may name a clip's `targets` (boxes declared in its adapter): `camera: [{at: 2, target: fleet}]`. `speed` can be a list of `{until, speed}` segments (speed ramps). `type: split` plays two recordings side by side (`props: {left: {clip}, right: {clip, delay}}`). See `docs/video-config.md`. - **Themes:** `paper`, `clean`, `midnight`, `blueprint`, `chalk` (`kinhin video theme list`), or the user's own: `kinhin video theme new <name> --from midnight` writes `.kinhin/videos/themes/<name>.yml` (`extends:` plus only the values they change; colours are `#rrggbb`). Fonts go in `.kinhin/videos/fonts/`. - Several files in the folder are several videos (`social/vertical.yml` is the video `social/vertical`). ## Music Nothing plays unless a video (or its adapter) selects a track. Prefer the command to hand-written paths: | Task | Command | | --- | --- | | Search | `kinhin video music search "<words>" [--min-seconds N] [--max-seconds N] [--license cc0\|cc-by]` | | Listen | `kinhin video music preview <number>` | | Add to a video | `kinhin video music add <number> [--video NAME] [--volume V]` | | See what each video uses | `kinhin video music list [--json]` | - Search is CC0 and public domain by default, from Openverse plus the built-in track. Numbers refer to the **last search**, so search again before `add` in a new session. With several videos, `add` needs `--video`; it never prompts. - `add` downloads the audio into `.kinhin/videos/music/` with a `.json` provenance file and edits `music:` in the YAML, keeping the file's comments. A JSON config is not rewritten: paste the printed block. - **CC BY needs credit.** Only add it if the user asks (`--license cc-by`), and tell them to put the printed credit line in the video description (`out/music-credit.txt` has it). Never add a non-commercial or share-alike track. - Licenses are as declared by the source; remind the user they are responsible for how they use a track. - Rate limited (about 200 searches a day)? The user can register a free Openverse application and set `KINHIN_OPENVERSE_CLIENT_ID` and `KINHIN_OPENVERSE_CLIENT_SECRET`; never ask them to paste the secret into the chat or a file. ## Rules - **Say only what the product does.** Do not write narration that claims features the repository does not have, and do not invent numbers. If the user supplies claims, keep them; ask before adding new ones. - **The first build downloads about a gigabyte** (the image), then reuses it. If `could not get the video image` appears for a development build of kinhin, pass `--image` with a locally built image (`docker build -t kinhin-video:local video/` in a kinhin checkout). - Do not commit `.kinhin/videos/out/` or `.cache/` (the starter `.gitignore` covers them). Downloaded music is the user's call to commit. - Needs a container runtime: `container system start` (Apple) or Docker running. `kinhin doctor` checks them. - Recording the user's own app, terminal or browser clips is separate and needs host tools; `reference/` clips in an adapter are what the build uses. Offer drawn scenes first.