komodo-cli 2.7.0 → 2.9.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.
- package/dist/index.js +26 -38
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -140,30 +140,43 @@ async function startInteractiveMode(projectPath) {
|
|
|
140
140
|
console.log(chalk.dim(" Type ") + chalk.hex("#d2ffd2")("help") + chalk.dim(" for commands, ") + chalk.hex("#d2ffd2")("exit") + chalk.dim(" to quit."));
|
|
141
141
|
console.log();
|
|
142
142
|
await updateChatContext(projectPath);
|
|
143
|
+
process.stdin.resume();
|
|
144
|
+
process.stdin.setEncoding("utf8");
|
|
143
145
|
const rl = readline.createInterface({
|
|
144
146
|
input: process.stdin,
|
|
145
|
-
output: process.stdout
|
|
146
|
-
|
|
147
|
-
rl.on("close", () => {
|
|
148
|
-
process.exit(0);
|
|
147
|
+
output: process.stdout,
|
|
148
|
+
terminal: process.stdin.isTTY ?? false
|
|
149
149
|
});
|
|
150
|
+
const showPrompt = () => {
|
|
151
|
+
process.stdout.write(chalk.hex("#5aff5a")("\u276F "));
|
|
152
|
+
};
|
|
153
|
+
const askQuestion = () => {
|
|
154
|
+
rl.once("line", (input) => {
|
|
155
|
+
handleInput(input).then(() => {
|
|
156
|
+
askQuestion();
|
|
157
|
+
}).catch((err) => {
|
|
158
|
+
console.error(chalk.red("\nError:"), err instanceof Error ? err.message : String(err));
|
|
159
|
+
console.log();
|
|
160
|
+
showPrompt();
|
|
161
|
+
askQuestion();
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
showPrompt();
|
|
165
|
+
};
|
|
150
166
|
const handleInput = async (input) => {
|
|
151
167
|
const trimmed = input.trim();
|
|
152
168
|
if (!trimmed) {
|
|
153
|
-
prompt();
|
|
154
169
|
return;
|
|
155
170
|
}
|
|
156
171
|
if (trimmed === "exit" || trimmed === "quit" || trimmed === "q") {
|
|
157
172
|
console.log();
|
|
158
173
|
console.log(chalk.hex("#a5ffa5")(" See you next time!"));
|
|
159
174
|
console.log();
|
|
160
|
-
rl.close();
|
|
161
175
|
process.exit(0);
|
|
162
176
|
}
|
|
163
177
|
if (trimmed === "clear" || trimmed === "cls") {
|
|
164
178
|
console.clear();
|
|
165
179
|
printBanner();
|
|
166
|
-
prompt();
|
|
167
180
|
return;
|
|
168
181
|
}
|
|
169
182
|
if (trimmed === "help" || trimmed === "?") {
|
|
@@ -185,83 +198,69 @@ async function startInteractiveMode(projectPath) {
|
|
|
185
198
|
console.log(` ${chalk.hex("#d2ffd2")("clear")} Clear screen`);
|
|
186
199
|
console.log(` ${chalk.hex("#d2ffd2")("exit")} Quit Komodo`);
|
|
187
200
|
console.log();
|
|
188
|
-
prompt();
|
|
189
201
|
return;
|
|
190
202
|
}
|
|
191
203
|
if (trimmed === "undo") {
|
|
192
204
|
await handleUndo(projectPath);
|
|
193
205
|
await updateChatContext(projectPath);
|
|
194
|
-
prompt();
|
|
195
206
|
return;
|
|
196
207
|
}
|
|
197
208
|
if (trimmed === "list" || trimmed === "ls") {
|
|
198
209
|
await handleList(projectPath);
|
|
199
|
-
prompt();
|
|
200
210
|
return;
|
|
201
211
|
}
|
|
202
212
|
if (trimmed === "check") {
|
|
203
213
|
await handleCheck(projectPath);
|
|
204
|
-
prompt();
|
|
205
214
|
return;
|
|
206
215
|
}
|
|
207
216
|
if (trimmed === "history") {
|
|
208
217
|
await handleHistory(projectPath);
|
|
209
|
-
prompt();
|
|
210
218
|
return;
|
|
211
219
|
}
|
|
212
220
|
if (trimmed === "doctor") {
|
|
213
221
|
await handleDoctor(projectPath);
|
|
214
|
-
prompt();
|
|
215
222
|
return;
|
|
216
223
|
}
|
|
217
224
|
if (trimmed === "optimize") {
|
|
218
225
|
await handleOptimize(projectPath);
|
|
219
|
-
prompt();
|
|
220
226
|
return;
|
|
221
227
|
}
|
|
222
228
|
if (trimmed === "tree") {
|
|
223
229
|
await handleTree(projectPath);
|
|
224
|
-
prompt();
|
|
225
230
|
return;
|
|
226
231
|
}
|
|
227
232
|
if (trimmed === "templates" || trimmed === "template") {
|
|
228
233
|
await handleTemplates();
|
|
229
|
-
prompt();
|
|
230
234
|
return;
|
|
231
235
|
}
|
|
232
236
|
if (trimmed.startsWith("template ") || trimmed.startsWith("use ")) {
|
|
233
237
|
const templateId = trimmed.replace(/^(template|use)\s+/, "").trim();
|
|
234
238
|
await handleUseTemplate(templateId, projectPath);
|
|
235
|
-
prompt();
|
|
236
239
|
return;
|
|
237
240
|
}
|
|
238
241
|
if (trimmed.startsWith("explain ")) {
|
|
239
242
|
const packageName = trimmed.slice(8).trim();
|
|
240
243
|
await handleExplain(packageName);
|
|
241
|
-
prompt();
|
|
242
244
|
return;
|
|
243
245
|
}
|
|
244
246
|
if (trimmed.startsWith("clone ") || trimmed.startsWith("setup ")) {
|
|
245
247
|
const url = trimmed.replace(/^(clone|setup)\s+/, "").trim();
|
|
246
248
|
await handleClone(url);
|
|
247
|
-
prompt();
|
|
248
249
|
return;
|
|
249
250
|
}
|
|
250
251
|
if (trimmed === "insights" || trimmed === "analytics") {
|
|
251
252
|
await handleInsights(projectPath);
|
|
252
|
-
prompt();
|
|
253
253
|
return;
|
|
254
254
|
}
|
|
255
255
|
if (trimmed === "ui") {
|
|
256
256
|
await handleUI(projectPath);
|
|
257
|
-
prompt();
|
|
258
257
|
return;
|
|
259
258
|
}
|
|
260
|
-
|
|
259
|
+
process.stdout.write(chalk.hex("#b4ffb4")(" Thinking...\r"));
|
|
261
260
|
try {
|
|
262
261
|
await updateChatContext(projectPath);
|
|
263
262
|
const response = await chat.chat(trimmed);
|
|
264
|
-
|
|
263
|
+
process.stdout.write(" \r");
|
|
265
264
|
const cleanMessage = stripMarkdown(response.message);
|
|
266
265
|
console.log();
|
|
267
266
|
console.log(chalk.hex("#b4ffb4")(cleanMessage));
|
|
@@ -274,27 +273,16 @@ async function startInteractiveMode(projectPath) {
|
|
|
274
273
|
}
|
|
275
274
|
}
|
|
276
275
|
} catch (error) {
|
|
277
|
-
|
|
276
|
+
process.stdout.write(" \r");
|
|
277
|
+
console.log(chalk.red(" Something went wrong"));
|
|
278
278
|
const errMsg = error instanceof Error ? error.message : "Unknown error";
|
|
279
279
|
console.log();
|
|
280
280
|
console.log(chalk.dim(" " + errMsg));
|
|
281
281
|
console.log(chalk.dim(" Try again or type 'help' for options."));
|
|
282
282
|
console.log();
|
|
283
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
|
-
});
|
|
295
|
-
});
|
|
296
284
|
};
|
|
297
|
-
|
|
285
|
+
askQuestion();
|
|
298
286
|
}
|
|
299
287
|
async function executePackageActions(packages, projectPath) {
|
|
300
288
|
const allActions = [
|
|
@@ -685,7 +673,7 @@ program.argument("[intent]", "What you want to build").option("-p, --path <path>
|
|
|
685
673
|
path: options.path,
|
|
686
674
|
dryRun: options.preview,
|
|
687
675
|
useAI: true,
|
|
688
|
-
apiKey:
|
|
676
|
+
apiKey: CEREBRAS_API_KEY,
|
|
689
677
|
onProgress: (message) => {
|
|
690
678
|
const friendly = friendlyMessage(message);
|
|
691
679
|
if (spinner.isSpinning) {
|