spawn/fly
L f1ca9cbce1
fix: smart bun mock + restore Bun JSON parsing in fly/lib (reverts #1553) (#1556)
* Revert "fix: handle raw m2. macaroon tokens from Fly.io CLI Sessions API (#1552)"

This reverts commit 9fc59ded1c.

* Revert "fix: replace bun -e with python3 in fly/lib/common.sh to fix 18 mock test failures (#1553)"

This reverts commit 328e6a6da4.

* fix: bun passthrough mock + restore Bun JSON parsing in fly/lib

Reverts PR #1553 (which reverted Bun in favour of Python to fix tests)
and instead fixes the root cause: the test/mock.sh bun mock was a dumb
no-op that discarded all output, causing _fly_json_get() to return empty
string and every fly script to fail with "Failed to extract machine ID".

test/mock.sh — smart bun mock:
- `bun -e "..."` (inline eval, used for JSON processing) → delegates to
  the real bun binary so _fly_json_get() / _fly_build_machine_body()
  actually produce correct output during tests
- All other bun invocations (install, run, etc.) → logged no-op as before

fly/lib/common.sh:
- Restores Bun-based _fly_json_get(), _fly_build_machine_body(),
  destroy_server machine-ID extraction, and list_servers table formatter
- Re-applies m2. macaroon token fix from #1552 (which was lost when
  #1553 reverted the whole file):
  _sanitize_fly_token now wraps raw m2.* tokens as "FlyV1 m2.*" so
  CLI Sessions OAuth tokens are sent with the correct auth header

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>

* test: add node fallback to bun mock for CI environments

CI (GitHub Actions ubuntu-latest) has node but not bun, so the bun
passthrough mock silently returns empty string, causing _fly_json_get
to fail and 18 Fly.io tests to break. Add a fallback chain:
real bun -> node (with Bun.stdin.text() polyfill) -> exit 0.

Agent: test-engineer
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-02-21 06:01:58 -08:00
..
lib fix: smart bun mock + restore Bun JSON parsing in fly/lib (reverts #1553) (#1556) 2026-02-21 06:01:58 -08:00
claude.sh fix: use ~/.spawnrc for env vars instead of inlining into .bashrc (#1362) 2026-02-16 17:05:17 -08:00
codex.sh fix: source .spawnrc directly in agent launch commands for reliable env loading (#1546) 2026-02-20 23:37:03 -05:00
kilocode.sh fix: source .spawnrc directly in agent launch commands for reliable env loading (#1546) 2026-02-20 23:37:03 -05:00
openclaw.sh fix: source .spawnrc directly in agent launch commands for reliable env loading (#1546) 2026-02-20 23:37:03 -05:00
opencode.sh fix: source .spawnrc directly in agent launch commands for reliable env loading (#1546) 2026-02-20 23:37:03 -05:00
README.md fix: sync cloud READMEs with current agent list (#1486) 2026-02-19 17:47:57 -05:00
zeroclaw.sh feat: reorder agents and remove NanoClaw (#1477) 2026-02-19 11:39:03 -08:00

Fly.io

Fly.io Machines via REST API and flyctl CLI. Fly.io

Agents

Claude Code

bash <(curl -fsSL https://openrouter.ai/labs/spawn/fly/claude.sh)

OpenClaw

bash <(curl -fsSL https://openrouter.ai/labs/spawn/fly/openclaw.sh)

ZeroClaw

bash <(curl -fsSL https://openrouter.ai/labs/spawn/fly/zeroclaw.sh)

Codex CLI

bash <(curl -fsSL https://openrouter.ai/labs/spawn/fly/codex.sh)

OpenCode

bash <(curl -fsSL https://openrouter.ai/labs/spawn/fly/opencode.sh)

Kilo Code

bash <(curl -fsSL https://openrouter.ai/labs/spawn/fly/kilocode.sh)

Non-Interactive Mode

FLY_APP_NAME=dev-mk1 \
FLY_API_TOKEN=your-token \
OPENROUTER_API_KEY=sk-or-v1-xxxxx \
  bash <(curl -fsSL https://openrouter.ai/labs/spawn/fly/claude.sh)

Environment Variables

Variable Description Default
FLY_API_TOKEN Fly.io API token (prompted or from flyctl auth)
FLY_APP_NAME App name (prompted)
FLY_REGION Deployment region iad
FLY_VM_SIZE VM size shared-cpu-1x
FLY_VM_MEMORY VM memory (MB) 1024
FLY_ORG Organization slug personal
OPENROUTER_API_KEY OpenRouter API key (OAuth or prompted)