@astroanywhere/cli 0.2.0 → 0.2.2
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/{chunk-7H7WD7QX.js → chunk-MJRAJPBU.js} +242 -30
- package/dist/client.js +5 -1
- package/dist/index.js +310 -6
- package/dist/tui.js +2336 -919
- package/package.json +10 -7
package/dist/index.js
CHANGED
|
@@ -6,8 +6,9 @@ import {
|
|
|
6
6
|
loadConfig,
|
|
7
7
|
resetConfig,
|
|
8
8
|
saveConfig,
|
|
9
|
+
streamChatToStdout,
|
|
9
10
|
streamDispatchToStdout
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-MJRAJPBU.js";
|
|
11
12
|
|
|
12
13
|
// src/index.ts
|
|
13
14
|
import { Command } from "commander";
|
|
@@ -128,6 +129,74 @@ function formatStatus(status) {
|
|
|
128
129
|
return colorFn(status);
|
|
129
130
|
}
|
|
130
131
|
|
|
132
|
+
// src/chat-utils.ts
|
|
133
|
+
import { readFileSync, writeFileSync } from "fs";
|
|
134
|
+
import { createInterface } from "readline";
|
|
135
|
+
var MAX_HISTORY_MESSAGES = 100;
|
|
136
|
+
function loadHistory(path) {
|
|
137
|
+
try {
|
|
138
|
+
const raw = readFileSync(path, "utf-8");
|
|
139
|
+
const messages = JSON.parse(raw);
|
|
140
|
+
if (!Array.isArray(messages)) return [];
|
|
141
|
+
return messages.slice(-MAX_HISTORY_MESSAGES);
|
|
142
|
+
} catch {
|
|
143
|
+
return [];
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function saveHistory(path, messages) {
|
|
147
|
+
writeFileSync(path, JSON.stringify(messages.slice(-MAX_HISTORY_MESSAGES), null, 2));
|
|
148
|
+
}
|
|
149
|
+
async function promptApproval(question, options) {
|
|
150
|
+
process.stderr.write(`
|
|
151
|
+
${question}
|
|
152
|
+
`);
|
|
153
|
+
for (let i = 0; i < options.length; i++) {
|
|
154
|
+
process.stderr.write(` [${i + 1}] ${options[i]}
|
|
155
|
+
`);
|
|
156
|
+
}
|
|
157
|
+
process.stderr.write("Select option (number): ");
|
|
158
|
+
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
159
|
+
return new Promise((resolve) => {
|
|
160
|
+
rl.question("", (input) => {
|
|
161
|
+
rl.close();
|
|
162
|
+
const idx = parseInt(input.trim(), 10) - 1;
|
|
163
|
+
if (idx >= 0 && idx < options.length) {
|
|
164
|
+
resolve({ answered: true, answer: options[idx] });
|
|
165
|
+
} else {
|
|
166
|
+
resolve({ answered: false });
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
function createApprovalHandler(client, yolo) {
|
|
172
|
+
return async (data) => {
|
|
173
|
+
let result;
|
|
174
|
+
if (yolo) {
|
|
175
|
+
result = { answered: true, answer: data.options[0] };
|
|
176
|
+
process.stderr.write(`
|
|
177
|
+
[yolo] Auto-approved: ${data.question} \u2192 ${data.options[0]}
|
|
178
|
+
`);
|
|
179
|
+
} else {
|
|
180
|
+
result = await promptApproval(data.question, data.options);
|
|
181
|
+
}
|
|
182
|
+
if (data.taskId && data.machineId && data.requestId) {
|
|
183
|
+
try {
|
|
184
|
+
await client.sendApproval({
|
|
185
|
+
taskId: data.taskId,
|
|
186
|
+
machineId: data.machineId,
|
|
187
|
+
requestId: data.requestId,
|
|
188
|
+
answered: result.answered,
|
|
189
|
+
answer: result.answer
|
|
190
|
+
});
|
|
191
|
+
} catch (err) {
|
|
192
|
+
process.stderr.write(`[approval] Failed to send: ${err instanceof Error ? err.message : String(err)}
|
|
193
|
+
`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return result;
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
131
200
|
// src/commands/project.ts
|
|
132
201
|
import chalk2 from "chalk";
|
|
133
202
|
var projectColumns = [
|
|
@@ -165,7 +234,6 @@ function registerProjectCommands(program2) {
|
|
|
165
234
|
["Status", formatStatus(p.status)],
|
|
166
235
|
["Description", p.description || chalk2.dim("\u2014")],
|
|
167
236
|
["Working Directory", p.workingDirectory || chalk2.dim("\u2014")],
|
|
168
|
-
["Source Directory", p.sourceDirectory || chalk2.dim("\u2014")],
|
|
169
237
|
["Repository", p.repository || chalk2.dim("\u2014")],
|
|
170
238
|
["Delivery Mode", p.deliveryMode || chalk2.dim("\u2014")],
|
|
171
239
|
["Health", p.health || chalk2.dim("\u2014")],
|
|
@@ -311,6 +379,62 @@ function registerProjectCommands(program2) {
|
|
|
311
379
|
process.exitCode = 1;
|
|
312
380
|
}
|
|
313
381
|
});
|
|
382
|
+
project.command("chat <id>").description("Chat with AI about a project").requiredOption("--message <msg>", "Message to send").option("--session-id <sid>", "Resume existing session").option("--model <model>", "AI model to use").option("--provider <provider>", "Provider ID").option("--history-file <path>", "Path to conversation history JSON file").option("--yolo", "Auto-approve all approval requests").action(async (id, cmdOpts) => {
|
|
383
|
+
const opts = program2.opts();
|
|
384
|
+
const client = getClient(opts.serverUrl);
|
|
385
|
+
let p;
|
|
386
|
+
try {
|
|
387
|
+
p = await client.resolveProject(id);
|
|
388
|
+
} catch (err) {
|
|
389
|
+
console.error(chalk2.red(err.message));
|
|
390
|
+
process.exitCode = 1;
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
let planNodes = [];
|
|
394
|
+
let planEdges = [];
|
|
395
|
+
try {
|
|
396
|
+
const plan = await client.getPlan(p.id);
|
|
397
|
+
planNodes = plan.nodes.filter((n) => !n.deletedAt);
|
|
398
|
+
planEdges = plan.edges;
|
|
399
|
+
} catch {
|
|
400
|
+
}
|
|
401
|
+
let messages = [];
|
|
402
|
+
if (cmdOpts.historyFile) {
|
|
403
|
+
messages = loadHistory(cmdOpts.historyFile);
|
|
404
|
+
}
|
|
405
|
+
try {
|
|
406
|
+
const response = await client.projectChat({
|
|
407
|
+
message: cmdOpts.message,
|
|
408
|
+
projectId: p.id,
|
|
409
|
+
sessionId: cmdOpts.sessionId,
|
|
410
|
+
model: cmdOpts.model,
|
|
411
|
+
providerId: cmdOpts.provider,
|
|
412
|
+
visionDoc: p.visionDoc || void 0,
|
|
413
|
+
planNodes,
|
|
414
|
+
planEdges,
|
|
415
|
+
messages: messages.length > 0 ? messages : void 0
|
|
416
|
+
});
|
|
417
|
+
const approvalHandler = createApprovalHandler(client, !!cmdOpts.yolo);
|
|
418
|
+
const result = await streamChatToStdout(response, {
|
|
419
|
+
json: opts.json,
|
|
420
|
+
onApprovalRequest: approvalHandler
|
|
421
|
+
});
|
|
422
|
+
if (result.sessionId) {
|
|
423
|
+
process.stderr.write(`
|
|
424
|
+
${chalk2.dim(`Session: ${result.sessionId}`)}
|
|
425
|
+
`);
|
|
426
|
+
}
|
|
427
|
+
if (cmdOpts.historyFile && result.assistantText) {
|
|
428
|
+
messages.push({ role: "user", content: cmdOpts.message });
|
|
429
|
+
messages.push({ role: "assistant", content: result.assistantText });
|
|
430
|
+
saveHistory(cmdOpts.historyFile, messages);
|
|
431
|
+
}
|
|
432
|
+
console.log();
|
|
433
|
+
} catch (err) {
|
|
434
|
+
console.error(chalk2.red(`Chat failed: ${err instanceof Error ? err.message : String(err)}`));
|
|
435
|
+
process.exitCode = 1;
|
|
436
|
+
}
|
|
437
|
+
});
|
|
314
438
|
project.command("delete <id>").description("Delete a project").action(async (id) => {
|
|
315
439
|
const opts = program2.opts();
|
|
316
440
|
const client = getClient(opts.serverUrl);
|
|
@@ -675,6 +799,35 @@ function registerPlanCommands(program2) {
|
|
|
675
799
|
process.exitCode = 1;
|
|
676
800
|
}
|
|
677
801
|
});
|
|
802
|
+
plan.command("generate").description("Generate a plan using AI").requiredOption("--project-id <id>", "Project ID").requiredOption("--description <desc>", "Description of what to plan").option("--model <model>", "AI model to use").option("--provider <provider>", "Preferred provider ID").option("--machine <id>", "Target machine ID").option("--yolo", "Auto-approve all approval requests").action(async (cmdOpts) => {
|
|
803
|
+
const opts = program2.opts();
|
|
804
|
+
const client = getClient(opts.serverUrl);
|
|
805
|
+
console.log(chalk3.dim("Generating plan..."));
|
|
806
|
+
console.log();
|
|
807
|
+
try {
|
|
808
|
+
const response = await client.dispatchTask({
|
|
809
|
+
nodeId: `plan-${cmdOpts.projectId}`,
|
|
810
|
+
projectId: cmdOpts.projectId,
|
|
811
|
+
title: `Interactive planning: ${cmdOpts.description.slice(0, 80)}`,
|
|
812
|
+
isInteractivePlan: true,
|
|
813
|
+
description: cmdOpts.description,
|
|
814
|
+
verification: "human",
|
|
815
|
+
model: cmdOpts.model,
|
|
816
|
+
preferredProvider: cmdOpts.provider,
|
|
817
|
+
targetMachineId: cmdOpts.machine
|
|
818
|
+
});
|
|
819
|
+
const approvalHandler = createApprovalHandler(client, !!cmdOpts.yolo);
|
|
820
|
+
await streamDispatchToStdout(response, {
|
|
821
|
+
json: opts.json,
|
|
822
|
+
onApprovalRequest: approvalHandler
|
|
823
|
+
});
|
|
824
|
+
console.log();
|
|
825
|
+
console.log(chalk3.green("Plan generation complete."));
|
|
826
|
+
} catch (err) {
|
|
827
|
+
console.error(chalk3.red(`Plan generation failed: ${err instanceof Error ? err.message : String(err)}`));
|
|
828
|
+
process.exitCode = 1;
|
|
829
|
+
}
|
|
830
|
+
});
|
|
678
831
|
}
|
|
679
832
|
|
|
680
833
|
// src/commands/task.ts
|
|
@@ -860,17 +1013,54 @@ function registerTaskCommands(program2) {
|
|
|
860
1013
|
}
|
|
861
1014
|
console.log();
|
|
862
1015
|
});
|
|
863
|
-
cmd.command("dispatch <id>").description("Dispatch a task for execution").requiredOption("--project-id <id>", "Project ID").option("--force", "Force re-dispatch even if already running").action(async (nodeId, opts) => {
|
|
1016
|
+
cmd.command("dispatch <id>").description("Dispatch a task for execution").requiredOption("--project-id <id>", "Project ID").option("--force", "Force re-dispatch even if already running").option("--machine <id>", "Target machine ID").option("--model <model>", "AI model to use").option("--provider <provider>", "Preferred provider ID").option("--yolo", "Auto-approve all approval requests").option("--slurm", "Dispatch to Slurm cluster").option("--slurm-partition <p>", "Slurm partition").option("--slurm-gpus <n>", "Number of GPUs", parseInt).option("--slurm-gpu-type <t>", "GPU type (e.g. a100, v100)").option("--slurm-mem <m>", "Memory (e.g. 16G, 64G)").option("--slurm-time <t>", "Time limit (e.g. 1:00:00)").option("--slurm-nodes <n>", "Number of nodes", parseInt).option("--slurm-cpus <n>", "CPUs per task", parseInt).option("--slurm-qos <q>", "Quality of service").option("--slurm-account <a>", "Slurm account").option("--slurm-modules <m>", "Comma-separated modules to load").option("--cluster <id>", "Target Slurm cluster ID").action(async (nodeId, opts) => {
|
|
864
1017
|
const client = getClient(program2.opts().serverUrl);
|
|
1018
|
+
const isJson = program2.opts().json;
|
|
865
1019
|
console.log(chalk4.dim(`Dispatching task ${chalk4.bold(nodeId)} to server...`));
|
|
866
1020
|
console.log();
|
|
867
1021
|
try {
|
|
1022
|
+
if (opts.slurm) {
|
|
1023
|
+
const slurmConfig = {};
|
|
1024
|
+
if (opts.slurmPartition) slurmConfig.partition = opts.slurmPartition;
|
|
1025
|
+
if (opts.slurmNodes) slurmConfig.nodes = opts.slurmNodes;
|
|
1026
|
+
if (opts.slurmCpus) slurmConfig.cpusPerTask = opts.slurmCpus;
|
|
1027
|
+
if (opts.slurmMem) slurmConfig.mem = opts.slurmMem;
|
|
1028
|
+
if (opts.slurmTime) slurmConfig.time = opts.slurmTime;
|
|
1029
|
+
if (opts.slurmQos) slurmConfig.qos = opts.slurmQos;
|
|
1030
|
+
if (opts.slurmAccount) slurmConfig.account = opts.slurmAccount;
|
|
1031
|
+
if (opts.slurmModules) slurmConfig.modules = opts.slurmModules.split(",").map((s) => s.trim());
|
|
1032
|
+
if (opts.slurmGpus || opts.slurmGpuType) {
|
|
1033
|
+
slurmConfig.gpu = { count: opts.slurmGpus ?? 1, type: opts.slurmGpuType };
|
|
1034
|
+
}
|
|
1035
|
+
const response2 = await client.dispatchSlurmTask({
|
|
1036
|
+
task: {
|
|
1037
|
+
taskId: `exec-${nodeId}-${Date.now()}`,
|
|
1038
|
+
projectId: opts.projectId,
|
|
1039
|
+
nodeId,
|
|
1040
|
+
title: nodeId,
|
|
1041
|
+
preferredProvider: opts.provider
|
|
1042
|
+
},
|
|
1043
|
+
targetClusterId: opts.cluster,
|
|
1044
|
+
slurmConfig: Object.keys(slurmConfig).length > 0 ? slurmConfig : void 0
|
|
1045
|
+
});
|
|
1046
|
+
await streamDispatchToStdout(response2, { json: isJson });
|
|
1047
|
+
console.log();
|
|
1048
|
+
console.log(chalk4.green("Slurm dispatch complete."));
|
|
1049
|
+
return;
|
|
1050
|
+
}
|
|
1051
|
+
const approvalHandler = createApprovalHandler(client, !!opts.yolo);
|
|
868
1052
|
const response = await client.dispatchTask({
|
|
869
1053
|
nodeId,
|
|
870
1054
|
projectId: opts.projectId,
|
|
871
|
-
force: opts.force
|
|
1055
|
+
force: opts.force,
|
|
1056
|
+
targetMachineId: opts.machine,
|
|
1057
|
+
model: opts.model,
|
|
1058
|
+
preferredProvider: opts.provider
|
|
1059
|
+
});
|
|
1060
|
+
await streamDispatchToStdout(response, {
|
|
1061
|
+
json: isJson,
|
|
1062
|
+
onApprovalRequest: approvalHandler
|
|
872
1063
|
});
|
|
873
|
-
await streamDispatchToStdout(response);
|
|
874
1064
|
console.log();
|
|
875
1065
|
console.log(chalk4.green("Task dispatch complete."));
|
|
876
1066
|
} catch (err) {
|
|
@@ -878,6 +1068,70 @@ function registerTaskCommands(program2) {
|
|
|
878
1068
|
process.exitCode = 1;
|
|
879
1069
|
}
|
|
880
1070
|
});
|
|
1071
|
+
cmd.command("chat <nodeId>").description("Chat with AI about a specific task").requiredOption("--project-id <id>", "Project ID").requiredOption("--message <msg>", "Message to send").option("--session-id <sid>", "Resume existing session").option("--model <model>", "AI model to use").option("--provider <provider>", "Provider ID").option("--history-file <path>", "Path to conversation history JSON file").option("--yolo", "Auto-approve all approval requests").action(async (nodeId, cmdOpts) => {
|
|
1072
|
+
const client = getClient(program2.opts().serverUrl);
|
|
1073
|
+
const isJson = program2.opts().json;
|
|
1074
|
+
let node;
|
|
1075
|
+
try {
|
|
1076
|
+
const { nodes } = await client.getPlan(cmdOpts.projectId);
|
|
1077
|
+
node = nodes.find((n) => n.id === nodeId && !n.deletedAt);
|
|
1078
|
+
} catch (err) {
|
|
1079
|
+
console.error(chalk4.red(err.message));
|
|
1080
|
+
process.exitCode = 1;
|
|
1081
|
+
return;
|
|
1082
|
+
}
|
|
1083
|
+
if (!node) {
|
|
1084
|
+
console.error(chalk4.red(`Task not found: ${nodeId}`));
|
|
1085
|
+
process.exitCode = 1;
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1088
|
+
let visionDoc;
|
|
1089
|
+
try {
|
|
1090
|
+
const project = await client.getProject(cmdOpts.projectId);
|
|
1091
|
+
visionDoc = project.visionDoc || void 0;
|
|
1092
|
+
} catch {
|
|
1093
|
+
}
|
|
1094
|
+
let messages = [];
|
|
1095
|
+
if (cmdOpts.historyFile) {
|
|
1096
|
+
messages = loadHistory(cmdOpts.historyFile);
|
|
1097
|
+
}
|
|
1098
|
+
try {
|
|
1099
|
+
const response = await client.taskChat({
|
|
1100
|
+
message: cmdOpts.message,
|
|
1101
|
+
nodeId,
|
|
1102
|
+
projectId: cmdOpts.projectId,
|
|
1103
|
+
taskTitle: node.title,
|
|
1104
|
+
taskDescription: node.description || void 0,
|
|
1105
|
+
taskOutput: node.executionOutput || void 0,
|
|
1106
|
+
visionDoc,
|
|
1107
|
+
sessionId: cmdOpts.sessionId,
|
|
1108
|
+
model: cmdOpts.model,
|
|
1109
|
+
providerId: cmdOpts.provider,
|
|
1110
|
+
branchName: node.branchName || void 0,
|
|
1111
|
+
prUrl: node.prUrl || void 0,
|
|
1112
|
+
messages: messages.length > 0 ? messages : void 0
|
|
1113
|
+
});
|
|
1114
|
+
const approvalHandler = createApprovalHandler(client, !!cmdOpts.yolo);
|
|
1115
|
+
const result = await streamChatToStdout(response, {
|
|
1116
|
+
json: isJson,
|
|
1117
|
+
onApprovalRequest: approvalHandler
|
|
1118
|
+
});
|
|
1119
|
+
if (result.sessionId) {
|
|
1120
|
+
process.stderr.write(`
|
|
1121
|
+
${chalk4.dim(`Session: ${result.sessionId}`)}
|
|
1122
|
+
`);
|
|
1123
|
+
}
|
|
1124
|
+
if (cmdOpts.historyFile && result.assistantText) {
|
|
1125
|
+
messages.push({ role: "user", content: cmdOpts.message });
|
|
1126
|
+
messages.push({ role: "assistant", content: result.assistantText });
|
|
1127
|
+
saveHistory(cmdOpts.historyFile, messages);
|
|
1128
|
+
}
|
|
1129
|
+
console.log();
|
|
1130
|
+
} catch (err) {
|
|
1131
|
+
console.error(chalk4.red(`Chat failed: ${err instanceof Error ? err.message : String(err)}`));
|
|
1132
|
+
process.exitCode = 1;
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
881
1135
|
cmd.command("cancel <executionId>").description("Cancel a running task execution").option("--machine <id>", "Target machine ID").option("--node-id <id>", "Node ID").action(async (executionId, opts) => {
|
|
882
1136
|
const client = getClient(program2.opts().serverUrl);
|
|
883
1137
|
const isJson = program2.opts().json;
|
|
@@ -947,9 +1201,10 @@ function registerTaskCommands(program2) {
|
|
|
947
1201
|
process.exitCode = 1;
|
|
948
1202
|
}
|
|
949
1203
|
});
|
|
950
|
-
cmd.command("watch <executionId>").description("Watch real-time output from a running task via SSE").action(async (executionId) => {
|
|
1204
|
+
cmd.command("watch <executionId>").description("Watch real-time output from a running task via SSE").option("--yolo", "Auto-approve all approval requests").action(async (executionId, cmdOpts) => {
|
|
951
1205
|
const client = getClient(program2.opts().serverUrl);
|
|
952
1206
|
const isJson = program2.opts().json;
|
|
1207
|
+
const approvalHandler = createApprovalHandler(client, !!cmdOpts.yolo);
|
|
953
1208
|
try {
|
|
954
1209
|
const response = await client.streamEvents();
|
|
955
1210
|
if (!response.body) {
|
|
@@ -994,6 +1249,17 @@ ${chalk4.bold("--- Result:")} ${formatStatus(event.status ?? "unknown")} ${event
|
|
|
994
1249
|
case "task:stdout":
|
|
995
1250
|
process.stdout.write(event.data ?? "");
|
|
996
1251
|
break;
|
|
1252
|
+
case "task:approval_request": {
|
|
1253
|
+
const result = await approvalHandler({
|
|
1254
|
+
requestId: event.requestId,
|
|
1255
|
+
question: event.question,
|
|
1256
|
+
options: event.options,
|
|
1257
|
+
machineId: event.machineId,
|
|
1258
|
+
taskId: event.taskId
|
|
1259
|
+
});
|
|
1260
|
+
void result;
|
|
1261
|
+
break;
|
|
1262
|
+
}
|
|
997
1263
|
}
|
|
998
1264
|
} catch {
|
|
999
1265
|
}
|
|
@@ -2074,6 +2340,43 @@ function registerCompletionCommands(program2) {
|
|
|
2074
2340
|
});
|
|
2075
2341
|
}
|
|
2076
2342
|
|
|
2343
|
+
// src/commands/playground.ts
|
|
2344
|
+
import chalk11 from "chalk";
|
|
2345
|
+
function registerPlaygroundCommands(program2) {
|
|
2346
|
+
const playground = program2.command("playground").description("Run ephemeral AI executions");
|
|
2347
|
+
playground.command("start").description("Start a playground execution").requiredOption("--project-id <id>", "Project ID").requiredOption("--description <desc>", "What to execute").option("--dir <path>", "Working directory override").option("--model <model>", "AI model to use").option("--provider <provider>", "Preferred provider ID").option("--machine <id>", "Target machine ID").option("--yolo", "Auto-approve all approval requests").action(async (cmdOpts) => {
|
|
2348
|
+
const opts = program2.opts();
|
|
2349
|
+
const client = getClient(opts.serverUrl);
|
|
2350
|
+
const nodeId = `playground-${cmdOpts.projectId}-${Date.now()}`;
|
|
2351
|
+
console.log(chalk11.dim(`Starting playground execution ${chalk11.bold(nodeId)}...`));
|
|
2352
|
+
console.log();
|
|
2353
|
+
try {
|
|
2354
|
+
const response = await client.dispatchTask({
|
|
2355
|
+
nodeId,
|
|
2356
|
+
projectId: cmdOpts.projectId,
|
|
2357
|
+
skipSafetyCheck: true,
|
|
2358
|
+
description: cmdOpts.description,
|
|
2359
|
+
title: "Playground execution",
|
|
2360
|
+
model: cmdOpts.model,
|
|
2361
|
+
preferredProvider: cmdOpts.provider,
|
|
2362
|
+
targetMachineId: cmdOpts.machine,
|
|
2363
|
+
...cmdOpts.dir ? { workingDirectory: cmdOpts.dir } : {}
|
|
2364
|
+
});
|
|
2365
|
+
const approvalHandler = createApprovalHandler(client, !!cmdOpts.yolo);
|
|
2366
|
+
await streamDispatchToStdout(response, {
|
|
2367
|
+
json: opts.json,
|
|
2368
|
+
onApprovalRequest: approvalHandler
|
|
2369
|
+
});
|
|
2370
|
+
console.log();
|
|
2371
|
+
console.log(chalk11.green("Playground execution complete."));
|
|
2372
|
+
console.log(chalk11.dim(`For follow-up: astro-cli task chat ${nodeId} --project-id ${cmdOpts.projectId} --message "..."`));
|
|
2373
|
+
} catch (err) {
|
|
2374
|
+
console.error(chalk11.red(`Playground failed: ${err instanceof Error ? err.message : String(err)}`));
|
|
2375
|
+
process.exitCode = 1;
|
|
2376
|
+
}
|
|
2377
|
+
});
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2077
2380
|
// src/index.ts
|
|
2078
2381
|
var program = new Command();
|
|
2079
2382
|
program.name("astro-cli").description("CLI for managing Astro projects, plans, tasks, and environments").version("0.2.0").option("--json", "Machine-readable JSON output").option("--quiet", "Suppress spinners and decorative output").option("--server-url <url>", "Override server URL");
|
|
@@ -2087,6 +2390,7 @@ registerEnvCommands(program);
|
|
|
2087
2390
|
registerConfigCommands(program);
|
|
2088
2391
|
registerAuthCommands(program);
|
|
2089
2392
|
registerCompletionCommands(program);
|
|
2393
|
+
registerPlaygroundCommands(program);
|
|
2090
2394
|
program.command("tui").description("Launch interactive terminal UI").action(async () => {
|
|
2091
2395
|
const { launchTui } = await import("./tui.js");
|
|
2092
2396
|
await launchTui(program.opts().serverUrl);
|