@todoforai/cli 0.1.8 → 0.1.10
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.
- package/dist/todoai.js +51 -14
- 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
|
-
//
|
|
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>
|
|
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>
|
|
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
|
|
@@ -43732,8 +43740,17 @@ class ScopedConfig {
|
|
|
43732
43740
|
// src/credentials.ts
|
|
43733
43741
|
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
43734
43742
|
import { dirname as dirname2, join as join2 } from "path";
|
|
43735
|
-
import { homedir as homedir2 } from "os";
|
|
43736
|
-
|
|
43743
|
+
import { homedir as homedir2, platform as platform2 } from "os";
|
|
43744
|
+
function credentialsPath2() {
|
|
43745
|
+
const sys = platform2();
|
|
43746
|
+
if (sys === "win32")
|
|
43747
|
+
return join2(homedir2(), "AppData", "Roaming", "todoforai", "credentials.json");
|
|
43748
|
+
if (sys === "darwin")
|
|
43749
|
+
return join2(homedir2(), "Library", "Application Support", "todoforai", "credentials.json");
|
|
43750
|
+
const xdg = process.env.XDG_CONFIG_HOME || join2(homedir2(), ".config");
|
|
43751
|
+
return join2(xdg, "todoforai", "credentials.json");
|
|
43752
|
+
}
|
|
43753
|
+
var CREDENTIALS_PATH2 = credentialsPath2();
|
|
43737
43754
|
function read() {
|
|
43738
43755
|
if (!existsSync2(CREDENTIALS_PATH2))
|
|
43739
43756
|
return {};
|
|
@@ -43744,7 +43761,8 @@ function read() {
|
|
|
43744
43761
|
}
|
|
43745
43762
|
}
|
|
43746
43763
|
function readCredential(apiUrl) {
|
|
43747
|
-
|
|
43764
|
+
const v = read()[apiUrl];
|
|
43765
|
+
return typeof v === "string" ? v : "";
|
|
43748
43766
|
}
|
|
43749
43767
|
function writeCredential(apiUrl, apiKey) {
|
|
43750
43768
|
const data = read();
|
|
@@ -43828,7 +43846,7 @@ function printLogo() {
|
|
|
43828
43846
|
}
|
|
43829
43847
|
|
|
43830
43848
|
// src/inspect.ts
|
|
43831
|
-
function printFullChat(todo, frontendUrl) {
|
|
43849
|
+
function printFullChat(todo, frontendUrl, untilMessageId) {
|
|
43832
43850
|
const statusColors = {
|
|
43833
43851
|
DONE: GREEN,
|
|
43834
43852
|
READY: GREEN,
|
|
@@ -43852,10 +43870,22 @@ function printFullChat(todo, frontendUrl) {
|
|
|
43852
43870
|
`);
|
|
43853
43871
|
if (todo.agentSettingsId)
|
|
43854
43872
|
process.stderr.write(`${DIM}Agent:${RESET} ${todo.agentSettingsId}
|
|
43873
|
+
`);
|
|
43874
|
+
if (untilMessageId)
|
|
43875
|
+
process.stderr.write(`${DIM}Until:${RESET} ${untilMessageId}
|
|
43855
43876
|
`);
|
|
43856
43877
|
process.stderr.write("\u2500".repeat(60) + `
|
|
43857
43878
|
`);
|
|
43858
|
-
|
|
43879
|
+
let messages = todo.messages || [];
|
|
43880
|
+
if (untilMessageId) {
|
|
43881
|
+
const idx = messages.findIndex((m) => m.id === untilMessageId);
|
|
43882
|
+
if (idx < 0) {
|
|
43883
|
+
process.stderr.write(`${RED}Error: message ${untilMessageId} not found in todo${RESET}
|
|
43884
|
+
`);
|
|
43885
|
+
process.exit(2);
|
|
43886
|
+
}
|
|
43887
|
+
messages = messages.slice(0, idx + 1);
|
|
43888
|
+
}
|
|
43859
43889
|
if (!messages.length) {
|
|
43860
43890
|
process.stderr.write(`${DIM}(no messages)${RESET}
|
|
43861
43891
|
`);
|
|
@@ -45217,7 +45247,7 @@ Cancelled by user (Ctrl+C)
|
|
|
45217
45247
|
await deviceLogin();
|
|
45218
45248
|
return;
|
|
45219
45249
|
}
|
|
45220
|
-
let apiKey = args["api-key"] || getEnv("API_KEY") || readCredential(apiUrl) || "";
|
|
45250
|
+
let apiKey = args["api-key"] || getEnv("API_TOKEN") || getEnv("API_KEY") || readCredential(apiUrl) || "";
|
|
45221
45251
|
if (!apiKey) {
|
|
45222
45252
|
apiKey = await deviceLogin();
|
|
45223
45253
|
}
|
|
@@ -45226,10 +45256,17 @@ Cancelled by user (Ctrl+C)
|
|
|
45226
45256
|
await listAgentsCommand(api, { json: !!args.json, formatPath: formatPathWithTilde });
|
|
45227
45257
|
return;
|
|
45228
45258
|
}
|
|
45229
|
-
if (args.inspect) {
|
|
45230
|
-
const
|
|
45259
|
+
if (args.inspect !== undefined) {
|
|
45260
|
+
const raw = String(args.inspect);
|
|
45261
|
+
const [rawTodoId, untilMessageId] = raw.includes(":") ? raw.split(":", 2) : [raw, undefined];
|
|
45262
|
+
const todoId = rawTodoId || getEnv("TODO_ID");
|
|
45263
|
+
if (!todoId) {
|
|
45264
|
+
process.stderr.write(`${RED}Error: --inspect requires a todoId (or $TODOFORAI_TODO_ID env var)${RESET}
|
|
45265
|
+
`);
|
|
45266
|
+
process.exit(2);
|
|
45267
|
+
}
|
|
45231
45268
|
const todo2 = await api.getTodo(todoId);
|
|
45232
|
-
printFullChat(todo2, getFrontendUrl(apiUrl, todo2.projectId, todoId));
|
|
45269
|
+
printFullChat(todo2, getFrontendUrl(apiUrl, todo2.projectId, todoId), untilMessageId || undefined);
|
|
45233
45270
|
return;
|
|
45234
45271
|
}
|
|
45235
45272
|
if (process.stderr.isTTY)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@todoforai/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
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"
|