flypod 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -35
- package/dist/bin/deploy.js +609 -47
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ npx flypod ./dist
|
|
|
11
11
|
|
|
12
12
|
- **No auth to deploy** — POST a zip, receive a URL + one-time tokens
|
|
13
13
|
- **Ephemeral by default** — anonymous deploys expire in 14 days
|
|
14
|
-
- **Optional accounts** — sign in once at [`flypod.dev/account`](https://flypod.dev/account) and every site you've deployed from that browser becomes permanently yours. CLI keys (`fk_...`) drop anonymous expiry too.
|
|
14
|
+
- **Optional accounts** — sign in once at [`flypod.dev/account`](https://flypod.dev/account) and every site you've deployed from that browser becomes permanently yours. CLI keys (`fk_...`) drop anonymous expiry too.
|
|
15
15
|
- **Rollback built-in** — every deploy is versioned; roll back with a single call
|
|
16
16
|
- **Render loop** — optional headless screenshot + console capture on every deploy
|
|
17
17
|
|
|
@@ -92,6 +92,7 @@ The URL is always printed alone on stdout in pretty and quiet modes, so
|
|
|
92
92
|
|
|
93
93
|
| Variable | Description |
|
|
94
94
|
|----------|-------------|
|
|
95
|
+
| `FLYPOD_API_KEY` | Deploy as your account without `flypod login` (agents / CI). A saved session takes precedence |
|
|
95
96
|
| `DEPLOY_URL` | Override the deploy server (default: `https://flypod.dev`) |
|
|
96
97
|
| `NO_COLOR` | Disable ANSI colors |
|
|
97
98
|
| `FORCE_COLOR` | Force colors even when stderr is not a TTY |
|
|
@@ -154,6 +155,62 @@ doesn't remember it.
|
|
|
154
155
|
|
|
155
156
|
---
|
|
156
157
|
|
|
158
|
+
## Teach your coding agents
|
|
159
|
+
|
|
160
|
+
One command writes a small instruction file into your coding agents so they know
|
|
161
|
+
how to deploy with flypod — no config, no copy-paste.
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
npx flypod install skill
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Run in a terminal, it shows a checklist of the agents it found. It always writes
|
|
168
|
+
the universal [`AGENTS.md`](https://agents.md) (read by Codex, Cursor, Copilot,
|
|
169
|
+
Gemini, Zed, Jules, and ~20 more) plus a first-class **Claude Code** skill at
|
|
170
|
+
`.claude/skills/flypod/SKILL.md`, and pre-selects any other agents it detects in
|
|
171
|
+
your repo (Cursor, Windsurf, Cline, Roo, …).
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
flypod · teach your agents to deploy
|
|
175
|
+
|
|
176
|
+
Install the flypod skill into:
|
|
177
|
+
|
|
178
|
+
› ◉ AGENTS.md universal — Codex, Cursor, Copilot, Gemini, Zed, Jules, +more
|
|
179
|
+
◉ Claude Code .claude/skills/flypod/SKILL.md — loaded on demand
|
|
180
|
+
◉ Cursor .cursor/rules/flypod.mdc · detected
|
|
181
|
+
◯ Windsurf .windsurf/rules/flypod.md
|
|
182
|
+
|
|
183
|
+
↑/↓ move · space toggle · a all · enter confirm · esc cancel
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
It's idempotent — shared files (`AGENTS.md`, `copilot-instructions.md`, `GEMINI.md`)
|
|
187
|
+
get a fenced `flypod` block that re-runs replace in place, never clobbering your
|
|
188
|
+
own content. Dedicated rule files are flypod-owned and rewritten wholesale.
|
|
189
|
+
|
|
190
|
+
Non-interactive when piped or under an agent (writes the same defaults), so it
|
|
191
|
+
drops cleanly into setup scripts and CI.
|
|
192
|
+
|
|
193
|
+
```sh
|
|
194
|
+
flypod install skill --all # write files for every supported agent
|
|
195
|
+
flypod install skill --claude # just the Claude Code skill
|
|
196
|
+
flypod install skill --global # install at the user level (~/.claude + ~/.codex; add --all for ~/.gemini)
|
|
197
|
+
flypod install skill --list # show what's detected and where it would go
|
|
198
|
+
flypod install skill --dry-run # print the planned paths, write nothing
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
| Target | File written |
|
|
202
|
+
|--------|--------------|
|
|
203
|
+
| `--agents` | `AGENTS.md` (universal) |
|
|
204
|
+
| `--claude` | `.claude/skills/flypod/SKILL.md` |
|
|
205
|
+
| `--cursor` | `.cursor/rules/flypod.mdc` |
|
|
206
|
+
| `--copilot` | `.github/copilot-instructions.md` |
|
|
207
|
+
| `--windsurf` | `.windsurf/rules/flypod.md` |
|
|
208
|
+
| `--cline` | `.clinerules/flypod.md` |
|
|
209
|
+
| `--roo` | `.roo/rules/flypod.md` |
|
|
210
|
+
| `--gemini` | `GEMINI.md` |
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
157
214
|
## Library
|
|
158
215
|
|
|
159
216
|
```ts
|
|
@@ -178,7 +235,7 @@ console.log(result.manage_token); // one-time — save to redeploy / rollback /
|
|
|
178
235
|
| Option | Type | Default | Description |
|
|
179
236
|
|--------|------|---------|-------------|
|
|
180
237
|
| `files` | `Record<string, Uint8Array>` | — | File path → bytes map |
|
|
181
|
-
| `baseUrl` | `string` | `https://flypod.dev` | Override
|
|
238
|
+
| `baseUrl` | `string` | `https://flypod.dev` | Override the deploy server |
|
|
182
239
|
| `handle` | `(req) => Promise<Response>` | `fetch` | Injectable transport (used in tests) |
|
|
183
240
|
|
|
184
241
|
Returns a `DeployResult`:
|
|
@@ -254,39 +311,7 @@ For agents and CI, set `FLYPOD_API_KEY=fk_…` and the CLI sends it as
|
|
|
254
311
|
GitHub Actions, in your own code.
|
|
255
312
|
|
|
256
313
|
Login on the web uses **magic link** or **email + password** — pick the one you
|
|
257
|
-
prefer; both land you in the same account.
|
|
258
|
-
`anonymous` + `magicLink` + `apiKey` plugins plus core email/password on
|
|
259
|
-
Cloudflare Workers + Turso, with `onLinkAccount` powering bulk claim) is
|
|
260
|
-
documented at [docs/identity.md](https://github.com/sdserranog/flypod/blob/main/docs/identity.md).
|
|
261
|
-
|
|
262
|
-
---
|
|
263
|
-
|
|
264
|
-
## Self-hosting
|
|
265
|
-
|
|
266
|
-
```ts
|
|
267
|
-
import { createApp } from "flypod/server";
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
The server runs on [Cloudflare Workers](https://workers.cloudflare.com) (free tier). Deploy your own instance:
|
|
271
|
-
|
|
272
|
-
```sh
|
|
273
|
-
git clone https://github.com/sdserranog/flypod
|
|
274
|
-
cd flypod
|
|
275
|
-
bunx wrangler deploy
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
Environment variables / secrets:
|
|
279
|
-
|
|
280
|
-
| Variable | Default | Description |
|
|
281
|
-
|----------|---------|-------------|
|
|
282
|
-
| `BASE_HOST` | `flypod.dev` | Wildcard subdomain root |
|
|
283
|
-
| `PUBLIC_SCHEME` | `https` | `http` or `https` |
|
|
284
|
-
| `LIBSQL_URL` | — | Turso/libSQL connection URL |
|
|
285
|
-
| `LIBSQL_AUTH_TOKEN` | — | Turso auth token |
|
|
286
|
-
| `SAFE_BROWSING_KEY` | — | Enables Google Safe Browsing link scan |
|
|
287
|
-
| `BETTER_AUTH_SECRET` | — | _v0.2:_ Better Auth signing secret (32+ random bytes) |
|
|
288
|
-
| `RESEND_API_KEY` | — | _v0.2:_ Resend API key for magic-link email delivery |
|
|
289
|
-
| `RESEND_FROM` | `notifications@flypod.dev` | _v0.2:_ verified sender address for magic links |
|
|
314
|
+
prefer; both land you in the same account.
|
|
290
315
|
|
|
291
316
|
---
|
|
292
317
|
|
package/dist/bin/deploy.js
CHANGED
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
} from "../cli-ynzcc4xy.js";
|
|
8
8
|
|
|
9
9
|
// bin/deploy.ts
|
|
10
|
-
import { readFile as
|
|
10
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
11
|
+
import { homedir as homedir3 } from "node:os";
|
|
11
12
|
import { relative } from "node:path";
|
|
12
13
|
import { fileURLToPath } from "node:url";
|
|
13
14
|
|
|
@@ -115,6 +116,12 @@ async function forgetSite(site_id, env) {
|
|
|
115
116
|
|
|
116
117
|
// src/cli/session.ts
|
|
117
118
|
import { readFile as readFile2, unlink } from "node:fs/promises";
|
|
119
|
+
async function resolveAuth(env = process.env) {
|
|
120
|
+
const session = await loadSession(env);
|
|
121
|
+
const apiKey = session?.api_key ?? env.FLYPOD_API_KEY;
|
|
122
|
+
const baseUrl = session?.base_url ?? env.DEPLOY_URL ?? "https://flypod.dev";
|
|
123
|
+
return { apiKey, baseUrl };
|
|
124
|
+
}
|
|
118
125
|
async function loadSession(env) {
|
|
119
126
|
try {
|
|
120
127
|
const path = sessionFilePath(env);
|
|
@@ -147,28 +154,61 @@ async function clearSession(env) {
|
|
|
147
154
|
function baseUrlFrom(env = process.env) {
|
|
148
155
|
return env.DEPLOY_URL ?? "https://flypod.dev";
|
|
149
156
|
}
|
|
150
|
-
function
|
|
151
|
-
|
|
157
|
+
async function openBrowser(url) {
|
|
158
|
+
const platform2 = process.platform;
|
|
159
|
+
const cmd = platform2 === "darwin" ? "open" : platform2 === "win32" ? "start" : "xdg-open";
|
|
160
|
+
await Bun.$`${cmd} ${url}`.quiet().nothrow();
|
|
152
161
|
}
|
|
153
|
-
|
|
162
|
+
var POLL_MAX_ATTEMPTS = 120;
|
|
163
|
+
async function login(_args, io) {
|
|
154
164
|
const env = io.env ?? process.env;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
io.err(
|
|
161
|
-
return
|
|
165
|
+
const baseUrl = baseUrlFrom(env);
|
|
166
|
+
const fetchImpl = io.fetch ?? fetch;
|
|
167
|
+
const openUrl = io.openUrl ?? openBrowser;
|
|
168
|
+
const startRes = await fetchImpl(`${baseUrl}/auth/device`, { method: "POST" });
|
|
169
|
+
if (!startRes.ok) {
|
|
170
|
+
io.err(`flypod login: server returned ${startRes.status}. Is the server running?`);
|
|
171
|
+
return 1;
|
|
162
172
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
173
|
+
const { device_code, user_code, verification_uri, interval } = await startRes.json();
|
|
174
|
+
const confirmUrl = `${verification_uri}?code=${user_code}`;
|
|
175
|
+
io.err("");
|
|
176
|
+
io.err(` Opening browser to complete sign-in...`);
|
|
177
|
+
io.err(` ${confirmUrl}`);
|
|
178
|
+
io.err("");
|
|
179
|
+
io.err(` Confirmation code: ${user_code}`);
|
|
180
|
+
io.err("");
|
|
181
|
+
await openUrl(confirmUrl);
|
|
182
|
+
const pollMs = (interval ?? 5) * 1000;
|
|
183
|
+
for (let attempt = 0;attempt < POLL_MAX_ATTEMPTS; attempt++) {
|
|
184
|
+
await new Promise((r) => setTimeout(r, attempt === 0 ? pollMs : pollMs));
|
|
185
|
+
const pollRes = await fetchImpl(`${baseUrl}/auth/device/token`, {
|
|
186
|
+
method: "POST",
|
|
187
|
+
headers: { "content-type": "application/json" },
|
|
188
|
+
body: JSON.stringify({ device_code })
|
|
189
|
+
});
|
|
190
|
+
if (pollRes.status === 202)
|
|
191
|
+
continue;
|
|
192
|
+
if (!pollRes.ok) {
|
|
193
|
+
const body = await pollRes.json().catch(() => ({}));
|
|
194
|
+
if (body.error === "denied") {
|
|
195
|
+
io.err("Authorization denied in browser.");
|
|
196
|
+
return 1;
|
|
197
|
+
}
|
|
198
|
+
if (body.error === "expired") {
|
|
199
|
+
io.err("Code expired. Run `flypod login` to try again.");
|
|
200
|
+
return 1;
|
|
201
|
+
}
|
|
202
|
+
io.err(`flypod login: unexpected error ${pollRes.status}.`);
|
|
203
|
+
return 1;
|
|
204
|
+
}
|
|
205
|
+
const { api_key } = await pollRes.json();
|
|
206
|
+
const path = await saveSession({ api_key, base_url: baseUrl, created_at: Date.now() }, env);
|
|
207
|
+
io.err(`Logged in. Session saved to ${path}`);
|
|
208
|
+
return 0;
|
|
166
209
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
io.err(`Saved your key to ${path}`);
|
|
170
|
-
io.err(`Now using ${baseUrl} for every flypod command.`);
|
|
171
|
-
return 0;
|
|
210
|
+
io.err("Timed out waiting for browser authorization. Run `flypod login` to try again.");
|
|
211
|
+
return 1;
|
|
172
212
|
}
|
|
173
213
|
async function logout(_args, io) {
|
|
174
214
|
const env = io.env ?? process.env;
|
|
@@ -183,7 +223,7 @@ async function list(_args, io) {
|
|
|
183
223
|
const env = io.env ?? process.env;
|
|
184
224
|
const session = await loadSession(env);
|
|
185
225
|
if (!session) {
|
|
186
|
-
io.err("Not signed in. Run `flypod login
|
|
226
|
+
io.err("Not signed in. Run `flypod login` first.");
|
|
187
227
|
return 1;
|
|
188
228
|
}
|
|
189
229
|
const fetchImpl = io.fetch ?? fetch;
|
|
@@ -208,7 +248,7 @@ async function claim(args, io) {
|
|
|
208
248
|
const env = io.env ?? process.env;
|
|
209
249
|
const session = await loadSession(env);
|
|
210
250
|
if (!session) {
|
|
211
|
-
io.err("Not signed in. Run `flypod login
|
|
251
|
+
io.err("Not signed in. Run `flypod login` first.");
|
|
212
252
|
return 1;
|
|
213
253
|
}
|
|
214
254
|
if (!args.site_id || !args.token) {
|
|
@@ -237,7 +277,7 @@ async function keysCreate(_args, io) {
|
|
|
237
277
|
const env = io.env ?? process.env;
|
|
238
278
|
const session = await loadSession(env);
|
|
239
279
|
if (!session) {
|
|
240
|
-
io.err("Not signed in. Run `flypod login
|
|
280
|
+
io.err("Not signed in. Run `flypod login` first.");
|
|
241
281
|
return 1;
|
|
242
282
|
}
|
|
243
283
|
const fetchImpl = io.fetch ?? fetch;
|
|
@@ -278,7 +318,7 @@ async function healGone(target, io, env) {
|
|
|
278
318
|
io.err(`Site ${target.site_id} is gone (expired or deleted). Run 'flypod' to create a new one.`);
|
|
279
319
|
}
|
|
280
320
|
function unauthorized(target, io) {
|
|
281
|
-
io.err(`Unauthorized for ${target.site_id}. Run
|
|
321
|
+
io.err(`Unauthorized for ${target.site_id}. Run \`flypod login\` or pass --token <manage_token>.`);
|
|
282
322
|
}
|
|
283
323
|
async function fetchSite(target, args, io, env) {
|
|
284
324
|
const { baseUrl, auth } = await requestContext(target, args, env);
|
|
@@ -345,7 +385,6 @@ async function update(args, io) {
|
|
|
345
385
|
return 1;
|
|
346
386
|
}
|
|
347
387
|
const body = await res.json();
|
|
348
|
-
const noop = target.rec?.version_id !== undefined && body.version_id === target.rec.version_id;
|
|
349
388
|
await touchLink(target, body.version_id, env);
|
|
350
389
|
if (args.json) {
|
|
351
390
|
io.out(JSON.stringify({
|
|
@@ -356,7 +395,7 @@ async function update(args, io) {
|
|
|
356
395
|
}));
|
|
357
396
|
return 0;
|
|
358
397
|
}
|
|
359
|
-
io.err(
|
|
398
|
+
io.err(`→ version ${body.version_id} is now live`);
|
|
360
399
|
io.out(body.url);
|
|
361
400
|
return 0;
|
|
362
401
|
}
|
|
@@ -457,8 +496,463 @@ async function forget(args, io) {
|
|
|
457
496
|
return 0;
|
|
458
497
|
}
|
|
459
498
|
|
|
460
|
-
// src/
|
|
499
|
+
// src/cli/select.ts
|
|
461
500
|
var ESC = "\x1B[";
|
|
501
|
+
function canPrompt(input = process.stdin, output = process.stderr) {
|
|
502
|
+
return Boolean(input.isTTY && output.isTTY && typeof input.setRawMode === "function");
|
|
503
|
+
}
|
|
504
|
+
function multiselect(opts) {
|
|
505
|
+
const input = opts.input ?? process.stdin;
|
|
506
|
+
const output = opts.output ?? process.stderr;
|
|
507
|
+
const { style } = opts;
|
|
508
|
+
const choices = opts.choices.map((c) => ({ ...c }));
|
|
509
|
+
return new Promise((resolve) => {
|
|
510
|
+
let index = 0;
|
|
511
|
+
let printed = 0;
|
|
512
|
+
const footer = style.dim("↑/↓ move · space toggle · a all · enter confirm · esc cancel");
|
|
513
|
+
const render = () => {
|
|
514
|
+
const lines = [` ${style.bold(opts.title)}`, ""];
|
|
515
|
+
choices.forEach((c, i) => {
|
|
516
|
+
const active = i === index;
|
|
517
|
+
const pointer = active ? style.accent("›") : " ";
|
|
518
|
+
const box = c.checked ? style.ok("◉") : style.dim("◯");
|
|
519
|
+
const label = active ? style.bold(c.label) : c.label;
|
|
520
|
+
const hint = c.hint ? ` ${style.dim(c.hint)}` : "";
|
|
521
|
+
lines.push(` ${pointer} ${box} ${label}${hint}`);
|
|
522
|
+
});
|
|
523
|
+
lines.push("");
|
|
524
|
+
lines.push(` ${footer}`);
|
|
525
|
+
return lines;
|
|
526
|
+
};
|
|
527
|
+
const draw = () => {
|
|
528
|
+
if (printed > 0)
|
|
529
|
+
output.write(`${ESC}${printed}A`);
|
|
530
|
+
output.write(`${ESC}0J`);
|
|
531
|
+
const lines = render();
|
|
532
|
+
output.write(`${lines.join(`
|
|
533
|
+
`)}
|
|
534
|
+
`);
|
|
535
|
+
printed = lines.length;
|
|
536
|
+
};
|
|
537
|
+
const cleanup = () => {
|
|
538
|
+
if (printed > 0) {
|
|
539
|
+
output.write(`${ESC}${printed}A`);
|
|
540
|
+
output.write(`${ESC}0J`);
|
|
541
|
+
}
|
|
542
|
+
output.write(`${ESC}?25h`);
|
|
543
|
+
input.removeListener("data", onData);
|
|
544
|
+
if (typeof input.setRawMode === "function")
|
|
545
|
+
input.setRawMode(false);
|
|
546
|
+
input.pause();
|
|
547
|
+
};
|
|
548
|
+
const finish = (value) => {
|
|
549
|
+
cleanup();
|
|
550
|
+
resolve(value);
|
|
551
|
+
};
|
|
552
|
+
const onData = (buf) => {
|
|
553
|
+
const key = buf.toString("utf8");
|
|
554
|
+
switch (key) {
|
|
555
|
+
case "\x03":
|
|
556
|
+
case "\x1B":
|
|
557
|
+
case "q":
|
|
558
|
+
return finish(null);
|
|
559
|
+
case "\r":
|
|
560
|
+
case `
|
|
561
|
+
`:
|
|
562
|
+
return finish(choices.filter((c) => c.checked).map((c) => c.id));
|
|
563
|
+
case " ": {
|
|
564
|
+
const c = choices[index];
|
|
565
|
+
if (c)
|
|
566
|
+
c.checked = !c.checked;
|
|
567
|
+
return draw();
|
|
568
|
+
}
|
|
569
|
+
case "a": {
|
|
570
|
+
const allOn = choices.every((c) => c.checked);
|
|
571
|
+
for (const c of choices)
|
|
572
|
+
c.checked = !allOn;
|
|
573
|
+
return draw();
|
|
574
|
+
}
|
|
575
|
+
case "\x1B[A":
|
|
576
|
+
case "k":
|
|
577
|
+
index = (index - 1 + choices.length) % choices.length;
|
|
578
|
+
return draw();
|
|
579
|
+
case "\x1B[B":
|
|
580
|
+
case "j":
|
|
581
|
+
index = (index + 1) % choices.length;
|
|
582
|
+
return draw();
|
|
583
|
+
default:
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
output.write(`${ESC}?25l`);
|
|
588
|
+
if (typeof input.setRawMode === "function")
|
|
589
|
+
input.setRawMode(true);
|
|
590
|
+
input.resume();
|
|
591
|
+
input.on("data", onData);
|
|
592
|
+
draw();
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
// src/cli/skill.ts
|
|
597
|
+
import { mkdir as mkdir2, readFile as readFile3, stat, writeFile as writeFile2 } from "node:fs/promises";
|
|
598
|
+
import { homedir as homedir2 } from "node:os";
|
|
599
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
600
|
+
var SKILL_NAME = "flypod";
|
|
601
|
+
var SKILL_DESCRIPTION = "Deploy any folder of static files to a live public URL with flypod (flypod.dev) — no account, config, or build pipeline needed. " + "Use when the user wants to deploy, publish, ship, share, or host a static site, build output, preview, or demo, or asks to put a finished build online or get a URL for it.";
|
|
602
|
+
var MARK_BEGIN = `<!-- ${SKILL_NAME}:begin -->`;
|
|
603
|
+
var MARK_END = `<!-- ${SKILL_NAME}:end -->`;
|
|
604
|
+
function renderBody(sub) {
|
|
605
|
+
return `flypod turns any folder of static files into a live, public URL with a single
|
|
606
|
+
command. No account, no config, no build step of its own — you bring the built
|
|
607
|
+
files, flypod hosts them. Reach for it the moment a build exists and the user
|
|
608
|
+
wants it online: a site, a preview, a demo, a one-off share.
|
|
609
|
+
|
|
610
|
+
${sub} The happy path
|
|
611
|
+
|
|
612
|
+
1. Make sure the site is built — there is a folder of static files to ship
|
|
613
|
+
(e.g. \`dist/\`, \`build/\`, \`out/\`). flypod ships files; it does not build them.
|
|
614
|
+
2. Deploy that folder. Prefer \`--json\` so you can read the result:
|
|
615
|
+
|
|
616
|
+
\`\`\`sh
|
|
617
|
+
npx flypod ./dist --json
|
|
618
|
+
\`\`\`
|
|
619
|
+
|
|
620
|
+
If flypod is installed globally, drop the \`npx\`: \`flypod ./dist --json\`.
|
|
621
|
+
3. Read the \`url\` field from the JSON and give it to the user. That is the live
|
|
622
|
+
site. That's the whole loop.
|
|
623
|
+
|
|
624
|
+
If you omit the path, flypod auto-detects a build folder, trying \`dist\`,
|
|
625
|
+
\`build\`, \`out\`, \`.output/public\`, \`.vercel/output/static\`, \`public\`, \`_site\`
|
|
626
|
+
(each must contain an \`index.html\`). When in doubt, pass the path explicitly.
|
|
627
|
+
|
|
628
|
+
${sub} Is flypod installed?
|
|
629
|
+
|
|
630
|
+
Run \`flypod --version\`. If it is missing, **do not install anything** — just
|
|
631
|
+
prefix commands with \`npx\`: \`npx flypod ...\` downloads and runs it on the fly.
|
|
632
|
+
To install once: \`npm install -g flypod\`.
|
|
633
|
+
|
|
634
|
+
${sub} Reading the result
|
|
635
|
+
|
|
636
|
+
\`npx flypod ./dist --json\` prints a JSON object on stdout:
|
|
637
|
+
|
|
638
|
+
\`\`\`json
|
|
639
|
+
{
|
|
640
|
+
"ok": true,
|
|
641
|
+
"url": "https://ab12cd34.flypod.dev",
|
|
642
|
+
"site_id": "ab12cd34",
|
|
643
|
+
"manage_token": "…",
|
|
644
|
+
"claim_token": "…",
|
|
645
|
+
"expires_at": 1782929906088,
|
|
646
|
+
"files": 12,
|
|
647
|
+
"bytes": 1234567,
|
|
648
|
+
"elapsed_ms": 812
|
|
649
|
+
}
|
|
650
|
+
\`\`\`
|
|
651
|
+
|
|
652
|
+
- \`url\` — the live site. Always surface this to the user.
|
|
653
|
+
- \`manage_token\` — save it; it is needed to redeploy, roll back, or delete the site.
|
|
654
|
+
- \`claim_token\` — save it; it attaches an anonymous site to an account later.
|
|
655
|
+
- \`expires_at\` — anonymous deploys are ephemeral (~14 days); \`null\` once owned.
|
|
656
|
+
|
|
657
|
+
Treat \`manage_token\` and \`claim_token\` as secrets — don't paste them into chat
|
|
658
|
+
unless the user asks. Without \`--json\`, use quiet mode to capture the URL in a
|
|
659
|
+
shell variable: \`URL=$(npx flypod ./dist -q)\` (URL on stdout, token on stderr).
|
|
660
|
+
|
|
661
|
+
${sub} Anonymous vs. signed in
|
|
662
|
+
|
|
663
|
+
- **Anonymous (default):** zero auth. The first deploy just works and the site
|
|
664
|
+
expires in ~14 days. Best for previews and throwaways.
|
|
665
|
+
- **Signed in:** deploys are attributed to an account, never expire, and show up
|
|
666
|
+
in \`flypod list\`. Sign in once (no interactive prompt):
|
|
667
|
+
|
|
668
|
+
\`\`\`sh
|
|
669
|
+
flypod login --key fk_xxxxxxxxxxxxxxxxxxxx
|
|
670
|
+
\`\`\`
|
|
671
|
+
|
|
672
|
+
For agents and CI, skip the session file entirely — set the key in the
|
|
673
|
+
environment and every deploy is attributed to the account:
|
|
674
|
+
|
|
675
|
+
\`\`\`sh
|
|
676
|
+
FLYPOD_API_KEY=fk_xxxxxxxxxxxxxxxxxxxx npx flypod ./dist --json
|
|
677
|
+
\`\`\`
|
|
678
|
+
|
|
679
|
+
Mint a key at https://flypod.dev/account, or run \`flypod keys create\` when
|
|
680
|
+
already signed in.
|
|
681
|
+
|
|
682
|
+
${sub} Other commands
|
|
683
|
+
|
|
684
|
+
\`\`\`sh
|
|
685
|
+
flypod list # sites you own (requires sign in)
|
|
686
|
+
flypod claim <site_id> <token> # attach an anonymous deploy to your account
|
|
687
|
+
flypod keys create # mint an API key for agents / CI
|
|
688
|
+
flypod logout # forget the saved key
|
|
689
|
+
flypod --help # full usage
|
|
690
|
+
\`\`\`
|
|
691
|
+
|
|
692
|
+
${sub} Rules of thumb
|
|
693
|
+
|
|
694
|
+
- Build first. Point flypod at the **output** folder, never the project root or source.
|
|
695
|
+
- Prefer \`--json\` and read \`url\`. Use \`-q\`/\`--quiet\` when you only need the URL.
|
|
696
|
+
- flypod hosts **static files only** (HTML/CSS/JS/assets). It runs no server or backend.
|
|
697
|
+
- A missing \`flypod\` binary is fine — use \`npx flypod\`; never block on installing it.`;
|
|
698
|
+
}
|
|
699
|
+
function standaloneMarkdown() {
|
|
700
|
+
return `# Deploy with flypod
|
|
701
|
+
|
|
702
|
+
${renderBody("##")}
|
|
703
|
+
`;
|
|
704
|
+
}
|
|
705
|
+
function embedSection() {
|
|
706
|
+
return `${MARK_BEGIN}
|
|
707
|
+
## Deploying with flypod
|
|
708
|
+
|
|
709
|
+
${renderBody("###")}
|
|
710
|
+
${MARK_END}`;
|
|
711
|
+
}
|
|
712
|
+
function claudeSkillFile() {
|
|
713
|
+
return `---
|
|
714
|
+
name: ${SKILL_NAME}
|
|
715
|
+
description: ${SKILL_DESCRIPTION}
|
|
716
|
+
---
|
|
717
|
+
|
|
718
|
+
${standaloneMarkdown()}`;
|
|
719
|
+
}
|
|
720
|
+
function cursorRuleFile() {
|
|
721
|
+
return `---
|
|
722
|
+
description: ${SKILL_DESCRIPTION}
|
|
723
|
+
globs:
|
|
724
|
+
alwaysApply: false
|
|
725
|
+
---
|
|
726
|
+
|
|
727
|
+
${standaloneMarkdown()}`;
|
|
728
|
+
}
|
|
729
|
+
async function exists(path) {
|
|
730
|
+
try {
|
|
731
|
+
await stat(path);
|
|
732
|
+
return true;
|
|
733
|
+
} catch {
|
|
734
|
+
return false;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
async function anyExists(root, rels) {
|
|
738
|
+
for (const rel of rels) {
|
|
739
|
+
if (await exists(join2(root, rel)))
|
|
740
|
+
return true;
|
|
741
|
+
}
|
|
742
|
+
return false;
|
|
743
|
+
}
|
|
744
|
+
var TARGETS = [
|
|
745
|
+
{
|
|
746
|
+
id: "agents",
|
|
747
|
+
label: "AGENTS.md",
|
|
748
|
+
detail: "universal — Codex, Cursor, Copilot, Gemini, Zed, Jules, +more",
|
|
749
|
+
kind: "embed",
|
|
750
|
+
alwaysDefault: true,
|
|
751
|
+
projectPath: (root) => join2(root, "AGENTS.md"),
|
|
752
|
+
globalPath: () => join2(homedir2(), ".codex", "AGENTS.md"),
|
|
753
|
+
detect: () => Promise.resolve(true),
|
|
754
|
+
render: embedSection
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
id: "claude",
|
|
758
|
+
label: "Claude Code",
|
|
759
|
+
detail: ".claude/skills/flypod/SKILL.md — loaded on demand",
|
|
760
|
+
kind: "skill",
|
|
761
|
+
alwaysDefault: true,
|
|
762
|
+
projectPath: (root) => join2(root, ".claude", "skills", SKILL_NAME, "SKILL.md"),
|
|
763
|
+
globalPath: () => join2(homedir2(), ".claude", "skills", SKILL_NAME, "SKILL.md"),
|
|
764
|
+
detect: (root) => anyExists(root, [".claude", "CLAUDE.md"]),
|
|
765
|
+
render: claudeSkillFile
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
id: "cursor",
|
|
769
|
+
label: "Cursor",
|
|
770
|
+
detail: ".cursor/rules/flypod.mdc",
|
|
771
|
+
kind: "rules",
|
|
772
|
+
alwaysDefault: false,
|
|
773
|
+
projectPath: (root) => join2(root, ".cursor", "rules", `${SKILL_NAME}.mdc`),
|
|
774
|
+
globalPath: () => null,
|
|
775
|
+
detect: (root) => anyExists(root, [".cursor", ".cursorrules"]),
|
|
776
|
+
render: cursorRuleFile
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
id: "copilot",
|
|
780
|
+
label: "GitHub Copilot",
|
|
781
|
+
detail: ".github/copilot-instructions.md",
|
|
782
|
+
kind: "embed",
|
|
783
|
+
alwaysDefault: false,
|
|
784
|
+
projectPath: (root) => join2(root, ".github", "copilot-instructions.md"),
|
|
785
|
+
globalPath: () => null,
|
|
786
|
+
detect: (root) => anyExists(root, [".github"]),
|
|
787
|
+
render: embedSection
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
id: "windsurf",
|
|
791
|
+
label: "Windsurf",
|
|
792
|
+
detail: ".windsurf/rules/flypod.md",
|
|
793
|
+
kind: "rules",
|
|
794
|
+
alwaysDefault: false,
|
|
795
|
+
projectPath: (root) => join2(root, ".windsurf", "rules", `${SKILL_NAME}.md`),
|
|
796
|
+
globalPath: () => null,
|
|
797
|
+
detect: (root) => anyExists(root, [".windsurf", ".windsurfrules"]),
|
|
798
|
+
render: standaloneMarkdown
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
id: "cline",
|
|
802
|
+
label: "Cline",
|
|
803
|
+
detail: ".clinerules/flypod.md",
|
|
804
|
+
kind: "rules",
|
|
805
|
+
alwaysDefault: false,
|
|
806
|
+
projectPath: (root) => join2(root, ".clinerules", `${SKILL_NAME}.md`),
|
|
807
|
+
globalPath: () => null,
|
|
808
|
+
detect: (root) => anyExists(root, [".clinerules"]),
|
|
809
|
+
render: standaloneMarkdown
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
id: "roo",
|
|
813
|
+
label: "Roo Code",
|
|
814
|
+
detail: ".roo/rules/flypod.md",
|
|
815
|
+
kind: "rules",
|
|
816
|
+
alwaysDefault: false,
|
|
817
|
+
projectPath: (root) => join2(root, ".roo", "rules", `${SKILL_NAME}.md`),
|
|
818
|
+
globalPath: () => null,
|
|
819
|
+
detect: (root) => anyExists(root, [".roo", ".roorules"]),
|
|
820
|
+
render: standaloneMarkdown
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
id: "gemini",
|
|
824
|
+
label: "Gemini CLI",
|
|
825
|
+
detail: "GEMINI.md",
|
|
826
|
+
kind: "embed",
|
|
827
|
+
alwaysDefault: false,
|
|
828
|
+
projectPath: (root) => join2(root, "GEMINI.md"),
|
|
829
|
+
globalPath: () => join2(homedir2(), ".gemini", "GEMINI.md"),
|
|
830
|
+
detect: (root) => anyExists(root, ["GEMINI.md", ".gemini"]),
|
|
831
|
+
render: embedSection
|
|
832
|
+
}
|
|
833
|
+
];
|
|
834
|
+
function spliceBlock(existing, section) {
|
|
835
|
+
const begin = existing.indexOf(MARK_BEGIN);
|
|
836
|
+
const end = existing.indexOf(MARK_END);
|
|
837
|
+
if (begin !== -1 && end !== -1 && end > begin) {
|
|
838
|
+
const before = existing.slice(0, begin);
|
|
839
|
+
const after = existing.slice(end + MARK_END.length);
|
|
840
|
+
return `${before}${section}${after}`;
|
|
841
|
+
}
|
|
842
|
+
const trimmed = existing.replace(/\s+$/, "");
|
|
843
|
+
return trimmed ? `${trimmed}
|
|
844
|
+
|
|
845
|
+
${section}
|
|
846
|
+
` : `${section}
|
|
847
|
+
`;
|
|
848
|
+
}
|
|
849
|
+
async function writeTarget(target, path) {
|
|
850
|
+
const had = await exists(path);
|
|
851
|
+
const current = had ? await readFile3(path, "utf8") : "";
|
|
852
|
+
let next;
|
|
853
|
+
if (target.kind === "embed") {
|
|
854
|
+
next = spliceBlock(current, target.render());
|
|
855
|
+
} else {
|
|
856
|
+
next = target.render();
|
|
857
|
+
}
|
|
858
|
+
if (had && current === next)
|
|
859
|
+
return { target, path, status: "unchanged" };
|
|
860
|
+
await mkdir2(dirname2(path), { recursive: true });
|
|
861
|
+
await writeFile2(path, next, "utf8");
|
|
862
|
+
return { target, path, status: had ? "updated" : "created" };
|
|
863
|
+
}
|
|
864
|
+
async function buildPlan(root, env, global) {
|
|
865
|
+
const entries = [];
|
|
866
|
+
for (const target of TARGETS) {
|
|
867
|
+
const path = global ? target.globalPath(env) : target.projectPath(root);
|
|
868
|
+
if (!path)
|
|
869
|
+
continue;
|
|
870
|
+
const detected = await target.detect(root, env);
|
|
871
|
+
entries.push({
|
|
872
|
+
target,
|
|
873
|
+
path,
|
|
874
|
+
detected,
|
|
875
|
+
defaultOn: target.alwaysDefault || detected
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
return entries;
|
|
879
|
+
}
|
|
880
|
+
async function installSkill(args, io) {
|
|
881
|
+
const env = io.env ?? process.env;
|
|
882
|
+
const root = args.cwd ?? process.cwd();
|
|
883
|
+
const global = Boolean(args.global);
|
|
884
|
+
const plan = await buildPlan(root, env, global);
|
|
885
|
+
if (args.list) {
|
|
886
|
+
io.err(global ? "flypod skill targets (global):" : "flypod skill targets (this project):");
|
|
887
|
+
io.err("");
|
|
888
|
+
for (const e of plan) {
|
|
889
|
+
const mark = e.defaultOn ? "●" : "○";
|
|
890
|
+
const tag = e.target.alwaysDefault ? "default" : e.detected ? "detected" : "available";
|
|
891
|
+
io.out(`${mark} ${e.target.id} ${tag} ${e.path}`);
|
|
892
|
+
}
|
|
893
|
+
io.err("");
|
|
894
|
+
io.err("● = installed by default. Run `flypod install skill` to write them.");
|
|
895
|
+
return 0;
|
|
896
|
+
}
|
|
897
|
+
let chosen;
|
|
898
|
+
if (args.all) {
|
|
899
|
+
chosen = plan.map((e) => e.target.id);
|
|
900
|
+
} else if (args.targets && args.targets.length > 0) {
|
|
901
|
+
const known = new Set(plan.map((e) => e.target.id));
|
|
902
|
+
const unknown = args.targets.filter((id) => !known.has(id));
|
|
903
|
+
if (unknown.length > 0) {
|
|
904
|
+
io.err(`flypod: unknown target(s): ${unknown.join(", ")}`);
|
|
905
|
+
io.err(`Known targets: ${TARGETS.map((t) => t.id).join(", ")}`);
|
|
906
|
+
return 2;
|
|
907
|
+
}
|
|
908
|
+
chosen = args.targets;
|
|
909
|
+
} else if (args.picker) {
|
|
910
|
+
const picked = await args.picker(plan);
|
|
911
|
+
if (picked === null) {
|
|
912
|
+
io.err("Cancelled. Nothing written.");
|
|
913
|
+
return 130;
|
|
914
|
+
}
|
|
915
|
+
chosen = picked;
|
|
916
|
+
} else {
|
|
917
|
+
chosen = plan.filter((e) => e.defaultOn).map((e) => e.target.id);
|
|
918
|
+
}
|
|
919
|
+
const selected = plan.filter((e) => chosen.includes(e.target.id));
|
|
920
|
+
if (selected.length === 0) {
|
|
921
|
+
io.err("No targets selected. Nothing written.");
|
|
922
|
+
return 0;
|
|
923
|
+
}
|
|
924
|
+
if (args.dryRun) {
|
|
925
|
+
io.err("Would write:");
|
|
926
|
+
for (const e of selected)
|
|
927
|
+
io.out(e.path);
|
|
928
|
+
return 0;
|
|
929
|
+
}
|
|
930
|
+
const results = [];
|
|
931
|
+
for (const e of selected) {
|
|
932
|
+
try {
|
|
933
|
+
results.push(await writeTarget(e.target, e.path));
|
|
934
|
+
} catch (error) {
|
|
935
|
+
io.err(`flypod: failed to write ${e.path}: ${error.message}`);
|
|
936
|
+
return 1;
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
const verb = {
|
|
940
|
+
created: "created",
|
|
941
|
+
updated: "updated",
|
|
942
|
+
unchanged: "up to date"
|
|
943
|
+
};
|
|
944
|
+
for (const r of results) {
|
|
945
|
+
io.err(` ${r.status === "unchanged" ? "·" : "✓"} ${verb[r.status]} ${r.path}`);
|
|
946
|
+
io.out(r.path);
|
|
947
|
+
}
|
|
948
|
+
const changed = results.filter((r) => r.status !== "unchanged").length;
|
|
949
|
+
io.err("");
|
|
950
|
+
io.err(changed > 0 ? `Your agents now know how to deploy with flypod. Try asking one to "deploy this with flypod".` : "Everything was already up to date.");
|
|
951
|
+
return 0;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
// src/ui.ts
|
|
955
|
+
var ESC2 = "\x1B[";
|
|
462
956
|
function envBool(name) {
|
|
463
957
|
const v = process.env[name];
|
|
464
958
|
return v !== undefined && v !== "" && v !== "0" && v !== "false";
|
|
@@ -472,7 +966,7 @@ function colorsEnabled(stream = process.stderr) {
|
|
|
472
966
|
}
|
|
473
967
|
var FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
474
968
|
function paint(open, s) {
|
|
475
|
-
return `${
|
|
969
|
+
return `${ESC2}${open}m${s}${ESC2}0m`;
|
|
476
970
|
}
|
|
477
971
|
function makeStyle(enabled) {
|
|
478
972
|
if (!enabled) {
|
|
@@ -495,11 +989,11 @@ function makeSpinner(stream = process.stderr, style = makeStyle(false)) {
|
|
|
495
989
|
let label = "";
|
|
496
990
|
let started = false;
|
|
497
991
|
const writeFrame = () => {
|
|
498
|
-
stream.write(`\r${
|
|
992
|
+
stream.write(`\r${ESC2}2K ${style.accent(FRAMES[frame] ?? "·")} ${label}`);
|
|
499
993
|
};
|
|
500
994
|
const clearLine = () => {
|
|
501
995
|
if (tty)
|
|
502
|
-
stream.write(`\r${
|
|
996
|
+
stream.write(`\r${ESC2}2K`);
|
|
503
997
|
};
|
|
504
998
|
return {
|
|
505
999
|
start(text) {
|
|
@@ -571,8 +1065,20 @@ var SUBCOMMANDS = new Set([
|
|
|
571
1065
|
"logout",
|
|
572
1066
|
"list",
|
|
573
1067
|
"claim",
|
|
574
|
-
"keys"
|
|
1068
|
+
"keys",
|
|
1069
|
+
"install"
|
|
575
1070
|
]);
|
|
1071
|
+
var TARGET_FLAGS = {
|
|
1072
|
+
"--agents": "agents",
|
|
1073
|
+
"--agents-md": "agents",
|
|
1074
|
+
"--claude": "claude",
|
|
1075
|
+
"--cursor": "cursor",
|
|
1076
|
+
"--copilot": "copilot",
|
|
1077
|
+
"--windsurf": "windsurf",
|
|
1078
|
+
"--cline": "cline",
|
|
1079
|
+
"--roo": "roo",
|
|
1080
|
+
"--gemini": "gemini"
|
|
1081
|
+
};
|
|
576
1082
|
function parseArgs(argv) {
|
|
577
1083
|
const out = { json: false, quiet: false, help: false, version: false };
|
|
578
1084
|
for (const a of argv) {
|
|
@@ -594,18 +1100,6 @@ Run \`flypod --help\` for usage.
|
|
|
594
1100
|
}
|
|
595
1101
|
return out;
|
|
596
1102
|
}
|
|
597
|
-
function flag(argv, name) {
|
|
598
|
-
const long = `--${name}`;
|
|
599
|
-
const equals = `${long}=`;
|
|
600
|
-
for (let i = 0;i < argv.length; i++) {
|
|
601
|
-
const a = argv[i];
|
|
602
|
-
if (a === long)
|
|
603
|
-
return argv[i + 1];
|
|
604
|
-
if (a.startsWith(equals))
|
|
605
|
-
return a.slice(equals.length);
|
|
606
|
-
}
|
|
607
|
-
return;
|
|
608
|
-
}
|
|
609
1103
|
function parseSub(argv) {
|
|
610
1104
|
const positionals = [];
|
|
611
1105
|
let site;
|
|
@@ -656,7 +1150,7 @@ async function runSubcommand(name, argv) {
|
|
|
656
1150
|
return forget({ site }, io);
|
|
657
1151
|
}
|
|
658
1152
|
case "login":
|
|
659
|
-
return login({
|
|
1153
|
+
return login({}, io);
|
|
660
1154
|
case "logout":
|
|
661
1155
|
return logout({}, io);
|
|
662
1156
|
case "list":
|
|
@@ -672,17 +1166,81 @@ async function runSubcommand(name, argv) {
|
|
|
672
1166
|
io.err("Usage: flypod keys create");
|
|
673
1167
|
return 2;
|
|
674
1168
|
}
|
|
1169
|
+
case "install":
|
|
1170
|
+
return runInstall(argv, io);
|
|
675
1171
|
default:
|
|
676
1172
|
io.err(`flypod: unknown subcommand "${name}"`);
|
|
677
1173
|
return 2;
|
|
678
1174
|
}
|
|
679
1175
|
}
|
|
1176
|
+
function shortHome(path) {
|
|
1177
|
+
const home = homedir3();
|
|
1178
|
+
return path.startsWith(home) ? `~${path.slice(home.length)}` : path;
|
|
1179
|
+
}
|
|
1180
|
+
async function runInstall(argv, io) {
|
|
1181
|
+
const noun = argv.find((a) => !a.startsWith("-"));
|
|
1182
|
+
if (noun !== "skill" && noun !== "skills") {
|
|
1183
|
+
io.err("Usage: flypod install skill [targets] [--all] [--global] [--list] [--dry-run]");
|
|
1184
|
+
io.err("");
|
|
1185
|
+
io.err("Teaches your coding agents (Claude Code, Codex, Cursor, …) how to deploy");
|
|
1186
|
+
io.err("with flypod by writing a small instruction file they read automatically.");
|
|
1187
|
+
return 2;
|
|
1188
|
+
}
|
|
1189
|
+
const KNOWN_FLAGS = new Set([
|
|
1190
|
+
"--all",
|
|
1191
|
+
"--global",
|
|
1192
|
+
"--list",
|
|
1193
|
+
"--dry-run",
|
|
1194
|
+
"--print",
|
|
1195
|
+
"--yes",
|
|
1196
|
+
"-y",
|
|
1197
|
+
...Object.keys(TARGET_FLAGS)
|
|
1198
|
+
]);
|
|
1199
|
+
const unknownFlag = argv.find((a) => a.startsWith("-") && !KNOWN_FLAGS.has(a));
|
|
1200
|
+
if (unknownFlag) {
|
|
1201
|
+
io.err(`flypod: unknown flag "${unknownFlag}"`);
|
|
1202
|
+
io.err("Run `flypod install skill --list` to see available targets and flags.");
|
|
1203
|
+
return 2;
|
|
1204
|
+
}
|
|
1205
|
+
const has = (flag) => argv.includes(flag);
|
|
1206
|
+
const targets = [];
|
|
1207
|
+
for (const [flag, id] of Object.entries(TARGET_FLAGS)) {
|
|
1208
|
+
if (has(flag) && !targets.includes(id))
|
|
1209
|
+
targets.push(id);
|
|
1210
|
+
}
|
|
1211
|
+
const all = has("--all");
|
|
1212
|
+
const global = has("--global");
|
|
1213
|
+
const list2 = has("--list");
|
|
1214
|
+
const dryRun = has("--dry-run") || has("--print");
|
|
1215
|
+
const yes = has("--yes") || has("-y");
|
|
1216
|
+
const interactive = !list2 && !dryRun && !all && !yes && targets.length === 0 && canPrompt(process.stdin);
|
|
1217
|
+
const picker = interactive ? async (plan) => {
|
|
1218
|
+
const style = makeStyle(colorsEnabled(process.stderr));
|
|
1219
|
+
process.stderr.write(`
|
|
1220
|
+
${style.bold(style.accent("flypod"))} ${style.dim("· teach your agents to deploy")}
|
|
1221
|
+
|
|
1222
|
+
`);
|
|
1223
|
+
const choices = plan.map((e) => ({
|
|
1224
|
+
id: e.target.id,
|
|
1225
|
+
label: e.target.label,
|
|
1226
|
+
hint: `${e.target.detail}${e.detected && !e.target.alwaysDefault ? " · detected" : ""}`,
|
|
1227
|
+
checked: e.defaultOn
|
|
1228
|
+
}));
|
|
1229
|
+
return multiselect({ title: "Install the flypod skill into:", choices, style });
|
|
1230
|
+
} : undefined;
|
|
1231
|
+
const io2 = {
|
|
1232
|
+
out: io.out,
|
|
1233
|
+
err: (line) => io.err(shortHome(line)),
|
|
1234
|
+
env: io.env
|
|
1235
|
+
};
|
|
1236
|
+
return installSkill({ targets, all, global, list: list2, dryRun, picker }, io2);
|
|
1237
|
+
}
|
|
680
1238
|
async function readVersion() {
|
|
681
1239
|
const here = fileURLToPath(import.meta.url);
|
|
682
1240
|
for (const rel of ["../../package.json", "../package.json"]) {
|
|
683
1241
|
try {
|
|
684
1242
|
const url = new URL(rel, `file://${here}`);
|
|
685
|
-
const text = await
|
|
1243
|
+
const text = await readFile4(url, "utf8");
|
|
686
1244
|
const version = JSON.parse(text).version;
|
|
687
1245
|
if (version)
|
|
688
1246
|
return version;
|
|
@@ -731,12 +1289,17 @@ Account (optional — lets deploys live forever and be listed/owned):
|
|
|
731
1289
|
flypod keys create Mint a new API key (for agents / CI).
|
|
732
1290
|
flypod forget [--site <id>] Drop this folder's remembered site link.
|
|
733
1291
|
|
|
1292
|
+
Agents:
|
|
1293
|
+
flypod install skill Teach your coding agents (Claude Code, Codex,
|
|
1294
|
+
Cursor, …) how to deploy with flypod.
|
|
1295
|
+
|
|
734
1296
|
Output:
|
|
735
1297
|
--json Emit a stable JSON result on stdout (for agents/scripts).
|
|
736
1298
|
-q, --quiet Print only the URL.
|
|
737
1299
|
-h, --help Show this help. -v, --version Show the flypod version.
|
|
738
1300
|
|
|
739
1301
|
Environment:
|
|
1302
|
+
FLYPOD_API_KEY Deploy as your account without logging in (agents / CI)
|
|
740
1303
|
DEPLOY_URL Override the deploy server (default: https://flypod.dev)
|
|
741
1304
|
FLYPOD_CONFIG_DIR Override where the CLI keeps its session + folder memory
|
|
742
1305
|
NO_COLOR Disable ANSI colors
|
|
@@ -774,8 +1337,7 @@ async function main() {
|
|
|
774
1337
|
`);
|
|
775
1338
|
return;
|
|
776
1339
|
}
|
|
777
|
-
const
|
|
778
|
-
const baseUrl = session?.base_url ?? process.env.DEPLOY_URL ?? "https://flypod.dev";
|
|
1340
|
+
const { apiKey, baseUrl } = await resolveAuth();
|
|
779
1341
|
const useUI = !args.json && !args.quiet;
|
|
780
1342
|
const style = makeStyle(colorsEnabled(process.stderr) && useUI);
|
|
781
1343
|
if (useUI) {
|
|
@@ -837,7 +1399,7 @@ async function main() {
|
|
|
837
1399
|
const started = Date.now();
|
|
838
1400
|
let result;
|
|
839
1401
|
try {
|
|
840
|
-
result = await deploySite({ baseUrl, files, apiKey
|
|
1402
|
+
result = await deploySite({ baseUrl, files, apiKey });
|
|
841
1403
|
} catch (error) {
|
|
842
1404
|
spinner.fail("Deploy failed.");
|
|
843
1405
|
const msg = error.message;
|