2 Commits

Author SHA1 Message Date
2e9ca56c36 fix(cli): stop railyard logs from buffering an unbounded tail in memory
`run()` always appended every stdout/stderr chunk from a child process onto
accumulator strings, even for `railyard logs` (wraps `wrangler tail`), which
only ever reads the exit code and can stream for hours -- so a long session
held every log line it had ever printed in memory for no reason. Added a
`capture` option (default true, unchanged for deploy/rollback which do need
the text back) and set `capture: false` for logs.

Load-tested the fix for real: a new fake-wrangler `tail` fixture that
behaves like the real thing (streams until killed, never exits on its own),
a 4,000-line end-to-end `railyard logs` test (every line still streamed
live, saved token redacted, --format/--status forwarded correctly), a
Ctrl+C-style signal-stop test, and a direct run() test proving capture:false
keeps result.stdout/stderr empty across 20,000 printed lines while
capture:true is unchanged. 28/28 CLI tests passing (23 pre-existing + 5 new).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-24 04:53:23 +03:00
eb26c4d38a feat(cli): railyard deploy with branch previews, deploy records and rollback (RYP-D4, Y-3)
npx railyard (zero dependencies):
- login: device flow against the console; the org token is saved 0600
  and never printed; no option takes a key or token.
- deploy: detects Next.js (OpenNext build for Workers), Vite, Astro
  (static output) or plain static; anything else stops with one line
  that says what to change (SvelteKit, Remix, Nuxt, server Astro...).
  Uses wrangler's own OAuth login on the user's machine, names the
  Worker <app> on main and <app>-<branch> elsewhere, and records URL,
  commit, branch, framework, duration and status in the console.
- rollback: wrangler rollback to the previous successful version id of
  the same branch, recorded with rollback_of.
- deploys: lists recent deploys.

Console: /api/v1/deploys (POST record, GET list) and /api/v1/deploys/:id
with org-scoped bearer tokens; the first deploy of a new app name creates
the app within the plan's limits; a paused or card-less org is refused
with 402. The Apps screen lists recent deploys.

Tests: the CLI runs against a mocked wrangler and the real console
device-flow and deploy code over local HTTP (login, main deploy, branch
preview, records, rollback, OpenNext path, failure, refusals, no token
in any output); deploy service tests cover org isolation and input
validation; README and CLI strings pass the copy lint. The run on a
real Cloudflare account is owner-run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 15:54:03 +03:00