@tobos/cli 0.2.0 → 0.3.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.
Files changed (2) hide show
  1. package/dist/tobos.js +71 -71
  2. package/package.json +1 -1
package/dist/tobos.js CHANGED
@@ -96,7 +96,7 @@ export declare function media(name: string): string;
96
96
  var define_TOBOS_SKILL_default;
97
97
  var init_define_TOBOS_SKILL = __esm({
98
98
  "<define:TOBOS_SKILL>"() {
99
- 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 that you write as code: one Svelte 5 file per scene, with beats (one click each) and GSAP animations. You build; Tobos checks every push, hosts the deck, and puts it on stage with a presenter view. There is no AI on Tobos's side and no MCP server: everything goes through the `tobos` command and git.\n\n## Set up (once per machine)\n\n```sh\nnpm i -g @tobos/cli # the `tobos` command; needs Node 22.18+ and git\ntobos login you@example.com # e-mails the person a 6-digit code (and signs them up if new)\ntobos login --code 123456 # the code they paste to you from the mail\n```\n\nAsk the person for their e-mail address first, then for the code in one line: it's in their e-mail, maybe in spam, and using it accepts https://tobos.ai/terms. Only they can read it; never guess or reuse one. It works for 10 minutes. In CI, set `TOBOS_TOKEN` instead.\n\n## Start or continue a deck\n\n```sh\ntobos decks # the decks you can work on\ntobos new \"Title of the talk\" # create one and clone it into ./<slug>\ntobos clone account/deck # or clone an existing one\n```\n\nThen **read the deck's `AGENTS.md`**. It, `.tobos/FORMAT.md` and `master/GUIDE.md` are the instructions for everything that follows: the loop (`check` \u2192 `render` \u2192 look \u2192 `push`), the format, the slide master's layouts and rules.\n\n## Follow the person\n\nThey decide what to make and how much you do: some build a deck one scene at a time, some want all of it at once. Do what they ask, at the size they ask. Don't ask what a talk is about, who it's for or how long it runs, and don't propose an outline they didn't ask for.\n\n## Commands\n\n| Command | Does |\n| -------------------------------------------------------- | ------------------------------------------------------ |\n| `tobos check` | compile and check the deck, offline |\n| `tobos push -m \"\u2026\"` | upload media, commit, push; the server checks it again |\n| `tobos render scene/beat` \xB7 `scene` \xB7 `--all` \xB7 `--film` | PNGs of beats; pushes what changed first |\n| `tobos open [scene/beat] [--presenter]` | the deck in a browser; pushes what changed first |\n| `tobos open` (outside a deck) | Tobos in the browser, logged in: decks and templates |\n| `tobos export pdf` | a PDF of every beat |\n\nEvery command takes `--json`. Exit codes: 0 ok, 1 error, 2 the deck has problems, 3 not logged in.\n\nWhen a command says a newer `tobos` is out, run `npm i -g @tobos/cli`; the next command updates this skill. When a plan's limit stops a command (Free hosts 3 decks), the error links to the billing page: give the person the link, since only they can buy Pro.\n" };
99
+ 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 that you write as code: one Svelte 5 file per scene, with beats (one click each) and GSAP animations. You build; Tobos checks every push, hosts the deck, and puts it on stage with a presenter view. There is no AI on Tobos's side and no MCP server: everything goes through the `tobos` command and git.\n\n## Set up (once per machine)\n\n```sh\nnpm i -g @tobos/cli # the `tobos` command; needs Node 22.18+ and git\ntobos login you@example.com # e-mails the person a 6-digit code (and signs them up if new)\ntobos login --code 123456 # the code they paste to you from the mail\n```\n\nAsk the person for their e-mail address first, then for the code in one line: it's in their e-mail, maybe in spam, and using it accepts https://tobos.ai/terms. Only they can read it; never guess or reuse one. It works for 10 minutes. In CI, set `TOBOS_TOKEN` instead.\n\n## Start or continue a deck\n\n```sh\ntobos decks # the decks you can work on, by id\ntobos new \"Title of the talk\" # create one and clone it into ./<id>\ntobos clone <id> # or clone an existing one\n```\n\nThen **read the deck's `AGENTS.md`**. It, `.tobos/FORMAT.md` and `master/GUIDE.md` are the instructions for everything that follows: the loop (`check` \u2192 `render` \u2192 look \u2192 `push`), the format, the slide master's layouts and rules.\n\n## Follow the person\n\nThey decide what to make and how much you do: some build a deck one scene at a time, some want all of it at once. Do what they ask, at the size they ask. Don't ask what a talk is about, who it's for or how long it runs, and don't propose an outline they didn't ask for.\n\n## Commands\n\n| Command | Does |\n| -------------------------------------------------------- | ------------------------------------------------------ |\n| `tobos check` | compile and check the deck, offline |\n| `tobos push -m \"\u2026\"` | upload media, commit, push; the server checks it again |\n| `tobos render scene/beat` \xB7 `scene` \xB7 `--all` \xB7 `--film` | PNGs of beats; pushes what changed first |\n| `tobos open [scene/beat] [--presenter]` | the deck in a browser; pushes what changed first |\n| `tobos open` (outside a deck) | Tobos in the browser, logged in: decks and templates |\n| `tobos export pdf` | a PDF of every beat |\n\nEvery command takes `--json`. Exit codes: 0 ok, 1 error, 2 the deck has problems, 3 not logged in.\n\nWhen a command says a newer `tobos` is out, run `npm i -g @tobos/cli`; the next command updates this skill. When a plan's limit stops a command (Free hosts 3 decks), the error links to the billing page: give the person the link, since only they can buy Pro.\n" };
100
100
  }
101
101
  });
102
102
 
@@ -56517,7 +56517,7 @@ function settings() {
56517
56517
 
56518
56518
  // src/api.ts
56519
56519
  init_out();
56520
- var VERSION = true ? "0.2.0" : "dev";
56520
+ var VERSION = true ? "0.3.0" : "dev";
56521
56521
  function newer(a, b) {
56522
56522
  const parse9 = (v) => /^\d+\.\d+\.\d+/.test(v) ? v.split(".").map((n2) => parseInt(n2)) : null;
56523
56523
  const x = parse9(a);
@@ -56640,9 +56640,9 @@ import { dirname, join as join3, resolve as resolve2 } from "node:path";
56640
56640
  // src/git.ts
56641
56641
  init_define_TOBOS_PRESENT_TYPES();
56642
56642
  init_define_TOBOS_SKILL();
56643
- init_out();
56644
56643
  import { spawn } from "node:child_process";
56645
56644
  import { realpathSync } from "node:fs";
56645
+ init_out();
56646
56646
  function git(args, options = {}) {
56647
56647
  return new Promise((resolve4, reject) => {
56648
56648
  const child = spawn("git", args, {
@@ -56684,6 +56684,16 @@ function credentialConfig(server) {
56684
56684
  `credential.${server}.helper=${credentialHelper()}`
56685
56685
  ];
56686
56686
  }
56687
+ function authEnv(server) {
56688
+ const { server: ours, token: token2 } = settings();
56689
+ if (!token2 || new URL(ours).origin !== new URL(server).origin) return {};
56690
+ const n2 = Number(process.env.GIT_CONFIG_COUNT) || 0;
56691
+ return {
56692
+ GIT_CONFIG_COUNT: String(n2 + 1),
56693
+ [`GIT_CONFIG_KEY_${n2}`]: `http.${server}.extraHeader`,
56694
+ [`GIT_CONFIG_VALUE_${n2}`]: `Authorization: Basic ${Buffer.from(`tobos:${token2}`).toString("base64")}`
56695
+ };
56696
+ }
56687
56697
  async function configureCredentials(dir2, server) {
56688
56698
  await gitOk(["config", "--replace-all", `credential.${server}.helper`, ""], { cwd: dir2 });
56689
56699
  await gitOk(["config", "--add", `credential.${server}.helper`, credentialHelper()], { cwd: dir2 });
@@ -56691,7 +56701,8 @@ async function configureCredentials(dir2, server) {
56691
56701
 
56692
56702
  // src/deck-dir.ts
56693
56703
  init_out();
56694
- var REMOTE2 = /^(https?:\/\/[^/]+)\/git\/([a-z][a-z0-9-]*)\/([a-z][a-z0-9-]*)\.git$/;
56704
+ var ID2 = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
56705
+ var REMOTE2 = new RegExp(`^(https?://[^/]+)/git/(${ID2})\\.git$`);
56695
56706
  async function findDeck(start = process.cwd()) {
56696
56707
  let dir2 = resolve2(start);
56697
56708
  while (!existsSync(join3(dir2, "deck.json"))) {
@@ -56702,20 +56713,20 @@ async function findDeck(start = process.cwd()) {
56702
56713
  }
56703
56714
  const remote = await git(["remote", "get-url", "origin"], { cwd: dir2 }).catch(() => void 0);
56704
56715
  const match = remote && remote.code === 0 ? REMOTE2.exec(remote.stdout.trim()) : null;
56705
- return match ? { root: dir2, server: match[1], name: `${match[2]}/${match[3]}` } : { root: dir2 };
56716
+ return match ? { root: dir2, server: match[1], id: match[2] } : { root: dir2 };
56706
56717
  }
56707
56718
  async function requireRemote(start) {
56708
56719
  const deck = await findDeck(start);
56709
- if (!deck.name || !deck.server)
56720
+ if (!deck.id || !deck.server)
56710
56721
  throw new CliError(
56711
56722
  `${deck.root} isn't linked to a deck on a Tobos server (no matching git remote "origin").`
56712
56723
  );
56713
56724
  return deck;
56714
56725
  }
56715
- function parseName(name) {
56716
- const match = /^([a-z][a-z0-9-]*)\/([a-z][a-z0-9-]*)$/.exec(name);
56717
- if (!match) throw new CliError(`"${name}" is not a deck name; use account/deck.`);
56718
- return { account: match[1], deck: match[2] };
56726
+ function parseId(id2) {
56727
+ if (!new RegExp(`^${ID2}$`).test(id2))
56728
+ throw new CliError(`"${id2}" is not a deck's id; \`tobos decks\` lists them.`);
56729
+ return id2;
56719
56730
  }
56720
56731
 
56721
56732
  // src/media.ts
@@ -56800,7 +56811,7 @@ async function syncMediaJson(root) {
56800
56811
  if (after !== before2) writeFileSync2(file2, after);
56801
56812
  return { media: sorted, changed: after !== before2 };
56802
56813
  }
56803
- async function uploadMedia(root, media, server, account, note) {
56814
+ async function uploadMedia(root, media, server, deck, note) {
56804
56815
  const hashes = [...new Set(Object.values(media).map((m) => m.hash))];
56805
56816
  if (hashes.length === 0) return [];
56806
56817
  const { missing } = await api("/api/media/missing", {
@@ -56816,7 +56827,7 @@ async function uploadMedia(root, media, server, account, note) {
56816
56827
  `media/${name} is in media.json but not on this machine, and the server doesn't have it.`
56817
56828
  );
56818
56829
  note(`uploading media/${name} (${Math.round(entry.size / 1e3)} kB)`);
56819
- const response = await request(`/api/media/${hash2}?account=${account}`, {
56830
+ const response = await request(`/api/media/${hash2}?deck=${deck}`, {
56820
56831
  method: "PUT",
56821
56832
  body: Readable.toWeb(createReadStream(path)),
56822
56833
  contentType: entry.type,
@@ -56997,10 +57008,7 @@ async function login(out, args) {
56997
57008
  save({ server, token: token2, pending: void 0 });
56998
57009
  const me = await api("/api/me", { server });
56999
57010
  save({ email: me.email });
57000
- out.result(
57001
- { email: me.email, server, accounts: me.accounts.map((a) => a.slug) },
57002
- () => `Logged in as ${me.email}.`
57003
- );
57011
+ out.result({ email: me.email, server }, () => `Logged in as ${me.email}.`);
57004
57012
  }
57005
57013
  async function logout(out) {
57006
57014
  let revoked = false;
@@ -57019,37 +57027,35 @@ async function logout(out) {
57019
57027
  }
57020
57028
  async function whoami(out) {
57021
57029
  const me = await api("/api/me");
57022
- out.result(
57023
- { ...me, server: settings().server },
57024
- () => `${me.email} on ${settings().server}
57025
- accounts: ${me.accounts.map((a) => `${a.slug} (${a.role})`).join(", ")}`
57026
- );
57030
+ out.result({ ...me, server: settings().server }, () => `${me.email} on ${settings().server}`);
57027
57031
  }
57028
57032
  async function decks(out) {
57029
57033
  const { decks: decks2 } = await api("/api/decks");
57030
57034
  out.result(
57031
57035
  { decks: decks2 },
57032
- () => decks2.length === 0 ? 'No decks yet. `tobos new "Title"` starts one.' : decks2.map((d) => `${d.name.padEnd(32)} ${d.title}`).join("\n")
57036
+ () => decks2.length === 0 ? 'No decks yet. `tobos new "Title"` starts one.' : decks2.map((d) => `${d.id} ${d.title}`).join("\n")
57033
57037
  );
57034
57038
  }
57035
57039
  async function cloneInto(out, info, dir2) {
57036
57040
  const { server } = settings();
57037
57041
  if (existsSync5(dir2)) throw new CliError(`${dir2} already exists.`);
57038
- out.note(`cloning ${info.name} into ${dir2}`);
57039
- await gitOk([...credentialConfig(server), "clone", "--quiet", info.git, dir2]);
57042
+ out.note(`cloning ${info.title} into ${dir2}`);
57043
+ await gitOk([...credentialConfig(server), "clone", "--quiet", info.git, dir2], {
57044
+ env: authEnv(server)
57045
+ });
57040
57046
  await configureCredentials(dir2, server);
57041
57047
  return writeFormatGuide(dir2, server);
57042
57048
  }
57043
57049
  async function clone(out, args) {
57044
- const name = args.positionals[0];
57045
- if (!name) throw new CliError("Which deck? `tobos clone account/deck` (see `tobos decks`).");
57046
- const { account, deck } = parseName(name);
57047
- const info = await api(`/api/decks/${account}/${deck}`);
57048
- const dir2 = resolve3(args.positionals[1] ?? deck);
57050
+ const given = args.positionals[0];
57051
+ if (!given) throw new CliError("Which deck? `tobos clone <id>` (`tobos decks` lists them).");
57052
+ const id2 = parseId(given);
57053
+ const info = await api(`/api/decks/${id2}`);
57054
+ const dir2 = resolve3(args.positionals[1] ?? id2);
57049
57055
  await cloneInto(out, info, dir2);
57050
57056
  out.result(
57051
57057
  { ...info, dir: dir2 },
57052
- () => `Cloned ${info.name} into ${relative3(process.cwd(), dir2) || "."}.
57058
+ () => `Cloned ${info.title} into ${relative3(process.cwd(), dir2) || "."}.
57053
57059
  Read AGENTS.md there first. Preview: ${info.url}`
57054
57060
  );
57055
57061
  }
@@ -57059,20 +57065,19 @@ async function create(out, args) {
57059
57065
  const info = await api("/api/decks", {
57060
57066
  body: {
57061
57067
  title,
57062
- slug: args.values.slug,
57063
57068
  from: args.values.from,
57064
57069
  template: Boolean(args.values.template)
57065
57070
  }
57066
57071
  });
57067
57072
  let dir2;
57068
57073
  if (!args.values["no-clone"]) {
57069
- dir2 = resolve3(args.values.dir ?? info.slug);
57074
+ dir2 = resolve3(args.values.dir ?? info.id);
57070
57075
  await cloneInto(out, info, dir2);
57071
57076
  }
57072
57077
  out.result(
57073
57078
  { ...info, dir: dir2 ?? null },
57074
57079
  () => [
57075
- `Created ${info.name}: ${info.url}`,
57080
+ `Created ${info.title}: ${info.url}`,
57076
57081
  dir2 ? `Cloned into ${relative3(process.cwd(), dir2) || "."}. Read AGENTS.md there first.` : ""
57077
57082
  ].filter(Boolean).join("\n")
57078
57083
  );
@@ -57081,9 +57086,7 @@ async function pull(out) {
57081
57086
  const deck = await requireRemote();
57082
57087
  const result = await git(
57083
57088
  [...credentialConfig(deck.server), "pull", "--ff-only", "--quiet", "origin", "main"],
57084
- {
57085
- cwd: deck.root
57086
- }
57089
+ { cwd: deck.root, env: authEnv(deck.server) }
57087
57090
  );
57088
57091
  if (result.code !== 0)
57089
57092
  throw new CliError(
@@ -57093,7 +57096,7 @@ Commit or stash your changes, then merge with \`git pull\`.`
57093
57096
  );
57094
57097
  await writeFormatGuide(deck.root, deck.server);
57095
57098
  const rev = (await gitOk(["rev-parse", "HEAD"], { cwd: deck.root })).trim();
57096
- out.result({ name: deck.name, rev }, () => `Up to date with ${deck.name} (${rev.slice(0, 7)}).`);
57099
+ out.result({ id: deck.id, rev }, () => `Up to date with the server (${rev.slice(0, 7)}).`);
57097
57100
  }
57098
57101
  async function runCheck(dir2) {
57099
57102
  const started = performance.now();
@@ -57141,8 +57144,7 @@ async function pushWorkingCopy(out, deck, message) {
57141
57144
  `note: media/${name} is ${Math.round(entry.size / 1e6)} MB. Every viewer downloads it; size it for the stage.`,
57142
57145
  true
57143
57146
  );
57144
- const account = deck.name.split("/")[0];
57145
- const uploaded = await uploadMedia(root, media, server, account, (m) => out.note(m));
57147
+ const uploaded = await uploadMedia(root, media, server, deck.id, (m) => out.note(m));
57146
57148
  await gitOk(["add", "-A"], { cwd: root });
57147
57149
  const committed = (await gitOk(["diff", "--cached", "--name-only"], { cwd: root })).split("\n").filter(Boolean);
57148
57150
  for (const file2 of committed) out.note(` ${file2}`);
@@ -57154,7 +57156,7 @@ async function pushWorkingCopy(out, deck, message) {
57154
57156
  out.note("pushing\u2026");
57155
57157
  const pushed = await git(
57156
57158
  [...credentialConfig(server), "push", "--porcelain", "origin", "HEAD:main"],
57157
- { cwd: root, echo: !out.json }
57159
+ { cwd: root, echo: !out.json, env: authEnv(server) }
57158
57160
  );
57159
57161
  const remote = remoteLines(pushed.stderr);
57160
57162
  if (pushed.code !== 0) {
@@ -57183,15 +57185,15 @@ async function push(out, args) {
57183
57185
  process.exitCode = EXIT.problems;
57184
57186
  return;
57185
57187
  }
57186
- const url = `${deck.server}/${deck.name}`;
57188
+ const url = `${deck.server}/${deck.id}`;
57187
57189
  out.result(
57188
57190
  { ...result, pushed: true, url },
57189
57191
  () => `\u2713 Pushed ${result.rev.slice(0, 7)}${result.uploaded.length ? ` with ${plural(result.uploaded.length, "media file")}` : ""}. Live at ${url}`
57190
57192
  );
57191
57193
  }
57192
- async function pushIfChanged(out, name, message) {
57194
+ async function pushIfChanged(out, id2, message) {
57193
57195
  const found2 = await findDeck().catch(() => void 0);
57194
- if (!found2?.server || found2.name !== name) return { pushed: false, uploaded: [] };
57196
+ if (!found2?.server || found2.id !== id2) return { pushed: false, uploaded: [] };
57195
57197
  const deck = found2;
57196
57198
  const dirty = (await gitOk(["status", "--porcelain"], { cwd: deck.root })).trim() !== "";
57197
57199
  const head = await git(["rev-parse", "--verify", "--quiet", "HEAD"], { cwd: deck.root });
@@ -57218,22 +57220,21 @@ async function identity(root) {
57218
57220
  GIT_COMMITTER_EMAIL: who ?? "tobos@localhost"
57219
57221
  };
57220
57222
  }
57221
- async function viewUrl(name, view, hours) {
57222
- const { account, deck } = parseName(name);
57223
- return api(`/api/decks/${account}/${deck}/view`, { body: { view, hours } });
57223
+ async function viewUrl(id2, view, hours) {
57224
+ return api(`/api/decks/${id2}/view`, { body: { view, hours } });
57224
57225
  }
57225
- async function deckName(args) {
57226
- if (typeof args.values.deck === "string") return args.values.deck;
57227
- return (await requireRemote()).name;
57226
+ async function deckId(args) {
57227
+ if (typeof args.values.deck === "string") return parseId(args.values.deck);
57228
+ return (await requireRemote()).id;
57228
57229
  }
57229
57230
  async function open2(out, args) {
57230
57231
  const position3 = args.positionals[0];
57231
57232
  if (!position3 && typeof args.values.deck !== "string" && !await findDeck().catch(() => null))
57232
57233
  return openApp(out, args);
57233
57234
  const view = args.values.presenter ? "presenter" : void 0;
57234
- const name = await deckName(args);
57235
- const { pushed } = await pushIfChanged(out, name);
57236
- const { url } = await viewUrl(name, view, 12);
57235
+ const id2 = await deckId(args);
57236
+ const { pushed } = await pushIfChanged(out, id2);
57237
+ const { url } = await viewUrl(id2, view, 12);
57237
57238
  const full = position3 ? `${url}#${position3}` : url;
57238
57239
  const opened = !args.values.print && await openUrl(full);
57239
57240
  out.result({ url: full, opened, pushed }, () => full);
@@ -57256,12 +57257,11 @@ async function exportTarget(args, file2) {
57256
57257
  }
57257
57258
  async function exportDeck(out, args) {
57258
57259
  const kind = args.positionals[0];
57259
- const name = await deckName(args);
57260
- const { account, deck } = parseName(name);
57260
+ const id2 = await deckId(args);
57261
57261
  if (kind === "pdf") {
57262
57262
  const { exportPdf: exportPdf2 } = await Promise.resolve().then(() => (init_render(), render_exports));
57263
- const { url, rev } = await viewUrl(name, "print");
57264
- const target = await exportTarget(args, `${account}-${deck}.pdf`);
57263
+ const { url, rev } = await viewUrl(id2, "print");
57264
+ const target = await exportTarget(args, `${id2}.pdf`);
57265
57265
  const pages = await exportPdf2(
57266
57266
  url + (args.values.handout ? "&beats=last" : ""),
57267
57267
  target,
@@ -57277,11 +57277,11 @@ async function exportDeck(out, args) {
57277
57277
  }
57278
57278
  async function render(out, args) {
57279
57279
  const { renderBeats: renderBeats2 } = await Promise.resolve().then(() => (init_render(), render_exports));
57280
- const deck = await findDeck();
57281
- const name = args.values.deck ?? deck.name;
57282
- if (!name) throw new CliError("Run this inside a cloned deck, or pass --deck account/deck.");
57283
- const { pushed, uploaded } = await pushIfChanged(out, name, args.values.message);
57284
- const view = await viewUrl(name, "render");
57280
+ const deck = await findDeck().catch(() => void 0);
57281
+ const id2 = typeof args.values.deck === "string" ? parseId(args.values.deck) : deck?.id;
57282
+ if (!id2) throw new CliError("Run this inside a cloned deck, or pass --deck <id>.");
57283
+ const { pushed, uploaded } = await pushIfChanged(out, id2, args.values.message);
57284
+ const view = await viewUrl(id2, "render");
57285
57285
  const { url } = view;
57286
57286
  const rev = view.rev ?? void 0;
57287
57287
  const targets2 = [];
@@ -57294,13 +57294,14 @@ async function render(out, args) {
57294
57294
  const scene = scenes.find((s) => s.id === sceneId);
57295
57295
  if (!scene) throw new CliError(`No scene "${sceneId}" in deck.json.`);
57296
57296
  if (beat) {
57297
- const id2 = /^\d+$/.test(beat) ? scene.beats[Number(beat)] : beat;
57298
- if (!id2 || !scene.beats.includes(id2))
57297
+ const id3 = /^\d+$/.test(beat) ? scene.beats[Number(beat)] : beat;
57298
+ if (!id3 || !scene.beats.includes(id3))
57299
57299
  throw new CliError(`No beat "${beat}" in scene "${sceneId}".`);
57300
- targets2.push(`${scene.id}/${id2}`);
57300
+ targets2.push(`${scene.id}/${id3}`);
57301
57301
  } else targets2.push(...scene.beats.map((b) => `${scene.id}/${b}`));
57302
57302
  }
57303
- const dir2 = resolve3(args.values.out ?? join9(deck.root, ".tobos", "render"));
57303
+ const root = deck?.id === id2 ? deck.root : ".";
57304
+ const dir2 = resolve3(args.values.out ?? join9(root, ".tobos", "render"));
57304
57305
  const { files, errors } = await renderBeats2(url, targets2, {
57305
57306
  dir: dir2,
57306
57307
  film: Boolean(args.values.film),
@@ -57359,11 +57360,11 @@ Account
57359
57360
  tobos login --code <code> finish: the code they read from the mail
57360
57361
  tobos logout forget this machine's token
57361
57362
  tobos whoami who you are, on which server
57362
- tobos decks your decks
57363
+ tobos decks your decks and templates, by id
57363
57364
 
57364
57365
  Working on a deck
57365
- tobos new "Title" [--slug S] create a deck and clone it here
57366
- tobos clone account/deck [dir] clone a deck, with the agent pack
57366
+ tobos new "Title" create a deck and clone it here, into ./<id>
57367
+ tobos clone <id> [dir] clone a deck, with the agent pack
57367
57368
  tobos pull get the latest pushes and the format guide
57368
57369
  tobos check [--types] compile and check the deck, offline (~1 s);
57369
57370
  --types: TypeScript too (installs a checker once)
@@ -57381,8 +57382,8 @@ The skill (what your harness reads to know Tobos without this help)
57381
57382
  read skills; later CLIs keep it up to date
57382
57383
 
57383
57384
  Templates (decks people start from: a new deck copies a template's master/)
57384
- tobos new "Title" --from account/template start a deck from that template (default: your own,
57385
- account/my-template)
57385
+ tobos new "Title" --from <id> start a deck from that template (default: your own,
57386
+ "My template")
57386
57387
  tobos new "Our brand" --template a new template: a copy of your default (or of --from)
57387
57388
 
57388
57389
  Every command takes --json and then prints one JSON object.
@@ -57403,7 +57404,6 @@ var TABLE = {
57403
57404
  new: {
57404
57405
  run: create,
57405
57406
  options: {
57406
- slug: { type: "string" },
57407
57407
  dir: { type: "string" },
57408
57408
  "no-clone": { type: "boolean" },
57409
57409
  from: { type: "string" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tobos/cli",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "The command line of Tobos: https://tobos.ai",
5
5
  "type": "module",
6
6
  "license": "FSL-1.1-ALv2",