@todoforai/cli 0.1.8 → 0.1.9

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/todoai.js +38 -11
  2. package/package.json +2 -1
package/dist/todoai.js CHANGED
@@ -42667,10 +42667,17 @@ import { fileURLToPath } from "url";
42667
42667
  import { homedir as homedir3 } from "os";
42668
42668
  import path4 from "path";
42669
42669
 
42670
- // src/update-notifier.ts
42670
+ // node_modules/@todoforai/update-notifier/src/index.ts
42671
42671
  import fs from "fs";
42672
42672
  import path from "path";
42673
42673
  import os from "os";
42674
+ function isLinkedInstall() {
42675
+ try {
42676
+ return !fs.realpathSync(process.argv[1] || "").includes(`${path.sep}node_modules${path.sep}`);
42677
+ } catch {
42678
+ return false;
42679
+ }
42680
+ }
42674
42681
  var TTL_MS = 24 * 60 * 60 * 1000;
42675
42682
  var CACHE_DIR = path.join(os.homedir(), ".config", "todoforai");
42676
42683
  function cmpVer(a, b) {
@@ -42684,7 +42691,7 @@ function cmpVer(a, b) {
42684
42691
  return 0;
42685
42692
  }
42686
42693
  function checkForUpdates(pkg) {
42687
- if (!process.stderr.isTTY || process.env.CI || process.env.NO_UPDATE_NOTIFIER)
42694
+ if (!process.stderr.isTTY || process.env.CI || process.env.NO_UPDATE_NOTIFIER || isLinkedInstall())
42688
42695
  return;
42689
42696
  const cacheFile = path.join(CACHE_DIR, `notifier-${encodeURIComponent(pkg.name)}.json`);
42690
42697
  let cache = {};
@@ -42898,7 +42905,6 @@ function credentialsPath() {
42898
42905
  return path2.join(xdg, "todoforai", "credentials.json");
42899
42906
  }
42900
42907
  var CREDENTIALS_PATH = credentialsPath();
42901
- var LEGACY_CREDENTIALS_PATH = path2.join(os2.homedir(), ".todoforai", "credentials.json");
42902
42908
 
42903
42909
  // ../edge/bun/src/frontend-ws.ts
42904
42910
  var log = (level, ...args) => console.log(`[frontend-ws:${level}]`, ...args);
@@ -43109,6 +43115,7 @@ var package_default = {
43109
43115
  postinstall: "rm -rf node_modules/@todoforai/edge && ln -s ../../../edge/bun node_modules/@todoforai/edge"
43110
43116
  },
43111
43117
  dependencies: {
43118
+ "@todoforai/update-notifier": "^0.1.0",
43112
43119
  "cli-highlight": "^2.1.11",
43113
43120
  "diff-match-patch": "^1.0.5",
43114
43121
  ws: "^8.18.0"
@@ -43146,7 +43153,8 @@ Usage:
43146
43153
  todoai --path /my/project "Fix bug" # Explicit workspace path
43147
43154
  todoai -c # Resume last todo
43148
43155
  todoai --resume <todo-id> # Resume specific todo
43149
- todoai --inspect <todo-id> # Print full chat log (read-only)
43156
+ todoai --inspect <todo-id>[:<msg-id>] # Print full chat log (read-only); :<msg-id> truncates inclusive
43157
+ todoai --inspect :<msg-id> # Same, using $TODOFORAI_TODO_ID from edge env
43150
43158
  todoai --template <id> [--input k=v] # Start from a registry template
43151
43159
  todoai --list-agents # List available agents and exit
43152
43160
 
@@ -43157,7 +43165,7 @@ Options:
43157
43165
  --list-agents List available agents (name, id, workspace paths) and exit
43158
43166
  --api-url <url> API URL
43159
43167
  --api-key <key> API key
43160
- --inspect, -i <todo-id> Print full chat log (read-only, no interactive)
43168
+ --inspect, -i [<todo-id>][:<msg-id>] Print full chat log; empty todo-id uses $TODOFORAI_TODO_ID
43161
43169
  --template, -t <id> Start from a registry template
43162
43170
  --input <key=value> Template input (repeatable)
43163
43171
  --resume, -r [todo-id] Resume existing todo
@@ -43828,7 +43836,7 @@ function printLogo() {
43828
43836
  }
43829
43837
 
43830
43838
  // src/inspect.ts
43831
- function printFullChat(todo, frontendUrl) {
43839
+ function printFullChat(todo, frontendUrl, untilMessageId) {
43832
43840
  const statusColors = {
43833
43841
  DONE: GREEN,
43834
43842
  READY: GREEN,
@@ -43852,10 +43860,22 @@ function printFullChat(todo, frontendUrl) {
43852
43860
  `);
43853
43861
  if (todo.agentSettingsId)
43854
43862
  process.stderr.write(`${DIM}Agent:${RESET} ${todo.agentSettingsId}
43863
+ `);
43864
+ if (untilMessageId)
43865
+ process.stderr.write(`${DIM}Until:${RESET} ${untilMessageId}
43855
43866
  `);
43856
43867
  process.stderr.write("\u2500".repeat(60) + `
43857
43868
  `);
43858
- const messages = todo.messages || [];
43869
+ let messages = todo.messages || [];
43870
+ if (untilMessageId) {
43871
+ const idx = messages.findIndex((m) => m.id === untilMessageId);
43872
+ if (idx < 0) {
43873
+ process.stderr.write(`${RED}Error: message ${untilMessageId} not found in todo${RESET}
43874
+ `);
43875
+ process.exit(2);
43876
+ }
43877
+ messages = messages.slice(0, idx + 1);
43878
+ }
43859
43879
  if (!messages.length) {
43860
43880
  process.stderr.write(`${DIM}(no messages)${RESET}
43861
43881
  `);
@@ -45217,7 +45237,7 @@ Cancelled by user (Ctrl+C)
45217
45237
  await deviceLogin();
45218
45238
  return;
45219
45239
  }
45220
- let apiKey = args["api-key"] || getEnv("API_KEY") || readCredential(apiUrl) || "";
45240
+ let apiKey = args["api-key"] || getEnv("API_TOKEN") || getEnv("API_KEY") || readCredential(apiUrl) || "";
45221
45241
  if (!apiKey) {
45222
45242
  apiKey = await deviceLogin();
45223
45243
  }
@@ -45226,10 +45246,17 @@ Cancelled by user (Ctrl+C)
45226
45246
  await listAgentsCommand(api, { json: !!args.json, formatPath: formatPathWithTilde });
45227
45247
  return;
45228
45248
  }
45229
- if (args.inspect) {
45230
- const todoId = args.inspect;
45249
+ if (args.inspect !== undefined) {
45250
+ const raw = String(args.inspect);
45251
+ const [rawTodoId, untilMessageId] = raw.includes(":") ? raw.split(":", 2) : [raw, undefined];
45252
+ const todoId = rawTodoId || getEnv("TODO_ID");
45253
+ if (!todoId) {
45254
+ process.stderr.write(`${RED}Error: --inspect requires a todoId (or $TODOFORAI_TODO_ID env var)${RESET}
45255
+ `);
45256
+ process.exit(2);
45257
+ }
45231
45258
  const todo2 = await api.getTodo(todoId);
45232
- printFullChat(todo2, getFrontendUrl(apiUrl, todo2.projectId, todoId));
45259
+ printFullChat(todo2, getFrontendUrl(apiUrl, todo2.projectId, todoId), untilMessageId || undefined);
45233
45260
  return;
45234
45261
  }
45235
45262
  if (process.stderr.isTTY)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todoforai/cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "todoai": "dist/todoai.js"
@@ -15,6 +15,7 @@
15
15
  "dev": "bun run src/index.ts"
16
16
  },
17
17
  "dependencies": {
18
+ "@todoforai/update-notifier": "^0.1.0",
18
19
  "cli-highlight": "^2.1.11",
19
20
  "diff-match-patch": "^1.0.5",
20
21
  "ws": "^8.18.0"