@todoforai/cli 0.1.1 → 0.1.3
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/README.md +1 -0
- package/dist/todoai.js +23 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -66,6 +66,7 @@ todoai --resume <todo-id> # resume specific todo
|
|
|
66
66
|
--continue, -c Continue most recent todo
|
|
67
67
|
--non-interactive, -n Run to completion and exit
|
|
68
68
|
--dangerously-skip-permissions Auto-approve all blocks (CI/benchmarks)
|
|
69
|
+
--allow-all Set permissions to allow all tools (no approval needed)
|
|
69
70
|
--no-watch Create todo and exit
|
|
70
71
|
--json Output as JSON
|
|
71
72
|
--safe Validate API key upfront
|
package/dist/todoai.js
CHANGED
|
@@ -43059,6 +43059,7 @@ Options:
|
|
|
43059
43059
|
--continue, -c Continue most recent todo
|
|
43060
43060
|
--non-interactive, -n Run to completion and exit without interactive prompt
|
|
43061
43061
|
--dangerously-skip-permissions Auto-approve all blocks (for CI/benchmarks)
|
|
43062
|
+
--allow-all Set permissions to allow all tools (no approval needed)
|
|
43062
43063
|
--no-watch Create todo and exit
|
|
43063
43064
|
--json Output as JSON
|
|
43064
43065
|
--safe Validate API key upfront
|
|
@@ -43087,6 +43088,7 @@ function parseCliArgs() {
|
|
|
43087
43088
|
continue: { type: "boolean", short: "c", default: false },
|
|
43088
43089
|
"non-interactive": { type: "boolean", short: "n", default: false },
|
|
43089
43090
|
"dangerously-skip-permissions": { type: "boolean", default: false },
|
|
43091
|
+
"allow-all": { type: "boolean", default: false },
|
|
43090
43092
|
"no-watch": { type: "boolean", default: false },
|
|
43091
43093
|
json: { type: "boolean", default: false },
|
|
43092
43094
|
safe: { type: "boolean", default: false },
|
|
@@ -44871,9 +44873,9 @@ Cancelled by user (Ctrl+C)
|
|
|
44871
44873
|
return;
|
|
44872
44874
|
}
|
|
44873
44875
|
const apiUrl = normalizeApiUrl(args["api-url"] || cfg.data.default_api_url || getEnv("API_URL") || DEFAULT_API_URL);
|
|
44874
|
-
|
|
44875
|
-
const
|
|
44876
|
-
const { code, url, expiresIn } = await
|
|
44876
|
+
async function deviceLogin() {
|
|
44877
|
+
const loginApi = new ApiClient(apiUrl, "");
|
|
44878
|
+
const { code, url, expiresIn } = await loginApi.initDeviceLogin("cli");
|
|
44877
44879
|
const userCode = new URL(url).searchParams.get("user_code") || code.slice(-8).toUpperCase();
|
|
44878
44880
|
process.stderr.write(`
|
|
44879
44881
|
\uD83D\uDD11 Open this URL to authorize:
|
|
@@ -44899,13 +44901,13 @@ Cancelled by user (Ctrl+C)
|
|
|
44899
44901
|
while (Date.now() < deadline) {
|
|
44900
44902
|
await new Promise((r) => setTimeout(r, 3000));
|
|
44901
44903
|
try {
|
|
44902
|
-
const poll = await
|
|
44904
|
+
const poll = await loginApi.pollDeviceLogin(code);
|
|
44903
44905
|
failures = 0;
|
|
44904
44906
|
if (poll.status === "complete" && poll.apiKey) {
|
|
44905
44907
|
cfg.setDefaultApiKey(poll.apiKey);
|
|
44906
44908
|
process.stderr.write(`${GREEN}\u2705 Login successful! API key saved.${RESET}
|
|
44907
44909
|
`);
|
|
44908
|
-
return;
|
|
44910
|
+
return poll.apiKey;
|
|
44909
44911
|
}
|
|
44910
44912
|
if (poll.status === "expired")
|
|
44911
44913
|
break;
|
|
@@ -44921,10 +44923,13 @@ Cancelled by user (Ctrl+C)
|
|
|
44921
44923
|
`);
|
|
44922
44924
|
process.exit(1);
|
|
44923
44925
|
}
|
|
44924
|
-
|
|
44926
|
+
if (positionals[0] === "login" && positionals.length === 1) {
|
|
44927
|
+
await deviceLogin();
|
|
44928
|
+
return;
|
|
44929
|
+
}
|
|
44930
|
+
let apiKey = args["api-key"] || cfg.data.default_api_key || getEnv("API_KEY") || "";
|
|
44925
44931
|
if (!apiKey) {
|
|
44926
|
-
|
|
44927
|
-
process.exit(1);
|
|
44932
|
+
apiKey = await deviceLogin();
|
|
44928
44933
|
}
|
|
44929
44934
|
const api = new ApiClient(apiUrl, apiKey);
|
|
44930
44935
|
if (args.inspect) {
|
|
@@ -44992,7 +44997,11 @@ Cancelled by user (Ctrl+C)
|
|
|
44992
44997
|
const ws2 = new FrontendWebSocket(apiUrl, apiKey);
|
|
44993
44998
|
await ws2.connect();
|
|
44994
44999
|
const autoApprove = !!args["dangerously-skip-permissions"];
|
|
44995
|
-
|
|
45000
|
+
let agent2 = todo2.agentSettings || { id: todo2.agentSettingsId };
|
|
45001
|
+
if (args["allow-all"]) {
|
|
45002
|
+
const perms = agent2.permissions || { allow: [], ask: [], deny: [] };
|
|
45003
|
+
agent2 = { ...agent2, permissions: { ...perms, allow: [...perms.allow || [], "*:*"] } };
|
|
45004
|
+
}
|
|
44996
45005
|
await watchTodo(ws2, todoId, projectId2, {
|
|
44997
45006
|
json: !!args.json,
|
|
44998
45007
|
autoApprove,
|
|
@@ -45002,7 +45011,7 @@ Cancelled by user (Ctrl+C)
|
|
|
45002
45011
|
process.stderr.write(`
|
|
45003
45012
|
${"\u2500".repeat(40)}
|
|
45004
45013
|
`);
|
|
45005
|
-
await interactiveLoop(ws2, api, todoId, projectId2, agent2, !!args.json, autoApprove);
|
|
45014
|
+
await interactiveLoop(ws2, api, todoId, projectId2, agent2, !!args.json, autoApprove, cfg);
|
|
45006
45015
|
}
|
|
45007
45016
|
await ws2.close();
|
|
45008
45017
|
}
|
|
@@ -45132,6 +45141,10 @@ Resumed todo: ${todoId}
|
|
|
45132
45141
|
await ws.connect();
|
|
45133
45142
|
if (args.model)
|
|
45134
45143
|
agent = { ...agent, model: args.model };
|
|
45144
|
+
if (args["allow-all"]) {
|
|
45145
|
+
const perms = agent.permissions || { allow: [], ask: [], deny: [] };
|
|
45146
|
+
agent = { ...agent, permissions: { ...perms, allow: [...perms.allow || [], "*:*"] } };
|
|
45147
|
+
}
|
|
45135
45148
|
cfg.addToHistory(content);
|
|
45136
45149
|
const todo = await api.addMessage(projectId, content, agent);
|
|
45137
45150
|
const actualTodoId = todo.id || crypto.randomUUID();
|