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
- return data.choices[0]?.message?.content ?? "";
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
- return data.choices[0]?.message?.content ?? "";
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-7BIJZKAM.js";
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
- const prompt = () => {
148
- rl.question(chalk.hex("#5aff5a")("\u276F "), async (input) => {
149
- const trimmed = input.trim();
150
- if (!trimmed) {
151
- prompt();
152
- return;
153
- }
154
- if (trimmed === "exit" || trimmed === "quit" || trimmed === "q") {
155
- console.log();
156
- console.log(chalk.hex("#a5ffa5")(" See you next time!"));
157
- console.log();
158
- rl.close();
159
- process.exit(0);
160
- }
161
- if (trimmed === "clear" || trimmed === "cls") {
162
- console.clear();
163
- printBanner();
164
- prompt();
165
- return;
166
- }
167
- if (trimmed === "help" || trimmed === "?") {
168
- console.log();
169
- console.log(chalk.hex("#a5ffa5")(" Just type what you want in plain English:"));
170
- console.log(chalk.dim(' "set up a venv to train llada 8b"'));
171
- console.log(chalk.dim(' "install pytorch and transformers"'));
172
- console.log(chalk.dim(' "what packages are installed?"'));
173
- console.log(chalk.dim(' "are there any conflicts?"'));
174
- console.log();
175
- console.log(chalk.hex("#a5ffa5")(" Shortcuts:"));
176
- console.log(` ${chalk.hex("#d2ffd2")("list")} See installed packages`);
177
- console.log(` ${chalk.hex("#d2ffd2")("check")} Check for problems`);
178
- console.log(` ${chalk.hex("#d2ffd2")("fix")} Auto-repair environment`);
179
- console.log(` ${chalk.hex("#d2ffd2")("conflicts")} Find package conflicts`);
180
- console.log(` ${chalk.hex("#d2ffd2")("doctor")} Full health audit`);
181
- console.log(` ${chalk.hex("#d2ffd2")("tree")} Dependency tree`);
182
- console.log(` ${chalk.hex("#d2ffd2")("undo")} Undo last change`);
183
- console.log(` ${chalk.hex("#d2ffd2")("clear")} Clear screen`);
184
- console.log(` ${chalk.hex("#d2ffd2")("exit")} Quit Komodo`);
185
- console.log();
186
- prompt();
187
- return;
188
- }
189
- if (trimmed === "undo") {
190
- await handleUndo(projectPath);
191
- await updateChatContext(projectPath);
192
- prompt();
193
- return;
194
- }
195
- if (trimmed === "list" || trimmed === "ls") {
196
- await handleList(projectPath);
197
- prompt();
198
- return;
199
- }
200
- if (trimmed === "check") {
201
- await handleCheck(projectPath);
202
- prompt();
203
- return;
204
- }
205
- if (trimmed === "history") {
206
- await handleHistory(projectPath);
207
- prompt();
208
- return;
209
- }
210
- if (trimmed === "doctor") {
211
- await handleDoctor(projectPath);
212
- prompt();
213
- return;
214
- }
215
- if (trimmed === "optimize") {
216
- await handleOptimize(projectPath);
217
- prompt();
218
- return;
219
- }
220
- if (trimmed === "tree") {
221
- await handleTree(projectPath);
222
- prompt();
223
- return;
224
- }
225
- if (trimmed === "templates" || trimmed === "template") {
226
- await handleTemplates();
227
- prompt();
228
- return;
229
- }
230
- if (trimmed.startsWith("template ") || trimmed.startsWith("use ")) {
231
- const templateId = trimmed.replace(/^(template|use)\s+/, "").trim();
232
- await handleUseTemplate(templateId, projectPath);
233
- prompt();
234
- return;
235
- }
236
- if (trimmed.startsWith("explain ")) {
237
- const packageName = trimmed.slice(8).trim();
238
- await handleExplain(packageName);
239
- prompt();
240
- return;
241
- }
242
- if (trimmed.startsWith("clone ") || trimmed.startsWith("setup ")) {
243
- const url = trimmed.replace(/^(clone|setup)\s+/, "").trim();
244
- await handleClone(url);
245
- prompt();
246
- return;
247
- }
248
- if (trimmed === "insights" || trimmed === "analytics") {
249
- await handleInsights(projectPath);
250
- prompt();
251
- return;
252
- }
253
- if (trimmed === "ui") {
254
- await handleUI(projectPath);
255
- prompt();
256
- return;
257
- }
258
- const spinner = ora(chalk.hex("#b4ffb4")("Thinking...")).start();
259
- try {
260
- await updateChatContext(projectPath);
261
- const response = await chat.chat(trimmed);
262
- spinner.stop();
263
- const cleanMessage = stripMarkdown(response.message);
264
- console.log();
265
- console.log(chalk.hex("#b4ffb4")(cleanMessage));
266
- console.log();
267
- if (response.packages) {
268
- 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;
269
- if (hasActions) {
270
- await executePackageActions(response.packages, projectPath);
271
- await updateChatContext(projectPath);
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
- prompt();
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-EPYAUU24.js");
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-EPYAUU24.js");
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)}`));
@@ -7,7 +7,7 @@ import {
7
7
  detectConflicts,
8
8
  getInstalledPackages,
9
9
  loadState
10
- } from "./chunk-7BIJZKAM.js";
10
+ } from "./chunk-GGBZF72M.js";
11
11
 
12
12
  // ../../node_modules/.pnpm/reusify@1.1.0/node_modules/reusify/reusify.js
13
13
  var require_reusify = __commonJS({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "komodo-cli",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "The simple way to set up your project. Just say what you want to build.",
5
5
  "type": "module",
6
6
  "bin": {