agdi 2.8.0 → 2.8.5
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 +98 -28
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -392,6 +392,12 @@ var flags = {
|
|
|
392
392
|
function setFlags(newFlags) {
|
|
393
393
|
Object.assign(flags, newFlags);
|
|
394
394
|
}
|
|
395
|
+
var GracefulExitError = class extends Error {
|
|
396
|
+
constructor() {
|
|
397
|
+
super("Process exiting");
|
|
398
|
+
this.name = "GracefulExitError";
|
|
399
|
+
}
|
|
400
|
+
};
|
|
395
401
|
function safeExit(code = 0) {
|
|
396
402
|
if (activeReadlineInterface) {
|
|
397
403
|
try {
|
|
@@ -404,7 +410,7 @@ function safeExit(code = 0) {
|
|
|
404
410
|
setImmediate(() => {
|
|
405
411
|
process.exit(code);
|
|
406
412
|
});
|
|
407
|
-
throw new
|
|
413
|
+
throw new GracefulExitError();
|
|
408
414
|
}
|
|
409
415
|
async function smartConfirm(message, defaultValue = false) {
|
|
410
416
|
if (flags.yes || flags.headless || process.env.CI === "true" || process.env.CI === "1") {
|
|
@@ -1392,8 +1398,11 @@ import { select as select2, password as password2 } from "@inquirer/prompts";
|
|
|
1392
1398
|
import chalk8 from "chalk";
|
|
1393
1399
|
var PROVIDER_MODELS = {
|
|
1394
1400
|
gemini: [
|
|
1395
|
-
{ name: "\
|
|
1396
|
-
{ name: "\
|
|
1401
|
+
{ name: "\u{1F9E0} Gemini 3 Pro (Most Intelligent)", value: "gemini-3-pro-preview" },
|
|
1402
|
+
{ name: "\u26A1 Gemini 3 Flash (Fast)", value: "gemini-3-flash-preview" },
|
|
1403
|
+
{ name: "\u{1F914} Gemini 3 Deep Think (Reasoning)", value: "gemini-3-deep-think" },
|
|
1404
|
+
{ name: "\u{1F680} Gemini 2.5 Pro", value: "gemini-2.5-pro" },
|
|
1405
|
+
{ name: "\u{1F4A8} Gemini 2.5 Flash", value: "gemini-2.5-flash" },
|
|
1397
1406
|
{ name: "\u{1F48E} Gemini 2.0 Flash", value: "gemini-2.0-flash" }
|
|
1398
1407
|
],
|
|
1399
1408
|
openrouter: [
|
|
@@ -1417,6 +1426,13 @@ var PROVIDER_MODELS = {
|
|
|
1417
1426
|
{ name: "\u{1F916} Mistral Large", value: "mistral/mistral-large-latest" }
|
|
1418
1427
|
],
|
|
1419
1428
|
openai: [
|
|
1429
|
+
{ name: "\u{1F9E0} GPT-5.2 (Flagship)", value: "gpt-5.2" },
|
|
1430
|
+
{ name: "\u26A1 GPT-5.2 Instant", value: "gpt-5.2-instant" },
|
|
1431
|
+
{ name: "\u{1F914} GPT-5.2 Thinking (Reasoning)", value: "gpt-5.2-thinking" },
|
|
1432
|
+
{ name: "\u{1F4BB} GPT-5.2 Codex (Coding)", value: "gpt-5.2-codex" },
|
|
1433
|
+
{ name: "\u{1F680} GPT-5.1", value: "gpt-5.1" },
|
|
1434
|
+
{ name: "\u{1F4A8} GPT-5.1 Instant", value: "gpt-5.1-instant" },
|
|
1435
|
+
{ name: "\u{1F527} GPT-5.1 Codex Max", value: "gpt-5.1-codex-max" },
|
|
1420
1436
|
{ name: "\u{1F48E} GPT-4o", value: "gpt-4o" },
|
|
1421
1437
|
{ name: "\u26A1 GPT-4o Mini", value: "gpt-4o-mini" },
|
|
1422
1438
|
{ name: "\u{1F9E0} o1", value: "o1" },
|
|
@@ -1451,7 +1467,7 @@ function getActiveProvider() {
|
|
|
1451
1467
|
return {
|
|
1452
1468
|
provider,
|
|
1453
1469
|
apiKey,
|
|
1454
|
-
model: config.defaultModel || PROVIDER_MODELS[provider]?.[0]?.value || "gemini-
|
|
1470
|
+
model: config.defaultModel || PROVIDER_MODELS[provider]?.[0]?.value || "gemini-3-flash-preview"
|
|
1455
1471
|
};
|
|
1456
1472
|
}
|
|
1457
1473
|
for (const [p, key] of Object.entries(keyMap)) {
|
|
@@ -1459,7 +1475,7 @@ function getActiveProvider() {
|
|
|
1459
1475
|
return {
|
|
1460
1476
|
provider: p,
|
|
1461
1477
|
apiKey: key,
|
|
1462
|
-
model: config.defaultModel || PROVIDER_MODELS[p]?.[0]?.value || "gemini-
|
|
1478
|
+
model: config.defaultModel || PROVIDER_MODELS[p]?.[0]?.value || "gemini-3-flash-preview"
|
|
1463
1479
|
};
|
|
1464
1480
|
}
|
|
1465
1481
|
}
|
|
@@ -3199,10 +3215,16 @@ Target: ${env.workspaceRoot}`
|
|
|
3199
3215
|
"\u26A0\uFE0F DANGEROUS COMMANDS DETECTED",
|
|
3200
3216
|
dangerousActions.map((a) => `\u2022 ${a.argv.join(" ")}`).join("\n") + "\n\nThese commands can modify your system or delete files."
|
|
3201
3217
|
);
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3218
|
+
let allowDangerous = false;
|
|
3219
|
+
let validResponse = false;
|
|
3220
|
+
while (!validResponse) {
|
|
3221
|
+
const response = await confirm({
|
|
3222
|
+
message: 'Type "yes" to execute or "no" to cancel',
|
|
3223
|
+
default: false
|
|
3224
|
+
});
|
|
3225
|
+
allowDangerous = response;
|
|
3226
|
+
validResponse = true;
|
|
3227
|
+
}
|
|
3206
3228
|
if (!allowDangerous) {
|
|
3207
3229
|
console.log(chalk11.yellow("\n\u{1F44B} Execution cancelled for safety.\n"));
|
|
3208
3230
|
return { success: false, results, filesCreated, commandsRun, errors: ["User cancelled dangerous commands"] };
|
|
@@ -4220,6 +4242,22 @@ function getMemoryStats() {
|
|
|
4220
4242
|
}
|
|
4221
4243
|
|
|
4222
4244
|
// src/commands/agdi-dev.ts
|
|
4245
|
+
async function collectMultiLineInput(message) {
|
|
4246
|
+
console.log(chalk13.cyan.bold(message) + chalk13.gray(" (paste text, press Enter on empty line to submit)"));
|
|
4247
|
+
const lines = [];
|
|
4248
|
+
while (true) {
|
|
4249
|
+
const line = await input5({ message: chalk13.gray("\u2502 ") });
|
|
4250
|
+
if (line.trim() === "") {
|
|
4251
|
+
if (lines.length > 0) break;
|
|
4252
|
+
continue;
|
|
4253
|
+
}
|
|
4254
|
+
lines.push(line);
|
|
4255
|
+
if (lines.length === 1 && line.trim().startsWith("/")) {
|
|
4256
|
+
break;
|
|
4257
|
+
}
|
|
4258
|
+
}
|
|
4259
|
+
return lines.join("\n").trim();
|
|
4260
|
+
}
|
|
4223
4261
|
var multiAgentMode = false;
|
|
4224
4262
|
var BASE_CHAT_PROMPT = `You are Agdi dev, an elite AI coding assistant. You help developers write code, debug issues, and build applications.
|
|
4225
4263
|
|
|
@@ -4276,14 +4314,6 @@ Instead, output a single JSON object with this exact structure:
|
|
|
4276
4314
|
- writeFile: { type: "writeFile", path: "relative/path/file.ts", content: "file contents" }
|
|
4277
4315
|
- deleteFile: { type: "deleteFile", path: "relative/path/file.ts" }
|
|
4278
4316
|
- exec: { type: "exec", argv: ["command", "arg1", "arg2"], cwd: "." }
|
|
4279
|
-
- generateImage: { type: "generateImage", prompt: "description of image", savePath: "public/hero.png", style: "tech" }
|
|
4280
|
-
|
|
4281
|
-
## Image Generation
|
|
4282
|
-
For landing pages, portfolios, or apps that need visuals, use generateImage actions:
|
|
4283
|
-
- style options: "realistic", "artistic", "minimal", "tech"
|
|
4284
|
-
- Save to public/ folder (e.g., public/hero.png, public/logo.png)
|
|
4285
|
-
- Use descriptive prompts based on the project type
|
|
4286
|
-
- Example: { type: "generateImage", prompt: "Modern tech startup hero image, abstract blue gradient", savePath: "public/hero.png", style: "tech" }
|
|
4287
4317
|
|
|
4288
4318
|
## Rules
|
|
4289
4319
|
1. All paths MUST be relative to workspace root (no leading /)
|
|
@@ -4293,7 +4323,7 @@ For landing pages, portfolios, or apps that need visuals, use generateImage acti
|
|
|
4293
4323
|
5. Create complete, production-ready code
|
|
4294
4324
|
6. Use TypeScript by default
|
|
4295
4325
|
7. Include proper error handling
|
|
4296
|
-
8. For
|
|
4326
|
+
8. For images, use placeholder URLs or instruct user to add images later
|
|
4297
4327
|
9. Output ONLY the JSON object, no extra text`;
|
|
4298
4328
|
async function startCodingMode() {
|
|
4299
4329
|
const activeConfig = getActiveProvider();
|
|
@@ -4324,9 +4354,7 @@ Context: ${isGitRepo() ? chalk13.green("Git Repository") : chalk13.gray("Local
|
|
|
4324
4354
|
conversation.setSystemPrompt(buildContextAwarePrompt());
|
|
4325
4355
|
while (true) {
|
|
4326
4356
|
try {
|
|
4327
|
-
const userInput = await
|
|
4328
|
-
message: chalk13.cyan.bold("\u{1F464} YOU \u203A")
|
|
4329
|
-
});
|
|
4357
|
+
const userInput = await collectMultiLineInput("\u{1F464} YOU \u203A");
|
|
4330
4358
|
const trimmed = userInput.trim().toLowerCase();
|
|
4331
4359
|
if (trimmed === "/exit" || trimmed === "exit" || trimmed === "quit") {
|
|
4332
4360
|
logSessionEnd();
|
|
@@ -4866,7 +4894,7 @@ ${chalk15.cyan(`/_/ |_|\\_, /\\__,_//_/ `)}
|
|
|
4866
4894
|
${chalk15.cyan(` /____/ `)}
|
|
4867
4895
|
`;
|
|
4868
4896
|
var program = new Command();
|
|
4869
|
-
program.name("agdi").description(chalk15.cyan("\u{1F680} AI-powered coding assistant")).version("2.8.
|
|
4897
|
+
program.name("agdi").description(chalk15.cyan("\u{1F680} AI-powered coding assistant")).version("2.8.5").option("-y, --yes", "Auto-approve all prompts (headless/CI mode)").option("-m, --minimal", "Generate only the requested file(s), not a full app").option("-d, --dry-run", "Show what would be created without writing files");
|
|
4870
4898
|
program.hook("preAction", (thisCommand) => {
|
|
4871
4899
|
const opts = thisCommand.opts();
|
|
4872
4900
|
if (opts.yes) {
|
|
@@ -4892,7 +4920,14 @@ program.action(async () => {
|
|
|
4892
4920
|
} catch (error) {
|
|
4893
4921
|
if (error.name === "ExitPromptError") {
|
|
4894
4922
|
console.log(chalk15.gray("\n\n\u{1F44B} Goodbye!\n"));
|
|
4895
|
-
|
|
4923
|
+
try {
|
|
4924
|
+
ui.safeExit(0);
|
|
4925
|
+
} catch {
|
|
4926
|
+
}
|
|
4927
|
+
return;
|
|
4928
|
+
}
|
|
4929
|
+
if (error.name === "GracefulExitError") {
|
|
4930
|
+
return;
|
|
4896
4931
|
}
|
|
4897
4932
|
throw error;
|
|
4898
4933
|
}
|
|
@@ -4907,7 +4942,14 @@ program.command("auth").description("Configure API keys").option("--status", "Sh
|
|
|
4907
4942
|
} catch (error) {
|
|
4908
4943
|
if (error.name === "ExitPromptError") {
|
|
4909
4944
|
console.log(chalk15.gray("\n\n\u{1F44B} Cancelled.\n"));
|
|
4910
|
-
|
|
4945
|
+
try {
|
|
4946
|
+
ui.safeExit(0);
|
|
4947
|
+
} catch {
|
|
4948
|
+
}
|
|
4949
|
+
return;
|
|
4950
|
+
}
|
|
4951
|
+
if (error.name === "GracefulExitError") {
|
|
4952
|
+
return;
|
|
4911
4953
|
}
|
|
4912
4954
|
throw error;
|
|
4913
4955
|
}
|
|
@@ -4918,7 +4960,14 @@ program.command("model").alias("models").description("Change AI model").action(a
|
|
|
4918
4960
|
} catch (error) {
|
|
4919
4961
|
if (error.name === "ExitPromptError") {
|
|
4920
4962
|
console.log(chalk15.gray("\n\n\u{1F44B} Cancelled.\n"));
|
|
4921
|
-
|
|
4963
|
+
try {
|
|
4964
|
+
ui.safeExit(0);
|
|
4965
|
+
} catch {
|
|
4966
|
+
}
|
|
4967
|
+
return;
|
|
4968
|
+
}
|
|
4969
|
+
if (error.name === "GracefulExitError") {
|
|
4970
|
+
return;
|
|
4922
4971
|
}
|
|
4923
4972
|
throw error;
|
|
4924
4973
|
}
|
|
@@ -4932,7 +4981,14 @@ program.command("chat").description("Start a chat session").action(async () => {
|
|
|
4932
4981
|
} catch (error) {
|
|
4933
4982
|
if (error.name === "ExitPromptError") {
|
|
4934
4983
|
console.log(chalk15.gray("\n\n\u{1F44B} Goodbye!\n"));
|
|
4935
|
-
|
|
4984
|
+
try {
|
|
4985
|
+
ui.safeExit(0);
|
|
4986
|
+
} catch {
|
|
4987
|
+
}
|
|
4988
|
+
return;
|
|
4989
|
+
}
|
|
4990
|
+
if (error.name === "GracefulExitError") {
|
|
4991
|
+
return;
|
|
4936
4992
|
}
|
|
4937
4993
|
throw error;
|
|
4938
4994
|
}
|
|
@@ -4943,7 +4999,14 @@ program.command("run [directory]").description("Run a generated project").action
|
|
|
4943
4999
|
} catch (error) {
|
|
4944
5000
|
if (error.name === "ExitPromptError") {
|
|
4945
5001
|
console.log(chalk15.gray("\n\n\u{1F44B} Cancelled.\n"));
|
|
4946
|
-
|
|
5002
|
+
try {
|
|
5003
|
+
ui.safeExit(0);
|
|
5004
|
+
} catch {
|
|
5005
|
+
}
|
|
5006
|
+
return;
|
|
5007
|
+
}
|
|
5008
|
+
if (error.name === "GracefulExitError") {
|
|
5009
|
+
return;
|
|
4947
5010
|
}
|
|
4948
5011
|
throw error;
|
|
4949
5012
|
}
|
|
@@ -5003,7 +5066,14 @@ program.command("build <prompt>").alias("b").description("Generate an app from a
|
|
|
5003
5066
|
} catch (error) {
|
|
5004
5067
|
if (error.name === "ExitPromptError") {
|
|
5005
5068
|
console.log(chalk15.gray("\n\n\u{1F44B} Cancelled.\n"));
|
|
5006
|
-
|
|
5069
|
+
try {
|
|
5070
|
+
ui.safeExit(0);
|
|
5071
|
+
} catch {
|
|
5072
|
+
}
|
|
5073
|
+
return;
|
|
5074
|
+
}
|
|
5075
|
+
if (error.name === "GracefulExitError") {
|
|
5076
|
+
return;
|
|
5007
5077
|
}
|
|
5008
5078
|
throw error;
|
|
5009
5079
|
}
|