flypod 0.18.1 → 0.19.1

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 CHANGED
@@ -212,9 +212,11 @@ Every command's output uses the same few shapes: a `✓` line for what
212
212
  happened, the URL on a line of its own, a small grid of next steps, `!` for
213
213
  something to look at, and `✗` with the fix underneath when it did not work.
214
214
 
215
- `flypod` always creates a **new site**. To ship changes to a site you already
216
- made, use [`flypod update`](#how-do-i-ship-a-change-to-the-same-site) — not
217
- `flypod` again.
215
+ The first `flypod` in a folder creates a **new site**. Every later `flypod` in
216
+ that folder updates the same site, like
217
+ [`flypod update`](#how-do-i-ship-a-change-to-the-same-site): same URL, new
218
+ version. To make a separate site from a folder that already has one, run
219
+ `flypod --new`.
218
220
 
219
221
  ### What gets uploaded
220
222
 
@@ -245,15 +247,20 @@ flypod ./dist
245
247
 
246
248
  ## How do I ship a change to the same site?
247
249
 
248
- Run `flypod update` from the same folder. It adds a new **version** to the
249
- existing site and points the live URL at it — the URL doesn't change.
250
+ Run `flypod update` (or plain `flypod` again) from the same folder. It adds a
251
+ new **version** to the existing site and points the live URL at it; the URL
252
+ doesn't change.
250
253
 
251
254
  ```sh
252
255
  flypod ./dist # v1 → new site, prints the URL
253
256
  flypod update # ship changes → v2 (now live, same URL)
254
- flypod update ./dist # same, with an explicit path
257
+ flypod ./dist # same: this folder already has a site, so it updates it
258
+ flypod --new # a separate new site; the earlier one stays live
255
259
  ```
256
260
 
261
+ If the folder's site is gone (deleted, or expired), plain `flypod` makes a new
262
+ one, as if the folder had never deployed.
263
+
257
264
  ```
258
265
  ✓ Updated · version 8f1a0c2e is live
259
266
 
@@ -369,6 +376,7 @@ npx flypod ./dist --json
369
376
  ```json
370
377
  {
371
378
  "ok": true,
379
+ "action": "created",
372
380
  "url": "https://a3f1c2d4e5b60789.flypod.page",
373
381
  "site_id": "a3f1c2d4e5b60789",
374
382
  "version_id": "8f1a0c2e44b7d913",
@@ -380,19 +388,23 @@ npx flypod ./dist --json
380
388
  "update": "flypod update",
381
389
  "versions": "flypod versions",
382
390
  "rollback": "flypod rollback",
383
- "keep": "flypod login"
391
+ "keep": "flypod login --json"
384
392
  }
385
393
  }
386
394
  ```
387
395
 
396
+ `action` is `"created"` on a folder's first deploy and `"updated"` when
397
+ `flypod` ran in a folder that already had a site: that run is an update, and
398
+ its receipt is the `flypod update` receipt.
399
+
388
400
  **Read `warnings` before you report success.** A deploy can exit 0 and still
389
401
  serve a site that's broken for visitors, and this array is the only signal that
390
402
  says so. Each entry carries a `code` and a `fix_recipe` naming the change to
391
403
  make — `missing-index` when nothing is served at `/`, `not-spa` when the build
392
404
  ships scripts alongside visible body content, so client-side routing fallback
393
405
  stays off and deep links will 404 on refresh, and `new-site-in-linked-folder`
394
- when `flypod` ran in a folder that already had a site and so made a second one
395
- (the deploy is live; ship later changes with `flypod update`).
406
+ when `flypod --new` made a separate site from a folder that already had one
407
+ (both are live; this folder now updates the new one).
396
408
 
397
409
  `healed` is the other half: problems flypod fixed on your behalf. `spa-fallback`
398
410
  there means it recognised a single-page app, so unknown paths serve `index.html`
@@ -416,8 +428,10 @@ uploaded.
416
428
 
417
429
  `expires_at` is epoch **milliseconds** while the site is temporary, and `null`
418
430
  once it's yours. `next` holds the literal commands for what comes after;
419
- `next.update` is the one that matters, because running `flypod` again makes a
420
- second site. `link_saved` says whether `flypod update` will work from this
431
+ `next.update` is the one that matters: it ships a change to this same URL
432
+ (in a linked folder plain `flypod` does too). `next.keep`, while the site
433
+ expires, is `flypod login --json`: see
434
+ [signing in from an agent](#how-do-i-use-flypod-from-an-agent-or-ci). `link_saved` says whether `flypod update` will work from this
421
435
  folder with no flags; when it is `false` the `next` commands carry
422
436
  `--site <id>`, and the receipt includes `manage_token`, because nobody else is
423
437
  holding it.
@@ -433,10 +447,10 @@ prose. `claim_token` and `owner_account_id` are omitted when they don't apply;
433
447
  `expires_at`, and `next.keep` is left out then.
434
448
 
435
449
  Two more keys appear only when they apply: `replaced_link` (`site_id` and
436
- `url` of the site this folder pointed at before — a second `flypod` in a
437
- linked folder makes a new site, and the old one keeps running until it
438
- expires; the receipt's `warnings` then carries `new-site-in-linked-folder`,
439
- and `-q` says so in one line on stderr), and, with `--timeline` / `--no-timeline`, `timeline` (the state the
450
+ `url` of the site this folder pointed at before, only after `flypod --new`
451
+ in a linked folder; the old site keeps running until it expires, the
452
+ receipt's `warnings` then carries `new-site-in-linked-folder`, and `-q` says
453
+ so in one line on stderr), and, with `--timeline` / `--no-timeline`, `timeline` (the state the
440
454
  site is actually in) plus `history_url` when it is on.
441
455
 
442
456
  **Every failure is JSON too**, on every verb, so `--json` is safe to parse
@@ -480,10 +494,14 @@ anonymous 14-day site.
480
494
  **Signing in from an agent.** `flypod login` needs a browser, so an agent runs
481
495
  `flypod login --json`: it prints the URL, the confirmation code, and a
482
496
  `device_code`, then exits at once (`interactive_login_required`, exit 2) instead
483
- of waiting. Hand the URL and code to the user; once they confirm, finish with
484
- `flypod login --device-code <device_code> --json` — that polls once and either saves
485
- the session (`{"ok": true, "logged_in": true}`) or reports
486
- `authorization_pending` (exit 4) to try again. The flow ends for good with
497
+ of waiting. Hand the URL and code to the user; that is all. Once they confirm, the next
498
+ flypod command of any kind (a deploy, `flypod list`, anything) finishes
499
+ signing in by itself and keeps every site on the machine, as `flypod login`
500
+ does, then runs signed in. To finish at once instead, run
501
+ `flypod login --device-code <device_code> --json`: it waits up to 25 seconds
502
+ for the confirmation and either saves the session
503
+ (`{"ok": true, "logged_in": true}`) or reports `authorization_pending` (exit 4)
504
+ to try again. The flow ends for good with
487
505
  `login_denied` (exit 3, the user said no) or `login_expired` (exit 1, start
488
506
  again; also what a code that was already used, or a `user_code` passed in
489
507
  place of the `device_code`, answers); an interactive `flypod login` that gives up waiting reports
@@ -660,7 +678,8 @@ Deploy flags:
660
678
  | `--verbose` | More of the same receipt. In a terminal: the rollback and history commands, plus the site id, version id and source folder. With `--json`: also tokens, counts, timing. Also on `flypod update` |
661
679
  | `-q`, `--quiet` | Print only the URL on stdout, and nothing else |
662
680
  | `--timeline`, `--no-timeline` | Turn History on or off: the chip on the site's pages, an address per version, and the compare page. Also on `flypod update`, and on `flypod versions` to switch it without deploying. `--history` / `--no-history` are the same flags |
663
- | `--comments` | Enable comments on the new site (requires being signed in; otherwise the receipt says `comments_skipped`) |
681
+ | `--new` | Make a separate new site, even though this folder already has one. The earlier site stays live, and this folder then updates the new one. The receipt carries `replaced_link` |
682
+ | `--comments` | Enable comments on the site (requires being signed in; otherwise the receipt says `comments_skipped`) |
664
683
  | `--mode <mode>` | With `--comments`: `anonymous` (default), `passcode`, or `approved` (the older names `open`, `review` and `members` are still accepted). Anything else is a usage error |
665
684
  | `-h`, `--help` | Show usage on stdout (JSON under `--json`); never runs the command |
666
685
  | `-v`, `--version` | Print the version |
@@ -806,7 +825,7 @@ flypod login # approve this CLI in your browser (device flow)
806
825
  flypod login --token <t> # check a session token, then save it; no browser
807
826
  flypod list # your sites (JSON on stdout)
808
827
  flypod claim <id> <token> # attach one anonymous deploy by its claim token
809
- flypod logout # forget the local session
828
+ flypod logout # forget the local session (and any sign-in still waiting)
810
829
  ```
811
830
 
812
831
  `flypod login` does two things at once: it attaches every anonymous site this
@@ -818,18 +837,19 @@ does not accept fails with `token_rejected` (exit 3), and a server it cannot
818
837
  reach with `network` (exit 4). Nothing is saved in either case.
819
838
 
820
839
  "Every site this machine remembers" includes a site whose folder you have
821
- since deployed a different site from: running `flypod` twice in one folder
822
- points the folder at the new site, and flypod keeps the first one's record so
840
+ since deployed a different site from: `flypod --new` in a folder that
841
+ already has a site points the folder at the new site, and flypod keeps the first one's record so
823
842
  `flypod login` still keeps it and `--site <id>` still reaches it.
824
843
 
825
844
  ## What does flypod write to disk?
826
845
 
827
- Three files, all in the CLI's own config directory — **never in your repo**:
846
+ These files, all in the CLI's own config directory, **never in your repo**:
828
847
 
829
848
  | File | What's in it |
830
849
  |------|--------------|
831
850
  | `session.json` | Your session token and the host it belongs to, after `flypod login` |
832
851
  | `projects.json` | The folder → site map, plus the `manage_token` for anonymous sites |
852
+ | `pending-login.json` | Only while a `flypod login --json` waits for its person: the device code, so the next command can finish the sign-in. Not a credential; worthless after ten minutes |
833
853
  | `install.json` | A random install id and when it was made (see [Telemetry](#telemetry)); not written when you opt out |
834
854
 
835
855
  Location: `~/Library/Application Support/flypod` (macOS),
@@ -13,7 +13,9 @@ import {
13
13
  classifyResponse,
14
14
  clearSession,
15
15
  collectFiles,
16
+ configDir,
16
17
  createClient,
18
+ detectCodingAgent,
17
19
  emitError,
18
20
  errorEnvelope,
19
21
  exitCodeFor,
@@ -45,10 +47,10 @@ import {
45
47
  unauthorizedFor,
46
48
  unexpectedError,
47
49
  uploadLimitsFor
48
- } from "../cli-tydvmnwj.js";
50
+ } from "../cli-qtqg73w5.js";
49
51
 
50
52
  // bin/deploy.ts
51
- import { readFile as readFile3, stat as stat4 } from "node:fs/promises";
53
+ import { readFile as readFile4, stat as stat4 } from "node:fs/promises";
52
54
  import { homedir } from "node:os";
53
55
  import { relative as relative3, resolve as resolve3 } from "node:path";
54
56
  import { fileURLToPath } from "node:url";
@@ -626,8 +628,33 @@ async function withFolderHint(err, cwd, deployed, opts = {}) {
626
628
  return { ...err, fix, telemetry };
627
629
  }
628
630
 
631
+ // src/cli/pending-login.ts
632
+ import { readFile as readFile2, rm } from "node:fs/promises";
633
+ import { join as join3 } from "node:path";
634
+ function pendingLoginPath(env = process.env) {
635
+ return join3(configDir(env), "pending-login.json");
636
+ }
637
+ async function savePendingLogin(pending, env = process.env) {
638
+ await atomicWriteFile(pendingLoginPath(env), `${JSON.stringify(pending)}
639
+ `);
640
+ }
641
+ async function loadPendingLogin(env = process.env, now = Date.now()) {
642
+ try {
643
+ const raw = JSON.parse(await readFile2(pendingLoginPath(env), "utf8"));
644
+ if (!raw || typeof raw.device_code !== "string" || typeof raw.base_url !== "string" || typeof raw.expires_at !== "number") {
645
+ return null;
646
+ }
647
+ return raw.expires_at > now ? raw : null;
648
+ } catch {
649
+ return null;
650
+ }
651
+ }
652
+ async function clearPendingLogin(env = process.env) {
653
+ await rm(pendingLoginPath(env), { force: true }).catch(() => {});
654
+ }
655
+
629
656
  // src/cli/projects.ts
630
- import { readFile as readFile2 } from "node:fs/promises";
657
+ import { readFile as readFile3 } from "node:fs/promises";
631
658
  import { sep } from "node:path";
632
659
  var MAX_PROJECTS = 64;
633
660
  function prune(projects, now) {
@@ -658,7 +685,7 @@ async function loadProjects(env) {
658
685
  }
659
686
  async function loadFile(env) {
660
687
  try {
661
- const text = await readFile2(projectsFilePath(env), "utf8");
688
+ const text = await readFile3(projectsFilePath(env), "utf8");
662
689
  const parsed = JSON.parse(text);
663
690
  if (!parsed || typeof parsed !== "object" || typeof parsed.projects !== "object")
664
691
  return null;
@@ -861,20 +888,20 @@ function versionsTable(opts) {
861
888
  function relinkNotice(prev, style) {
862
889
  const s = style ?? PLAIN;
863
890
  return [
864
- ` ${(s.warn ?? ((x) => x))("!")} ${s.bold("This folder already deploys to")}`,
891
+ ` ${s.dim("--new: a separate site. The earlier one stays live at")}`,
865
892
  ` ${s.accent(prev.url)}`,
866
- ` ${s.bold("flypod update")}${s.dim(" ships there. This run makes a second site.")}`
893
+ ` ${s.dim("and this folder now updates the new one.")}`
867
894
  ];
868
895
  }
869
896
  var RELINK_WARNING = "new-site-in-linked-folder";
870
897
  function relinkWarning(prev, newUrl) {
871
898
  return {
872
899
  code: RELINK_WARNING,
873
- fix_recipe: `This folder already deployed to ${prev.url}, so \`flypod\` made a second site (${newUrl}, live now; nothing to redo). ` + "To ship changes to a site you already have, run `flypod update`, never `flypod` again. " + `To put this build on the earlier URL instead: \`flypod update --site ${prev.site_id}\`.`
900
+ fix_recipe: `\`--new\` made a separate site (${newUrl}, live now; nothing to redo). The earlier site ${prev.url} stays live, ` + "and this folder now updates the new one: run `flypod` again to ship changes here. " + `To ship to the earlier URL instead: \`flypod update --site ${prev.site_id}\`.`
874
901
  };
875
902
  }
876
903
  function relinkHint(prev) {
877
- return `flypod: this folder already deploys to ${prev.url}; this run makes a second site. Use \`flypod update\` to ship there.`;
904
+ return `flypod: --new made a separate site; the earlier one stays live at ${prev.url}.`;
878
905
  }
879
906
  function skippedRows(skipped, style) {
880
907
  if (skipped.length === 0)
@@ -905,7 +932,7 @@ function agentNext(opts) {
905
932
  const target = linked ? "" : ` --site ${opts.siteId}`;
906
933
  const update = `flypod update${target}`;
907
934
  const linkNote = linked ? `This folder is linked to ${opts.siteId}.` : `The folder → site link could not be saved, so every command needs --site ${opts.siteId}.`;
908
- const expiryNote = expiring ? "The site stops serving on the date above unless `flypod login` claims it, which removes the expiry and changes nothing else." : "This site does not expire.";
935
+ const expiryNote = expiring ? "The site stops serving on the date above unless it is kept: run `flypod login --json` and give your user the URL it returns; once they confirm, the next flypod command finishes signing in and keeps every site on this machine (no expiry, nothing else changes)." : "This site does not expire.";
909
936
  return {
910
937
  expires_in_days: expiring ? daysUntil(opts.expiresAt, now) : null,
911
938
  expires_at_iso: expiring ? new Date(opts.expiresAt).toISOString() : null,
@@ -913,9 +940,9 @@ function agentNext(opts) {
913
940
  update,
914
941
  versions: `flypod versions${target}`,
915
942
  rollback: `flypod rollback${target}`,
916
- ...expiring ? { keep: "flypod login" } : {}
943
+ ...expiring ? { keep: "flypod login --json" } : {}
917
944
  },
918
- next_note: `${linkNote} Run \`${update}\` to publish changes to this same URL — running \`flypod\` again creates a different site at a different URL. ${expiryNote}`
945
+ next_note: `${linkNote} Run \`${update}\`${linked ? " (or plain `flypod` again: in a linked folder it updates)" : ""} to publish changes to this same URL; \`flypod --new\` makes a separate site. ${expiryNote}`
919
946
  };
920
947
  }
921
948
 
@@ -928,7 +955,8 @@ function siteUrlFrom(site_id, baseUrl) {
928
955
  var SUBCOMMAND_HELP = {
929
956
  update: `flypod update [path] [flags]
930
957
 
931
- Ship a new version of the site linked to this folder.
958
+ Ship a new version of the site linked to this folder. Plain \`flypod\` in a
959
+ linked folder does the same; \`flypod --new\` makes a separate site instead.
932
960
 
933
961
  flypod update Re-deploy this folder as a new version.
934
962
  flypod update ./dist Same, with an explicit path.
@@ -1016,13 +1044,15 @@ Authenticate with flypod via the browser (device authorization).
1016
1044
  code, then waits for the browser confirmation.
1017
1045
  flypod login --token <t> Save a session token directly (for agents/CI).
1018
1046
  flypod login --json Agents: print the URL, code, and device_code as
1019
- JSON and exit at once instead of waiting.
1047
+ JSON and exit at once instead of waiting. Once
1048
+ the user confirms, the next flypod command
1049
+ finishes signing in by itself.
1020
1050
  flypod login --device-code <c>
1021
- Finish a --json login once the user confirmed.
1051
+ Finish a --json login now (waits up to 25s).
1022
1052
 
1023
1053
  Flags:
1024
1054
  --token <t> Save this session token instead of opening a browser.
1025
- --device-code <c> Poll once for the approval of a sign-in started with --json.
1055
+ --device-code <c> Wait up to 25s for the approval of a sign-in started with --json.
1026
1056
  --json Emit JSON on stdout; never blocks waiting for a browser.
1027
1057
  -h, --help Show this help.`,
1028
1058
  logout: `flypod logout [--json]
@@ -1136,6 +1166,58 @@ async function finishLogin(accessToken, baseUrl, args, io, env) {
1136
1166
  io.out(JSON.stringify({ ok: true, logged_in: true, ...attached }));
1137
1167
  return 0;
1138
1168
  }
1169
+ var RESUME_WAIT_MS = 25000;
1170
+ var RESUME_POLL_MS = 5000;
1171
+ async function markPendingDone(deviceCode, env) {
1172
+ const pending = await loadPendingLogin(env);
1173
+ if (pending?.device_code !== deviceCode)
1174
+ return;
1175
+ await savePendingLogin({ ...pending, completed: true }, env).catch(() => {});
1176
+ }
1177
+ async function resumePendingLogin(io, opts) {
1178
+ const env = io.env ?? process.env;
1179
+ const pending = await loadPendingLogin(env);
1180
+ if (!pending || pending.completed)
1181
+ return;
1182
+ const session = await loadSession(env).catch(() => null);
1183
+ if (resolveCredentials(env, session).token)
1184
+ return;
1185
+ const client = await createClient({
1186
+ env,
1187
+ fetch: io.fetch,
1188
+ overrides: { baseUrl: pending.base_url }
1189
+ });
1190
+ let poll;
1191
+ try {
1192
+ poll = await withDeadline(pollDeviceToken(client, pending.device_code), RESUME_DEADLINE_MS);
1193
+ } catch {
1194
+ return;
1195
+ }
1196
+ if (poll.state === "approved") {
1197
+ await saveSession({ session_token: poll.access_token, base_url: pending.base_url, created_at: Date.now() }, env);
1198
+ await savePendingLogin({ ...pending, completed: true }, env).catch(() => {});
1199
+ const silent = { ...io, out: () => {}, err: () => {} };
1200
+ const kept = await attachAnonymousSites(poll.access_token, pending.base_url, { json: true }, silent, env).catch(() => ({ attached: [] }));
1201
+ if (!opts.quiet) {
1202
+ const n = kept.attached.length;
1203
+ io.err(headline("Signed in", n > 0 ? `${n} site${n === 1 ? "" : "s"} kept, no expiry` : undefined, io.style ?? PLAIN));
1204
+ }
1205
+ return;
1206
+ }
1207
+ if (poll.state === "denied" || poll.state === "expired" || poll.state === "invalid") {
1208
+ await clearPendingLogin(env);
1209
+ }
1210
+ }
1211
+ var RESUME_DEADLINE_MS = 2500;
1212
+ function withDeadline(p, ms) {
1213
+ let timer;
1214
+ return Promise.race([
1215
+ p,
1216
+ new Promise((_, reject) => {
1217
+ timer = setTimeout(() => reject(new Error("deadline")), ms);
1218
+ })
1219
+ ]).finally(() => clearTimeout(timer));
1220
+ }
1139
1221
  async function login(args, io) {
1140
1222
  if (args.help)
1141
1223
  return showSubHelp("login", io, args);
@@ -1149,13 +1231,39 @@ async function login(args, io) {
1149
1231
  }
1150
1232
  const client = await createClient({ env, fetch: io.fetch, overrides: { baseUrl } });
1151
1233
  if (args.deviceCode) {
1234
+ const remembered = await loadPendingLogin(env);
1235
+ if (remembered?.completed && remembered.device_code === args.deviceCode) {
1236
+ const session = await loadSession(env).catch(() => null);
1237
+ if (session?.session_token) {
1238
+ if (args.json)
1239
+ io.out(JSON.stringify({ ok: true, logged_in: true, attached: [], skipped: [] }));
1240
+ else
1241
+ io.err(headline("Logged in", undefined, io.style ?? PLAIN));
1242
+ return 0;
1243
+ }
1244
+ }
1245
+ let waited = 0;
1152
1246
  let poll;
1153
- try {
1154
- poll = await pollDeviceToken(client, args.deviceCode);
1155
- } catch (e) {
1156
- return emitError(networkError(e, baseUrl), args, io, { prefix: "flypod login" });
1247
+ for (;; ) {
1248
+ try {
1249
+ poll = await pollDeviceToken(client, args.deviceCode);
1250
+ } catch (e) {
1251
+ return emitError(networkError(e, baseUrl), args, io, { prefix: "flypod login" });
1252
+ }
1253
+ const waiting = poll.state === "pending" || poll.state === "slow_down";
1254
+ const pause = poll.state === "slow_down" ? RESUME_POLL_MS * 2 : RESUME_POLL_MS;
1255
+ if (!waiting || waited + pause > RESUME_WAIT_MS)
1256
+ break;
1257
+ await (io.sleep ?? delay)(pause);
1258
+ waited += pause;
1157
1259
  }
1158
- return poll.state === "approved" ? finishLogin(poll.access_token, baseUrl, args, io, env) : emitError(await loginPollError(poll, args.deviceCode, args), args, io, {
1260
+ if (poll.state === "approved") {
1261
+ await markPendingDone(args.deviceCode, env);
1262
+ return finishLogin(poll.access_token, baseUrl, args, io, env);
1263
+ }
1264
+ if (poll.state !== "pending" && poll.state !== "slow_down")
1265
+ await clearPendingLogin(env);
1266
+ return emitError(await loginPollError(poll, args.deviceCode, args), args, io, {
1159
1267
  prefix: "flypod login"
1160
1268
  });
1161
1269
  }
@@ -1171,11 +1279,17 @@ async function login(args, io) {
1171
1279
  }
1172
1280
  const start = await startRes.json();
1173
1281
  const openUrl = start.verification_uri_complete ?? `${start.verification_uri}?user_code=${encodeURIComponent(start.user_code)}`;
1174
- if (args.json) {
1282
+ const agentWithoutTerminal = !io.interactive && detectCodingAgent(env) !== "none";
1283
+ if (args.json || agentWithoutTerminal) {
1284
+ await savePendingLogin({
1285
+ device_code: start.device_code,
1286
+ base_url: baseUrl,
1287
+ expires_at: Date.now() + (start.expires_in ?? 600) * 1000
1288
+ }, env).catch(() => {});
1175
1289
  return emitError({
1176
1290
  code: "interactive_login_required",
1177
1291
  error: "Sign-in needs a browser. Ask the user to open the URL and confirm the code.",
1178
- fix: `Ask the user to open ${openUrl} and confirm code ${start.user_code}. Then run \`flypod login --device-code ${start.device_code} --json\`; while it answers authorization_pending, wait ${start.interval ?? 5}s and run it again.`,
1292
+ fix: `Ask the user to open ${openUrl} and confirm code ${start.user_code}. Once they have, your next flypod command (a deploy, \`flypod list\`, anything) finishes signing in by itself; to finish it now, run \`flypod login --device-code ${start.device_code} --json\`, which waits up to ${RESUME_WAIT_MS / 1000}s for the confirmation.`,
1179
1293
  extra: {
1180
1294
  verification_uri: start.verification_uri,
1181
1295
  verification_uri_complete: openUrl,
@@ -1313,6 +1427,7 @@ async function logout(args, io) {
1313
1427
  return showSubHelp("logout", io, args);
1314
1428
  const env = io.env ?? process.env;
1315
1429
  const ok = await clearSession(env);
1430
+ await clearPendingLogin(env);
1316
1431
  if (args.json) {
1317
1432
  io.out(JSON.stringify({ ok: true, signed_out: ok }));
1318
1433
  return 0;
@@ -1454,6 +1569,8 @@ async function failSiteRequest(verb, res, target, args, io, env, opts = {}) {
1454
1569
  status: err.status
1455
1570
  });
1456
1571
  }
1572
+ if (opts.fixSuffix && err.fix)
1573
+ err = { ...err, fix: `${err.fix}${opts.fixSuffix}` };
1457
1574
  return emitError(err, args, io, { prefix: verb });
1458
1575
  }
1459
1576
  function credentialSent(target, args, client) {
@@ -1582,7 +1699,7 @@ function shortPath(path, cwd) {
1582
1699
  return path;
1583
1700
  return rel.startsWith("..") ? rel : `./${rel}`;
1584
1701
  }
1585
- async function update(args, io) {
1702
+ async function update(args, io, opts = {}) {
1586
1703
  const pre = await withTarget("update", args, io);
1587
1704
  if (typeof pre === "number")
1588
1705
  return pre;
@@ -1647,19 +1764,27 @@ async function update(args, io) {
1647
1764
  return emitError(sent.err, args, io, { prefix: "flypod update" });
1648
1765
  const { client } = sent;
1649
1766
  if (sent.kind === "refused") {
1767
+ if (sent.res.status === 404 && opts.whenGone && target.dir) {
1768
+ await sent.res.body?.cancel().catch(() => {});
1769
+ await forgetDir(target.dir, env, { gone: true });
1770
+ return opts.whenGone();
1771
+ }
1650
1772
  return failSiteRequest("flypod update", sent.res, target, args, io, env, {
1651
1773
  upload: () => uploadReport(files, skipped.length),
1652
- client
1774
+ client,
1775
+ fixSuffix: opts.fromDeploy ? " To make a separate new site from this folder instead, run `flypod --new`." : undefined
1653
1776
  });
1654
1777
  }
1655
1778
  const { body } = sent;
1656
1779
  await touchLink(target, body.version_id, env, resolve2(dir));
1657
1780
  const switched = args.timeline === undefined ? undefined : await switchTimeline(client, target.site_id, args.timeline);
1658
1781
  const timeline = switched?.timeline;
1782
+ const extra = opts.extra ? await opts.extra(target.site_id) : undefined;
1659
1783
  const expiresAt = body.expires_at !== undefined ? body.expires_at : target.rec?.expires_at ?? null;
1660
1784
  if (args.json) {
1661
1785
  io.out(JSON.stringify({
1662
1786
  ok: true,
1787
+ action: "updated",
1663
1788
  site_id: target.site_id,
1664
1789
  version_id: body.version_id,
1665
1790
  url: body.url,
@@ -1668,6 +1793,7 @@ async function update(args, io) {
1668
1793
  expires_at: expiresAt,
1669
1794
  ...skipped.length > 0 ? { skipped } : {},
1670
1795
  ...switched ?? {},
1796
+ ...extra?.json ?? {},
1671
1797
  ...(args.verbose ? agentNext : agentNextCommands)({
1672
1798
  siteId: target.site_id,
1673
1799
  expiresAt,
@@ -1692,6 +1818,8 @@ async function update(args, io) {
1692
1818
  })) {
1693
1819
  io.err(line);
1694
1820
  }
1821
+ for (const line of extra?.lines ?? [])
1822
+ io.err(line);
1695
1823
  if (timeline !== undefined) {
1696
1824
  for (const line of timelineRows(args.timeline, timeline, io.style ?? PLAIN, switched?.history_url)) {
1697
1825
  io.err(line);
@@ -2538,7 +2666,8 @@ var TOP_LEVEL_FLAG_SPEC = {
2538
2666
  "--timeline": "bool",
2539
2667
  "--no-timeline": "bool",
2540
2668
  "--history": "bool",
2541
- "--no-history": "bool"
2669
+ "--no-history": "bool",
2670
+ "--new": "bool"
2542
2671
  };
2543
2672
  var COMMENT_MODES = ["anonymous", "passcode", "approved", "open", "review", "members"];
2544
2673
  function exitUsage(err, argv) {
@@ -2591,7 +2720,8 @@ function parseArgs(argv) {
2591
2720
  comments: Boolean(flags["--comments"]),
2592
2721
  commentsMode: mode ?? "anonymous",
2593
2722
  verbose: Boolean(flags["--verbose"]),
2594
- timeline: timelineFlag(flags)
2723
+ timeline: timelineFlag(flags),
2724
+ newSite: Boolean(flags["--new"])
2595
2725
  };
2596
2726
  }
2597
2727
  var SUB_FLAG_SPEC = {
@@ -2767,7 +2897,7 @@ async function readVersion() {
2767
2897
  for (const rel of ["../../package.json", "../package.json"]) {
2768
2898
  try {
2769
2899
  const url = new URL(rel, `file://${here}`);
2770
- const text = await readFile3(url, "utf8");
2900
+ const text = await readFile4(url, "utf8");
2771
2901
  const version = JSON.parse(text).version;
2772
2902
  if (version)
2773
2903
  return version;
@@ -2780,13 +2910,15 @@ function helpText(version) {
2780
2910
  Drop files, get a live URL. Every deploy is versioned, so you can roll back.
2781
2911
 
2782
2912
  THE LOOP (this is all most agents need):
2783
- flypod [path] Deploy NEW content -> creates a new site, prints a URL.
2913
+ flypod [path] Deploy. The first time in a folder it creates a site
2914
+ and prints a URL; after that it updates that site.
2784
2915
  flypod update Ship CHANGES to that same site -> adds a new VERSION.
2785
2916
  flypod versions List every version, newest first (the live one is marked).
2786
2917
  flypod rollback Make the previous version live again.
2787
2918
 
2788
- A "version" is one deploy of a set of files. 'flypod' makes a brand-new site;
2789
- 'flypod update' adds a version to the site you already made. flypod remembers
2919
+ A "version" is one deploy of a set of files. 'flypod' makes a site the first
2920
+ time and adds a version every time after; 'flypod --new' makes a separate site
2921
+ even when the folder already has one. flypod remembers
2790
2922
  which site a folder belongs to (stored under your home config, never in your
2791
2923
  repo), so 'update'/'versions'/'rollback' just work from that folder. To target
2792
2924
  a site from anywhere, pass --site <id> (the id is printed on first deploy).
@@ -2851,6 +2983,9 @@ Agents:
2851
2983
  -y/--yes to write every target without asking.
2852
2984
 
2853
2985
  Deploy flags:
2986
+ --new Make a separate new site, even though this
2987
+ folder already has one. The earlier site stays
2988
+ live, and this folder then updates the new one.
2854
2989
  --timeline Turn on History: a chip on the site's pages
2855
2990
  that opens earlier versions, and a page that
2856
2991
  compares two side by side. Off by default: it
@@ -2960,6 +3095,54 @@ async function firstRunNotice(argv) {
2960
3095
 
2961
3096
  `);
2962
3097
  }
3098
+ var LINK_GONE = -1;
3099
+ async function deployAsUpdate(args, link, session, style, useUI) {
3100
+ if (useUI) {
3101
+ process.stderr.write(` ${style.dim("Updating this folder's site")} ${style.accent(link.url)}
3102
+ ` + ` ${style.dim("For a separate new site: flypod --new")}
3103
+
3104
+ `);
3105
+ }
3106
+ return update({
3107
+ path: args.path,
3108
+ json: args.json,
3109
+ quiet: args.quiet,
3110
+ verbose: args.verbose,
3111
+ timeline: args.timeline
3112
+ }, {
3113
+ out: (line) => process.stdout.write(`${line}
3114
+ `),
3115
+ err: (line) => process.stderr.write(`${line}
3116
+ `),
3117
+ interactive: Boolean(process.stdout.isTTY),
3118
+ style: makeStyle(colorsEnabled(process.stderr))
3119
+ }, {
3120
+ fromDeploy: true,
3121
+ whenGone: async () => LINK_GONE,
3122
+ extra: args.comments ? (siteId) => enableCommentsAfterUpdate(session, siteId, args) : undefined
3123
+ });
3124
+ }
3125
+ async function enableCommentsAfterUpdate(session, siteId, args) {
3126
+ const mode = args.commentsMode;
3127
+ if (!session.token) {
3128
+ return {
3129
+ json: {
3130
+ comments_enabled: false,
3131
+ comments_mode: mode,
3132
+ comments_skipped: "not_signed_in",
3133
+ comments_fix: "Run `flypod login`, then `flypod comments enable`."
3134
+ },
3135
+ lines: [" comments skipped — run `flypod login` to enable comments"]
3136
+ };
3137
+ }
3138
+ const ok = await session.setCommentsMode(siteId, { enabled: true, mode }).then((r) => r.ok).catch(() => false);
3139
+ return {
3140
+ json: { comments_enabled: ok, comments_mode: mode },
3141
+ lines: [
3142
+ ` comments ${ok ? `enabled (${mode})` : "failed — run `flypod comments enable`"}`
3143
+ ]
3144
+ };
3145
+ }
2963
3146
  async function main() {
2964
3147
  const rawArgv = process.argv.slice(2);
2965
3148
  const version = await readVersion();
@@ -2975,6 +3158,15 @@ async function main() {
2975
3158
  });
2976
3159
  if (!answersLocally)
2977
3160
  await firstRunNotice(rawArgv);
3161
+ const verb = isSubcommand ? firstPositional : "deploy";
3162
+ if (!answersLocally && verb !== "login" && verb !== "logout") {
3163
+ await resumePendingLogin({
3164
+ out: () => {},
3165
+ err: (line) => process.stderr.write(`${line}
3166
+ `),
3167
+ style: makeStyle(colorsEnabled(process.stderr))
3168
+ }, { quiet: rawArgv.some((a) => a === "--json" || a === "-q" || a === "--quiet") }).catch(() => {});
3169
+ }
2978
3170
  if (isSubcommand) {
2979
3171
  const code = await runSubcommand(firstPositional, withoutVerb);
2980
3172
  await flushFailureReports();
@@ -2996,11 +3188,11 @@ async function main() {
2996
3188
  const style = makeStyle(colorsEnabled(process.stderr) && useUI);
2997
3189
  if (args.path !== undefined && !await exists(args.path)) {
2998
3190
  const bareWord = /^[a-z]+$/i.test(args.path) && !BUILD_DIR_CANDIDATES.includes(args.path);
2999
- const verb = bareWord ? closest(args.path, [...SUBCOMMANDS]) : undefined;
3000
- fail2(verb ? {
3191
+ const verb2 = bareWord ? closest(args.path, [...SUBCOMMANDS]) : undefined;
3192
+ fail2(verb2 ? {
3001
3193
  code: "unknown_command",
3002
- error: `unknown command "${args.path}" — did you mean \`flypod ${verb}\`?`,
3003
- fix: `flypod ${verb}`
3194
+ error: `unknown command "${args.path}" — did you mean \`flypod ${verb2}\`?`,
3195
+ fix: `flypod ${verb2}`
3004
3196
  } : await withFolderHint({
3005
3197
  code: "no_build_dir",
3006
3198
  error: `Nothing to deploy at ${args.path}: no such file or folder.`,
@@ -3008,6 +3200,15 @@ async function main() {
3008
3200
  }, process.cwd()), args, style);
3009
3201
  }
3010
3202
  const priorLink = await projectForDir(process.cwd()).catch(() => null);
3203
+ let linked = priorLink;
3204
+ if (priorLink && !args.newSite) {
3205
+ const code = await deployAsUpdate(args, priorLink, client, style, useUI);
3206
+ if (code !== LINK_GONE) {
3207
+ await flushFailureReports();
3208
+ process.exit(code);
3209
+ }
3210
+ linked = null;
3211
+ }
3011
3212
  let dir;
3012
3213
  try {
3013
3214
  const remembered = args.path === undefined && priorLink?.deploy_dir && await exists(priorLink.deploy_dir) ? priorLink.deploy_dir : undefined;
@@ -3041,14 +3242,14 @@ async function main() {
3041
3242
  });
3042
3243
  if (tooLarge)
3043
3244
  fail2(tooLarge, args, style);
3044
- if (priorLink && useUI) {
3045
- for (const line of relinkNotice(priorLink, style))
3245
+ if (linked && useUI) {
3246
+ for (const line of relinkNotice(linked, style))
3046
3247
  process.stderr.write(`${line}
3047
3248
  `);
3048
3249
  process.stderr.write(`
3049
3250
  `);
3050
- } else if (priorLink && args.quiet) {
3051
- process.stderr.write(`${relinkHint(priorLink)}
3251
+ } else if (linked && args.quiet) {
3252
+ process.stderr.write(`${relinkHint(linked)}
3052
3253
  `);
3053
3254
  }
3054
3255
  if (useUI)
@@ -3060,7 +3261,7 @@ async function main() {
3060
3261
  const started = Date.now();
3061
3262
  let result;
3062
3263
  try {
3063
- const res = await client.createSite(packDeploy(files), { relink: Boolean(priorLink) });
3264
+ const res = await client.createSite(packDeploy(files), { relink: Boolean(linked) });
3064
3265
  if (!res.ok)
3065
3266
  throw await DeployError.fromResponse(res);
3066
3267
  result = await res.json();
@@ -3127,10 +3328,10 @@ async function main() {
3127
3328
  healed: result.healed ?? [],
3128
3329
  warnings: [
3129
3330
  ...result.warnings ?? [],
3130
- ...priorLink && priorLink.site_id !== result.site_id ? [relinkWarning(priorLink, result.url)] : []
3331
+ ...linked && linked.site_id !== result.site_id ? [relinkWarning(linked, result.url)] : []
3131
3332
  ],
3132
3333
  link_saved: linkSaved,
3133
- ...priorLink && priorLink.site_id !== result.site_id ? { replaced_link: { site_id: priorLink.site_id, url: priorLink.url } } : {},
3334
+ ...linked && linked.site_id !== result.site_id ? { replaced_link: { site_id: linked.site_id, url: linked.url } } : {},
3134
3335
  ...args.comments ? {
3135
3336
  comments_enabled: commentsEnabled,
3136
3337
  comments_mode: args.commentsMode,
@@ -3150,6 +3351,7 @@ async function main() {
3150
3351
  };
3151
3352
  const receipt = args.verbose ? {
3152
3353
  ok: true,
3354
+ action: "created",
3153
3355
  url: result.url,
3154
3356
  site_id: result.site_id,
3155
3357
  version_id: result.version_id,
@@ -3165,6 +3367,7 @@ async function main() {
3165
3367
  ...agentNext(nextOpts)
3166
3368
  } : {
3167
3369
  ok: true,
3370
+ action: "created",
3168
3371
  url: result.url,
3169
3372
  site_id: result.site_id,
3170
3373
  version_id: result.version_id,
@@ -901,11 +901,14 @@ video or images, it says so and names the folder or the \`.flypodignore\` lines
901
901
 
902
902
  \`no_site\` carries a \`reason\`: \`never_linked\` (run \`flypod\` to make the site),
903
903
  \`expired\` (the temporary site ran out: run \`flypod\` for a new one, then
904
- \`flypod login\` to keep it), \`gone\` (the site no longer exists: run \`flypod\`), or
904
+ \`flypod login --json\` to keep it), \`gone\` (the site no longer exists: run \`flypod\`), or
905
905
  \`other_folder\` (a folder above or below this one is linked: the \`fix\` gives the
906
906
  \`--site <id>\` command). \`unauthorized\` on a version verb says what to do with the
907
907
  credential this machine holds; when the site was kept by the account you are
908
- signed in to, flypod retries as that account by itself.
908
+ signed in to, flypod retries as that account by itself. Plain \`flypod\` in a
909
+ folder that already has a site is an update, so it fails the same ways; its
910
+ \`fix\` then also names \`flypod --new\`, for when a separate site is what the
911
+ user wants.
909
912
 
910
913
  Rarer ones: \`unknown_command\` (a verb that does not exist — \`flypod verisons\`
911
914
  fails this way with \`"fix": "flypod versions"\` instead of deploying a folder
@@ -939,10 +942,10 @@ Each warning has a \`code\` and a \`fix_recipe\` naming the change to make.
939
942
  - \`missing-index\` — nothing is served at \`/\`. Name the entry file \`index.html\`.
940
943
  - \`not-spa\` — the page ships scripts but also has visible body content, so
941
944
  client-side routing fallback stays off and deep links will 404 on refresh.
942
- - \`new-site-in-linked-folder\` — \`flypod\` ran in a folder that already had a
943
- site, so it made a second one. The deploy is live; do not redo it. Next time,
944
- ship with \`flypod update\`. To put this build on the earlier URL instead, run
945
- the \`flypod update --site <id>\` the warning names.
945
+ - \`new-site-in-linked-folder\`: \`flypod --new\` made a separate site from a
946
+ folder that already had one. Both are live; do not redo it. This folder now
947
+ updates the new site; to ship to the earlier URL, run the
948
+ \`flypod update --site <id>\` the warning names.
946
949
 
947
950
  \`healed\` lists what flypod fixed on your behalf. \`spa-fallback\` there means it
948
951
  recognised a single-page app, so unknown paths serve \`index.html\` and
@@ -1008,10 +1011,11 @@ files; flypod serves them.
1008
1011
  npx flypod ./dist --json
1009
1012
  \`\`\`
1010
1013
 
1011
- **Every later deploy** of the same project is \`flypod update\`, which ships
1012
- to the URL the user already has (see "Shipping a change"). Running \`flypod\`
1013
- again makes a second site on a new URL, and the receipt then carries a
1014
- \`new-site-in-linked-folder\` warning.
1014
+ **Every later deploy** from the same folder updates that site: plain
1015
+ \`flypod\` again (or \`flypod update\`, the explicit spelling) ships a new
1016
+ version to the URL the user already has, and the receipt says
1017
+ \`"action": "updated"\` (see "Shipping a change"). \`flypod --new\` makes a
1018
+ separate site; run it only when the user asks for one.
1015
1019
 
1016
1020
  3. Read \`url\` from the JSON and give it to the user.
1017
1021
 
@@ -1035,6 +1039,7 @@ is the normal path rather than a fallback. To install once: \`npm install -g fly
1035
1039
  \`\`\`json
1036
1040
  {
1037
1041
  "ok": true,
1042
+ "action": "created",
1038
1043
  "url": "https://a3f1c2d4e5b60789.flypod.page",
1039
1044
  "site_id": "a3f1c2d4e5b60789",
1040
1045
  "version_id": "…",
@@ -1042,10 +1047,12 @@ is the normal path rather than a fallback. To install once: \`npm install -g fly
1042
1047
  "healed": ["spa-fallback"],
1043
1048
  "warnings": [],
1044
1049
  "link_saved": true,
1045
- "next": { "update": "flypod update", "versions": "flypod versions", "rollback": "flypod rollback", "keep": "flypod login" }
1050
+ "next": { "update": "flypod update", "versions": "flypod versions", "rollback": "flypod rollback", "keep": "flypod login --json" }
1046
1051
  }
1047
1052
  \`\`\`
1048
1053
 
1054
+ - \`action\`: \`"created"\` on a folder's first deploy, \`"updated"\` when the
1055
+ folder already had a site and this run added a version to it.
1049
1056
  - \`url\` — the live site. Give it to the user. Read it from the JSON rather than
1050
1057
  assembling it: every site is served at \`https://<site_id>.flypod.page\`, on a
1051
1058
  different domain from the API and docs (\`flypod.dev\`).
@@ -1057,7 +1064,8 @@ is the normal path rather than a fallback. To install once: \`npm install -g fly
1057
1064
  - \`expires_at\` — epoch **milliseconds** while the site is temporary, \`null\` once
1058
1065
  it belongs to an account.
1059
1066
  - \`next\` — the literal commands for what comes after. \`next.update\` is how a
1060
- change is shipped to this same URL.
1067
+ change is shipped to this same URL. \`next.keep\`, while the site is
1068
+ temporary, is how it is kept (see below).
1061
1069
  - \`link_saved\` — whether \`flypod update\` works from this folder with no flags.
1062
1070
  When it is \`false\` (a read-only config dir, typical of CI), the \`next\`
1063
1071
  commands carry \`--site <id>\` and the receipt also has a \`manage_token\`:
@@ -1092,42 +1100,54 @@ account from the start, with no browser:
1092
1100
  FLYPOD_TOKEN=<session-token> npx flypod ./dist --json
1093
1101
  \`\`\`
1094
1102
 
1095
- When the user wants to sign in and you have no browser, do not run a bare
1096
- \`flypod login\` — it waits up to ten minutes. Run it with \`--json\`:
1103
+ When the user wants to keep the site and you have no browser, run the
1104
+ receipt's \`next.keep\`, which is \`flypod login\` with \`--json\` (without it, in
1105
+ a terminal, login waits for a browser):
1097
1106
 
1098
1107
  \`\`\`sh
1099
1108
  flypod login --json
1100
1109
  # {"ok":false,"code":"interactive_login_required","error":"…","fix":"…","verification_uri":"https://…","verification_uri_complete":"https://…","user_code":"ABCD-1234","device_code":"…","expires_in":600,"interval":5}
1101
1110
  \`\`\`
1102
1111
 
1103
- It exits at once (code 2). Give the user the URL and the \`user_code\`; when they
1104
- say they have confirmed, finish with the \`device_code\` (not the \`user_code\`)
1105
- from that output:
1112
+ It exits at once (code 2). Give the user \`verification_uri_complete\` and the
1113
+ \`user_code\` and ask them to confirm. That is all; there is nothing to poll.
1114
+ Once they have confirmed, your next flypod command of any kind (a deploy,
1115
+ \`flypod list\`) finishes signing in by itself, keeps every temporary site this
1116
+ machine deployed, and runs signed in.
1117
+
1118
+ To finish at once instead (the user has just said they confirmed), pass the
1119
+ \`device_code\` (not the \`user_code\`) from that output:
1106
1120
 
1107
1121
  \`\`\`sh
1108
1122
  flypod login --device-code <device_code> --json
1109
1123
  # {"ok":true,"logged_in":true,"attached":[…],"skipped":[]} — or
1110
- # {"ok":false,"code":"authorization_pending",…} — exit 4, ask again later
1124
+ # {"ok":false,"code":"authorization_pending",…} — exit 4
1111
1125
  \`\`\`
1112
1126
 
1113
- \`authorization_pending\` means the user has not confirmed yet: wait \`interval\`
1114
- seconds and run the same command again. \`login_expired\` means the code is
1115
- spent (expired, or already used): if an earlier run printed
1116
- \`"ok":true\` you are signed in, otherwise start again with \`flypod login --json\`.
1127
+ It waits up to 25 seconds for the confirmation. \`authorization_pending\` means
1128
+ the user has not confirmed yet: carry on with the work, and the next command
1129
+ finishes it once they do. \`login_expired\` means the code is spent (expired,
1130
+ or already used): if an earlier run printed \`"ok":true\` you are signed in,
1131
+ otherwise start again with \`flypod login --json\`.
1117
1132
 
1118
1133
  A successful login also attaches every temporary site this machine deployed;
1119
1134
  \`attached\` lists them.
1120
1135
 
1121
1136
  ## Shipping a change
1122
1137
 
1123
- A second \`flypod\` **forks** the site: a new site on a new URL, while the link
1124
- you already gave the user quietly goes stale. \`flypod update\` adds a version to
1125
- the site you already made, and the URL holds.
1138
+ In a folder that already has a site, plain \`flypod\` adds a version to it and
1139
+ the URL holds. \`flypod update\` does the same and says so outright (it also
1140
+ takes \`--site <id>\` from any other folder):
1126
1141
 
1127
1142
  \`\`\`sh
1128
1143
  flypod update ./dist
1129
1144
  \`\`\`
1130
1145
 
1146
+ \`flypod --new\` **forks** the site: a separate site on a new URL, while the link
1147
+ you already gave the user stays on the earlier one. Run it only when the user
1148
+ asks for a second site; the receipt then carries \`replaced_link\` and a
1149
+ \`new-site-in-linked-folder\` warning.
1150
+
1131
1151
  ### Let a reviewer compare versions
1132
1152
 
1133
1153
  \`\`\`sh
@@ -2641,4 +2661,4 @@ class DeployError extends Error {
2641
2661
  }
2642
2662
  }
2643
2663
 
2644
- export { PLAIN, headline, hero, field, notice, failure, shortVersion, HOSTED_UPLOAD_LIMITS, uploadLimitsFor, storedZipBytes, projectsFilePath, atomicWriteFile, loadSession, saveSession, clearSession, startFailureReports, reportFailure, flushFailureReports, exitCodeFor, errorEnvelope, emitError, fail, readServerMessage, classifyResponse, UNAUTHORIZED_FIX, serverError, noBuildDir, networkError, NO_SITE, noSite, unauthorizedFor, NOT_SIGNED_IN, unexpectedError, installSkill, installId, setCliVersion, FIRST_RUN_NOTICE, resolveCredentials, createClient, packDeploy, BUILD_DIR_CANDIDATES, resolveDeployDir, DEFAULT_IGNORES, IGNORE_FILE, collectFiles, collectDist, deploySite, DeployError };
2664
+ export { detectCodingAgent, PLAIN, headline, hero, field, notice, failure, shortVersion, HOSTED_UPLOAD_LIMITS, uploadLimitsFor, storedZipBytes, configDir, projectsFilePath, atomicWriteFile, loadSession, saveSession, clearSession, startFailureReports, reportFailure, flushFailureReports, exitCodeFor, errorEnvelope, emitError, fail, readServerMessage, classifyResponse, UNAUTHORIZED_FIX, serverError, noBuildDir, networkError, NO_SITE, noSite, unauthorizedFor, NOT_SIGNED_IN, unexpectedError, installSkill, installId, setCliVersion, FIRST_RUN_NOTICE, resolveCredentials, createClient, packDeploy, BUILD_DIR_CANDIDATES, resolveDeployDir, DEFAULT_IGNORES, IGNORE_FILE, collectFiles, collectDist, deploySite, DeployError };
@@ -43,6 +43,18 @@ export declare function emitHelp(text: string, args: {
43
43
  }, io: Pick<CommandIO, "out">): number;
44
44
  /** The help text for a verb, or undefined. */
45
45
  export declare function subcommandHelp(name: string): string | undefined;
46
+ /**
47
+ * Finish a `flypod login` that is waiting for its person, from any other
48
+ * command: one poll, at most a couple of seconds, before the command runs.
49
+ * Approved → the session is saved and every site this machine remembers is
50
+ * kept, so the command that follows runs signed in. Still waiting or offline →
51
+ * nothing happens. Denied or expired → the record is dropped. Never fails the
52
+ * command it runs before, and prints one line only when it signed someone in
53
+ * and the output is for a person.
54
+ */
55
+ export declare function resumePendingLogin(io: CommandIO, opts: {
56
+ quiet: boolean;
57
+ }): Promise<void>;
46
58
  export declare function login(args: {
47
59
  token?: string;
48
60
  deviceCode?: string;
@@ -65,6 +77,18 @@ export declare function claim(args: {
65
77
  }, io: CommandIO): Promise<number>;
66
78
  /** The pause before `update`'s one retry. */
67
79
  export declare const UPDATE_RETRY_MS = 2000;
80
+ /** How `flypod` (a deploy in a folder that already has a site) runs `update`. */
81
+ export interface UpdateOptions {
82
+ /** Ran as `flypod`, not `flypod update`: fixes name `flypod --new` as the way to a second site. */
83
+ fromDeploy?: boolean;
84
+ /** The linked site is gone (404): forget the link and return this instead of failing. */
85
+ whenGone?: () => Promise<number>;
86
+ /** More receipt fields and screen lines, computed once the update is live (`--comments`). */
87
+ extra?: (siteId: string) => Promise<{
88
+ json: Record<string, unknown>;
89
+ lines: string[];
90
+ }>;
91
+ }
68
92
  export declare function update(args: {
69
93
  path?: string;
70
94
  site?: string;
@@ -76,7 +100,7 @@ export declare function update(args: {
76
100
  verbose?: boolean;
77
101
  /** Turn the version timeline on (`true`) or off (`false`); unset leaves it alone. */
78
102
  timeline?: boolean;
79
- }, io: CommandIO): Promise<number>;
103
+ }, io: CommandIO, opts?: UpdateOptions): Promise<number>;
80
104
  /**
81
105
  * Turn the version timeline on or off, and report the state the site is
82
106
  * actually in: a refusal leaves it as it was. `history_url` is where two
@@ -0,0 +1,17 @@
1
+ export interface PendingLogin {
2
+ device_code: string;
3
+ base_url: string;
4
+ /** Epoch ms after which the code is dead and the record is ignored. */
5
+ expires_at: number;
6
+ /**
7
+ * Set once the code became a session, so a later `flypod login --device-code`
8
+ * with the same code (the agent following the original instructions) is told
9
+ * it is signed in rather than that the code is invalid.
10
+ */
11
+ completed?: boolean;
12
+ }
13
+ export declare function pendingLoginPath(env?: NodeJS.ProcessEnv): string;
14
+ export declare function savePendingLogin(pending: PendingLogin, env?: NodeJS.ProcessEnv): Promise<void>;
15
+ /** The remembered login, or null when there is none, it is corrupt, or it has expired. */
16
+ export declare function loadPendingLogin(env?: NodeJS.ProcessEnv, now?: number): Promise<PendingLogin | null>;
17
+ export declare function clearPendingLogin(env?: NodeJS.ProcessEnv): Promise<void>;
package/dist/src/cli.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  collectFiles,
8
8
  deploySite,
9
9
  resolveDeployDir
10
- } from "../cli-tydvmnwj.js";
10
+ } from "../cli-qtqg73w5.js";
11
11
  export {
12
12
  BUILD_DIR_CANDIDATES,
13
13
  DEFAULT_IGNORES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flypod",
3
- "version": "0.18.1",
3
+ "version": "0.19.1",
4
4
  "description": "Zero-auth deploy primitive. Turns any folder into a live URL in one command. For AI agents and humans.",
5
5
  "module": "./dist/src/cli.js",
6
6
  "types": "./dist/src/cli.d.ts",