spawn/fly/lib
A a1a1ae85dc
refactor: replace python3 with bun+TS in fly/lib/common.sh (#1596)
* refactor: replace python3 with bun+TS in fly/lib/common.sh, fix token validation

Three targeted fixes to the Fly.io library:

1. Replace all python3 with bun+TypeScript:
   - _fly_json: stdin-piped field extractor via bun -e (no eval, no env var
     size limits — handles arbitrarily large API responses)
   - _fly_json_ids: dedicated machine ID extractor for destroy_server
   - _fly_list_orgs: bun -e with flat dict + nodes/organizations support
   - list_servers: bun -e formatted table output
   Zero python3 invocations remain in the file.

2. Dual-endpoint _test_fly_token: tries Machines API first (deploy tokens),
   falls back to api.fly.io/v1/user (OAuth/personal tokens). Prevents
   rejecting valid personal tokens that lack Machines API access.

3. No more eval(): _fly_json uses direct property access (d[field]) instead
   of python3 eval(expr), eliminating the code injection surface entirely.

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

* fix: always prompt user for Fly.io org, never silently default

_fly_prompt_org now asks the user directly when the org list can't be
fetched, instead of silently falling back to "personal".

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

---------

Co-authored-by: lab <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-21 08:56:24 -08:00
..
common.sh refactor: replace python3 with bun+TS in fly/lib/common.sh (#1596) 2026-02-21 08:56:24 -08:00