komodo-cli 2.6.0 → 2.7.0
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.
|
@@ -4993,7 +4993,11 @@ var CerebrasAI = class {
|
|
|
4993
4993
|
throw new Error(`Cerebras API error: ${response.status} - ${error}`);
|
|
4994
4994
|
}
|
|
4995
4995
|
const data = await response.json();
|
|
4996
|
-
|
|
4996
|
+
const content = data.choices[0]?.message?.content ?? "";
|
|
4997
|
+
if (!content) {
|
|
4998
|
+
throw new Error("Empty response from Cerebras API");
|
|
4999
|
+
}
|
|
5000
|
+
return content;
|
|
4997
5001
|
}
|
|
4998
5002
|
/**
|
|
4999
5003
|
* Analyze user intent and return comprehensive package recommendations
|
|
@@ -5301,7 +5305,11 @@ Only include actions when there are actual packages to change. Your conversation
|
|
|
5301
5305
|
throw new Error(`API error: ${response.status} - ${error}`);
|
|
5302
5306
|
}
|
|
5303
5307
|
const data = await response.json();
|
|
5304
|
-
|
|
5308
|
+
const content = data.choices[0]?.message?.content ?? "";
|
|
5309
|
+
if (!content) {
|
|
5310
|
+
throw new Error("Empty response from AI - try again");
|
|
5311
|
+
}
|
|
5312
|
+
return content;
|
|
5305
5313
|
}
|
|
5306
5314
|
parseResponse(response) {
|
|
5307
5315
|
const result = {
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
runDoctor,
|
|
32
32
|
searchTemplates,
|
|
33
33
|
visualizeTree
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-GGBZF72M.js";
|
|
35
35
|
|
|
36
36
|
// src/index.ts
|
|
37
37
|
import { Command } from "commander";
|
|
@@ -144,142 +144,154 @@ async function startInteractiveMode(projectPath) {
|
|
|
144
144
|
input: process.stdin,
|
|
145
145
|
output: process.stdout
|
|
146
146
|
});
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
147
|
+
rl.on("close", () => {
|
|
148
|
+
process.exit(0);
|
|
149
|
+
});
|
|
150
|
+
const handleInput = async (input) => {
|
|
151
|
+
const trimmed = input.trim();
|
|
152
|
+
if (!trimmed) {
|
|
153
|
+
prompt();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (trimmed === "exit" || trimmed === "quit" || trimmed === "q") {
|
|
157
|
+
console.log();
|
|
158
|
+
console.log(chalk.hex("#a5ffa5")(" See you next time!"));
|
|
159
|
+
console.log();
|
|
160
|
+
rl.close();
|
|
161
|
+
process.exit(0);
|
|
162
|
+
}
|
|
163
|
+
if (trimmed === "clear" || trimmed === "cls") {
|
|
164
|
+
console.clear();
|
|
165
|
+
printBanner();
|
|
166
|
+
prompt();
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (trimmed === "help" || trimmed === "?") {
|
|
170
|
+
console.log();
|
|
171
|
+
console.log(chalk.hex("#a5ffa5")(" Just type what you want in plain English:"));
|
|
172
|
+
console.log(chalk.dim(' "set up a venv to train llada 8b"'));
|
|
173
|
+
console.log(chalk.dim(' "install pytorch and transformers"'));
|
|
174
|
+
console.log(chalk.dim(' "what packages are installed?"'));
|
|
175
|
+
console.log(chalk.dim(' "are there any conflicts?"'));
|
|
176
|
+
console.log();
|
|
177
|
+
console.log(chalk.hex("#a5ffa5")(" Shortcuts:"));
|
|
178
|
+
console.log(` ${chalk.hex("#d2ffd2")("list")} See installed packages`);
|
|
179
|
+
console.log(` ${chalk.hex("#d2ffd2")("check")} Check for problems`);
|
|
180
|
+
console.log(` ${chalk.hex("#d2ffd2")("fix")} Auto-repair environment`);
|
|
181
|
+
console.log(` ${chalk.hex("#d2ffd2")("conflicts")} Find package conflicts`);
|
|
182
|
+
console.log(` ${chalk.hex("#d2ffd2")("doctor")} Full health audit`);
|
|
183
|
+
console.log(` ${chalk.hex("#d2ffd2")("tree")} Dependency tree`);
|
|
184
|
+
console.log(` ${chalk.hex("#d2ffd2")("undo")} Undo last change`);
|
|
185
|
+
console.log(` ${chalk.hex("#d2ffd2")("clear")} Clear screen`);
|
|
186
|
+
console.log(` ${chalk.hex("#d2ffd2")("exit")} Quit Komodo`);
|
|
187
|
+
console.log();
|
|
188
|
+
prompt();
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if (trimmed === "undo") {
|
|
192
|
+
await handleUndo(projectPath);
|
|
193
|
+
await updateChatContext(projectPath);
|
|
194
|
+
prompt();
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (trimmed === "list" || trimmed === "ls") {
|
|
198
|
+
await handleList(projectPath);
|
|
199
|
+
prompt();
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
if (trimmed === "check") {
|
|
203
|
+
await handleCheck(projectPath);
|
|
204
|
+
prompt();
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (trimmed === "history") {
|
|
208
|
+
await handleHistory(projectPath);
|
|
209
|
+
prompt();
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
if (trimmed === "doctor") {
|
|
213
|
+
await handleDoctor(projectPath);
|
|
214
|
+
prompt();
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
if (trimmed === "optimize") {
|
|
218
|
+
await handleOptimize(projectPath);
|
|
219
|
+
prompt();
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
if (trimmed === "tree") {
|
|
223
|
+
await handleTree(projectPath);
|
|
224
|
+
prompt();
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
if (trimmed === "templates" || trimmed === "template") {
|
|
228
|
+
await handleTemplates();
|
|
229
|
+
prompt();
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
if (trimmed.startsWith("template ") || trimmed.startsWith("use ")) {
|
|
233
|
+
const templateId = trimmed.replace(/^(template|use)\s+/, "").trim();
|
|
234
|
+
await handleUseTemplate(templateId, projectPath);
|
|
235
|
+
prompt();
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (trimmed.startsWith("explain ")) {
|
|
239
|
+
const packageName = trimmed.slice(8).trim();
|
|
240
|
+
await handleExplain(packageName);
|
|
241
|
+
prompt();
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
if (trimmed.startsWith("clone ") || trimmed.startsWith("setup ")) {
|
|
245
|
+
const url = trimmed.replace(/^(clone|setup)\s+/, "").trim();
|
|
246
|
+
await handleClone(url);
|
|
247
|
+
prompt();
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
if (trimmed === "insights" || trimmed === "analytics") {
|
|
251
|
+
await handleInsights(projectPath);
|
|
252
|
+
prompt();
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (trimmed === "ui") {
|
|
256
|
+
await handleUI(projectPath);
|
|
257
|
+
prompt();
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
const spinner = ora(chalk.hex("#b4ffb4")("Thinking...")).start();
|
|
261
|
+
try {
|
|
262
|
+
await updateChatContext(projectPath);
|
|
263
|
+
const response = await chat.chat(trimmed);
|
|
264
|
+
spinner.stop();
|
|
265
|
+
const cleanMessage = stripMarkdown(response.message);
|
|
266
|
+
console.log();
|
|
267
|
+
console.log(chalk.hex("#b4ffb4")(cleanMessage));
|
|
268
|
+
console.log();
|
|
269
|
+
if (response.packages) {
|
|
270
|
+
const hasActions = response.packages.toInstall && response.packages.toInstall.length > 0 || response.packages.toRemove && response.packages.toRemove.length > 0 || response.packages.toUpdate && response.packages.toUpdate.length > 0;
|
|
271
|
+
if (hasActions) {
|
|
272
|
+
await executePackageActions(response.packages, projectPath);
|
|
273
|
+
await updateChatContext(projectPath);
|
|
273
274
|
}
|
|
274
|
-
} catch (error) {
|
|
275
|
-
spinner.fail(chalk.red("Something went wrong"));
|
|
276
|
-
const errMsg = error instanceof Error ? error.message : "Unknown error";
|
|
277
|
-
console.log();
|
|
278
|
-
console.log(chalk.dim(" " + errMsg));
|
|
279
|
-
console.log(chalk.dim(" Try again or type 'help' for options."));
|
|
280
|
-
console.log();
|
|
281
275
|
}
|
|
282
|
-
|
|
276
|
+
} catch (error) {
|
|
277
|
+
spinner.fail(chalk.red("Something went wrong"));
|
|
278
|
+
const errMsg = error instanceof Error ? error.message : "Unknown error";
|
|
279
|
+
console.log();
|
|
280
|
+
console.log(chalk.dim(" " + errMsg));
|
|
281
|
+
console.log(chalk.dim(" Try again or type 'help' for options."));
|
|
282
|
+
console.log();
|
|
283
|
+
}
|
|
284
|
+
prompt();
|
|
285
|
+
};
|
|
286
|
+
const prompt = () => {
|
|
287
|
+
if (rl.closed) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
rl.question(chalk.hex("#5aff5a")("\u276F "), (input) => {
|
|
291
|
+
handleInput(input).catch((err) => {
|
|
292
|
+
console.error(chalk.red("Error:"), err);
|
|
293
|
+
prompt();
|
|
294
|
+
});
|
|
283
295
|
});
|
|
284
296
|
};
|
|
285
297
|
prompt();
|
|
@@ -635,7 +647,7 @@ async function handleUI(projectPath) {
|
|
|
635
647
|
console.log();
|
|
636
648
|
console.log(chalk.hex("#b4ffb4").dim(" Starting dashboard..."));
|
|
637
649
|
try {
|
|
638
|
-
const { startServer } = await import("./server-
|
|
650
|
+
const { startServer } = await import("./server-JOKWCY3W.js");
|
|
639
651
|
await startServer(projectPath, port);
|
|
640
652
|
console.log(chalk.hex("#5aff5a")(` \u2713 Dashboard ready at ${chalk.bold(url)}`));
|
|
641
653
|
console.log();
|
|
@@ -964,7 +976,7 @@ program.command("ui").description("Open the visual dashboard").option("-p, --pat
|
|
|
964
976
|
const url = `http://localhost:${port}`;
|
|
965
977
|
console.log(chalk.dim(" Starting dashboard..."));
|
|
966
978
|
try {
|
|
967
|
-
const { startServer } = await import("./server-
|
|
979
|
+
const { startServer } = await import("./server-JOKWCY3W.js");
|
|
968
980
|
await startServer(options.path, port);
|
|
969
981
|
console.log();
|
|
970
982
|
console.log(chalk.green(` \u2713 Dashboard ready at ${chalk.bold(url)}`));
|