@todoforai/cli 0.1.44 → 0.1.45

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.
@@ -42949,25 +42949,15 @@ class ApiClient {
42949
42949
  throw new Error(`API GET /resources/show failed: ${res.status} ${await res.text()}`);
42950
42950
  return res.json();
42951
42951
  }
42952
- async patchSite(siteId, body) {
42953
- const res = await fetch(`${this.apiUrl}${restBasePath(this.apiKey)}/resources/sites/${siteId}`, {
42954
- method: "PATCH",
42955
- headers: { "x-api-key": this.apiKey, "Content-Type": "application/json" },
42956
- body: JSON.stringify(body),
42957
- signal: AbortSignal.timeout(30000)
42958
- });
42959
- if (!res.ok)
42960
- throw new Error(`API PATCH site failed: ${res.status} ${await res.text()}`);
42961
- return res.json();
42962
- }
42963
- async deleteSite(siteId) {
42964
- const res = await fetch(`${this.apiUrl}${restBasePath(this.apiKey)}/resources/sites/${siteId}`, {
42952
+ async removeShow(todoId, key) {
42953
+ const url = `${this.apiUrl}${restBasePath(this.apiKey)}/resources/show/${encodeURIComponent(todoId)}/${encodeURIComponent(key)}`;
42954
+ const res = await fetch(url, {
42965
42955
  method: "DELETE",
42966
42956
  headers: { "x-api-key": this.apiKey },
42967
42957
  signal: AbortSignal.timeout(30000)
42968
42958
  });
42969
42959
  if (!res.ok)
42970
- throw new Error(`API DELETE site failed: ${res.status} ${await res.text()}`);
42960
+ throw new Error(`API DELETE /resources/show failed: ${res.status} ${await res.text()}`);
42971
42961
  }
42972
42962
  async upsertCard(projectId, name, html, opts = {}) {
42973
42963
  const form = new FormData;
@@ -43703,6 +43693,7 @@ var SERVER_TO_FRONTENDS = {
43703
43693
  msgMetaUsr: (todoId) => `${"todo:msg_meta_usr" /* TODO_MSG_META_USR */}:${todoId}`,
43704
43694
  msgMetaAi: (todoId) => `${"todo:msg_meta_ai" /* TODO_MSG_META_AI */}:${todoId}`,
43705
43695
  msgQueueUpdate: (todoId) => `${"todo:msg_queue_update" /* TODO_MSG_QUEUE_UPDATE */}:${todoId}`,
43696
+ message_removed: (todoId) => `${"todo:message_removed" /* TODO_MESSAGE_REMOVED */}:${todoId}`,
43706
43697
  start_universal: (todoId) => `${"block:start_universal" /* BLOCK_START_UNIVERSAL */}:${todoId}`,
43707
43698
  message: (todoId) => `${"block:message" /* BLOCK_MESSAGE */}:${todoId}`,
43708
43699
  end: (todoId) => `${"block:end" /* BLOCK_END */}:${todoId}`,
@@ -44378,6 +44369,10 @@ var TOPICS = {
44378
44369
  channel: (p) => SERVER_TO_FRONTENDS.todo.msgQueueUpdate(p.todoId),
44379
44370
  audience: "frontend"
44380
44371
  },
44372
+ ["todo:message_removed" /* TODO_MESSAGE_REMOVED */]: {
44373
+ channel: (p) => SERVER_TO_FRONTENDS.todo.message_removed(p.todoId),
44374
+ audience: "frontend"
44375
+ },
44381
44376
  ["todo:msg_meta_usr" /* TODO_MSG_META_USR */]: {
44382
44377
  channel: (p) => SERVER_TO_FRONTENDS.todo.msgMetaUsr(p.todoId),
44383
44378
  audience: "frontend"
@@ -44454,11 +44449,12 @@ import { parseArgs } from "util";
44454
44449
  // package.json
44455
44450
  var package_default = {
44456
44451
  name: "@todoforai/cli",
44457
- version: "0.1.44",
44452
+ version: "0.1.45",
44458
44453
  type: "module",
44459
44454
  bin: {
44460
44455
  "todoforai-cli": "bin/todoforai-cli.js",
44461
44456
  "tfa-cli": "bin/todoforai-cli.js",
44457
+ "tfa-code": "bin/todoforai-cli.js",
44462
44458
  todoai: "bin/todoforai-cli.js"
44463
44459
  },
44464
44460
  files: [
@@ -44518,10 +44514,10 @@ Usage:
44518
44514
  tfa-cli show <file|-> [todo-id] # Show a file in the chat (rendered by mimetype; - reads stdin)
44519
44515
  # [--title T] [--alias A] [--mime M] [--card <name>] [--link] [--json]
44520
44516
  # --link = compact chip (name+size+download) instead of inline render
44521
- # The file gets a stable public url: show.todofor.ai/<site-id>
44522
- # (latest; /<site-id>/<attachment-id> = frozen version). --site <id>
44523
- # pushes a new version to an existing url (from any todo).
44524
- tfa-cli show rm <site-id> # Take a shown file down (all versions)
44517
+ # Prints "<todoId>:<alias|id> <public url>". Re-showing with the same
44518
+ # --alias updates that block in place and pushes a new version to the
44519
+ # same url (older versions stay reachable at /<id>/<version>).
44520
+ tfa-cli show rm <ref|alias> # Take a shown file down (block, url, every version)
44525
44521
  tfa-cli show list [todo-id] # List show blocks (ref, title, mime/url, card)
44526
44522
  # [--project <id>] [--card <name>] [--json]
44527
44523
  # no todo-id + --project (or $TODOFORAI_PROJECT_ID) = every todo
@@ -44615,7 +44611,6 @@ function parseCliArgs() {
44615
44611
  mime: { type: "string" },
44616
44612
  card: { type: "string" },
44617
44613
  link: { type: "boolean", default: false },
44618
- site: { type: "string" },
44619
44614
  direction: { type: "string" },
44620
44615
  "business-context": { type: "string" },
44621
44616
  seed: { type: "string" },
@@ -53488,14 +53483,22 @@ Cancelled by user (Ctrl+C)
53488
53483
  return;
53489
53484
  }
53490
53485
  if (positionals[0] === "show" && positionals[1] === "rm") {
53491
- const id = positionals[2];
53492
- if (!id) {
53493
- process.stderr.write(`${RED3}Usage: tfa-cli show rm <site-id>${RESET2}
53486
+ const arg = positionals[2];
53487
+ if (!arg) {
53488
+ process.stderr.write(`${RED3}Usage: tfa-cli show rm <ref|alias>${RESET2}
53489
+ `);
53490
+ process.exit(2);
53491
+ }
53492
+ const sep = arg.indexOf(":");
53493
+ const todoId = sep >= 0 ? arg.slice(0, sep) : getEnv("TODO_ID") || cfgScope.data.last_todo_id;
53494
+ const key = sep >= 0 ? arg.slice(sep + 1) : arg;
53495
+ if (!todoId || !key) {
53496
+ process.stderr.write(`${RED3}show rm: need <todoId>:<alias> (no current todo)${RESET2}
53494
53497
  `);
53495
53498
  process.exit(2);
53496
53499
  }
53497
- await api.deleteSite(id);
53498
- process.stderr.write(`${GREEN2}\u2705 deleted ${id}${RESET2}
53500
+ await api.removeShow(todoId, key);
53501
+ process.stderr.write(`${GREEN2}\u2705 removed ${todoId}:${key}${RESET2}
53499
53502
  `);
53500
53503
  return;
53501
53504
  }
@@ -53503,7 +53506,7 @@ Cancelled by user (Ctrl+C)
53503
53506
  const [, filePath, todoArg] = positionals;
53504
53507
  const todoId = todoArg || getEnv("TODO_ID") || cfgScope.data.last_todo_id;
53505
53508
  if (!filePath || !todoId) {
53506
- process.stderr.write(`${RED3}Usage: tfa-cli show <file|-> [todo-id] [--title T] [--alias A] [--mime M] [--card <name>] [--link] [--site <id>]${RESET2}
53509
+ process.stderr.write(`${RED3}Usage: tfa-cli show <file|-> [todo-id] [--title T] [--alias A] [--mime M] [--card <name>] [--link]${RESET2}
53507
53510
  `);
53508
53511
  process.exit(2);
53509
53512
  }
@@ -53534,13 +53537,12 @@ Cancelled by user (Ctrl+C)
53534
53537
  alias: args.alias,
53535
53538
  mime: args.mime,
53536
53539
  card: args.card,
53537
- display: args.link ? "link" : undefined,
53538
- site: args.site
53540
+ display: args.link ? "link" : undefined
53539
53541
  });
53540
53542
  if (args.json)
53541
53543
  console.log(JSON.stringify(res, null, 2));
53542
53544
  else
53543
- console.log(res.url ? `${res.ref} site=${res.siteId} ${res.url}` : res.ref);
53545
+ console.log(res.url ? `${res.ref} ${res.url}` : res.ref);
53544
53546
  return;
53545
53547
  }
53546
53548
  if (positionals[0] === "open") {
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@todoforai/cli",
3
- "version": "0.1.44",
3
+ "version": "0.1.45",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "todoforai-cli": "bin/todoforai-cli.js",
7
7
  "tfa-cli": "bin/todoforai-cli.js",
8
+ "tfa-code": "bin/todoforai-cli.js",
8
9
  "todoai": "bin/todoforai-cli.js"
9
10
  },
10
11
  "files": [