@tobos/cli 0.4.27 → 0.4.29

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.
@@ -116,7 +116,7 @@ export declare const JoinCode: Component<JoinCodeProps>;
116
116
  var define_TOBOS_SKILL_default;
117
117
  var init_define_TOBOS_SKILL = __esm({
118
118
  "<define:TOBOS_SKILL>"() {
119
- define_TOBOS_SKILL_default = { "SKILL.md": "---\nname: tobos-present\ndescription: Build presentations as code with Tobos Present. Use when the user wants a talk, lecture, pitch or slide deck made, changed, rendered, presented or exported as a PDF, or mentions Tobos or `tobos`.\n---\n\n<!-- Installed by the `tobos` CLI and overwritten when it updates, so changes made here don't last. -->\n\n# Tobos Present\n\nTobos hosts presentations written as code: a deck is a git repository, one Svelte 5 file per scene, advancing one beat per click. You build it with the `tobos` command; Tobos checks every push, hosts the deck and puts it on stage. `tobos --help` lists every command, and each takes `--json`.\n\n## Get to the deck\n\n- `tobos decks` lists the decks and templates the person can work on, by id. `tobos clone <id>` gets one; `tobos new \"Title\"` starts one and clones it.\n- A new deck starts from Tobos simple. The person's own templates, their house styles, are in `tobos decks`: start from one with `--from <id>`, and ask which when there are several.\n- Then read the deck's `AGENTS.md`: it points to the loop, the format and the deck's slide master.\n- The person's decks are in folders, which `tobos --help` lists the commands for.\n\nExit code 3 means no one is logged in. Ask the person for their e-mail address and run `tobos login <email>`. Then ask, in one line, for the 6-digit code it mailed them (it may be in spam, and using it accepts https://tobos.ai/terms), and run `tobos login --code <code>`. In CI or a sandbox with no one to ask, `TOBOS_TOKEN` and `TOBOS_SERVER` stand in for the login.\n\n## Follow the person\n\nThey decide what to make and how much of it you build: one scene at a time, or the whole deck at once. Build what they ask, at the size they ask, from what they have told you about the talk. When they ask how Tobos works or where to start, give them the tour, https://tobos.ai/tour, and nothing of your own: no explanation, no deck to try.\n\n## Folders\n\n- Look at the person's folders before you make or move a deck, and file it under a folder name they have already, as they wrote it, rather than a new one that means the same.\n- File every deck you make: once it is made, move it into the folder it belongs in.\n- Before you move more than a handful of decks, show the person the tree you propose, and make it once they say yes.\n- A reorganisation is taken back by moving the decks back where they were: note where they were before you move them.\n- A folder stays when a move empties it, until the person removes it: removing is theirs, as deleting a deck is.\n\n## What stays the person's\n\n- **Exit code 5** is a plan's limit or an archived deck. Show the person the message as it is, which says what they can do, and wait for their answer. The deck stays in Tobos: a deck built elsewhere to upload later, media shrunk or hosted elsewhere to fit, or someone else's account would decide for them what is theirs to decide.\n- **Archiving, opening again and deleting** a deck, and deleting a session's answers, are done by the person on the deck's page, also in a browser `tobos open` logged in.\n- **Who is on a deck, and its link,** are the person's, on the deck's page: they put people on it, change what each may do, take them off, and turn the link on or off there. You neither see nor change any of it: `tobos decks` tells you only what you may do on each deck and whose it is. Can edit builds it with their own agent, can present presents it with its notes and polls, and can view sees the slides; on a template, can edit and can use.\n- **The URL `tobos open` prints** opens once, for whoever opens it first: give it to the person unopened, and run the command again for another window or computer.\n\n## The story\n\nA deck's story is the talk as the speaker tells it, in paragraphs. What follows a mention of a scene, `[Title](scene:<id>)` or one of its beats, `[Title](scene:<id>/<beat>)`, up to the next mention, is that scene's: the presenter sees it as speaker notes. The server holds the story, not git: the person types in it on the deck's page, and you change it with `tobos story`.\n\n- Read it again right before each change: the person may be typing.\n- Change what the person asked, and keep the rest of their words as they are.\n- An edit is anchored on exact text that occurs once in its paragraph. Exit code 4 means the paragraph changed meanwhile: anchor on it as the reply gives it, and try again.\n- Set `TOBOS_AGENT` to your name (`claude`, `codex`), so the page shows what you wrote.\n" };
119
+ define_TOBOS_SKILL_default = { "SKILL.md": "---\nname: tobos-present\ndescription: Build presentations as code with Tobos Present. Use when the user wants a talk, lecture, pitch or slide deck made, changed, rendered, presented or exported as a PDF, or mentions Tobos or `tobos`.\n---\n\n<!-- Installed by the `tobos` CLI and overwritten when it updates, so changes made here don't last. -->\n\n# Tobos Present\n\nTobos hosts presentations written as code: a deck is a git repository, one Svelte 5 file per scene, advancing one beat per click. You build it with the `tobos` command; Tobos checks every push, hosts the deck and puts it on stage. `tobos --help` lists every command, and each takes `--json`.\n\n## Get to the deck\n\n- `tobos decks` lists the decks and templates the person can work on, by id. `tobos clone <id>` gets one; `tobos new \"Title\"` starts one and clones it.\n- A new deck starts from Tobos simple. The person's own templates, their house styles, are in `tobos decks`: start from one with `--from <id>`, and ask which when there are several.\n- Then read the deck's `AGENTS.md`: it points to the loop, the format and the deck's slide master.\n- The person's decks are in folders, which `tobos --help` lists the commands for.\n\nExit code 3 means no one is logged in. Ask the person for their e-mail address and run `tobos login <email>`. Then ask, in one line, for the 6-digit code it mailed them (it may be in spam, and using it accepts https://tobos.ai/terms), and run `tobos login --code <code>`. In CI or a sandbox with no one to ask, `TOBOS_TOKEN` and `TOBOS_SERVER` stand in for the login.\n\n## Follow the person\n\nThey decide what to make and how much of it you build: one scene at a time, or the whole deck at once. Build what they ask, at the size they ask, from what they have told you about the talk. When they ask how Tobos works or where to start, give them the tour, https://tobos.ai/tour, and nothing of your own: no explanation, no deck to try.\n\n## Folders\n\n- Look at the person's folders before you make or move a deck, and file it under a folder name they have already, as they wrote it, rather than a new one that means the same.\n- File every deck you make: once it is made, move it into the folder it belongs in.\n- Before you move more than a handful of decks, show the person the tree you propose, and make it once they say yes.\n- A reorganisation is taken back by moving the decks back where they were: note where they were before you move them.\n- A folder goes when it empties, by a move or a deck's deletion: there is no removing one. A folder with only archived decks in it isn't empty.\n\n## What stays the person's\n\n- **Exit code 5** is a plan's limit or an archived deck. Show the person the message as it is, which says what they can do, and wait for their answer. The deck stays in Tobos: a deck built elsewhere to upload later, media shrunk or hosted elsewhere to fit, or someone else's account would decide for them what is theirs to decide.\n- **Archiving, opening again and deleting** a deck, and deleting a session's answers, are done by the person on the deck's page, also in a browser `tobos open` logged in.\n- **Who is on a deck, and its link,** are the person's, on the deck's page: they put people on it, change what each may do, take them off, and turn the link on or off there. You neither see nor change any of it: `tobos decks` tells you only what you may do on each deck and whose it is. Can edit builds it with their own agent, can present presents it with its notes and polls, and can view sees the slides; on a template, can edit and can use.\n- **The URL `tobos open` prints** opens once, for whoever opens it first: give it to the person unopened, and run the command again for another window or computer.\n\n## The story\n\nA deck's story is the talk as the speaker tells it, in paragraphs. What follows a mention of a scene, `[Title](scene:<id>)` or one of its beats, `[Title](scene:<id>/<beat>)`, up to the next mention, is that scene's: the presenter sees it as speaker notes. The server holds the story, not git: the person types in it on the deck's page, and you change it with `tobos story`.\n\n- Read it again right before each change: the person may be typing.\n- Change what the person asked, and keep the rest of their words as they are.\n- An edit is anchored on exact text that occurs once in its paragraph. Exit code 4 means the paragraph changed meanwhile: anchor on it as the reply gives it, and try again.\n- Set `TOBOS_AGENT` to your name (`claude`, `codex`), so the page shows what you wrote.\n" };
120
120
  }
121
121
  });
122
122
 
@@ -5,7 +5,7 @@ import {
5
5
  init_define_TOBOS_PRESENT_TYPES,
6
6
  init_define_TOBOS_SKILL,
7
7
  init_define_TOBOS_TOOLCHAIN
8
- } from "./chunk-TCQ2QETE.js";
8
+ } from "./chunk-3SEPIUUD.js";
9
9
 
10
10
  // src/out.ts
11
11
  init_define_TOBOS_PRESENT_TYPES();
@@ -8,7 +8,7 @@ import {
8
8
  init_define_TOBOS_PRESENT_TYPES,
9
9
  init_define_TOBOS_SKILL,
10
10
  init_define_TOBOS_TOOLCHAIN
11
- } from "./chunk-TCQ2QETE.js";
11
+ } from "./chunk-3SEPIUUD.js";
12
12
 
13
13
  // ../node_modules/.pnpm/aria-query@5.3.1/node_modules/aria-query/lib/util/iteratorProxy.js
14
14
  var require_iteratorProxy = __commonJS({
@@ -55798,6 +55798,120 @@ function mediaTypeOf(name) {
55798
55798
  return TYPES[extname(name).toLowerCase()] ?? "application/octet-stream";
55799
55799
  }
55800
55800
 
55801
+ // ../deck/src/merge.ts
55802
+ init_define_TOBOS_PRESENT_TYPES();
55803
+ init_define_TOBOS_SKILL();
55804
+ init_define_TOBOS_TOOLCHAIN();
55805
+ var MOST = 4e6;
55806
+ function mergeText(base, ours, theirs) {
55807
+ if (ours === theirs || theirs === base) return ours;
55808
+ if (ours === base) return theirs;
55809
+ const [b, o, t] = [base, ours, theirs].map(split);
55810
+ let changes;
55811
+ try {
55812
+ changes = [hunksOf(b, o), hunksOf(b, t)];
55813
+ } catch (error) {
55814
+ if (error instanceof TooLarge) return void 0;
55815
+ throw error;
55816
+ }
55817
+ const hunks = [
55818
+ ...changes[0].map((h) => ({ ...h, side: 0 })),
55819
+ ...changes[1].map((h) => ({ ...h, side: 1 }))
55820
+ ].sort((x, y) => x.from - y.from || x.to - y.to);
55821
+ const merged = [];
55822
+ let at2 = 0;
55823
+ for (let i2 = 0; i2 < hunks.length; ) {
55824
+ const group = [hunks[i2]];
55825
+ let to = hunks[i2].to;
55826
+ for (i2++; i2 < hunks.length && overlaps(hunks[i2], group.at(-1).from, to); i2++) {
55827
+ group.push(hunks[i2]);
55828
+ to = Math.max(to, hunks[i2].to);
55829
+ }
55830
+ const from = group[0].from;
55831
+ const sides = new Set(group.map((h) => h.side));
55832
+ let lines2;
55833
+ if (sides.size === 1) lines2 = applied(b, group, from, to);
55834
+ else {
55835
+ const mine = applied(
55836
+ b,
55837
+ group.filter((h) => h.side === 0),
55838
+ from,
55839
+ to
55840
+ );
55841
+ const yours = applied(
55842
+ b,
55843
+ group.filter((h) => h.side === 1),
55844
+ from,
55845
+ to
55846
+ );
55847
+ if (mine.join("") !== yours.join("")) return void 0;
55848
+ lines2 = mine;
55849
+ }
55850
+ merged.push(...b.slice(at2, from), ...lines2);
55851
+ at2 = to;
55852
+ }
55853
+ merged.push(...b.slice(at2));
55854
+ return merged.join("");
55855
+ }
55856
+ function overlaps(hunk, from, to) {
55857
+ return hunk.from < to || hunk.from === from || hunk.from === to && (hunk.to === to || from === to);
55858
+ }
55859
+ function applied(base, hunks, from, to) {
55860
+ const out = [];
55861
+ let at2 = from;
55862
+ for (const hunk of hunks) {
55863
+ out.push(...base.slice(at2, hunk.from), ...hunk.lines);
55864
+ at2 = hunk.to;
55865
+ }
55866
+ out.push(...base.slice(at2, to));
55867
+ return out;
55868
+ }
55869
+ function split(text3) {
55870
+ return text3.match(/[^\n]*\n|[^\n]+$/g) ?? [];
55871
+ }
55872
+ function hunksOf(all, other) {
55873
+ let start = 0;
55874
+ while (start < all.length && start < other.length && all[start] === other[start]) start++;
55875
+ let end = 0;
55876
+ while (end < all.length - start && end < other.length - start && all[all.length - 1 - end] === other[other.length - 1 - end])
55877
+ end++;
55878
+ const a = all.slice(start, all.length - end);
55879
+ const b = other.slice(start, other.length - end);
55880
+ if ((a.length + 1) * (b.length + 1) > MOST) throw new TooLarge();
55881
+ return middleHunks(a, b).map((h) => ({ ...h, from: h.from + start, to: h.to + start }));
55882
+ }
55883
+ var TooLarge = class extends Error {
55884
+ };
55885
+ function middleHunks(a, b) {
55886
+ const width = b.length + 1;
55887
+ const tail = new Int32Array((a.length + 1) * width);
55888
+ for (let i3 = a.length - 1; i3 >= 0; i3--)
55889
+ for (let j2 = b.length - 1; j2 >= 0; j2--)
55890
+ tail[i3 * width + j2] = a[i3] === b[j2] ? tail[(i3 + 1) * width + j2 + 1] + 1 : Math.max(tail[(i3 + 1) * width + j2], tail[i3 * width + j2 + 1]);
55891
+ const hunks = [];
55892
+ let [i2, j] = [0, 0];
55893
+ let open2;
55894
+ const close2 = () => {
55895
+ if (open2) hunks.push(open2);
55896
+ open2 = void 0;
55897
+ };
55898
+ while (i2 < a.length || j < b.length) {
55899
+ if (i2 < a.length && j < b.length && a[i2] === b[j]) {
55900
+ close2();
55901
+ i2++;
55902
+ j++;
55903
+ } else if (j < b.length && (i2 === a.length || tail[i2 * width + j + 1] >= tail[(i2 + 1) * width + j])) {
55904
+ open2 ??= { from: i2, to: i2, lines: [] };
55905
+ open2.lines.push(b[j++]);
55906
+ } else {
55907
+ open2 ??= { from: i2, to: i2, lines: [] };
55908
+ open2.to = ++i2;
55909
+ }
55910
+ }
55911
+ close2();
55912
+ return hunks;
55913
+ }
55914
+
55801
55915
  export {
55802
55916
  formatProblems,
55803
55917
  TEXT_MAX,
@@ -55818,5 +55932,6 @@ export {
55818
55932
  KEPT_MEDIA_DAYS,
55819
55933
  buildDeck,
55820
55934
  masterOf,
55821
- mediaTypeOf
55935
+ mediaTypeOf,
55936
+ mergeText
55822
55937
  };
package/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  formatMediaJson,
6
6
  formatProblems,
7
7
  mediaTypeOf
8
- } from "./chunk-C64PAF2N.js";
8
+ } from "./chunk-TQNXR6KB.js";
9
9
  import {
10
10
  ASK_THE_PERSON,
11
11
  CliError,
@@ -13,13 +13,13 @@ import {
13
13
  createOutput,
14
14
  offerUpdate,
15
15
  update
16
- } from "./chunk-YCMXQODD.js";
16
+ } from "./chunk-BEVE4YBG.js";
17
17
  import {
18
18
  define_TOBOS_SKILL_default,
19
19
  init_define_TOBOS_PRESENT_TYPES,
20
20
  init_define_TOBOS_SKILL,
21
21
  init_define_TOBOS_TOOLCHAIN
22
- } from "./chunk-TCQ2QETE.js";
22
+ } from "./chunk-3SEPIUUD.js";
23
23
 
24
24
  // src/main.ts
25
25
  init_define_TOBOS_PRESENT_TYPES();
@@ -89,7 +89,7 @@ function settings() {
89
89
  }
90
90
 
91
91
  // src/api.ts
92
- var VERSION = true ? "0.4.27" : "dev";
92
+ var VERSION = true ? "0.4.29" : "dev";
93
93
  function newer(a, b) {
94
94
  const parse = (v) => /^\d+\.\d+\.\d+/.test(v) ? v.split(".").map((n) => parseInt(n)) : null;
95
95
  const x = parse(a);
@@ -112,7 +112,7 @@ async function api(path, options = {}) {
112
112
  }
113
113
  function failure(response, data, prefix = "") {
114
114
  const { error, message, ...extra } = data;
115
- const said = prefix + (error ?? message ?? `${response.status} ${response.statusText}`);
115
+ const said = prefix + (message ?? error ?? `${response.status} ${response.statusText}`);
116
116
  const limit = response.status === 402 || response.status === 423;
117
117
  return new CliError(
118
118
  limit ? `${said}
@@ -760,7 +760,7 @@ async function pushedFiles(root) {
760
760
  }
761
761
  }
762
762
  async function runCheck(dir2) {
763
- const { buildDeck } = await import("./src-637KP3RE.js");
763
+ const { buildDeck } = await import("./src-K2VVILG5.js");
764
764
  const started = performance.now();
765
765
  const files = await pushedFiles(dir2.root);
766
766
  const result = await buildDeck(directoryTree(dir2.root, files));
@@ -821,7 +821,7 @@ async function check(out, args) {
821
821
  await syncMediaJson(deck.root);
822
822
  const result = await runCheck(deck);
823
823
  if (args.values.types) {
824
- const { checkTypes } = await import("./types-AVF2FBWC.js");
824
+ const { checkTypes } = await import("./types-BX3YXER7.js");
825
825
  const sent = result.files && new Set(result.files);
826
826
  result.problems.push(
827
827
  ...(await checkTypes(deck.root, (m) => out.note(m))).filter((p) => sent?.has(p.file) ?? true)
@@ -848,7 +848,7 @@ async function pushWorkingCopy(out, deck, message) {
848
848
  const result = await runCheck(deck);
849
849
  const { errors, warnings } = problemSummary(result.problems);
850
850
  if (errors > 0) return { ok: false, errors, warnings, problems: result.problems };
851
- const { mediaInUse } = await import("./src-637KP3RE.js");
851
+ const { mediaInUse } = await import("./src-K2VVILG5.js");
852
852
  const shown = result.manifest ? mediaInUse(result.manifest) : media;
853
853
  for (const [name, entry] of Object.entries(shown)) {
854
854
  const note = sizeNote(name, entry.size);
@@ -1048,7 +1048,7 @@ async function exportDeck(out, args) {
1048
1048
  );
1049
1049
  }
1050
1050
  async function render(out, args) {
1051
- const { renderBeats } = await import("./render-PTXWZNVT.js");
1051
+ const { renderBeats } = await import("./render-C7UKAYCT.js");
1052
1052
  const deck = await findDeck().catch(() => void 0);
1053
1053
  const id = typeof args.values.deck === "string" ? parseId(args.values.deck) : deck?.id;
1054
1054
  if (!id) throw new CliError("Run this inside a cloned deck, or pass --deck <id>.");
@@ -1147,9 +1147,8 @@ Account
1147
1147
  its folders, then its decks
1148
1148
 
1149
1149
  Folders (your decks and templates in a tree; a deck by its id or title, a folder by its path)
1150
- tobos mv <deck or /folder>\u2026 </path> move them into that folder, made if there is none
1151
- (a folder emptied stays, until the person removes
1152
- it on the web)
1150
+ tobos mv <deck or /folder>\u2026 </path> move them into that folder, made if there is none;
1151
+ a folder a move empties goes
1153
1152
 
1154
1153
  Working on a deck
1155
1154
  tobos new "Title" [--dir dir] [--no-clone] create a deck and clone it here, into ./<id>
@@ -3,12 +3,12 @@ import { createRequire as __tobosRequire } from 'node:module';
3
3
  const require = __tobosRequire(import.meta.url);
4
4
  import {
5
5
  CliError
6
- } from "./chunk-YCMXQODD.js";
6
+ } from "./chunk-BEVE4YBG.js";
7
7
  import {
8
8
  init_define_TOBOS_PRESENT_TYPES,
9
9
  init_define_TOBOS_SKILL,
10
10
  init_define_TOBOS_TOOLCHAIN
11
- } from "./chunk-TCQ2QETE.js";
11
+ } from "./chunk-3SEPIUUD.js";
12
12
 
13
13
  // src/render.ts
14
14
  init_define_TOBOS_PRESENT_TYPES();
@@ -15,6 +15,7 @@ import {
15
15
  mediaInUse,
16
16
  mediaTypeOf,
17
17
  memoryTree,
18
+ mergeText,
18
19
  openActivity,
19
20
  parseDeckJson,
20
21
  parseMediaJson,
@@ -22,8 +23,8 @@ import {
22
23
  servesModule,
23
24
  sha256,
24
25
  sharedManifest
25
- } from "./chunk-C64PAF2N.js";
26
- import "./chunk-TCQ2QETE.js";
26
+ } from "./chunk-TQNXR6KB.js";
27
+ import "./chunk-3SEPIUUD.js";
27
28
  export {
28
29
  ID,
29
30
  KEPT_MEDIA_DAYS,
@@ -38,6 +39,7 @@ export {
38
39
  mediaInUse,
39
40
  mediaTypeOf,
40
41
  memoryTree,
42
+ mergeText,
41
43
  openActivity,
42
44
  parseDeckJson,
43
45
  parseMediaJson,
@@ -3,17 +3,17 @@ import { createRequire as __tobosRequire } from 'node:module';
3
3
  const require = __tobosRequire(import.meta.url);
4
4
  import {
5
5
  parseDeckJson
6
- } from "./chunk-C64PAF2N.js";
6
+ } from "./chunk-TQNXR6KB.js";
7
7
  import {
8
8
  CliError
9
- } from "./chunk-YCMXQODD.js";
9
+ } from "./chunk-BEVE4YBG.js";
10
10
  import {
11
11
  define_TOBOS_PRESENT_TYPES_default,
12
12
  define_TOBOS_TOOLCHAIN_default,
13
13
  init_define_TOBOS_PRESENT_TYPES,
14
14
  init_define_TOBOS_SKILL,
15
15
  init_define_TOBOS_TOOLCHAIN
16
- } from "./chunk-TCQ2QETE.js";
16
+ } from "./chunk-3SEPIUUD.js";
17
17
 
18
18
  // src/types.ts
19
19
  init_define_TOBOS_PRESENT_TYPES();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tobos/cli",
3
- "version": "0.4.27",
3
+ "version": "0.4.29",
4
4
  "description": "The command line of Tobos: https://tobos.ai",
5
5
  "type": "module",
6
6
  "license": "FSL-1.1-ALv2",