komodo-cli 2.6.0 → 2.8.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";
|
|
@@ -131,21 +131,36 @@ function stripMarkdown(text) {
|
|
|
131
131
|
return text.replace(/```[\s\S]*?```/g, "").replace(/`([^`]+)`/g, "$1").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\*([^*]+)\*/g, "$1").replace(/__([^_]+)__/g, "$1").replace(/_([^_]+)_/g, "$1").replace(/^#{1,6}\s+/gm, "").replace(/^\s*[-*+]\s+/gm, " - ").replace(/^\s*\d+\.\s+/gm, (m) => m).replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/\n{3,}/g, "\n\n").trim();
|
|
132
132
|
}
|
|
133
133
|
async function startInteractiveMode(projectPath) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
rl.
|
|
134
|
+
try {
|
|
135
|
+
printBanner();
|
|
136
|
+
const hardware = komodo.getHardware();
|
|
137
|
+
console.log(chalk.hex("#b4ffb4").dim(` ${formatOs(hardware.os)} \xB7 ${formatGpu(hardware)} \xB7 ${hardware.totalMemoryGb}GB memory`));
|
|
138
|
+
console.log();
|
|
139
|
+
console.log(chalk.dim(" Type anything naturally. Komodo understands what you need."));
|
|
140
|
+
console.log(chalk.dim(` Try: "set up a venv for pytorch" or "what's installed?"`));
|
|
141
|
+
console.log(chalk.dim(" Type ") + chalk.hex("#d2ffd2")("help") + chalk.dim(" for commands, ") + chalk.hex("#d2ffd2")("exit") + chalk.dim(" to quit."));
|
|
142
|
+
console.log();
|
|
143
|
+
await updateChatContext(projectPath);
|
|
144
|
+
const rl = readline.createInterface({
|
|
145
|
+
input: process.stdin,
|
|
146
|
+
output: process.stdout
|
|
147
|
+
});
|
|
148
|
+
rl.on("close", () => {
|
|
149
|
+
process.exit(0);
|
|
150
|
+
});
|
|
151
|
+
process.on("unhandledRejection", (reason) => {
|
|
152
|
+
console.error(chalk.red("\n[DEBUG] Unhandled rejection:"), reason);
|
|
153
|
+
if (!rl.closed) {
|
|
154
|
+
prompt();
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
process.on("uncaughtException", (error) => {
|
|
158
|
+
console.error(chalk.red("\n[DEBUG] Uncaught exception:"), error);
|
|
159
|
+
if (!rl.closed) {
|
|
160
|
+
prompt();
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
const handleInput = async (input) => {
|
|
149
164
|
const trimmed = input.trim();
|
|
150
165
|
if (!trimmed) {
|
|
151
166
|
prompt();
|
|
@@ -280,9 +295,28 @@ async function startInteractiveMode(projectPath) {
|
|
|
280
295
|
console.log();
|
|
281
296
|
}
|
|
282
297
|
prompt();
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
|
|
298
|
+
};
|
|
299
|
+
const prompt = () => {
|
|
300
|
+
if (rl.closed) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
rl.question(chalk.hex("#5aff5a")("\u276F "), (input) => {
|
|
304
|
+
handleInput(input).catch((err) => {
|
|
305
|
+
console.error(chalk.red("\nError:"), err instanceof Error ? err.message : String(err));
|
|
306
|
+
console.log();
|
|
307
|
+
prompt();
|
|
308
|
+
}).catch(() => {
|
|
309
|
+
if (!rl.closed) {
|
|
310
|
+
prompt();
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
};
|
|
315
|
+
prompt();
|
|
316
|
+
} catch (error) {
|
|
317
|
+
console.error(chalk.red("Fatal error:"), error instanceof Error ? error.message : String(error));
|
|
318
|
+
process.exit(1);
|
|
319
|
+
}
|
|
286
320
|
}
|
|
287
321
|
async function executePackageActions(packages, projectPath) {
|
|
288
322
|
const allActions = [
|
|
@@ -635,7 +669,7 @@ async function handleUI(projectPath) {
|
|
|
635
669
|
console.log();
|
|
636
670
|
console.log(chalk.hex("#b4ffb4").dim(" Starting dashboard..."));
|
|
637
671
|
try {
|
|
638
|
-
const { startServer } = await import("./server-
|
|
672
|
+
const { startServer } = await import("./server-JOKWCY3W.js");
|
|
639
673
|
await startServer(projectPath, port);
|
|
640
674
|
console.log(chalk.hex("#5aff5a")(` \u2713 Dashboard ready at ${chalk.bold(url)}`));
|
|
641
675
|
console.log();
|
|
@@ -964,7 +998,7 @@ program.command("ui").description("Open the visual dashboard").option("-p, --pat
|
|
|
964
998
|
const url = `http://localhost:${port}`;
|
|
965
999
|
console.log(chalk.dim(" Starting dashboard..."));
|
|
966
1000
|
try {
|
|
967
|
-
const { startServer } = await import("./server-
|
|
1001
|
+
const { startServer } = await import("./server-JOKWCY3W.js");
|
|
968
1002
|
await startServer(options.path, port);
|
|
969
1003
|
console.log();
|
|
970
1004
|
console.log(chalk.green(` \u2713 Dashboard ready at ${chalk.bold(url)}`));
|