flypod 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -452,7 +452,7 @@ publish something.
452
452
  | `deploy_site`, `update_site`, `rollback_site` | Publish a site, publish a new version, go back to an earlier one |
453
453
  | `get_site`, `compare_versions` | A site's URL, expiry and versions; the files that differ between two versions |
454
454
  | `duplicate_site` | Copy a temporary site to a new URL |
455
- | `configure_timeline` | Show or hide the version slider on a site's pages |
455
+ | `configure_timeline` | Show or hide the History chip on a site's pages |
456
456
  | `list_sites`, `rename_site`, `delete_site` | The sites on your account |
457
457
  | `keep_site` | Attach a temporary site to your account so it no longer expires |
458
458
  | `configure_comments`, `list_comments`, `get_comment_thread` | Turn comments on or off; read threads and the moderation queue |
@@ -503,9 +503,13 @@ The way a static export expects, with nothing to configure:
503
503
  page's title instead of a bare address. Tags you wrote are never changed.
504
504
  `<meta name="flypod" content="none">` turns this and the attribution block
505
505
  off.
506
- - **Version timeline** (opt-in). `--timeline` puts a small slider on the
507
- site's pages that steps through its versions, so a reviewer can compare
508
- the third attempt with the fifth without anyone rolling back. It is off
506
+ - **Version timeline** (opt-in). `--timeline` puts a small History chip on
507
+ the site's pages that lists its versions and opens any of them, each at
508
+ its own address (`<site>--<version>.flypod.page`), and a page at
509
+ `/_flypod/history` that shows two versions side by side, stacked, or
510
+ with a divider to drag across them. A reviewer can compare the third
511
+ attempt with the fifth without anyone rolling back. `flypod versions`
512
+ prints the compare link, and the account page has the same switch. It is off
509
513
  by default because it makes replaced versions public. Versions that are
510
514
  not live are kept for seven days.
511
515
  - **Dead links.** An address with no site shows a browser a short page saying
@@ -571,7 +575,7 @@ Deploy flags:
571
575
  | `--json` | Emit the result as JSON on stdout (replaces the pretty output) |
572
576
  | `--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` |
573
577
  | `-q`, `--quiet` | Print only the URL on stdout, and nothing else |
574
- | `--timeline`, `--no-timeline` | Show or hide the version slider on the site's pages. Also on `flypod update` |
578
+ | `--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` is the same flag |
575
579
  | `--comments` | Enable comments on the new site (requires being signed in) |
576
580
  | `--mode <mode>` | With `--comments`: `anonymous` (default), `passcode`, or `approved` |
577
581
  | `-h`, `--help` | Show usage |
@@ -12,7 +12,7 @@ import {
12
12
  resolveCredentials,
13
13
  resolveDeployDir,
14
14
  saveSession
15
- } from "../cli-krr4ygaf.js";
15
+ } from "../cli-xrnr1hed.js";
16
16
 
17
17
  // bin/deploy.ts
18
18
  import { readFile as readFile2 } from "node:fs/promises";
@@ -490,8 +490,8 @@ Ship a new version of the site linked to this folder.
490
490
  Flags:
491
491
  --site <id> Target a site by id instead of the linked folder.
492
492
  --token <tok> Authorize with a manage_token.
493
- --timeline Show a version slider on the site's pages, so a visitor can
494
- step back through earlier versions. --no-timeline hides it.
493
+ --timeline Show a History chip on the site's pages, so a visitor can
494
+ open earlier versions and compare two. --no-timeline hides it.
495
495
  --verbose The full receipt: also the rollback command, and with
496
496
  --json the expiry restated as days and an ISO date.
497
497
  --json Emit JSON on stdout (for agents/scripts).
@@ -503,11 +503,17 @@ List every version of the site linked to this folder.
503
503
 
504
504
  flypod versions Show version history for the linked site.
505
505
  flypod versions --site <id> Show versions for a specific site.
506
+ flypod versions --timeline Turn on History for the site, without a deploy.
506
507
 
507
508
  Flags:
508
509
  --site <id> Target a site by id.
509
510
  --token <tok> Authorize with a manage_token.
510
- --json Emit JSON on stdout.
511
+ --timeline Turn on History: a chip on the site's pages that opens
512
+ earlier versions, and a page that compares two. Each version
513
+ then has an address of its own, listed here.
514
+ --no-timeline Turn it off. Earlier versions stop being reachable.
515
+ --json Emit JSON on stdout: also "timeline", and with it on,
516
+ "history_url" and a "url" for each version.
511
517
  -h, --help Show this help.`,
512
518
  rollback: `flypod rollback [version] [flags]
513
519
 
@@ -935,11 +941,8 @@ async function update(args, io) {
935
941
  return failSiteRequest("flypod update", res, target, args, io, env);
936
942
  const body = await res.json();
937
943
  await touchLink(target, body.version_id, env);
938
- let timeline;
939
- if (args.timeline !== undefined) {
940
- const ok = await client.setTimeline(target.site_id, args.timeline).then((r) => r.ok).catch(() => false);
941
- timeline = ok ? args.timeline : !args.timeline;
942
- }
944
+ const switched = args.timeline === undefined ? undefined : await switchTimeline(client, target.site_id, args.timeline);
945
+ const timeline = switched?.timeline;
943
946
  const expiresAt = body.expires_at !== undefined ? body.expires_at : target.rec?.expires_at ?? null;
944
947
  if (args.json) {
945
948
  io.out(JSON.stringify({
@@ -950,7 +953,7 @@ async function update(args, io) {
950
953
  healed: body.healed ?? [],
951
954
  warnings: body.warnings ?? [],
952
955
  expires_at: expiresAt,
953
- ...timeline !== undefined ? { timeline } : {},
956
+ ...switched ?? {},
954
957
  ...(args.verbose ? agentNext : agentNextCommands)({
955
958
  siteId: target.site_id,
956
959
  expiresAt,
@@ -974,7 +977,7 @@ async function update(args, io) {
974
977
  io.err(line);
975
978
  }
976
979
  if (timeline !== undefined) {
977
- for (const line of timelineRows(args.timeline, timeline, io.style ?? PLAIN)) {
980
+ for (const line of timelineRows(args.timeline, timeline, io.style ?? PLAIN, switched?.history_url)) {
978
981
  io.err(line);
979
982
  }
980
983
  }
@@ -982,12 +985,27 @@ async function update(args, io) {
982
985
  io.out(body.url);
983
986
  return 0;
984
987
  }
985
- function timelineRows(asked, now, s) {
988
+ async function switchTimeline(client, siteId, enabled) {
989
+ try {
990
+ const res = await client.setTimeline(siteId, enabled);
991
+ if (!res.ok)
992
+ return { timeline: !enabled };
993
+ const body = await res.json().catch(() => ({}));
994
+ return {
995
+ timeline: enabled,
996
+ ...enabled && typeof body.history_url === "string" ? { history_url: body.history_url } : {}
997
+ };
998
+ } catch {
999
+ return { timeline: !enabled };
1000
+ }
1001
+ }
1002
+ function timelineRows(asked, now, s, historyUrl) {
986
1003
  if (asked !== now) {
987
- return [field("timeline", "not changed", "the server refused; run it again", s), ""];
1004
+ return [field("history", "not changed", "the server refused; run it again", s), ""];
988
1005
  }
989
1006
  return [
990
- field("timeline", now ? "on" : "off", now ? "visitors can step back through versions" : "only the live version is public", s),
1007
+ field("history", now ? "on" : "off", now ? "visitors can open earlier versions" : "only the live version is public", s),
1008
+ ...now && historyUrl ? [field("compare", historyUrl, undefined, s)] : [],
991
1009
  ""
992
1010
  ];
993
1011
  }
@@ -996,11 +1014,29 @@ async function versions(args, io) {
996
1014
  if (typeof pre === "number")
997
1015
  return pre;
998
1016
  const { env, target } = pre;
1017
+ if (args.timeline !== undefined) {
1018
+ const client = await clientForTarget(target, args, io);
1019
+ let res;
1020
+ try {
1021
+ res = await client.setTimeline(target.site_id, args.timeline);
1022
+ } catch (e) {
1023
+ return emitError(networkError(e, client.baseUrl), args, io, { prefix: "flypod versions" });
1024
+ }
1025
+ if (!res.ok)
1026
+ return failSiteRequest("flypod versions", res, target, args, io, env);
1027
+ }
999
1028
  const site = await fetchSite("flypod versions", target, args, io, env);
1000
1029
  if ("error" in site)
1001
1030
  return site.error;
1002
1031
  const { live_version_id, versions: vers } = site.data;
1003
1032
  const expiresAt = site.data.expires_at ?? null;
1033
+ const timeline = Boolean(site.data.timeline);
1034
+ const historyRows = () => {
1035
+ const s = io.style ?? PLAIN;
1036
+ if (timeline)
1037
+ return timelineRows(true, true, s, site.data.history_url);
1038
+ return [field("history", "off", "flypod versions --timeline turns it on", s), ""];
1039
+ };
1004
1040
  if (args.json) {
1005
1041
  io.out(JSON.stringify({
1006
1042
  ok: true,
@@ -1008,6 +1044,8 @@ async function versions(args, io) {
1008
1044
  live_version_id,
1009
1045
  versions: vers,
1010
1046
  expires_at: expiresAt,
1047
+ timeline,
1048
+ ...site.data.history_url ? { history_url: site.data.history_url } : {},
1011
1049
  ...agentNextCommands({ siteId: target.site_id, expiresAt, owned: expiresAt === null })
1012
1050
  }));
1013
1051
  return 0;
@@ -1021,6 +1059,8 @@ async function versions(args, io) {
1021
1059
  })) {
1022
1060
  io.err(line);
1023
1061
  }
1062
+ for (const line of historyRows())
1063
+ io.err(line);
1024
1064
  return 0;
1025
1065
  }
1026
1066
  for (const v of [...vers].reverse()) {
@@ -1029,6 +1069,9 @@ async function versions(args, io) {
1029
1069
  if (expiresAt !== null)
1030
1070
  for (const line of expiryRows({ expiresAt }, io.style))
1031
1071
  io.err(line);
1072
+ if (timeline || args.timeline !== undefined)
1073
+ for (const line of historyRows())
1074
+ io.err(line);
1032
1075
  return 0;
1033
1076
  }
1034
1077
  async function rollback(args, io) {
@@ -1765,9 +1808,9 @@ var INSTALL_FLAG_SPEC = {
1765
1808
  ...Object.fromEntries(Object.keys(TARGET_FLAGS).map((f) => [f, "bool"]))
1766
1809
  };
1767
1810
  function timelineFlag(flags) {
1768
- if (flags["--no-timeline"])
1811
+ if (flags["--no-timeline"] || flags["--no-history"])
1769
1812
  return false;
1770
- return flags["--timeline"] ? true : undefined;
1813
+ return flags["--timeline"] || flags["--history"] ? true : undefined;
1771
1814
  }
1772
1815
  var TOP_LEVEL_FLAG_SPEC = {
1773
1816
  "--json": "bool",
@@ -1781,7 +1824,9 @@ var TOP_LEVEL_FLAG_SPEC = {
1781
1824
  "--mode": "value",
1782
1825
  "--verbose": "bool",
1783
1826
  "--timeline": "bool",
1784
- "--no-timeline": "bool"
1827
+ "--no-timeline": "bool",
1828
+ "--history": "bool",
1829
+ "--no-history": "bool"
1785
1830
  };
1786
1831
  function rejectUnknownFlag(unknown, argv, helpCmd) {
1787
1832
  const err = {
@@ -1826,7 +1871,9 @@ var SUB_FLAG_SPEC = {
1826
1871
  "--help": "bool",
1827
1872
  "--verbose": "bool",
1828
1873
  "--timeline": "bool",
1829
- "--no-timeline": "bool"
1874
+ "--no-timeline": "bool",
1875
+ "--history": "bool",
1876
+ "--no-history": "bool"
1830
1877
  };
1831
1878
  var LOGIN_FLAG_SPEC = {
1832
1879
  "--token": "value",
@@ -1870,8 +1917,8 @@ async function runSubcommand(name, argv) {
1870
1917
  return update({ path: positionals[0], site, token: token2, json, quiet, help, verbose, timeline }, io);
1871
1918
  }
1872
1919
  case "versions": {
1873
- const { site, token: token2, json, help } = parseSub(name, argv);
1874
- return versions({ site, token: token2, json, help }, io);
1920
+ const { site, token: token2, json, help, timeline } = parseSub(name, argv);
1921
+ return versions({ site, token: token2, json, help, timeline }, io);
1875
1922
  }
1876
1923
  case "rollback": {
1877
1924
  const { positionals, site, token: token2, json, help } = parseSub(name, argv);
@@ -2059,11 +2106,13 @@ Agents:
2059
2106
  --list to see the paths, --dry-run to preview.
2060
2107
 
2061
2108
  Deploy flags:
2062
- --timeline Show a version slider on the site's pages, so a
2063
- visitor can step back through earlier versions.
2064
- Off by default: it makes replaced versions
2065
- public. Also on 'flypod update'.
2066
- --no-timeline Turn the slider off again.
2109
+ --timeline Turn on History: a chip on the site's pages
2110
+ that opens earlier versions, and a page that
2111
+ compares two side by side. Off by default: it
2112
+ makes replaced versions public. Also on
2113
+ 'flypod update', and on 'flypod versions' to
2114
+ switch it without deploying.
2115
+ --no-timeline Turn History off again.
2067
2116
  --comments Enable comments on the new site (mode: anonymous).
2068
2117
  --comments --mode <mode> Same, but choose the mode: anonymous|passcode|
2069
2118
  approved.
@@ -2239,12 +2288,12 @@ async function main() {
2239
2288
  } catch {}
2240
2289
  }
2241
2290
  }
2242
- let timeline;
2291
+ let switched;
2243
2292
  if (args.timeline !== undefined) {
2244
2293
  const siteClient = owned ? client : await createClient({ overrides: { manageToken: result.manage_token, baseUrl } });
2245
- const ok = await siteClient.setTimeline(result.site_id, args.timeline).then((r) => r.ok).catch(() => false);
2246
- timeline = ok ? args.timeline : !args.timeline;
2294
+ switched = await switchTimeline(siteClient, result.site_id, args.timeline);
2247
2295
  }
2296
+ const timeline = switched?.timeline;
2248
2297
  if (args.json) {
2249
2298
  const shared = {
2250
2299
  healed: result.healed ?? [],
@@ -2252,7 +2301,7 @@ async function main() {
2252
2301
  link_saved: linkSaved,
2253
2302
  ...priorLink && priorLink.site_id !== result.site_id ? { replaced_link: { site_id: priorLink.site_id, url: priorLink.url } } : {},
2254
2303
  ...args.comments ? { comments_enabled: commentsEnabled, comments_mode: args.commentsMode } : {},
2255
- ...timeline !== undefined ? { timeline } : {}
2304
+ ...switched ?? {}
2256
2305
  };
2257
2306
  const nextOpts = {
2258
2307
  siteId: result.site_id,
@@ -2310,7 +2359,7 @@ async function main() {
2310
2359
  `);
2311
2360
  }
2312
2361
  if (timeline !== undefined) {
2313
- for (const line of timelineRows(args.timeline, timeline, style)) {
2362
+ for (const line of timelineRows(args.timeline, timeline, style, switched?.history_url)) {
2314
2363
  process.stderr.write(`${line}
2315
2364
  `);
2316
2365
  }
@@ -521,14 +521,19 @@ flypod update ./dist
521
521
  ### Let a reviewer compare versions
522
522
 
523
523
  \`\`\`sh
524
- flypod update --timeline # --no-timeline turns it off
524
+ flypod update --timeline # with the next deploy
525
+ flypod versions --timeline --json # now, without deploying
526
+ flypod versions --no-timeline # off again
525
527
  \`\`\`
526
528
 
527
- \`--timeline\` (also on \`flypod\`) puts a slider on the site's pages that steps
528
- through its versions without changing what is live. Offer it when the user is
529
+ \`--timeline\` (also on \`flypod\`) puts a History chip on the site's pages that lists
530
+ its versions and opens any of them, plus a page that compares two side by
531
+ side (\`<site url>/_flypod/history\`), without changing what is live. Offer it when the user is
529
532
  choosing between iterations. It is off by default because it makes replaced
530
533
  versions public: do not turn it on for a site where an earlier version held
531
- something that was removed on purpose. Versions that are not live are kept
534
+ something that was removed on purpose. With it on, \`--json\` carries a
535
+ \`history_url\` to give the user (two versions side by side), and
536
+ \`flypod versions --json\` a \`url\` for each version. Versions that are not live are kept
532
537
  for seven days.
533
538
 
534
539
  ## Where sites live
@@ -1,3 +1,4 @@
1
+ import { type FlypodClient } from "./client";
1
2
  import { type TailStyle } from "./receipt";
2
3
  type FetchLike = typeof fetch;
3
4
  export interface CommandIO {
@@ -58,13 +59,24 @@ export declare function update(args: {
58
59
  /** Turn the version timeline on (`true`) or off (`false`); unset leaves it alone. */
59
60
  timeline?: boolean;
60
61
  }, io: CommandIO): Promise<number>;
62
+ /**
63
+ * Turn the version timeline on or off, and report the state the site is
64
+ * actually in: a refusal leaves it as it was. `history_url` is where two
65
+ * versions can be compared, present only while the timeline is on.
66
+ */
67
+ export declare function switchTimeline(client: FlypodClient, siteId: string, enabled: boolean): Promise<{
68
+ timeline: boolean;
69
+ history_url?: string;
70
+ }>;
61
71
  /** What the screen says after `--timeline` / `--no-timeline`. */
62
- export declare function timelineRows(asked: boolean, now: boolean, s: TailStyle): string[];
72
+ export declare function timelineRows(asked: boolean, now: boolean, s: TailStyle, historyUrl?: string): string[];
63
73
  export declare function versions(args: {
64
74
  site?: string;
65
75
  token?: string;
66
76
  json?: boolean;
67
77
  help?: boolean;
78
+ /** Turn the version timeline on or off before listing; unset leaves it alone. */
79
+ timeline?: boolean;
68
80
  }, io: CommandIO): Promise<number>;
69
81
  export declare function rollback(args: {
70
82
  version?: string;
package/dist/src/cli.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  collectDist,
5
5
  deploySite,
6
6
  resolveDeployDir
7
- } from "../cli-krr4ygaf.js";
7
+ } from "../cli-xrnr1hed.js";
8
8
  export {
9
9
  BUILD_DIR_CANDIDATES,
10
10
  DeployError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flypod",
3
- "version": "0.13.0",
3
+ "version": "0.15.0",
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",