@tobos/cli 0.4.31 → 0.4.32

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/cli.js +206 -35
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -27,6 +27,166 @@ init_define_TOBOS_SKILL();
27
27
  init_define_TOBOS_TOOLCHAIN();
28
28
  import { parseArgs } from "node:util";
29
29
 
30
+ // ../deck/src/verbs.ts
31
+ init_define_TOBOS_PRESENT_TYPES();
32
+ init_define_TOBOS_SKILL();
33
+ init_define_TOBOS_TOOLCHAIN();
34
+ var FOLDER_PATH = "A folder\u2019s path from the root, such as `/Courses/AI 101`; `/` is the root.";
35
+ var REV = { type: "string", description: "A version of the deck; its latest if left out." };
36
+ var CHANGESET_SCHEMA = {
37
+ type: "object",
38
+ properties: {
39
+ base: {
40
+ type: ["string", "null"],
41
+ description: "The version the files were read at: the `rev` that a read, `new` or the last write gave. If the deck changed since, Tobos merges: only lines both changed differently are a conflict."
42
+ },
43
+ message: {
44
+ type: "string",
45
+ description: "What the change does, as a commit message says: needed unless `dry`."
46
+ },
47
+ dry: {
48
+ type: "boolean",
49
+ description: "Check it, and land no version: what the check says of the deck as it would be. A file from the web for media/ is still fetched and stored, so the check sees it. Its answer is no version to write on."
50
+ },
51
+ files: {
52
+ type: "object",
53
+ description: 'Each path to change: its new text in full; `{"patch": [{"find", "replace"}]}` to change part of it, each `find` once in the file as it is now; for a file in media/, `{"url"}`, the address of a file on the web, which Tobos fetches, or `{"base64"}` or `{"hash"}` of an upload; or null to delete it. Only Tobos writes media.json, from what goes into media/.',
54
+ additionalProperties: {
55
+ anyOf: [
56
+ { type: "string" },
57
+ {
58
+ type: "object",
59
+ properties: {
60
+ patch: {
61
+ type: "array",
62
+ items: {
63
+ type: "object",
64
+ properties: { find: { type: "string" }, replace: { type: "string" } },
65
+ required: ["find", "replace"],
66
+ additionalProperties: false
67
+ }
68
+ }
69
+ },
70
+ required: ["patch"],
71
+ additionalProperties: false
72
+ },
73
+ ...["url", "base64", "hash"].map((key) => ({
74
+ type: "object",
75
+ properties: { [key]: { type: "string" } },
76
+ required: [key],
77
+ additionalProperties: false
78
+ })),
79
+ { type: "null" }
80
+ ]
81
+ }
82
+ }
83
+ },
84
+ required: ["base", "files"]
85
+ };
86
+ var VERBS = {
87
+ list: {
88
+ does: "The decks and templates the person works on, by id: their own, and those shared with them that they may present or change. Each with its title, your level on it and whose it is, whether it is archived (read-only), when it last changed, its address in Tobos, and, for the person\u2019s own, its folder. With a path, what that folder holds: its folders, then its decks.",
89
+ input: { properties: { path: { type: "string", description: FOLDER_PATH } }, required: [] },
90
+ cli: [
91
+ {
92
+ usage: "tobos ls [/path]",
93
+ does: "your decks and templates, by id, with your level on each, whose it is and its folder; with a path, what that folder holds"
94
+ }
95
+ ]
96
+ },
97
+ read: {
98
+ does: "A deck\u2019s files at a version, its latest unless another is named, with that version, `rev`, to write on.",
99
+ input: {
100
+ properties: {
101
+ paths: {
102
+ type: "array",
103
+ items: { type: "string" },
104
+ description: "The files to read, such as `deck.json` and `scenes/intro.svelte`, or `master/`."
105
+ },
106
+ rev: REV,
107
+ since: {
108
+ type: "string",
109
+ description: "Reading media/: a version you read, for only the files added since then."
110
+ }
111
+ },
112
+ required: []
113
+ },
114
+ cli: [
115
+ { usage: "tobos pull <id> [dir]", does: "a working copy of a deck, into ./<id> or dir" },
116
+ {
117
+ usage: "tobos pull",
118
+ does: "the latest version into the copy, merged with your changes; a conflict is left between <<<<<<< and >>>>>>> to resolve"
119
+ }
120
+ ],
121
+ chat: 'Without `paths`, lists its files with their sizes; with them, gives each file\u2019s text, many in one call (a path ending in `/` reads every file under it). Reading media/ (`paths: ["media/"]`) shows its pictures, video and sound instead: each file\u2019s name, type and size, when it was added and by whom, and contact sheets to see what they show, with the address of the deck\u2019s page where the person drops files. With `since`, only the files added since that version. Paths of files in media/ show just those, one alone as large as the sheet. A picture the person gave you in the chat reaches you, not Tobos: give them the address of the deck\u2019s page that reading media/ gives, where they drop it.'
122
+ },
123
+ write: {
124
+ does: "Changes a deck\u2019s files as one version, live at once, made on the version they were read at: Tobos merges what changed since, checks the deck as it would be, and saves nothing, saying why, if the check refuses it or someone changed the same lines. Dry, it only checks.",
125
+ input: {
126
+ properties: { ...CHANGESET_SCHEMA.properties },
127
+ required: CHANGESET_SCHEMA.required
128
+ },
129
+ cli: [
130
+ {
131
+ usage: 'tobos push [-m "what changed"]',
132
+ does: "the copy\u2019s changes as one version, media uploaded"
133
+ },
134
+ {
135
+ usage: "tobos check [--types]",
136
+ does: "the same, dry: the server\u2019s check, nothing saved; --types adds TypeScript\u2019s view, here"
137
+ }
138
+ ],
139
+ chat: "Each file\u2019s text in full, a patch of part of it, a file on the web for media/, or null to delete it. All or nothing, so put everything a step needs into one call."
140
+ },
141
+ new: {
142
+ does: "Makes a deck in the person\u2019s account from a template, Tobos simple unless another is named, such as the person\u2019s own house style (ask which when they have several), with its first version, `rev`; or, as a template, a new template: a copy of all of the one it starts from.",
143
+ input: {
144
+ properties: {
145
+ title: { type: "string", description: "The title of the talk." },
146
+ from: { type: "string", description: "The id of the template to start from." },
147
+ template: { type: "boolean", description: "Make a template rather than a deck." }
148
+ },
149
+ required: ["title"]
150
+ },
151
+ chat: "Gives the deck\u2019s id, its first version, `rev`, its files, and its address in Tobos; `list` gives templates\u2019 ids.",
152
+ cli: [
153
+ {
154
+ usage: 'tobos new "Title" [--from <id>] [--template] [--dir dir]',
155
+ does: "a deck from a template (Tobos simple unless --from), or a template; pulled into ./<id> or dir (--no-pull: only made)"
156
+ }
157
+ ]
158
+ },
159
+ move: {
160
+ does: "Moves the person\u2019s decks and templates, a deck by its id or title, and folders, by path, with all that is in them, into a folder, made with the folders on its path if there are none. A folder a move empties goes. Refused, with nothing moved, if one isn\u2019t there, if a title is two decks\u2019 (name that one by its id), if the folder has one of a moved folder\u2019s name, or if a folder would go into itself.",
161
+ input: {
162
+ properties: {
163
+ decks: {
164
+ type: "array",
165
+ items: { type: "string" },
166
+ description: "Decks and templates to move, each by its id or title."
167
+ },
168
+ folders: {
169
+ type: "array",
170
+ items: { type: "string" },
171
+ description: "Folders to move, each by its path, with all that is in them."
172
+ },
173
+ to: { type: "string", description: `Where they go. ${FOLDER_PATH}` }
174
+ },
175
+ required: ["to"]
176
+ },
177
+ cli: [
178
+ {
179
+ usage: "tobos mv <deck or /folder>\u2026 </path>",
180
+ does: "move decks and folders into that folder, made if there is none; a folder a move empties goes"
181
+ }
182
+ ]
183
+ }
184
+ };
185
+ function verbsAppendix(door) {
186
+ const verbs = Object.entries(VERBS);
187
+ return door === "chat" ? verbs.map(([name, verb]) => `- \`${name}\`: ${verb.does}`).join("\n") : verbs.flatMap(([, verb]) => verb.cli.map((c) => `- \`${c.usage}\`: ${c.does}`)).join("\n");
188
+ }
189
+
30
190
  // src/api.ts
31
191
  init_define_TOBOS_PRESENT_TYPES();
32
192
  init_define_TOBOS_SKILL();
@@ -94,7 +254,7 @@ function settings() {
94
254
  }
95
255
 
96
256
  // src/api.ts
97
- var VERSION = true ? "0.4.31" : "dev";
257
+ var VERSION = true ? "0.4.32" : "dev";
98
258
  function newer(a, b) {
99
259
  const parse = (v) => /^\d+\.\d+\.\d+/.test(v) ? v.split(".").map((n) => parseInt(n)) : null;
100
260
  const x = parse(a);
@@ -535,13 +695,34 @@ init_define_TOBOS_SKILL();
535
695
  init_define_TOBOS_TOOLCHAIN();
536
696
  import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "node:fs";
537
697
  import { join as join3 } from "node:path";
698
+ var WORKING = `# Working on a deck
699
+
700
+ You work in a copy of the deck, from \`tobos pull <id>\` or \`tobos new\`, with no git: the server keeps
701
+ the versions. Every push is live: every open preview follows within a second, so the person
702
+ watches the deck take shape.
703
+
704
+ 1. Change \`deck.json\`, the scenes and whatever else the step needs.
705
+ 2. \`tobos check\`: fix every error it reports.
706
+ 3. \`tobos render <scene>/<beat>\` pushes what changed and writes a PNG of that beat; \`--film\`
707
+ writes frames through its animation. Look at each one.
708
+ 4. \`tobos push -m "what changed"\`. \`render\` and \`open\` push the same way when the copy has
709
+ changed, and \`-m\` names that push too.
710
+
711
+ A step is done when every beat it changed has been rendered and looked at.
712
+
713
+ \`.tobos/\` holds this file and the version the copy is of: leave it be. A push leaves out what
714
+ is in \`.tobos/\`, \`.git/\`, \`sources/\` and \`node_modules/\` at the copy's top.
715
+
716
+ ${verbsAppendix("cli")}
717
+
718
+ `;
538
719
  async function writeFormatGuide(root, server) {
539
720
  const dir2 = join3(root, ".tobos");
540
721
  mkdirSync3(dir2, { recursive: true });
541
722
  const format = await request("/api/format", { anonymous: true, server });
542
723
  if (!format.ok)
543
724
  throw new CliError(`Couldn't fetch the format guide from ${server} (${format.status}).`);
544
- writeFileSync3(join3(dir2, "FORMAT.md"), await format.text());
725
+ writeFileSync3(join3(dir2, "FORMAT.md"), WORKING + await format.text());
545
726
  }
546
727
 
547
728
  // src/skill.ts
@@ -1085,34 +1266,29 @@ async function skill(out, args) {
1085
1266
  }
1086
1267
 
1087
1268
  // src/main.ts
1269
+ function row(usage, does) {
1270
+ const lines = [];
1271
+ for (const word of does.split(" ")) {
1272
+ const last = lines.at(-1);
1273
+ if (last !== void 0 && last.length + word.length < 50) lines[lines.length - 1] += ` ${word}`;
1274
+ else lines.push(word);
1275
+ }
1276
+ const first = ` ${usage}`;
1277
+ const pad = " ".repeat(46);
1278
+ return [first.length < 45 ? first.padEnd(46) + lines[0] : `${first}
1279
+ ${pad}${lines[0]}`].concat(lines.slice(1).map((line) => pad + line)).join("\n");
1280
+ }
1281
+ var VERB_ROWS = Object.values(VERBS).flatMap((verb) => verb.cli.map((c) => row(c.usage, c.does))).join("\n");
1088
1282
  var HELP = `tobos ${VERSION}: the command line of Tobos, the office suite your coding agent works in.
1089
1283
 
1090
1284
  Account
1091
- tobos login [--server URL] connect this machine: prints an address for the
1092
- person to open and approve (logging in, or signing
1093
- up, there); run it again once they did
1094
- tobos logout forget this machine's token
1095
- tobos whoami who you are, on which server
1096
- tobos ls [/path] your decks and templates, by id, each in its folder,
1097
- and those shared with you; an archived one is
1098
- read-only. With a path: what that folder holds,
1099
- its folders, then its decks
1285
+ ${row("tobos login [--server URL]", "connect this machine: prints an address for the person to open and approve (logging in, or signing up, there); run it again once they did")}
1286
+ ${row("tobos logout", "forget this machine's token")}
1287
+ ${row("tobos whoami", "who you are, on which server")}
1100
1288
 
1101
- Folders (your decks and templates in a tree; a deck by its id or title, a folder by its path)
1102
- tobos mv <deck or /folder>\u2026 </path> move them into that folder, made if there is none;
1103
- a folder a move empties goes
1104
-
1105
- Working on a deck (a working copy: no git; the server keeps the versions)
1106
- tobos new "Title" [--dir dir] [--no-pull] create a deck and pull it here, into ./<id>
1107
- (or into dir; --no-pull: only create it)
1108
- tobos pull <id> [dir] a working copy of a deck, with the agent pack
1109
- tobos pull the latest version into the copy, merged with your
1110
- changes; a conflict is left between <<<<<<< and
1111
- >>>>>>> to resolve; and the format guide
1112
- tobos check [--types] the server's check of your changes; nothing lands;
1113
- --types: TypeScript too, here (installs a checker once)
1114
- tobos push [-m "what changed"] your changes as one version, media uploaded; the
1115
- server checks it, and it goes live
1289
+ The five verbs (a deck by its id, or its title to mv it; a folder by its path; in a working copy,
1290
+ with no git: the server keeps the versions)
1291
+ ${VERB_ROWS}
1116
1292
 
1117
1293
  Looking at it (from the working copy, render and open push what changed first; with --deck <id>,
1118
1294
  from anywhere)
@@ -1137,16 +1313,11 @@ The skill (what your harness reads to know Tobos without this help)
1137
1313
  tobos skill install put it where Claude Code, Codex, OpenCode and others
1138
1314
  read skills; later CLIs keep it up to date
1139
1315
 
1140
- Templates (decks people start from: a new deck copies a template's master/)
1141
- tobos new "Title" --from <id> start a deck from that template (default: Tobos
1142
- simple; \`tobos ls\` lists the person's own)
1143
- tobos new "Our brand" --template a new template: a copy of Tobos simple (or of --from)
1144
-
1145
1316
  Every command takes --json and then prints one JSON object.
1146
- Exit codes: 0 ok, 1 error, 2 the deck has problems, 3 not logged in (or not yet approved), 4 a conflict: someone
1147
- changed the same lines (pull, resolve, push again; for the story, the reply has the paragraph as
1148
- it is now), 5 a plan's limit or an archived deck: the person decides what to do, so show them the
1149
- message and wait.
1317
+ Exit codes: 0 ok, 1 error, 2 the deck has problems, 3 not logged in (or not yet approved),
1318
+ 4 a conflict: someone changed the same lines (pull, resolve, push again; for the story, the reply
1319
+ has the paragraph as it is now), 5 a plan's limit or an archived deck: the person decides what to
1320
+ do, so show them the message and wait.
1150
1321
  `;
1151
1322
  var COMMON = {
1152
1323
  json: { type: "boolean" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tobos/cli",
3
- "version": "0.4.31",
3
+ "version": "0.4.32",
4
4
  "description": "The command line of Tobos: https://tobos.ai",
5
5
  "type": "module",
6
6
  "license": "FSL-1.1-ALv2",