flypod 0.11.3 → 0.13.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,6 +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
456
  | `list_sites`, `rename_site`, `delete_site` | The sites on your account |
456
457
  | `keep_site` | Attach a temporary site to your account so it no longer expires |
457
458
  | `configure_comments`, `list_comments`, `get_comment_thread` | Turn comments on or off; read threads and the moderation queue |
@@ -502,6 +503,11 @@ The way a static export expects, with nothing to configure:
502
503
  page's title instead of a bare address. Tags you wrote are never changed.
503
504
  `<meta name="flypod" content="none">` turns this and the attribution block
504
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
509
+ by default because it makes replaced versions public. Versions that are
510
+ not live are kept for seven days.
505
511
  - **Dead links.** An address with no site shows a browser a short page saying
506
512
  that previews last 14 days and how the owner keeps one.
507
513
  - **Read-only.** A site answers `GET` and `HEAD`; anything else gets a `405`.
@@ -565,6 +571,7 @@ Deploy flags:
565
571
  | `--json` | Emit the result as JSON on stdout (replaces the pretty output) |
566
572
  | `--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` |
567
573
  | `-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` |
568
575
  | `--comments` | Enable comments on the new site (requires being signed in) |
569
576
  | `--mode <mode>` | With `--comments`: `anonymous` (default), `passcode`, or `approved` |
570
577
  | `-h`, `--help` | Show usage |
@@ -12,7 +12,7 @@ import {
12
12
  resolveCredentials,
13
13
  resolveDeployDir,
14
14
  saveSession
15
- } from "../cli-zc5d42zg.js";
15
+ } from "../cli-krr4ygaf.js";
16
16
 
17
17
  // bin/deploy.ts
18
18
  import { readFile as readFile2 } from "node:fs/promises";
@@ -490,6 +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
495
  --verbose The full receipt: also the rollback command, and with
494
496
  --json the expiry restated as days and an ISO date.
495
497
  --json Emit JSON on stdout (for agents/scripts).
@@ -933,6 +935,11 @@ async function update(args, io) {
933
935
  return failSiteRequest("flypod update", res, target, args, io, env);
934
936
  const body = await res.json();
935
937
  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
+ }
936
943
  const expiresAt = body.expires_at !== undefined ? body.expires_at : target.rec?.expires_at ?? null;
937
944
  if (args.json) {
938
945
  io.out(JSON.stringify({
@@ -943,6 +950,7 @@ async function update(args, io) {
943
950
  healed: body.healed ?? [],
944
951
  warnings: body.warnings ?? [],
945
952
  expires_at: expiresAt,
953
+ ...timeline !== undefined ? { timeline } : {},
946
954
  ...(args.verbose ? agentNext : agentNextCommands)({
947
955
  siteId: target.site_id,
948
956
  expiresAt,
@@ -965,10 +973,24 @@ async function update(args, io) {
965
973
  })) {
966
974
  io.err(line);
967
975
  }
976
+ if (timeline !== undefined) {
977
+ for (const line of timelineRows(args.timeline, timeline, io.style ?? PLAIN)) {
978
+ io.err(line);
979
+ }
980
+ }
968
981
  if (!io.interactive)
969
982
  io.out(body.url);
970
983
  return 0;
971
984
  }
985
+ function timelineRows(asked, now, s) {
986
+ if (asked !== now) {
987
+ return [field("timeline", "not changed", "the server refused; run it again", s), ""];
988
+ }
989
+ return [
990
+ field("timeline", now ? "on" : "off", now ? "visitors can step back through versions" : "only the live version is public", s),
991
+ ""
992
+ ];
993
+ }
972
994
  async function versions(args, io) {
973
995
  const pre = await withTarget("versions", args, io);
974
996
  if (typeof pre === "number")
@@ -1742,6 +1764,11 @@ var INSTALL_FLAG_SPEC = {
1742
1764
  "-y": "bool",
1743
1765
  ...Object.fromEntries(Object.keys(TARGET_FLAGS).map((f) => [f, "bool"]))
1744
1766
  };
1767
+ function timelineFlag(flags) {
1768
+ if (flags["--no-timeline"])
1769
+ return false;
1770
+ return flags["--timeline"] ? true : undefined;
1771
+ }
1745
1772
  var TOP_LEVEL_FLAG_SPEC = {
1746
1773
  "--json": "bool",
1747
1774
  "-q": "bool",
@@ -1752,7 +1779,9 @@ var TOP_LEVEL_FLAG_SPEC = {
1752
1779
  "--version": "bool",
1753
1780
  "--comments": "bool",
1754
1781
  "--mode": "value",
1755
- "--verbose": "bool"
1782
+ "--verbose": "bool",
1783
+ "--timeline": "bool",
1784
+ "--no-timeline": "bool"
1756
1785
  };
1757
1786
  function rejectUnknownFlag(unknown, argv, helpCmd) {
1758
1787
  const err = {
@@ -1783,7 +1812,8 @@ function parseArgs(argv) {
1783
1812
  version: Boolean(flags["-v"] || flags["--version"]),
1784
1813
  comments: Boolean(flags["--comments"]),
1785
1814
  commentsMode: flags["--mode"] ?? "anonymous",
1786
- verbose: Boolean(flags["--verbose"])
1815
+ verbose: Boolean(flags["--verbose"]),
1816
+ timeline: timelineFlag(flags)
1787
1817
  };
1788
1818
  }
1789
1819
  var SUB_FLAG_SPEC = {
@@ -1794,7 +1824,9 @@ var SUB_FLAG_SPEC = {
1794
1824
  "--quiet": "bool",
1795
1825
  "-h": "bool",
1796
1826
  "--help": "bool",
1797
- "--verbose": "bool"
1827
+ "--verbose": "bool",
1828
+ "--timeline": "bool",
1829
+ "--no-timeline": "bool"
1798
1830
  };
1799
1831
  var LOGIN_FLAG_SPEC = {
1800
1832
  "--token": "value",
@@ -1819,7 +1851,8 @@ function parseSub(name, argv) {
1819
1851
  json: Boolean(flags["--json"]),
1820
1852
  quiet: Boolean(flags["-q"] || flags["--quiet"]),
1821
1853
  help: Boolean(flags["-h"] || flags["--help"]),
1822
- verbose: Boolean(flags["--verbose"])
1854
+ verbose: Boolean(flags["--verbose"]),
1855
+ timeline: timelineFlag(flags)
1823
1856
  };
1824
1857
  }
1825
1858
  async function runSubcommand(name, argv) {
@@ -1833,8 +1866,8 @@ async function runSubcommand(name, argv) {
1833
1866
  };
1834
1867
  switch (name) {
1835
1868
  case "update": {
1836
- const { positionals, site, token: token2, json, quiet, help, verbose } = parseSub(name, argv);
1837
- return update({ path: positionals[0], site, token: token2, json, quiet, help, verbose }, io);
1869
+ const { positionals, site, token: token2, json, quiet, help, verbose, timeline } = parseSub(name, argv);
1870
+ return update({ path: positionals[0], site, token: token2, json, quiet, help, verbose, timeline }, io);
1838
1871
  }
1839
1872
  case "versions": {
1840
1873
  const { site, token: token2, json, help } = parseSub(name, argv);
@@ -2026,6 +2059,11 @@ Agents:
2026
2059
  --list to see the paths, --dry-run to preview.
2027
2060
 
2028
2061
  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.
2029
2067
  --comments Enable comments on the new site (mode: anonymous).
2030
2068
  --comments --mode <mode> Same, but choose the mode: anonymous|passcode|
2031
2069
  approved.
@@ -2201,13 +2239,20 @@ async function main() {
2201
2239
  } catch {}
2202
2240
  }
2203
2241
  }
2242
+ let timeline;
2243
+ if (args.timeline !== undefined) {
2244
+ 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;
2247
+ }
2204
2248
  if (args.json) {
2205
2249
  const shared = {
2206
2250
  healed: result.healed ?? [],
2207
2251
  warnings: result.warnings ?? [],
2208
2252
  link_saved: linkSaved,
2209
2253
  ...priorLink && priorLink.site_id !== result.site_id ? { replaced_link: { site_id: priorLink.site_id, url: priorLink.url } } : {},
2210
- ...args.comments ? { comments_enabled: commentsEnabled, comments_mode: args.commentsMode } : {}
2254
+ ...args.comments ? { comments_enabled: commentsEnabled, comments_mode: args.commentsMode } : {},
2255
+ ...timeline !== undefined ? { timeline } : {}
2211
2256
  };
2212
2257
  const nextOpts = {
2213
2258
  siteId: result.site_id,
@@ -2264,6 +2309,12 @@ async function main() {
2264
2309
  process.stderr.write(`${line}
2265
2310
  `);
2266
2311
  }
2312
+ if (timeline !== undefined) {
2313
+ for (const line of timelineRows(args.timeline, timeline, style)) {
2314
+ process.stderr.write(`${line}
2315
+ `);
2316
+ }
2317
+ }
2267
2318
  if (!linkSaved && !owned) {
2268
2319
  for (const line of unsavedLinkNotice({ configPath: projectsFilePath(), manageToken: result.manage_token }, style)) {
2269
2320
  process.stderr.write(`${line}
@@ -518,6 +518,19 @@ the site you already made, and the URL holds.
518
518
  flypod update ./dist
519
519
  \`\`\`
520
520
 
521
+ ### Let a reviewer compare versions
522
+
523
+ \`\`\`sh
524
+ flypod update --timeline # --no-timeline turns it off
525
+ \`\`\`
526
+
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
+ choosing between iterations. It is off by default because it makes replaced
530
+ 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
532
+ for seven days.
533
+
521
534
  ## Where sites live
522
535
 
523
536
  Every deployed site — temporary or claimed — is served at
@@ -799,6 +812,7 @@ function buildClient(token, baseUrl, fetchImpl, source = "library") {
799
812
  createSite: (zip) => request("POST", "/sites", { zip }),
800
813
  redeploy: (siteId, zip) => request("POST", `/sites/${siteId}/deploys`, { zip }),
801
814
  rollback: (siteId, versionId) => request("POST", `/sites/${siteId}/rollback`, { json: { version_id: versionId } }),
815
+ setTimeline: (siteId, enabled) => request("POST", `/sites/${siteId}/timeline`, { json: { enabled } }),
802
816
  setCommentsMode: (siteId, body) => request("POST", `/api/sites/${siteId}/comments-mode`, { json: body }),
803
817
  listComments: (siteId, query) => request("GET", `/api/sites/${siteId}/comments`, { query }),
804
818
  getThread: (siteId, threadId) => request("GET", `/api/sites/${siteId}/comments/${threadId}`),
@@ -36,6 +36,7 @@ export interface FlypodClient {
36
36
  createSite(zip: Uint8Array): Promise<Response>;
37
37
  redeploy(siteId: string, zip: Uint8Array): Promise<Response>;
38
38
  rollback(siteId: string, versionId: string): Promise<Response>;
39
+ setTimeline(siteId: string, enabled: boolean): Promise<Response>;
39
40
  setCommentsMode(siteId: string, body: {
40
41
  mode?: string;
41
42
  enabled?: boolean;
@@ -55,7 +55,11 @@ export declare function update(args: {
55
55
  help?: boolean;
56
56
  /** The full receipt instead of the short default. See receipt.ts. */
57
57
  verbose?: boolean;
58
+ /** Turn the version timeline on (`true`) or off (`false`); unset leaves it alone. */
59
+ timeline?: boolean;
58
60
  }, io: CommandIO): Promise<number>;
61
+ /** What the screen says after `--timeline` / `--no-timeline`. */
62
+ export declare function timelineRows(asked: boolean, now: boolean, s: TailStyle): string[];
59
63
  export declare function versions(args: {
60
64
  site?: string;
61
65
  token?: string;
package/dist/src/cli.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  collectDist,
5
5
  deploySite,
6
6
  resolveDeployDir
7
- } from "../cli-zc5d42zg.js";
7
+ } from "../cli-krr4ygaf.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.11.3",
3
+ "version": "0.13.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",