agdi 2.7.0 → 2.7.1

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/bin/agdi.js CHANGED
File without changes
package/dist/index.js CHANGED
@@ -1519,6 +1519,54 @@ function createSpinner(text) {
1519
1519
  function printIter() {
1520
1520
  console.log(chalk8.hex(THEME.dim)("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
1521
1521
  }
1522
+ var activeReadlineInterface = null;
1523
+ function registerActivePrompt(rl) {
1524
+ activeReadlineInterface = rl;
1525
+ }
1526
+ var flags = {
1527
+ yes: false,
1528
+ headless: false
1529
+ };
1530
+ function setFlags(newFlags) {
1531
+ Object.assign(flags, newFlags);
1532
+ }
1533
+ function safeExit(code = 0) {
1534
+ if (activeReadlineInterface) {
1535
+ try {
1536
+ activeReadlineInterface.close?.();
1537
+ activeReadlineInterface.destroy?.();
1538
+ } catch {
1539
+ }
1540
+ activeReadlineInterface = null;
1541
+ }
1542
+ setImmediate(() => {
1543
+ process.exit(code);
1544
+ });
1545
+ throw new Error("Process exiting");
1546
+ }
1547
+ async function smartConfirm(message, defaultValue = false) {
1548
+ if (flags.yes || flags.headless || process.env.CI === "true" || process.env.CI === "1") {
1549
+ console.log(chalk8.gray(` [Auto-approved: ${message}]`));
1550
+ return true;
1551
+ }
1552
+ if (!process.stdout.isTTY) {
1553
+ console.warn(chalk8.yellow("\u26A0\uFE0F Non-interactive session detected. Use --yes to approve actions."));
1554
+ return false;
1555
+ }
1556
+ const { confirm: confirm4 } = await import("@inquirer/prompts");
1557
+ return confirm4({ message, default: defaultValue });
1558
+ }
1559
+ async function smartSelect(message, choices, defaultValue) {
1560
+ if (!process.stdout.isTTY || flags.headless) {
1561
+ const result = defaultValue || choices[0]?.value;
1562
+ if (result) {
1563
+ console.log(chalk8.gray(` [Auto-selected: ${result}]`));
1564
+ }
1565
+ return result || null;
1566
+ }
1567
+ const { select: select5 } = await import("@inquirer/prompts");
1568
+ return select5({ message, choices });
1569
+ }
1522
1570
  var ui = {
1523
1571
  renderBanner,
1524
1572
  renderBox,
@@ -1528,7 +1576,14 @@ var ui = {
1528
1576
  createSpinner,
1529
1577
  printIter,
1530
1578
  brandGradient,
1531
- THEME
1579
+ THEME,
1580
+ // Safety & Automation
1581
+ safeExit,
1582
+ smartConfirm,
1583
+ smartSelect,
1584
+ setFlags,
1585
+ flags,
1586
+ registerActivePrompt
1532
1587
  };
1533
1588
 
1534
1589
  // src/actions/plan-executor.ts
@@ -1631,7 +1686,12 @@ function validateAction(action) {
1631
1686
  }
1632
1687
  function parseActionPlan(response) {
1633
1688
  try {
1634
- const jsonMatch = response.match(/\{[\s\S]*"actions"[\s\S]*\}/);
1689
+ let cleanedResponse = response;
1690
+ const fenceMatch = response.match(/```(?:json)?\s*([\s\S]*?)```/);
1691
+ if (fenceMatch) {
1692
+ cleanedResponse = fenceMatch[1].trim();
1693
+ }
1694
+ const jsonMatch = cleanedResponse.match(/\{[\s\S]*"actions"[\s\S]*\}/);
1635
1695
  if (!jsonMatch) {
1636
1696
  return null;
1637
1697
  }
@@ -4191,7 +4251,7 @@ async function startCodingMode() {
4191
4251
  const env = initSession();
4192
4252
  const isTrusted = await ensureTrusted(env.workspaceRoot);
4193
4253
  if (!isTrusted) {
4194
- process.exit(0);
4254
+ ui.safeExit(0);
4195
4255
  }
4196
4256
  logSessionStart(env.workspaceRoot, env.trustLevel);
4197
4257
  ui.renderBox(
@@ -4385,7 +4445,7 @@ Context: ${isGitRepo() ? chalk13.green("Git Repository") : chalk13.gray("Local
4385
4445
  if (error.name === "ExitPromptError") {
4386
4446
  logSessionEnd();
4387
4447
  console.log(chalk13.gray("\n\n\u{1F44B} Goodbye!\n"));
4388
- process.exit(0);
4448
+ ui.safeExit(0);
4389
4449
  }
4390
4450
  throw error;
4391
4451
  }
@@ -4599,12 +4659,16 @@ ${chalk14.cyan(`/_/ |_|\\_, /\\__,_//_/ `)}
4599
4659
  ${chalk14.cyan(` /____/ `)}
4600
4660
  `;
4601
4661
  var program = new Command();
4602
- program.name("agdi").description(chalk14.cyan("\u{1F680} AI-powered coding assistant")).version("2.6.0").configureHelp({
4603
- // Show banner only when help is requested
4604
- formatHelp: (cmd, helper) => {
4605
- return BANNER + "\n" + chalk14.gray(" The Open Source AI Architect") + "\n" + chalk14.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n") + "\n" + helper.formatHelp(cmd, helper);
4662
+ program.name("agdi").description(chalk14.cyan("\u{1F680} AI-powered coding assistant")).version("2.7.0").option("-y, --yes", "Auto-approve all prompts (headless/CI mode)");
4663
+ program.hook("preAction", (thisCommand) => {
4664
+ const opts = thisCommand.opts();
4665
+ if (opts.yes) {
4666
+ ui.setFlags({ yes: true, headless: true });
4606
4667
  }
4607
4668
  });
4669
+ program.addHelpText("beforeAll", () => {
4670
+ return BANNER + "\n" + chalk14.gray(" The Open Source AI Architect") + "\n" + chalk14.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n");
4671
+ });
4608
4672
  program.action(async () => {
4609
4673
  try {
4610
4674
  await ui.renderBanner();
@@ -4615,7 +4679,7 @@ program.action(async () => {
4615
4679
  } catch (error) {
4616
4680
  if (error.name === "ExitPromptError") {
4617
4681
  console.log(chalk14.gray("\n\n\u{1F44B} Goodbye!\n"));
4618
- process.exit(0);
4682
+ ui.safeExit(0);
4619
4683
  }
4620
4684
  throw error;
4621
4685
  }
@@ -4630,7 +4694,7 @@ program.command("auth").description("Configure API keys").option("--status", "Sh
4630
4694
  } catch (error) {
4631
4695
  if (error.name === "ExitPromptError") {
4632
4696
  console.log(chalk14.gray("\n\n\u{1F44B} Cancelled.\n"));
4633
- process.exit(0);
4697
+ ui.safeExit(0);
4634
4698
  }
4635
4699
  throw error;
4636
4700
  }
@@ -4641,7 +4705,7 @@ program.command("model").alias("models").description("Change AI model").action(a
4641
4705
  } catch (error) {
4642
4706
  if (error.name === "ExitPromptError") {
4643
4707
  console.log(chalk14.gray("\n\n\u{1F44B} Cancelled.\n"));
4644
- process.exit(0);
4708
+ ui.safeExit(0);
4645
4709
  }
4646
4710
  throw error;
4647
4711
  }
@@ -4655,7 +4719,7 @@ program.command("chat").description("Start a chat session").action(async () => {
4655
4719
  } catch (error) {
4656
4720
  if (error.name === "ExitPromptError") {
4657
4721
  console.log(chalk14.gray("\n\n\u{1F44B} Goodbye!\n"));
4658
- process.exit(0);
4722
+ ui.safeExit(0);
4659
4723
  }
4660
4724
  throw error;
4661
4725
  }
@@ -4666,7 +4730,7 @@ program.command("run [directory]").description("Run a generated project").action
4666
4730
  } catch (error) {
4667
4731
  if (error.name === "ExitPromptError") {
4668
4732
  console.log(chalk14.gray("\n\n\u{1F44B} Cancelled.\n"));
4669
- process.exit(0);
4733
+ ui.safeExit(0);
4670
4734
  }
4671
4735
  throw error;
4672
4736
  }
@@ -4709,12 +4773,12 @@ program.command("build <prompt>").alias("b").description("Generate an app from a
4709
4773
  } else {
4710
4774
  console.error(chalk14.red("\n" + msg + "\n"));
4711
4775
  }
4712
- process.exit(1);
4776
+ ui.safeExit(1);
4713
4777
  }
4714
4778
  } catch (error) {
4715
4779
  if (error.name === "ExitPromptError") {
4716
4780
  console.log(chalk14.gray("\n\n\u{1F44B} Cancelled.\n"));
4717
- process.exit(0);
4781
+ ui.safeExit(0);
4718
4782
  }
4719
4783
  throw error;
4720
4784
  }
package/package.json CHANGED
@@ -1,69 +1,70 @@
1
- {
2
- "name": "agdi",
3
- "version": "2.7.0",
4
- "description": "AI-powered app generator - build full-stack apps from natural language in your terminal",
5
- "type": "module",
6
- "bin": {
7
- "agdi": "./bin/agdi.js"
8
- },
9
- "main": "./dist/index.js",
10
- "files": [
11
- "bin",
12
- "dist",
13
- "README.md"
14
- ],
15
- "keywords": [
16
- "cli",
17
- "ai",
18
- "code-generation",
19
- "app-generator",
20
- "llm",
21
- "gpt",
22
- "claude",
23
- "gemini",
24
- "react",
25
- "vite",
26
- "full-stack"
27
- ],
28
- "author": "Agdi Systems Inc.",
29
- "license": "MIT",
30
- "repository": {
31
- "type": "git",
32
- "url": "git+https://github.com/anassagd432/Agdi-dev.git"
33
- },
34
- "homepage": "https://agdi-dev.vercel.app",
35
- "bugs": {
36
- "url": "https://github.com/anassagd432/Agdi-dev/issues"
37
- },
38
- "engines": {
39
- "node": ">=18.0.0"
40
- },
41
- "devDependencies": {
42
- "@types/fs-extra": "^11.0.0",
43
- "@types/node": "^20.0.0",
44
- "tsup": "^8.0.0",
45
- "tsx": "^4.7.0",
46
- "typescript": "^5.4.0",
47
- "vitest": "^3.0.0"
48
- },
49
- "dependencies": {
50
- "@google/genai": "^1.0.0",
51
- "@inquirer/prompts": "^5.0.0",
52
- "@types/figlet": "^1.7.0",
53
- "@types/gradient-string": "^1.1.6",
54
- "boxen": "^8.0.1",
55
- "chalk": "^5.3.0",
56
- "commander": "^12.0.0",
57
- "figlet": "^1.9.4",
58
- "fs-extra": "^11.2.0",
59
- "gradient-string": "^3.0.0",
60
- "jszip": "^3.10.0",
61
- "ora": "^8.0.0"
62
- },
63
- "scripts": {
64
- "build": "tsup src/index.ts --format esm --clean",
65
- "dev": "tsx src/index.ts",
66
- "start": "node bin/agdi.js",
67
- "test": "vitest run"
68
- }
1
+ {
2
+ "name": "agdi",
3
+ "version": "2.7.1",
4
+ "description": "AI-powered app generator - build full-stack apps from natural language in your terminal",
5
+ "type": "module",
6
+ "bin": {
7
+ "agdi": "./bin/agdi.js"
8
+ },
9
+ "main": "./dist/index.js",
10
+ "files": [
11
+ "bin",
12
+ "dist",
13
+ "README.md"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsup src/index.ts --format esm --clean",
17
+ "dev": "tsx src/index.ts",
18
+ "start": "node bin/agdi.js",
19
+ "test": "vitest run",
20
+ "prepublishOnly": "npm run build"
21
+ },
22
+ "keywords": [
23
+ "cli",
24
+ "ai",
25
+ "code-generation",
26
+ "app-generator",
27
+ "llm",
28
+ "gpt",
29
+ "claude",
30
+ "gemini",
31
+ "react",
32
+ "vite",
33
+ "full-stack"
34
+ ],
35
+ "author": "Agdi Systems Inc.",
36
+ "license": "MIT",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/anassagd432/Agdi-dev.git"
40
+ },
41
+ "homepage": "https://agdi-dev.vercel.app",
42
+ "bugs": {
43
+ "url": "https://github.com/anassagd432/Agdi-dev/issues"
44
+ },
45
+ "engines": {
46
+ "node": ">=18.0.0"
47
+ },
48
+ "devDependencies": {
49
+ "@types/fs-extra": "^11.0.0",
50
+ "@types/node": "^20.0.0",
51
+ "tsup": "^8.0.0",
52
+ "tsx": "^4.7.0",
53
+ "typescript": "^5.4.0",
54
+ "vitest": "^3.0.0"
55
+ },
56
+ "dependencies": {
57
+ "@google/genai": "^1.0.0",
58
+ "@inquirer/prompts": "^5.0.0",
59
+ "@types/figlet": "^1.7.0",
60
+ "@types/gradient-string": "^1.1.6",
61
+ "boxen": "^8.0.1",
62
+ "chalk": "^5.3.0",
63
+ "commander": "^12.0.0",
64
+ "figlet": "^1.9.4",
65
+ "fs-extra": "^11.2.0",
66
+ "gradient-string": "^3.0.0",
67
+ "jszip": "^3.10.0",
68
+ "ora": "^8.0.0"
69
+ }
69
70
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Agdi Systems
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.