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>
15 lines
675 B
TypeScript
15 lines
675 B
TypeScript
import { deps } from "../../../../../lib/deps.ts";
|
|
import { json } from "../../../../../lib/http.ts";
|
|
import { orgForBearer } from "../../../../../lib/tokens.ts";
|
|
import { publicDeploy } from "../service.ts";
|
|
|
|
export async function GET(req: Request, { params }: { params: { id: string } }) {
|
|
const { repo } = deps();
|
|
const who = await orgForBearer(repo, req.headers.get("authorization"));
|
|
if (!who) return json({ error: "unauthorized" }, 401);
|
|
const d = await repo.getDeploy(who.orgId, params.id);
|
|
if (!d) return json({ error: "not found" }, 404);
|
|
const app = await repo.getApp(who.orgId, d.app_id);
|
|
return json({ deploy: publicDeploy(d, app?.name ?? "") });
|
|
}
|