flypod 0.7.0 → 0.9.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/LICENSE +42 -15
- package/README.md +512 -193
- package/dist/bin/deploy.js +323 -418
- package/dist/{cli-j9rxpfdv.js → cli-db9gcrd0.js} +621 -14
- package/dist/src/cli/client.d.ts +13 -1
- package/dist/src/cli/commands.d.ts +76 -0
- package/dist/src/cli/projects.d.ts +35 -0
- package/dist/src/cli/receipt.d.ts +155 -0
- package/dist/src/cli/skill.d.ts +135 -0
- package/dist/src/cli/source.d.ts +7 -0
- package/dist/src/cli.d.ts +18 -0
- package/dist/src/cli.js +4 -4
- package/dist/src/deploy-source.d.ts +28 -0
- package/package.json +6 -10
package/dist/bin/deploy.js
CHANGED
|
@@ -5,16 +5,17 @@ import {
|
|
|
5
5
|
collectDist,
|
|
6
6
|
createClient,
|
|
7
7
|
deploySite,
|
|
8
|
+
installSkill,
|
|
8
9
|
projectsFilePath,
|
|
9
10
|
resolveCredentials,
|
|
10
11
|
resolveDeployDir,
|
|
11
12
|
saveSession,
|
|
12
13
|
zipSync
|
|
13
|
-
} from "../cli-
|
|
14
|
+
} from "../cli-db9gcrd0.js";
|
|
14
15
|
|
|
15
16
|
// bin/deploy.ts
|
|
16
|
-
import { readFile as
|
|
17
|
-
import { homedir
|
|
17
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
18
|
+
import { homedir } from "node:os";
|
|
18
19
|
import { relative } from "node:path";
|
|
19
20
|
import { fileURLToPath } from "node:url";
|
|
20
21
|
|
|
@@ -34,8 +35,14 @@ function cap(projects) {
|
|
|
34
35
|
const entries = Object.entries(projects);
|
|
35
36
|
if (entries.length <= MAX_PROJECTS)
|
|
36
37
|
return projects;
|
|
38
|
+
const irreplaceable = ([, r]) => r.expires_at !== null && typeof r.manage_token === "string";
|
|
37
39
|
entries.sort(([, a], [, b]) => b.last_used - a.last_used);
|
|
38
|
-
|
|
40
|
+
const keep = [
|
|
41
|
+
...entries.filter((e) => irreplaceable(e)),
|
|
42
|
+
...entries.filter((e) => !irreplaceable(e))
|
|
43
|
+
].slice(0, MAX_PROJECTS);
|
|
44
|
+
keep.sort(([, a], [, b]) => b.last_used - a.last_used);
|
|
45
|
+
return Object.fromEntries(keep);
|
|
39
46
|
}
|
|
40
47
|
async function loadProjects(env) {
|
|
41
48
|
try {
|
|
@@ -87,6 +94,110 @@ async function forgetSite(site_id, env) {
|
|
|
87
94
|
return removed;
|
|
88
95
|
}
|
|
89
96
|
|
|
97
|
+
// src/cli/receipt.ts
|
|
98
|
+
var DAY_MS = 86400000;
|
|
99
|
+
var ANSI = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`, "g");
|
|
100
|
+
var LABEL = 15;
|
|
101
|
+
var COMMAND = 18;
|
|
102
|
+
function daysUntil(expiresAt, now) {
|
|
103
|
+
return Math.max(0, Math.round((expiresAt - now) / DAY_MS));
|
|
104
|
+
}
|
|
105
|
+
var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
106
|
+
function expiryDate(expiresAt) {
|
|
107
|
+
const d = new Date(expiresAt);
|
|
108
|
+
return `${d.getUTCDate()} ${MONTHS[d.getUTCMonth()]} ${d.getUTCFullYear()}`;
|
|
109
|
+
}
|
|
110
|
+
function timestamp(ms) {
|
|
111
|
+
const d = new Date(ms);
|
|
112
|
+
const hh = String(d.getUTCHours()).padStart(2, "0");
|
|
113
|
+
const mm = String(d.getUTCMinutes()).padStart(2, "0");
|
|
114
|
+
return `${expiryDate(ms)} ${hh}:${mm} UTC`;
|
|
115
|
+
}
|
|
116
|
+
var LOOP = [
|
|
117
|
+
{ label: "ship a change", command: "flypod update", effect: "new version, same URL" },
|
|
118
|
+
{ label: "undo", command: "flypod rollback", effect: "previous version, instantly" },
|
|
119
|
+
{ label: "history", command: "flypod versions", effect: "every version, newest first" }
|
|
120
|
+
];
|
|
121
|
+
var PLAIN = {
|
|
122
|
+
dim: (s) => s,
|
|
123
|
+
bold: (s) => s,
|
|
124
|
+
muted: (s) => s,
|
|
125
|
+
accent: (s) => s,
|
|
126
|
+
ok: (s) => s
|
|
127
|
+
};
|
|
128
|
+
function gutter(label) {
|
|
129
|
+
return label.padEnd(LABEL, " ");
|
|
130
|
+
}
|
|
131
|
+
function row(label, command, effect, s) {
|
|
132
|
+
return ` ${s.muted(gutter(label))}${s.bold(command.padEnd(COMMAND, " "))}${s.dim(effect)}`;
|
|
133
|
+
}
|
|
134
|
+
function wrap(effect, s) {
|
|
135
|
+
return ` ${" ".repeat(LABEL + COMMAND)}${s.dim(effect)}`;
|
|
136
|
+
}
|
|
137
|
+
function note(label, text, s) {
|
|
138
|
+
return ` ${s.muted(gutter(label))}${s.dim(text)}`;
|
|
139
|
+
}
|
|
140
|
+
function expiryLines(opts) {
|
|
141
|
+
if (opts.expiresAt === null)
|
|
142
|
+
return [];
|
|
143
|
+
const s = opts.style ?? PLAIN;
|
|
144
|
+
const days = daysUntil(opts.expiresAt, opts.now ?? Date.now());
|
|
145
|
+
const when = `${expiryDate(opts.expiresAt)} · ${days} day${days === 1 ? "" : "s"}`;
|
|
146
|
+
return [
|
|
147
|
+
opts.check === false ? note("expires", when, s) : ` ${s.muted(gutter("expires"))}${s.dim(`${when} · `)}${s.bold("flypod versions")}`,
|
|
148
|
+
row("keep it", "flypod login", "drops the expiry from this URL", s),
|
|
149
|
+
wrap("and every site on this machine", s)
|
|
150
|
+
];
|
|
151
|
+
}
|
|
152
|
+
function deployTail(opts) {
|
|
153
|
+
const style = opts.style ?? PLAIN;
|
|
154
|
+
const lines = LOOP.map((step) => row(step.label, step.command, step.effect, style));
|
|
155
|
+
lines.push("");
|
|
156
|
+
if (opts.expiresAt === null) {
|
|
157
|
+
lines.push(note("expires", opts.owned ? "never · attributed to your account" : "never", style));
|
|
158
|
+
return lines;
|
|
159
|
+
}
|
|
160
|
+
lines.push(...expiryLines({ expiresAt: opts.expiresAt, now: opts.now, style }));
|
|
161
|
+
return lines;
|
|
162
|
+
}
|
|
163
|
+
function updateTail(opts) {
|
|
164
|
+
const s = opts.style ?? PLAIN;
|
|
165
|
+
return [
|
|
166
|
+
` ${s.ok("✓")} ${s.dim(`version ${opts.versionId} is now live`)}`,
|
|
167
|
+
` ${s.accent(opts.url)}`,
|
|
168
|
+
...(opts.warnings ?? []).map((w) => ` ! ${w.code} — ${w.fix_recipe}`),
|
|
169
|
+
row("undo", "flypod rollback", "previous version, instantly", s),
|
|
170
|
+
...expiryLines({ expiresAt: opts.expiresAt, now: opts.now, style: s })
|
|
171
|
+
];
|
|
172
|
+
}
|
|
173
|
+
function rollbackTail(opts) {
|
|
174
|
+
const s = opts.style ?? PLAIN;
|
|
175
|
+
return [` ${s.ok("✓")} ${s.dim(`rolled back to ${opts.versionId}`)}`, ` ${s.accent(opts.url)}`];
|
|
176
|
+
}
|
|
177
|
+
function relinkNotice(prev, style) {
|
|
178
|
+
const s = style ?? PLAIN;
|
|
179
|
+
return [
|
|
180
|
+
` ${s.muted(gutter("linked"))}${s.bold("flypod update")}${s.dim(" ships to")}`,
|
|
181
|
+
` ${s.muted(gutter(""))}${s.accent(prev.url)}`,
|
|
182
|
+
note("", "this run makes a second site instead", s)
|
|
183
|
+
];
|
|
184
|
+
}
|
|
185
|
+
function agentNext(opts) {
|
|
186
|
+
const now = opts.now ?? Date.now();
|
|
187
|
+
const expiring = opts.expiresAt !== null;
|
|
188
|
+
return {
|
|
189
|
+
expires_in_days: expiring ? daysUntil(opts.expiresAt, now) : null,
|
|
190
|
+
expires_at_iso: expiring ? new Date(opts.expiresAt).toISOString() : null,
|
|
191
|
+
next: {
|
|
192
|
+
update: "flypod update",
|
|
193
|
+
versions: "flypod versions",
|
|
194
|
+
rollback: "flypod rollback",
|
|
195
|
+
...expiring ? { keep: "flypod login" } : {}
|
|
196
|
+
},
|
|
197
|
+
next_note: expiring ? `This folder is linked to ${opts.siteId}. Run \`flypod update\` to publish changes to this same URL — running \`flypod\` again creates a different site at a different URL. The site stops serving on the date above unless \`flypod login\` claims it, which removes the expiry and changes nothing else.` : `This folder is linked to ${opts.siteId}. Run \`flypod update\` to publish changes to this same URL — running \`flypod\` again creates a different site at a different URL. This site does not expire.`
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
90
201
|
// src/cli/commands.ts
|
|
91
202
|
function siteUrlFrom(site_id, baseUrl) {
|
|
92
203
|
const host = new URL(baseUrl).host;
|
|
@@ -144,6 +255,26 @@ Drop this folder's remembered site link.
|
|
|
144
255
|
Flags:
|
|
145
256
|
--site <id> Forget all links to this site.
|
|
146
257
|
-h, --help Show this help.`,
|
|
258
|
+
token: `flypod token [flags]
|
|
259
|
+
|
|
260
|
+
Reveal the manage token for a site you deployed.
|
|
261
|
+
|
|
262
|
+
The token is a secret: anyone holding it can update, roll back, or claim that
|
|
263
|
+
site. Deploy output hides it by default for exactly that reason — it is already
|
|
264
|
+
saved for this folder, so update/rollback/versions work without it. You only
|
|
265
|
+
need to reveal it to act on the site from a different machine or folder.
|
|
266
|
+
|
|
267
|
+
flypod token Reveal this folder's site token.
|
|
268
|
+
flypod token --site <id> Reveal a remembered site's token by id.
|
|
269
|
+
|
|
270
|
+
The token goes to stdout, so it pipes:
|
|
271
|
+
|
|
272
|
+
flypod token | pbcopy
|
|
273
|
+
TOKEN=$(flypod token)
|
|
274
|
+
|
|
275
|
+
Flags:
|
|
276
|
+
--site <id> Reveal the token for this site id instead of this folder.
|
|
277
|
+
-h, --help Show this help.`,
|
|
147
278
|
login: `flypod login [flags]
|
|
148
279
|
|
|
149
280
|
Authenticate with flypod via the browser (device authorization).
|
|
@@ -269,14 +400,15 @@ async function attachAnonymousSites(apiKey, baseUrl, io, env) {
|
|
|
269
400
|
if (attached.size > 0) {
|
|
270
401
|
for (const [dir, rec] of candidates) {
|
|
271
402
|
if (attached.has(rec.site_id)) {
|
|
272
|
-
|
|
403
|
+
const { manage_token: _dead, ...owned } = rec;
|
|
404
|
+
projects[dir] = { ...owned, expires_at: null };
|
|
273
405
|
}
|
|
274
406
|
}
|
|
275
407
|
await saveProjects(projects, env);
|
|
276
408
|
}
|
|
277
409
|
if (attached.size > 0) {
|
|
278
410
|
const word = attached.size === 1 ? "site" : "sites";
|
|
279
|
-
io.err(` Attached ${attached.size} ${word}.`);
|
|
411
|
+
io.err(` Attached ${attached.size} ${word} — no expiry now, same URLs.`);
|
|
280
412
|
}
|
|
281
413
|
if (skipped.length > 0) {
|
|
282
414
|
io.err(` Skipped ${skipped.length} (already owned or expired).`);
|
|
@@ -325,12 +457,30 @@ async function claim(args, io) {
|
|
|
325
457
|
}
|
|
326
458
|
const res = await client.claimSite(args.site_id, args.token);
|
|
327
459
|
if (!res.ok) {
|
|
328
|
-
io.err(`flypod claim: server returned ${res.status}.`);
|
|
460
|
+
io.err(res.status === 409 ? `flypod claim: ${args.site_id} already belongs to another account.` : `flypod claim: server returned ${res.status}.`);
|
|
329
461
|
return 1;
|
|
330
462
|
}
|
|
331
463
|
const body = await res.json();
|
|
332
|
-
|
|
333
|
-
|
|
464
|
+
try {
|
|
465
|
+
const projects = await loadProjects(env);
|
|
466
|
+
let changed = false;
|
|
467
|
+
for (const [dir, r] of Object.entries(projects)) {
|
|
468
|
+
if (r.site_id === body.site_id && (r.expires_at !== null || r.manage_token)) {
|
|
469
|
+
const { manage_token: _dead, ...owned } = r;
|
|
470
|
+
projects[dir] = { ...owned, expires_at: null };
|
|
471
|
+
changed = true;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
if (changed)
|
|
475
|
+
await saveProjects(projects, env);
|
|
476
|
+
} catch {}
|
|
477
|
+
io.out(JSON.stringify({
|
|
478
|
+
ok: true,
|
|
479
|
+
site_id: body.site_id,
|
|
480
|
+
owner_account_id: body.owner_account_id,
|
|
481
|
+
expires_at: null
|
|
482
|
+
}));
|
|
483
|
+
io.err(`Claimed ${body.site_id} — the expiry is gone. Same URL, same versions.`);
|
|
334
484
|
return 0;
|
|
335
485
|
}
|
|
336
486
|
var NO_SITE = "No flypod site is linked to this folder. Run 'flypod' here to create one, or pass --site <id>.";
|
|
@@ -357,6 +507,7 @@ function clientForTarget(target, args, io) {
|
|
|
357
507
|
return createClient({
|
|
358
508
|
env: io.env ?? process.env,
|
|
359
509
|
fetch: io.fetch,
|
|
510
|
+
cwd: io.cwd,
|
|
360
511
|
overrides: {
|
|
361
512
|
token: args.token,
|
|
362
513
|
manageToken: target.rec?.manage_token,
|
|
@@ -428,12 +579,20 @@ async function update(args, io) {
|
|
|
428
579
|
}
|
|
429
580
|
const body = await res.json();
|
|
430
581
|
await touchLink(target, body.version_id, env);
|
|
582
|
+
const expiresAt = target.rec?.expires_at ?? null;
|
|
431
583
|
if (args.json) {
|
|
432
584
|
io.out(JSON.stringify({
|
|
433
585
|
ok: true,
|
|
434
586
|
site_id: target.site_id,
|
|
435
587
|
version_id: body.version_id,
|
|
436
|
-
url: body.url
|
|
588
|
+
url: body.url,
|
|
589
|
+
healed: body.healed ?? [],
|
|
590
|
+
warnings: body.warnings ?? [],
|
|
591
|
+
...agentNext({
|
|
592
|
+
siteId: target.site_id,
|
|
593
|
+
expiresAt,
|
|
594
|
+
owned: expiresAt === null
|
|
595
|
+
})
|
|
437
596
|
}));
|
|
438
597
|
return 0;
|
|
439
598
|
}
|
|
@@ -441,7 +600,15 @@ async function update(args, io) {
|
|
|
441
600
|
io.out(body.url);
|
|
442
601
|
return 0;
|
|
443
602
|
}
|
|
444
|
-
|
|
603
|
+
for (const line of updateTail({
|
|
604
|
+
versionId: body.version_id,
|
|
605
|
+
url: body.url,
|
|
606
|
+
expiresAt,
|
|
607
|
+
warnings: body.warnings,
|
|
608
|
+
style: io.style
|
|
609
|
+
})) {
|
|
610
|
+
io.err(line);
|
|
611
|
+
}
|
|
445
612
|
io.out(body.url);
|
|
446
613
|
return 0;
|
|
447
614
|
}
|
|
@@ -454,13 +621,23 @@ async function versions(args, io) {
|
|
|
454
621
|
if ("error" in site)
|
|
455
622
|
return site.error;
|
|
456
623
|
const { live_version_id, versions: vers } = site.data;
|
|
624
|
+
const expiresAt = site.data.expires_at ?? null;
|
|
457
625
|
if (args.json) {
|
|
458
|
-
io.out(JSON.stringify({
|
|
626
|
+
io.out(JSON.stringify({
|
|
627
|
+
ok: true,
|
|
628
|
+
site_id: target.site_id,
|
|
629
|
+
live_version_id,
|
|
630
|
+
versions: vers,
|
|
631
|
+
expires_at: expiresAt,
|
|
632
|
+
...agentNext({ siteId: target.site_id, expiresAt, owned: expiresAt === null })
|
|
633
|
+
}));
|
|
459
634
|
return 0;
|
|
460
635
|
}
|
|
461
636
|
for (const v of [...vers].reverse()) {
|
|
462
|
-
io.out(`${v.version_id} ${v.created_at} ${v.version_id === live_version_id ? "live" : ""}`);
|
|
637
|
+
io.out(`${v.version_id} ${timestamp(v.created_at)} ${v.version_id === live_version_id ? "live" : ""}`);
|
|
463
638
|
}
|
|
639
|
+
for (const line of expiryLines({ expiresAt, style: io.style, check: false }))
|
|
640
|
+
io.err(line);
|
|
464
641
|
return 0;
|
|
465
642
|
}
|
|
466
643
|
async function rollback(args, io) {
|
|
@@ -516,10 +693,36 @@ async function rollback(args, io) {
|
|
|
516
693
|
}));
|
|
517
694
|
return 0;
|
|
518
695
|
}
|
|
519
|
-
|
|
696
|
+
for (const line of rollbackTail({
|
|
697
|
+
versionId: body.live_version_id,
|
|
698
|
+
url,
|
|
699
|
+
style: io.style
|
|
700
|
+
})) {
|
|
701
|
+
io.err(line);
|
|
702
|
+
}
|
|
520
703
|
io.out(url);
|
|
521
704
|
return 0;
|
|
522
705
|
}
|
|
706
|
+
async function token(args, io) {
|
|
707
|
+
if (args.help) {
|
|
708
|
+
showSubHelp("token", io);
|
|
709
|
+
return 0;
|
|
710
|
+
}
|
|
711
|
+
const env = io.env ?? process.env;
|
|
712
|
+
const record = args.site ? Object.values(await loadProjects(env)).find((p) => p.site_id === args.site) : await projectForDir(io.cwd ?? process.cwd(), env);
|
|
713
|
+
if (!record) {
|
|
714
|
+
io.err(args.site ? `No remembered site ${args.site}. Tokens are only stored for sites deployed from this machine.` : "Nothing linked to this folder. Deploy first, or pass --site <id>.");
|
|
715
|
+
return 1;
|
|
716
|
+
}
|
|
717
|
+
if (!record.manage_token) {
|
|
718
|
+
io.err(`Site ${record.site_id} has no stored manage token. If you claimed it, it authenticates with your account — run \`flypod login\`.`);
|
|
719
|
+
return 1;
|
|
720
|
+
}
|
|
721
|
+
io.err(`Manage token for ${record.site_id} — treat it like a password.
|
|
722
|
+
`);
|
|
723
|
+
io.out(record.manage_token);
|
|
724
|
+
return 0;
|
|
725
|
+
}
|
|
523
726
|
async function forget(args, io) {
|
|
524
727
|
if (args.help) {
|
|
525
728
|
showSubHelp("forget", io);
|
|
@@ -610,12 +813,12 @@ async function resolveSiteAndThread(f, io) {
|
|
|
610
813
|
thread_id: f.positionals[0]
|
|
611
814
|
};
|
|
612
815
|
}
|
|
613
|
-
function requireCommentWriteToken(
|
|
614
|
-
if (!
|
|
816
|
+
function requireCommentWriteToken(token2, io) {
|
|
817
|
+
if (!token2) {
|
|
615
818
|
io.err("Not signed in. Run `flypod login` or set FLYPOD_TOKEN.");
|
|
616
819
|
return 3;
|
|
617
820
|
}
|
|
618
|
-
if (
|
|
821
|
+
if (token2.startsWith("fk_")) {
|
|
619
822
|
io.err("comments operations require an account session or agent token");
|
|
620
823
|
return 3;
|
|
621
824
|
}
|
|
@@ -1001,360 +1204,6 @@ function multiselect(opts) {
|
|
|
1001
1204
|
});
|
|
1002
1205
|
}
|
|
1003
1206
|
|
|
1004
|
-
// src/cli/skill.ts
|
|
1005
|
-
import { mkdir, readFile as readFile2, stat, writeFile } from "node:fs/promises";
|
|
1006
|
-
import { homedir } from "node:os";
|
|
1007
|
-
import { dirname, join } from "node:path";
|
|
1008
|
-
var SKILL_NAME = "flypod";
|
|
1009
|
-
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.";
|
|
1010
|
-
var MARK_BEGIN = `<!-- ${SKILL_NAME}:begin -->`;
|
|
1011
|
-
var MARK_END = `<!-- ${SKILL_NAME}:end -->`;
|
|
1012
|
-
function renderBody(sub) {
|
|
1013
|
-
return `flypod turns any folder of static files into a live, public URL with a single
|
|
1014
|
-
command. No account, no config, no build step of its own — you bring the built
|
|
1015
|
-
files, flypod hosts them. Reach for it the moment a build exists and the user
|
|
1016
|
-
wants it online: a site, a preview, a demo, a one-off share.
|
|
1017
|
-
|
|
1018
|
-
${sub} The happy path
|
|
1019
|
-
|
|
1020
|
-
1. Make sure the site is built — there is a folder of static files to ship
|
|
1021
|
-
(e.g. \`dist/\`, \`build/\`, \`out/\`). flypod ships files; it does not build them.
|
|
1022
|
-
2. Deploy that folder. Prefer \`--json\` so you can read the result:
|
|
1023
|
-
|
|
1024
|
-
\`\`\`sh
|
|
1025
|
-
npx flypod ./dist --json
|
|
1026
|
-
\`\`\`
|
|
1027
|
-
|
|
1028
|
-
If flypod is installed globally, drop the \`npx\`: \`flypod ./dist --json\`.
|
|
1029
|
-
3. Read the \`url\` field from the JSON and give it to the user. That is the live
|
|
1030
|
-
site. That's the whole loop.
|
|
1031
|
-
|
|
1032
|
-
If you omit the path, flypod auto-detects a build folder, trying \`dist\`,
|
|
1033
|
-
\`build\`, \`out\`, \`.output/public\`, \`.vercel/output/static\`, \`public\`, \`_site\`
|
|
1034
|
-
(each must contain an \`index.html\`). When in doubt, pass the path explicitly.
|
|
1035
|
-
|
|
1036
|
-
${sub} Is flypod installed?
|
|
1037
|
-
|
|
1038
|
-
Run \`flypod --version\`. If it is missing, **do not install anything** — just
|
|
1039
|
-
prefix commands with \`npx\`: \`npx flypod ...\` downloads and runs it on the fly.
|
|
1040
|
-
To install once: \`npm install -g flypod\`.
|
|
1041
|
-
|
|
1042
|
-
${sub} Reading the result
|
|
1043
|
-
|
|
1044
|
-
\`npx flypod ./dist --json\` prints a JSON object on stdout:
|
|
1045
|
-
|
|
1046
|
-
\`\`\`json
|
|
1047
|
-
{
|
|
1048
|
-
"ok": true,
|
|
1049
|
-
"url": "https://ab12cd34.flypod.dev",
|
|
1050
|
-
"site_id": "ab12cd34",
|
|
1051
|
-
"manage_token": "…",
|
|
1052
|
-
"claim_token": "…",
|
|
1053
|
-
"expires_at": 1782929906088,
|
|
1054
|
-
"files": 12,
|
|
1055
|
-
"bytes": 1234567,
|
|
1056
|
-
"elapsed_ms": 812
|
|
1057
|
-
}
|
|
1058
|
-
\`\`\`
|
|
1059
|
-
|
|
1060
|
-
- \`url\` — the live site. Always surface this to the user.
|
|
1061
|
-
- \`manage_token\` — save it; it is needed to redeploy, roll back, or delete the site.
|
|
1062
|
-
- \`claim_token\` — save it; it attaches an anonymous site to an account later.
|
|
1063
|
-
- \`expires_at\` — anonymous deploys are ephemeral (~14 days); \`null\` once owned.
|
|
1064
|
-
|
|
1065
|
-
Treat \`manage_token\` and \`claim_token\` as secrets — don't paste them into chat
|
|
1066
|
-
unless the user asks. Without \`--json\`, use quiet mode to capture the URL in a
|
|
1067
|
-
shell variable: \`URL=$(npx flypod ./dist -q)\` (URL on stdout, token on stderr).
|
|
1068
|
-
|
|
1069
|
-
${sub} Anonymous vs. signed in
|
|
1070
|
-
|
|
1071
|
-
- **Anonymous (default):** zero auth. The first deploy just works and the site
|
|
1072
|
-
expires in ~14 days. Best for previews and throwaways.
|
|
1073
|
-
- **Signed in:** deploys are attributed to an account, never expire, and show up
|
|
1074
|
-
in \`flypod list\`. Sign in once via the browser:
|
|
1075
|
-
|
|
1076
|
-
\`\`\`sh
|
|
1077
|
-
flypod login
|
|
1078
|
-
\`\`\`
|
|
1079
|
-
|
|
1080
|
-
For agents and CI, skip the session file entirely — set a session token in the
|
|
1081
|
-
environment and every deploy is attributed to the account:
|
|
1082
|
-
|
|
1083
|
-
\`\`\`sh
|
|
1084
|
-
FLYPOD_TOKEN=<session-token> npx flypod ./dist --json
|
|
1085
|
-
\`\`\`
|
|
1086
|
-
|
|
1087
|
-
${sub} Other commands
|
|
1088
|
-
|
|
1089
|
-
\`\`\`sh
|
|
1090
|
-
flypod list # sites you own (requires sign in)
|
|
1091
|
-
flypod claim <site_id> <token> # attach an anonymous deploy to your account
|
|
1092
|
-
flypod logout # forget the saved session token
|
|
1093
|
-
flypod --help # full usage
|
|
1094
|
-
\`\`\`
|
|
1095
|
-
|
|
1096
|
-
${sub} Rules of thumb
|
|
1097
|
-
|
|
1098
|
-
- Build first. Point flypod at the **output** folder, never the project root or source.
|
|
1099
|
-
- Prefer \`--json\` and read \`url\`. Use \`-q\`/\`--quiet\` when you only need the URL.
|
|
1100
|
-
- flypod hosts **static files only** (HTML/CSS/JS/assets). It runs no server or backend.
|
|
1101
|
-
- A missing \`flypod\` binary is fine — use \`npx flypod\`; never block on installing it.`;
|
|
1102
|
-
}
|
|
1103
|
-
function standaloneMarkdown() {
|
|
1104
|
-
return `# Deploy with flypod
|
|
1105
|
-
|
|
1106
|
-
${renderBody("##")}
|
|
1107
|
-
`;
|
|
1108
|
-
}
|
|
1109
|
-
function embedSection() {
|
|
1110
|
-
return `${MARK_BEGIN}
|
|
1111
|
-
## Deploying with flypod
|
|
1112
|
-
|
|
1113
|
-
${renderBody("###")}
|
|
1114
|
-
${MARK_END}`;
|
|
1115
|
-
}
|
|
1116
|
-
function claudeSkillFile() {
|
|
1117
|
-
return `---
|
|
1118
|
-
name: ${SKILL_NAME}
|
|
1119
|
-
description: ${SKILL_DESCRIPTION}
|
|
1120
|
-
---
|
|
1121
|
-
|
|
1122
|
-
${standaloneMarkdown()}`;
|
|
1123
|
-
}
|
|
1124
|
-
function cursorRuleFile() {
|
|
1125
|
-
return `---
|
|
1126
|
-
description: ${SKILL_DESCRIPTION}
|
|
1127
|
-
globs:
|
|
1128
|
-
alwaysApply: false
|
|
1129
|
-
---
|
|
1130
|
-
|
|
1131
|
-
${standaloneMarkdown()}`;
|
|
1132
|
-
}
|
|
1133
|
-
async function exists(path) {
|
|
1134
|
-
try {
|
|
1135
|
-
await stat(path);
|
|
1136
|
-
return true;
|
|
1137
|
-
} catch {
|
|
1138
|
-
return false;
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
async function anyExists(root, rels) {
|
|
1142
|
-
for (const rel of rels) {
|
|
1143
|
-
if (await exists(join(root, rel)))
|
|
1144
|
-
return true;
|
|
1145
|
-
}
|
|
1146
|
-
return false;
|
|
1147
|
-
}
|
|
1148
|
-
var TARGETS = [
|
|
1149
|
-
{
|
|
1150
|
-
id: "agents",
|
|
1151
|
-
label: "AGENTS.md",
|
|
1152
|
-
detail: "universal — Codex, Cursor, Copilot, Gemini, Zed, Jules, +more",
|
|
1153
|
-
kind: "embed",
|
|
1154
|
-
alwaysDefault: true,
|
|
1155
|
-
projectPath: (root) => join(root, "AGENTS.md"),
|
|
1156
|
-
globalPath: () => join(homedir(), ".codex", "AGENTS.md"),
|
|
1157
|
-
detect: () => Promise.resolve(true),
|
|
1158
|
-
render: embedSection
|
|
1159
|
-
},
|
|
1160
|
-
{
|
|
1161
|
-
id: "claude",
|
|
1162
|
-
label: "Claude Code",
|
|
1163
|
-
detail: ".claude/skills/flypod/SKILL.md — loaded on demand",
|
|
1164
|
-
kind: "skill",
|
|
1165
|
-
alwaysDefault: true,
|
|
1166
|
-
projectPath: (root) => join(root, ".claude", "skills", SKILL_NAME, "SKILL.md"),
|
|
1167
|
-
globalPath: () => join(homedir(), ".claude", "skills", SKILL_NAME, "SKILL.md"),
|
|
1168
|
-
detect: (root) => anyExists(root, [".claude", "CLAUDE.md"]),
|
|
1169
|
-
render: claudeSkillFile
|
|
1170
|
-
},
|
|
1171
|
-
{
|
|
1172
|
-
id: "cursor",
|
|
1173
|
-
label: "Cursor",
|
|
1174
|
-
detail: ".cursor/rules/flypod.mdc",
|
|
1175
|
-
kind: "rules",
|
|
1176
|
-
alwaysDefault: false,
|
|
1177
|
-
projectPath: (root) => join(root, ".cursor", "rules", `${SKILL_NAME}.mdc`),
|
|
1178
|
-
globalPath: () => null,
|
|
1179
|
-
detect: (root) => anyExists(root, [".cursor", ".cursorrules"]),
|
|
1180
|
-
render: cursorRuleFile
|
|
1181
|
-
},
|
|
1182
|
-
{
|
|
1183
|
-
id: "copilot",
|
|
1184
|
-
label: "GitHub Copilot",
|
|
1185
|
-
detail: ".github/copilot-instructions.md",
|
|
1186
|
-
kind: "embed",
|
|
1187
|
-
alwaysDefault: false,
|
|
1188
|
-
projectPath: (root) => join(root, ".github", "copilot-instructions.md"),
|
|
1189
|
-
globalPath: () => null,
|
|
1190
|
-
detect: (root) => anyExists(root, [".github"]),
|
|
1191
|
-
render: embedSection
|
|
1192
|
-
},
|
|
1193
|
-
{
|
|
1194
|
-
id: "windsurf",
|
|
1195
|
-
label: "Windsurf",
|
|
1196
|
-
detail: ".windsurf/rules/flypod.md",
|
|
1197
|
-
kind: "rules",
|
|
1198
|
-
alwaysDefault: false,
|
|
1199
|
-
projectPath: (root) => join(root, ".windsurf", "rules", `${SKILL_NAME}.md`),
|
|
1200
|
-
globalPath: () => null,
|
|
1201
|
-
detect: (root) => anyExists(root, [".windsurf", ".windsurfrules"]),
|
|
1202
|
-
render: standaloneMarkdown
|
|
1203
|
-
},
|
|
1204
|
-
{
|
|
1205
|
-
id: "cline",
|
|
1206
|
-
label: "Cline",
|
|
1207
|
-
detail: ".clinerules/flypod.md",
|
|
1208
|
-
kind: "rules",
|
|
1209
|
-
alwaysDefault: false,
|
|
1210
|
-
projectPath: (root) => join(root, ".clinerules", `${SKILL_NAME}.md`),
|
|
1211
|
-
globalPath: () => null,
|
|
1212
|
-
detect: (root) => anyExists(root, [".clinerules"]),
|
|
1213
|
-
render: standaloneMarkdown
|
|
1214
|
-
},
|
|
1215
|
-
{
|
|
1216
|
-
id: "roo",
|
|
1217
|
-
label: "Roo Code",
|
|
1218
|
-
detail: ".roo/rules/flypod.md",
|
|
1219
|
-
kind: "rules",
|
|
1220
|
-
alwaysDefault: false,
|
|
1221
|
-
projectPath: (root) => join(root, ".roo", "rules", `${SKILL_NAME}.md`),
|
|
1222
|
-
globalPath: () => null,
|
|
1223
|
-
detect: (root) => anyExists(root, [".roo", ".roorules"]),
|
|
1224
|
-
render: standaloneMarkdown
|
|
1225
|
-
},
|
|
1226
|
-
{
|
|
1227
|
-
id: "gemini",
|
|
1228
|
-
label: "Gemini CLI",
|
|
1229
|
-
detail: "GEMINI.md",
|
|
1230
|
-
kind: "embed",
|
|
1231
|
-
alwaysDefault: false,
|
|
1232
|
-
projectPath: (root) => join(root, "GEMINI.md"),
|
|
1233
|
-
globalPath: () => join(homedir(), ".gemini", "GEMINI.md"),
|
|
1234
|
-
detect: (root) => anyExists(root, ["GEMINI.md", ".gemini"]),
|
|
1235
|
-
render: embedSection
|
|
1236
|
-
}
|
|
1237
|
-
];
|
|
1238
|
-
function spliceBlock(existing, section) {
|
|
1239
|
-
const begin = existing.indexOf(MARK_BEGIN);
|
|
1240
|
-
const end = existing.indexOf(MARK_END);
|
|
1241
|
-
if (begin !== -1 && end !== -1 && end > begin) {
|
|
1242
|
-
const before = existing.slice(0, begin);
|
|
1243
|
-
const after = existing.slice(end + MARK_END.length);
|
|
1244
|
-
return `${before}${section}${after}`;
|
|
1245
|
-
}
|
|
1246
|
-
const trimmed = existing.replace(/\s+$/, "");
|
|
1247
|
-
return trimmed ? `${trimmed}
|
|
1248
|
-
|
|
1249
|
-
${section}
|
|
1250
|
-
` : `${section}
|
|
1251
|
-
`;
|
|
1252
|
-
}
|
|
1253
|
-
async function writeTarget(target, path) {
|
|
1254
|
-
const had = await exists(path);
|
|
1255
|
-
const current = had ? await readFile2(path, "utf8") : "";
|
|
1256
|
-
let next;
|
|
1257
|
-
if (target.kind === "embed") {
|
|
1258
|
-
next = spliceBlock(current, target.render());
|
|
1259
|
-
} else {
|
|
1260
|
-
next = target.render();
|
|
1261
|
-
}
|
|
1262
|
-
if (had && current === next)
|
|
1263
|
-
return { target, path, status: "unchanged" };
|
|
1264
|
-
await mkdir(dirname(path), { recursive: true });
|
|
1265
|
-
await writeFile(path, next, "utf8");
|
|
1266
|
-
return { target, path, status: had ? "updated" : "created" };
|
|
1267
|
-
}
|
|
1268
|
-
async function buildPlan(root, env, global) {
|
|
1269
|
-
const entries = [];
|
|
1270
|
-
for (const target of TARGETS) {
|
|
1271
|
-
const path = global ? target.globalPath(env) : target.projectPath(root);
|
|
1272
|
-
if (!path)
|
|
1273
|
-
continue;
|
|
1274
|
-
const detected = await target.detect(root, env);
|
|
1275
|
-
entries.push({
|
|
1276
|
-
target,
|
|
1277
|
-
path,
|
|
1278
|
-
detected,
|
|
1279
|
-
defaultOn: target.alwaysDefault || detected
|
|
1280
|
-
});
|
|
1281
|
-
}
|
|
1282
|
-
return entries;
|
|
1283
|
-
}
|
|
1284
|
-
async function installSkill(args, io) {
|
|
1285
|
-
const env = io.env ?? process.env;
|
|
1286
|
-
const root = args.cwd ?? process.cwd();
|
|
1287
|
-
const global = Boolean(args.global);
|
|
1288
|
-
const plan = await buildPlan(root, env, global);
|
|
1289
|
-
if (args.list) {
|
|
1290
|
-
io.err(global ? "flypod skill targets (global):" : "flypod skill targets (this project):");
|
|
1291
|
-
io.err("");
|
|
1292
|
-
for (const e of plan) {
|
|
1293
|
-
const mark = e.defaultOn ? "●" : "○";
|
|
1294
|
-
const tag = e.target.alwaysDefault ? "default" : e.detected ? "detected" : "available";
|
|
1295
|
-
io.out(`${mark} ${e.target.id} ${tag} ${e.path}`);
|
|
1296
|
-
}
|
|
1297
|
-
io.err("");
|
|
1298
|
-
io.err("● = installed by default. Run `flypod install skill` to write them.");
|
|
1299
|
-
return 0;
|
|
1300
|
-
}
|
|
1301
|
-
let chosen;
|
|
1302
|
-
if (args.all) {
|
|
1303
|
-
chosen = plan.map((e) => e.target.id);
|
|
1304
|
-
} else if (args.targets && args.targets.length > 0) {
|
|
1305
|
-
const known = new Set(plan.map((e) => e.target.id));
|
|
1306
|
-
const unknown = args.targets.filter((id) => !known.has(id));
|
|
1307
|
-
if (unknown.length > 0) {
|
|
1308
|
-
io.err(`flypod: unknown target(s): ${unknown.join(", ")}`);
|
|
1309
|
-
io.err(`Known targets: ${TARGETS.map((t) => t.id).join(", ")}`);
|
|
1310
|
-
return 2;
|
|
1311
|
-
}
|
|
1312
|
-
chosen = args.targets;
|
|
1313
|
-
} else if (args.picker) {
|
|
1314
|
-
const picked = await args.picker(plan);
|
|
1315
|
-
if (picked === null) {
|
|
1316
|
-
io.err("Cancelled. Nothing written.");
|
|
1317
|
-
return 130;
|
|
1318
|
-
}
|
|
1319
|
-
chosen = picked;
|
|
1320
|
-
} else {
|
|
1321
|
-
chosen = plan.filter((e) => e.defaultOn).map((e) => e.target.id);
|
|
1322
|
-
}
|
|
1323
|
-
const selected = plan.filter((e) => chosen.includes(e.target.id));
|
|
1324
|
-
if (selected.length === 0) {
|
|
1325
|
-
io.err("No targets selected. Nothing written.");
|
|
1326
|
-
return 0;
|
|
1327
|
-
}
|
|
1328
|
-
if (args.dryRun) {
|
|
1329
|
-
io.err("Would write:");
|
|
1330
|
-
for (const e of selected)
|
|
1331
|
-
io.out(e.path);
|
|
1332
|
-
return 0;
|
|
1333
|
-
}
|
|
1334
|
-
const results = [];
|
|
1335
|
-
for (const e of selected) {
|
|
1336
|
-
try {
|
|
1337
|
-
results.push(await writeTarget(e.target, e.path));
|
|
1338
|
-
} catch (error) {
|
|
1339
|
-
io.err(`flypod: failed to write ${e.path}: ${error.message}`);
|
|
1340
|
-
return 1;
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
const verb = {
|
|
1344
|
-
created: "created",
|
|
1345
|
-
updated: "updated",
|
|
1346
|
-
unchanged: "up to date"
|
|
1347
|
-
};
|
|
1348
|
-
for (const r of results) {
|
|
1349
|
-
io.err(` ${r.status === "unchanged" ? "·" : "✓"} ${verb[r.status]} ${r.path}`);
|
|
1350
|
-
io.out(r.path);
|
|
1351
|
-
}
|
|
1352
|
-
const changed = results.filter((r) => r.status !== "unchanged").length;
|
|
1353
|
-
io.err("");
|
|
1354
|
-
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.");
|
|
1355
|
-
return 0;
|
|
1356
|
-
}
|
|
1357
|
-
|
|
1358
1207
|
// src/ui.ts
|
|
1359
1208
|
var ESC2 = "\x1B[";
|
|
1360
1209
|
function envBool(name) {
|
|
@@ -1465,6 +1314,7 @@ var SUBCOMMANDS = new Set([
|
|
|
1465
1314
|
"versions",
|
|
1466
1315
|
"rollback",
|
|
1467
1316
|
"forget",
|
|
1317
|
+
"token",
|
|
1468
1318
|
"login",
|
|
1469
1319
|
"logout",
|
|
1470
1320
|
"list",
|
|
@@ -1473,15 +1323,15 @@ var SUBCOMMANDS = new Set([
|
|
|
1473
1323
|
"comments"
|
|
1474
1324
|
]);
|
|
1475
1325
|
var TARGET_FLAGS = {
|
|
1476
|
-
"--agents": "agents",
|
|
1477
|
-
"--agents-md": "agents",
|
|
1478
1326
|
"--claude": "claude",
|
|
1479
|
-
"--
|
|
1480
|
-
"--
|
|
1481
|
-
"--
|
|
1482
|
-
"--
|
|
1483
|
-
"--
|
|
1484
|
-
"--
|
|
1327
|
+
"--agents": "agents",
|
|
1328
|
+
"--cursor": "agents",
|
|
1329
|
+
"--codex": "agents",
|
|
1330
|
+
"--copilot": "agents",
|
|
1331
|
+
"--gemini": "agents",
|
|
1332
|
+
"--windsurf": "agents",
|
|
1333
|
+
"--cline": "agents",
|
|
1334
|
+
"--roo": "agents"
|
|
1485
1335
|
};
|
|
1486
1336
|
var INSTALL_FLAG_SPEC = {
|
|
1487
1337
|
"--all": "bool",
|
|
@@ -1552,25 +1402,30 @@ async function runSubcommand(name, argv) {
|
|
|
1552
1402
|
out: (line) => process.stdout.write(`${line}
|
|
1553
1403
|
`),
|
|
1554
1404
|
err: (line) => process.stderr.write(`${line}
|
|
1555
|
-
`)
|
|
1405
|
+
`),
|
|
1406
|
+
style: makeStyle(colorsEnabled(process.stderr))
|
|
1556
1407
|
};
|
|
1557
1408
|
switch (name) {
|
|
1558
1409
|
case "update": {
|
|
1559
|
-
const { positionals, site, token, json, quiet, help } = parseSub(argv);
|
|
1560
|
-
return update({ path: positionals[0], site, token, json, quiet, help }, io);
|
|
1410
|
+
const { positionals, site, token: token2, json, quiet, help } = parseSub(argv);
|
|
1411
|
+
return update({ path: positionals[0], site, token: token2, json, quiet, help }, io);
|
|
1561
1412
|
}
|
|
1562
1413
|
case "versions": {
|
|
1563
|
-
const { site, token, json, help } = parseSub(argv);
|
|
1564
|
-
return versions({ site, token, json, help }, io);
|
|
1414
|
+
const { site, token: token2, json, help } = parseSub(argv);
|
|
1415
|
+
return versions({ site, token: token2, json, help }, io);
|
|
1565
1416
|
}
|
|
1566
1417
|
case "rollback": {
|
|
1567
|
-
const { positionals, site, token, json, help } = parseSub(argv);
|
|
1568
|
-
return rollback({ version: positionals[0], site, token, json, help }, io);
|
|
1418
|
+
const { positionals, site, token: token2, json, help } = parseSub(argv);
|
|
1419
|
+
return rollback({ version: positionals[0], site, token: token2, json, help }, io);
|
|
1569
1420
|
}
|
|
1570
1421
|
case "forget": {
|
|
1571
1422
|
const { site, help } = parseSub(argv);
|
|
1572
1423
|
return forget({ site, help }, io);
|
|
1573
1424
|
}
|
|
1425
|
+
case "token": {
|
|
1426
|
+
const { site, help } = parseSub(argv);
|
|
1427
|
+
return token({ site, help }, io);
|
|
1428
|
+
}
|
|
1574
1429
|
case "login": {
|
|
1575
1430
|
const { flags } = parseFlags(argv, LOGIN_FLAG_SPEC);
|
|
1576
1431
|
return login({
|
|
@@ -1596,16 +1451,16 @@ async function runSubcommand(name, argv) {
|
|
|
1596
1451
|
}
|
|
1597
1452
|
}
|
|
1598
1453
|
function shortHome(path) {
|
|
1599
|
-
const home =
|
|
1454
|
+
const home = homedir();
|
|
1600
1455
|
return path.startsWith(home) ? `~${path.slice(home.length)}` : path;
|
|
1601
1456
|
}
|
|
1602
1457
|
async function runInstall(argv, io) {
|
|
1603
1458
|
const noun = argv.find((a) => !a.startsWith("-"));
|
|
1604
1459
|
if (noun !== "skill" && noun !== "skills") {
|
|
1605
|
-
io.err("Usage: flypod install skill [
|
|
1460
|
+
io.err("Usage: flypod install skill [--claude] [--agents] [--global] [--list] [--dry-run]");
|
|
1606
1461
|
io.err("");
|
|
1607
1462
|
io.err("Teaches your coding agents (Claude Code, Codex, Cursor, …) how to deploy");
|
|
1608
|
-
io.err("with flypod by writing
|
|
1463
|
+
io.err("with flypod by writing an Agent Skill into .claude/skills/ and .agents/skills/.");
|
|
1609
1464
|
return 2;
|
|
1610
1465
|
}
|
|
1611
1466
|
const { flags, unknown } = parseFlags(argv, INSTALL_FLAG_SPEC);
|
|
@@ -1635,8 +1490,8 @@ async function runInstall(argv, io) {
|
|
|
1635
1490
|
const choices = plan.map((e) => ({
|
|
1636
1491
|
id: e.target.id,
|
|
1637
1492
|
label: e.target.label,
|
|
1638
|
-
hint:
|
|
1639
|
-
checked:
|
|
1493
|
+
hint: e.target.detail,
|
|
1494
|
+
checked: true
|
|
1640
1495
|
}));
|
|
1641
1496
|
return multiselect({ title: "Install the flypod skill into:", choices, style });
|
|
1642
1497
|
} : undefined;
|
|
@@ -1645,14 +1500,14 @@ async function runInstall(argv, io) {
|
|
|
1645
1500
|
err: (line) => io.err(shortHome(line)),
|
|
1646
1501
|
env: io.env
|
|
1647
1502
|
};
|
|
1648
|
-
return installSkill({ targets, all, global, list: list2, dryRun, picker }, io2);
|
|
1503
|
+
return installSkill({ targets, all: all || yes, global, list: list2, dryRun, picker }, io2);
|
|
1649
1504
|
}
|
|
1650
1505
|
async function readVersion() {
|
|
1651
1506
|
const here = fileURLToPath(import.meta.url);
|
|
1652
1507
|
for (const rel of ["../../package.json", "../package.json"]) {
|
|
1653
1508
|
try {
|
|
1654
1509
|
const url = new URL(rel, `file://${here}`);
|
|
1655
|
-
const text = await
|
|
1510
|
+
const text = await readFile2(url, "utf8");
|
|
1656
1511
|
const version = JSON.parse(text).version;
|
|
1657
1512
|
if (version)
|
|
1658
1513
|
return version;
|
|
@@ -1693,21 +1548,43 @@ Targeting (update / versions / rollback):
|
|
|
1693
1548
|
--token <tok> A site's manage token, for acting on an anonymous site from a
|
|
1694
1549
|
machine that doesn't remember it. Owned sites use your login.
|
|
1695
1550
|
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1551
|
+
Ownership — two states, one command:
|
|
1552
|
+
A deploy with no account is TEMPORARY: live now, gone in 14 days. Run
|
|
1553
|
+
'flypod login' and it becomes YOURS: no expiry, listed on your account.
|
|
1554
|
+
Logging in claims EVERY temporary site this machine remembers, not just the
|
|
1555
|
+
last one — so "deploy now, log in whenever" works. You never need a token.
|
|
1556
|
+
|
|
1557
|
+
'flypod versions' prints the expiry date any time, so the end date is never
|
|
1558
|
+
a surprise. Claiming changes nothing else: same URL, same versions.
|
|
1559
|
+
|
|
1560
|
+
Attribution:
|
|
1561
|
+
flypod adds a small block of <meta> and JSON-LD to served HTML so crawlers
|
|
1562
|
+
can tell what hosts the page. It renders nothing and runs no script. To turn
|
|
1563
|
+
it off completely, put this anywhere in your page:
|
|
1564
|
+
|
|
1565
|
+
<meta name="flypod" content="none">
|
|
1566
|
+
|
|
1567
|
+
flypod login Sign in (opens your browser to confirm) and
|
|
1568
|
+
keep every site deployed from this machine.
|
|
1701
1569
|
flypod login --token <t> Save a session token directly (skip the browser).
|
|
1702
1570
|
Or set FLYPOD_TOKEN for agents/CI.
|
|
1703
1571
|
flypod logout Forget the saved session token.
|
|
1704
1572
|
flypod list List sites you own (JSON on stdout).
|
|
1705
|
-
flypod claim <id> <token> Attach
|
|
1573
|
+
flypod claim <id> <token> Attach one anonymous deploy to your account.
|
|
1574
|
+
'flypod login' is the easier path.
|
|
1706
1575
|
flypod forget [--site <id>] Drop this folder's remembered site link.
|
|
1576
|
+
flypod token [--site <id>] Print a site's manage token on stdout. Deploys
|
|
1577
|
+
don't show it — it's saved for you — so you only
|
|
1578
|
+
need this to act on a site from a machine that
|
|
1579
|
+
doesn't remember it. Treat it like a password.
|
|
1707
1580
|
|
|
1708
1581
|
Agents:
|
|
1709
|
-
flypod install skill Teach your coding agents
|
|
1710
|
-
|
|
1582
|
+
flypod install skill Teach your coding agents how to deploy with
|
|
1583
|
+
flypod. Writes an Agent Skill into
|
|
1584
|
+
.claude/skills/flypod/ (Claude Code) and
|
|
1585
|
+
.agents/skills/flypod/ (Codex, Cursor, Gemini
|
|
1586
|
+
CLI, Copilot). Add --global for your home dir,
|
|
1587
|
+
--list to see the paths, --dry-run to preview.
|
|
1711
1588
|
|
|
1712
1589
|
Deploy flags:
|
|
1713
1590
|
--comments Enable comments on the new site (mode: anonymous).
|
|
@@ -1732,13 +1609,17 @@ Comments (off by default — enabling is one command):
|
|
|
1732
1609
|
|
|
1733
1610
|
Output:
|
|
1734
1611
|
--json Emit a stable JSON result on stdout (for agents/scripts).
|
|
1735
|
-
|
|
1612
|
+
expires_at is epoch ms, or null once the site is yours.
|
|
1613
|
+
'warnings' lists problems that survived the deploy, each with
|
|
1614
|
+
a fix_recipe; 'healed' lists what flypod fixed for you.
|
|
1615
|
+
-q, --quiet Print only the URL on stdout, and nothing else.
|
|
1736
1616
|
-h, --help Show this help. -v, --version Show the flypod version.
|
|
1737
1617
|
|
|
1738
1618
|
Environment:
|
|
1739
1619
|
FLYPOD_TOKEN Deploy as your account without logging in (agents / CI)
|
|
1740
1620
|
DEPLOY_URL Override the deploy server (default: https://flypod.dev)
|
|
1741
1621
|
FLYPOD_CONFIG_DIR Override where the CLI keeps its session + folder memory
|
|
1622
|
+
FLYPOD_SHOW_TOKEN Set to 1 to print the manage token inline on deploy
|
|
1742
1623
|
NO_COLOR Disable ANSI colors
|
|
1743
1624
|
FORCE_COLOR Force ANSI colors even when stderr is not a TTY
|
|
1744
1625
|
|
|
@@ -1795,13 +1676,21 @@ async function main() {
|
|
|
1795
1676
|
if (useUI) {
|
|
1796
1677
|
process.stderr.write(`
|
|
1797
1678
|
${style.bold(style.accent("flypod"))} ${style.dim(`v${version}`)}
|
|
1798
|
-
|
|
1799
1679
|
`);
|
|
1800
1680
|
if (!apiKey) {
|
|
1801
|
-
process.stderr.write(` ${style.muted("account")} ${style.dim("anonymous · ")}${style.bold("flypod login")}${style.dim("
|
|
1802
|
-
|
|
1681
|
+
process.stderr.write(` ${style.muted("account")} ${style.dim("anonymous · deploy now, ")}${style.bold("flypod login")}${style.dim(" later")}
|
|
1803
1682
|
`);
|
|
1804
1683
|
}
|
|
1684
|
+
process.stderr.write(`
|
|
1685
|
+
`);
|
|
1686
|
+
}
|
|
1687
|
+
const priorLink = await projectForDir(process.cwd()).catch(() => null);
|
|
1688
|
+
if (priorLink && useUI) {
|
|
1689
|
+
for (const line of relinkNotice(priorLink, style))
|
|
1690
|
+
process.stderr.write(`${line}
|
|
1691
|
+
`);
|
|
1692
|
+
process.stderr.write(`
|
|
1693
|
+
`);
|
|
1805
1694
|
}
|
|
1806
1695
|
let dir;
|
|
1807
1696
|
try {
|
|
@@ -1829,7 +1718,7 @@ async function main() {
|
|
|
1829
1718
|
const started = Date.now();
|
|
1830
1719
|
let result;
|
|
1831
1720
|
try {
|
|
1832
|
-
result = await deploySite({ baseUrl, files, apiKey });
|
|
1721
|
+
result = await deploySite({ baseUrl, files, apiKey, source: client.source });
|
|
1833
1722
|
} catch (error) {
|
|
1834
1723
|
spinner.fail("Deploy failed.");
|
|
1835
1724
|
fail2(error.message, args, style, { dimOnly: true });
|
|
@@ -1837,6 +1726,7 @@ async function main() {
|
|
|
1837
1726
|
const elapsed = Date.now() - started;
|
|
1838
1727
|
spinner.success(`Deployed in ${fmtSeconds(elapsed)}`);
|
|
1839
1728
|
const owned = typeof result.owner_account_id === "string";
|
|
1729
|
+
let linkSaved = true;
|
|
1840
1730
|
try {
|
|
1841
1731
|
await linkProject(process.cwd(), {
|
|
1842
1732
|
site_id: result.site_id,
|
|
@@ -1847,7 +1737,9 @@ async function main() {
|
|
|
1847
1737
|
last_used: Date.now(),
|
|
1848
1738
|
version_id: result.version_id
|
|
1849
1739
|
});
|
|
1850
|
-
} catch {
|
|
1740
|
+
} catch {
|
|
1741
|
+
linkSaved = false;
|
|
1742
|
+
}
|
|
1851
1743
|
let commentsEnabled = false;
|
|
1852
1744
|
if (args.comments) {
|
|
1853
1745
|
if (!apiKey) {
|
|
@@ -1866,7 +1758,7 @@ async function main() {
|
|
|
1866
1758
|
process.stderr.write(` ${style.muted("comments")} ${style.dim(`enabled (${mode})`)}
|
|
1867
1759
|
`);
|
|
1868
1760
|
} else {
|
|
1869
|
-
process.stderr.write(` ${style.muted("comments")} ${style.dim(
|
|
1761
|
+
process.stderr.write(` ${style.muted("comments")} ${style.dim("failed — run `flypod comments enable`")}
|
|
1870
1762
|
`);
|
|
1871
1763
|
}
|
|
1872
1764
|
}
|
|
@@ -1887,6 +1779,14 @@ async function main() {
|
|
|
1887
1779
|
files: fileNames.length,
|
|
1888
1780
|
bytes: totalBytes,
|
|
1889
1781
|
elapsed_ms: elapsed,
|
|
1782
|
+
healed: result.healed ?? [],
|
|
1783
|
+
warnings: result.warnings ?? [],
|
|
1784
|
+
...agentNext({
|
|
1785
|
+
siteId: result.site_id,
|
|
1786
|
+
expiresAt: result.expires_at,
|
|
1787
|
+
owned
|
|
1788
|
+
}),
|
|
1789
|
+
...priorLink && priorLink.site_id !== result.site_id ? { replaced_link: { site_id: priorLink.site_id, url: priorLink.url } } : {},
|
|
1890
1790
|
...args.comments ? { comments_enabled: commentsEnabled, comments_mode: args.commentsMode } : {}
|
|
1891
1791
|
}, null, 2)}
|
|
1892
1792
|
`);
|
|
@@ -1895,13 +1795,13 @@ async function main() {
|
|
|
1895
1795
|
if (args.quiet) {
|
|
1896
1796
|
process.stdout.write(`${result.url}
|
|
1897
1797
|
`);
|
|
1898
|
-
|
|
1798
|
+
if (!linkSaved && !owned)
|
|
1799
|
+
process.stderr.write(`${result.manage_token}
|
|
1899
1800
|
`);
|
|
1900
1801
|
return;
|
|
1901
1802
|
}
|
|
1902
1803
|
const rule = style.dim("─".repeat(56));
|
|
1903
|
-
process.stderr.write(`
|
|
1904
|
-
${rule}
|
|
1804
|
+
process.stderr.write(` ${rule}
|
|
1905
1805
|
`);
|
|
1906
1806
|
process.stderr.write(` ${style.ok("●")} ${style.bold("Live")}
|
|
1907
1807
|
`);
|
|
@@ -1910,18 +1810,23 @@ async function main() {
|
|
|
1910
1810
|
process.stderr.write(` ${rule}
|
|
1911
1811
|
|
|
1912
1812
|
`);
|
|
1913
|
-
const
|
|
1914
|
-
|
|
1915
|
-
|
|
1813
|
+
for (const line of deployTail({ expiresAt: result.expires_at, owned, style })) {
|
|
1814
|
+
process.stderr.write(`${line}
|
|
1916
1815
|
`);
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
`
|
|
1816
|
+
}
|
|
1817
|
+
process.stderr.write(`
|
|
1818
|
+
`);
|
|
1819
|
+
if (!linkSaved && !owned) {
|
|
1820
|
+
process.stderr.write(` ${style.err("!")} ${style.bold("Couldn't remember this site")} ${style.dim(`— can't write ${projectsFilePath()}`)}
|
|
1821
|
+
` + ` ${style.dim("Save this manage token now — without it you can't update or claim this site:")}
|
|
1822
|
+
` + ` ${style.accent(result.manage_token)}
|
|
1920
1823
|
|
|
1921
1824
|
`);
|
|
1922
|
-
process.
|
|
1825
|
+
} else if (process.env.FLYPOD_SHOW_TOKEN) {
|
|
1826
|
+
process.stderr.write(` ${style.dim(`manage token ${result.manage_token} — remembered for this folder; needed only with --site elsewhere`)}
|
|
1923
1827
|
|
|
1924
1828
|
`);
|
|
1829
|
+
}
|
|
1925
1830
|
process.stdout.write(`${result.url}
|
|
1926
1831
|
`);
|
|
1927
1832
|
}
|