agdi 2.11.6 → 2.11.7

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.
@@ -5,11 +5,11 @@ import {
5
5
  import {
6
6
  ProjectManager,
7
7
  createLLMProvider
8
- } from "./chunk-JCG626TO.js";
8
+ } from "./chunk-KDNQ3XUH.js";
9
9
  import "./chunk-OXDKL57B.js";
10
10
  import {
11
11
  ui
12
- } from "./chunk-OQSTPS5P.js";
12
+ } from "./chunk-TKNZIFUE.js";
13
13
  import {
14
14
  getActiveProvider,
15
15
  selectModel
@@ -135,7 +135,14 @@ function parseActionPlan(response) {
135
135
  if (!jsonMatch) {
136
136
  return null;
137
137
  }
138
- const parsed = JSON.parse(jsonMatch[0]);
138
+ const jsonText = jsonMatch[0];
139
+ let parsed;
140
+ try {
141
+ parsed = JSON.parse(jsonText);
142
+ } catch {
143
+ const repaired = repairJsonStringLiterals(jsonText);
144
+ parsed = JSON.parse(repaired);
145
+ }
139
146
  if (!parsed.actions || !Array.isArray(parsed.actions)) {
140
147
  return null;
141
148
  }
@@ -161,6 +168,50 @@ function parseActionPlan(response) {
161
168
  return null;
162
169
  }
163
170
  }
171
+ function repairJsonStringLiterals(input3) {
172
+ let output = "";
173
+ let inString = false;
174
+ let escaped = false;
175
+ for (let i = 0; i < input3.length; i++) {
176
+ const ch = input3[i];
177
+ if (!inString) {
178
+ if (ch === '"') {
179
+ inString = true;
180
+ }
181
+ output += ch;
182
+ continue;
183
+ }
184
+ if (escaped) {
185
+ output += ch;
186
+ escaped = false;
187
+ continue;
188
+ }
189
+ if (ch === "\\") {
190
+ output += ch;
191
+ escaped = true;
192
+ continue;
193
+ }
194
+ if (ch === '"') {
195
+ inString = false;
196
+ output += ch;
197
+ continue;
198
+ }
199
+ if (ch === "\n") {
200
+ output += "\\n";
201
+ continue;
202
+ }
203
+ if (ch === "\r") {
204
+ output += "\\r";
205
+ continue;
206
+ }
207
+ if (ch === " ") {
208
+ output += "\\t";
209
+ continue;
210
+ }
211
+ output += ch;
212
+ }
213
+ return output;
214
+ }
164
215
 
165
216
  // src/actions/fs-tools.ts
166
217
  import { mkdir, writeFile, rm, readFile } from "fs/promises";
@@ -2797,7 +2848,10 @@ Instead, output a single JSON object with this exact structure:
2797
2848
  6. Use TypeScript by default
2798
2849
  7. Include proper error handling
2799
2850
  8. For images, use placeholder URLs or instruct user to add images later
2800
- 9. Output ONLY the JSON object, no extra text`;
2851
+ 9. Output ONLY the JSON object, no extra text
2852
+ 10. Do NOT ask the user questions. Make reasonable assumptions and proceed.
2853
+ 11. If user says "create a folder", include a mkdir action for a suitable folder name.
2854
+ 12. Use modern, production-ready defaults when details are missing.`;
2801
2855
  async function startCodingMode() {
2802
2856
  const activeConfig = getActiveProvider();
2803
2857
  if (!activeConfig) {
@@ -3012,10 +3066,19 @@ async function buildAppWithPlan(prompt, llm) {
3012
3066
  try {
3013
3067
  const response = await llm.generate(prompt, BUILD_SYSTEM_PROMPT);
3014
3068
  spinner.stop();
3015
- const result = await parseAndExecutePlan(response.text);
3069
+ let result = await parseAndExecutePlan(response.text);
3016
3070
  if (!result) {
3017
- console.log(chalk5.yellow("\n\u26A0\uFE0F Model did not return an action plan. Showing response:\n"));
3018
- console.log(formatResponse(response.text) + "\n");
3071
+ const repairPrompt = `Convert the following response into a valid Action Plan JSON ONLY.
3072
+ No markdown, no explanation. If data is missing, make reasonable assumptions.
3073
+
3074
+ RESPONSE:
3075
+ ${response.text}`;
3076
+ const repairResponse = await llm.generate(repairPrompt, BUILD_SYSTEM_PROMPT);
3077
+ result = await parseAndExecutePlan(repairResponse.text);
3078
+ if (!result) {
3079
+ console.log(chalk5.yellow("\n\u26A0\uFE0F Model did not return an action plan. Showing response:\n"));
3080
+ console.log(formatResponse(response.text) + "\n");
3081
+ }
3019
3082
  }
3020
3083
  } catch (error) {
3021
3084
  spinner.fail("Generation failed");
@@ -2,12 +2,12 @@ import {
2
2
  ProjectManager,
3
3
  createLLMProvider,
4
4
  generateApp
5
- } from "./chunk-JCG626TO.js";
5
+ } from "./chunk-KDNQ3XUH.js";
6
6
  import "./chunk-OXDKL57B.js";
7
7
  import {
8
8
  writeProject
9
9
  } from "./chunk-UVP44ZF3.js";
10
- import "./chunk-OQSTPS5P.js";
10
+ import "./chunk-TKNZIFUE.js";
11
11
  import {
12
12
  loadConfig
13
13
  } from "./chunk-OPFFFAQC.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-OXDKL57B.js";
4
4
  import {
5
5
  ui
6
- } from "./chunk-OQSTPS5P.js";
6
+ } from "./chunk-TKNZIFUE.js";
7
7
  import {
8
8
  __toESM
9
9
  } from "./chunk-EAQYK3U2.js";
@@ -25,7 +25,7 @@ var THEME = {
25
25
  var brandGradient = gradient([THEME.cyan, THEME.purple]);
26
26
  var errorGradient = gradient([THEME.red, "#b91c1c"]);
27
27
  var goldGradient = gradient([THEME.yellow, "#fbbf24"]);
28
- async function renderBanner(version = "v2.11.5") {
28
+ async function renderBanner(version = "v2.11.7") {
29
29
  console.clear();
30
30
  const text = await new Promise((resolve) => {
31
31
  figlet("AGDI", { font: "Slant" }, (err, data) => {
@@ -10,9 +10,9 @@ import {
10
10
  generatePlan,
11
11
  projectToZip,
12
12
  zipToProject
13
- } from "./chunk-JCG626TO.js";
13
+ } from "./chunk-KDNQ3XUH.js";
14
14
  import "./chunk-OXDKL57B.js";
15
- import "./chunk-OQSTPS5P.js";
15
+ import "./chunk-TKNZIFUE.js";
16
16
  import "./chunk-OPFFFAQC.js";
17
17
  import "./chunk-EAQYK3U2.js";
18
18
  export {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ui
3
- } from "./chunk-OQSTPS5P.js";
3
+ } from "./chunk-TKNZIFUE.js";
4
4
  import {
5
5
  getActiveProvider
6
6
  } from "./chunk-LT5YNSIX.js";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ui
4
- } from "./chunk-OQSTPS5P.js";
4
+ } from "./chunk-TKNZIFUE.js";
5
5
  import "./chunk-OPFFFAQC.js";
6
6
  import "./chunk-EAQYK3U2.js";
7
7
 
@@ -13,14 +13,26 @@ function isNodeRuntime() {
13
13
  var _a;
14
14
  return typeof process !== "undefined" && !!((_a = process.versions) == null ? void 0 : _a.node);
15
15
  }
16
- function requireNodeRuntime(commandName) {
17
- if (isNodeRuntime()) return true;
18
- console.error(chalk.red(`
16
+ async function requireNodeRuntime(commandName) {
17
+ if (!isNodeRuntime()) {
18
+ console.error(chalk.red(`
19
19
  \u274C "${commandName}" requires the Node.js CLI runtime.
20
20
  `));
21
- console.error(chalk.gray("You appear to be running in a browser/online sandbox."));
22
- console.error(chalk.gray("Use the web app for online generation or run the CLI locally with Node.js.\n"));
23
- return false;
21
+ console.error(chalk.gray("You appear to be running in a browser/online sandbox."));
22
+ console.error(chalk.gray("Use the web app for online generation or run the CLI locally with Node.js.\n"));
23
+ return false;
24
+ }
25
+ try {
26
+ await import("child_process");
27
+ } catch {
28
+ console.error(chalk.red(`
29
+ \u274C "${commandName}" requires Node.js child_process support.
30
+ `));
31
+ console.error(chalk.gray("This environment blocks child_process (ARCHITECT ONLINE)."));
32
+ console.error(chalk.gray("Run the CLI locally in PowerShell/Terminal for full autonomy.\n"));
33
+ return false;
34
+ }
35
+ return true;
24
36
  }
25
37
  var BANNER = `
26
38
  ${chalk.cyan(` ___ __ _ `)}
@@ -31,7 +43,7 @@ ${chalk.cyan(`/_/ |_|\\_, /\\__,_//_/ `)}
31
43
  ${chalk.cyan(` /____/ `)}
32
44
  `;
33
45
  var program = new Command();
34
- program.name("agdi").description(chalk.cyan("\u{1F680} AI-powered coding assistant")).version("2.11.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");
46
+ program.name("agdi").description(chalk.cyan("\u{1F680} AI-powered coding assistant")).version("2.11.7").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");
35
47
  program.hook("preAction", (thisCommand) => {
36
48
  const opts = thisCommand.opts();
37
49
  if (opts.yes) {
@@ -49,13 +61,13 @@ program.addHelpText("beforeAll", () => {
49
61
  });
50
62
  program.action(async () => {
51
63
  try {
52
- if (!requireNodeRuntime("agdi")) return;
64
+ if (!await requireNodeRuntime("agdi")) return;
53
65
  await ui.renderBanner();
54
66
  const { needsOnboarding, runOnboarding } = await import("./onboarding-PVQJQYGY.js");
55
67
  if (needsOnboarding()) {
56
68
  await runOnboarding();
57
69
  }
58
- const { startCodingMode } = await import("./agdi-dev-WRBTW44Q.js");
70
+ const { startCodingMode } = await import("./agdi-dev-TZGPEEMF.js");
59
71
  await startCodingMode();
60
72
  } catch (error) {
61
73
  if (error.name === "ExitPromptError") {
@@ -74,7 +86,7 @@ program.action(async () => {
74
86
  });
75
87
  program.command("auth").description("Configure API keys").option("--status", "Show authentication status").action(async (options) => {
76
88
  try {
77
- if (!requireNodeRuntime("agdi auth")) return;
89
+ if (!await requireNodeRuntime("agdi auth")) return;
78
90
  const { login, showStatus } = await import("./auth-P6MQA3ZW.js");
79
91
  if (options.status) {
80
92
  await showStatus();
@@ -98,7 +110,7 @@ program.command("auth").description("Configure API keys").option("--status", "Sh
98
110
  });
99
111
  program.command("model").alias("models").description("Change AI model").action(async () => {
100
112
  try {
101
- if (!requireNodeRuntime("agdi model")) return;
113
+ if (!await requireNodeRuntime("agdi model")) return;
102
114
  const { selectModel } = await import("./onboarding-PVQJQYGY.js");
103
115
  await selectModel();
104
116
  } catch (error) {
@@ -118,12 +130,12 @@ program.command("model").alias("models").description("Change AI model").action(a
118
130
  });
119
131
  program.command("chat").description("Start a chat session").action(async () => {
120
132
  try {
121
- if (!requireNodeRuntime("agdi chat")) return;
133
+ if (!await requireNodeRuntime("agdi chat")) return;
122
134
  const { needsOnboarding, runOnboarding } = await import("./onboarding-PVQJQYGY.js");
123
135
  if (needsOnboarding()) {
124
136
  await runOnboarding();
125
137
  }
126
- const { startChat } = await import("./chat-W4D2XB7B.js");
138
+ const { startChat } = await import("./chat-R5ERGSZ4.js");
127
139
  await startChat();
128
140
  } catch (error) {
129
141
  if (error.name === "ExitPromptError") {
@@ -142,7 +154,7 @@ program.command("chat").description("Start a chat session").action(async () => {
142
154
  });
143
155
  program.command("run [directory]").description("Run a generated project").action(async (directory) => {
144
156
  try {
145
- if (!requireNodeRuntime("agdi run")) return;
157
+ if (!await requireNodeRuntime("agdi run")) return;
146
158
  const { runProject } = await import("./run-NR2ZAGAG.js");
147
159
  await runProject(directory);
148
160
  } catch (error) {
@@ -162,7 +174,7 @@ program.command("run [directory]").description("Run a generated project").action
162
174
  });
163
175
  program.command("build <prompt>").alias("b").description("Generate an app from a prompt").option("-o, --output <dir>", "Output directory", "./generated-app").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").action(async (prompt, options) => {
164
176
  try {
165
- if (!requireNodeRuntime("agdi build")) return;
177
+ if (!await requireNodeRuntime("agdi build")) return;
166
178
  const { needsOnboarding, runOnboarding, getActiveProvider } = await import("./onboarding-PVQJQYGY.js");
167
179
  if (needsOnboarding()) {
168
180
  await runOnboarding();
@@ -174,7 +186,7 @@ program.command("build <prompt>").alias("b").description("Generate an app from a
174
186
  }
175
187
  const spinner = ora("Generating application...").start();
176
188
  try {
177
- const { createLLMProvider, ProjectManager, generateApp } = await import("./core-W346W5AW.js");
189
+ const { createLLMProvider, ProjectManager, generateApp } = await import("./core-FSXMKRED.js");
178
190
  const { writeProject } = await import("./utils-HBXXT5LZ.js");
179
191
  const llm = createLLMProvider(activeConfig.provider, {
180
192
  apiKey: activeConfig.apiKey,
@@ -233,7 +245,7 @@ program.command("build <prompt>").alias("b").description("Generate an app from a
233
245
  });
234
246
  program.command("config").description("Show configuration").action(async () => {
235
247
  var _a;
236
- if (!requireNodeRuntime("agdi config")) return;
248
+ if (!await requireNodeRuntime("agdi config")) return;
237
249
  const { loadConfig } = await import("./utils-HBXXT5LZ.js");
238
250
  const { getActiveProvider } = await import("./onboarding-PVQJQYGY.js");
239
251
  const config = loadConfig();
@@ -262,7 +274,7 @@ program.command("config").description("Show configuration").action(async () => {
262
274
  console.log("");
263
275
  });
264
276
  program.command("config:telemetry").alias("telemetry").description("Manage telemetry settings").option("--enable", "Enable anonymous telemetry").option("--disable", "Disable telemetry").option("--status", "Show current telemetry status").option("--dry-run", "Show exactly what data would be sent (transparency mode)").option("--test", "Alias for --dry-run").action(async (options) => {
265
- if (!requireNodeRuntime("agdi telemetry")) return;
277
+ if (!await requireNodeRuntime("agdi telemetry")) return;
266
278
  const { isTelemetryEnabled, setTelemetryConsent, getTelemetryConfig } = await import("./config-LBIRRMSE.js");
267
279
  const { generateSampleEvent, generateSanitizationDemo } = await import("./telemetry-service-D4P7B4B4.js");
268
280
  if (options.dryRun || options.test) {
@@ -316,8 +328,8 @@ program.command("config:telemetry").alias("telemetry").description("Manage telem
316
328
  });
317
329
  program.command("doctor").alias("doc").description("Run self-diagnosis checks").action(async () => {
318
330
  try {
319
- if (!requireNodeRuntime("agdi doctor")) return;
320
- const { runDoctor } = await import("./doctor-D4QH2A66.js");
331
+ if (!await requireNodeRuntime("agdi doctor")) return;
332
+ const { runDoctor } = await import("./doctor-F4E6THYF.js");
321
333
  await runDoctor();
322
334
  } catch (error) {
323
335
  console.error(chalk.red("Diagnostic failed: " + error));
@@ -326,7 +338,7 @@ program.command("doctor").alias("doc").description("Run self-diagnosis checks").
326
338
  });
327
339
  program.command("squad [prompt]").alias("s").description("\u{1F9B8} Autonomous multi-agent app builder").option("-d, --deploy", "Auto-deploy to Vercel after build").option("-o, --output <dir>", "Output directory", "./").option("-v, --verbose", "Show detailed agent logs", true).action(async (prompt, options) => {
328
340
  try {
329
- if (!requireNodeRuntime("agdi squad")) return;
341
+ if (!await requireNodeRuntime("agdi squad")) return;
330
342
  const { needsOnboarding, runOnboarding, getActiveProvider } = await import("./onboarding-PVQJQYGY.js");
331
343
  if (needsOnboarding()) {
332
344
  await runOnboarding();
@@ -336,7 +348,7 @@ program.command("squad [prompt]").alias("s").description("\u{1F9B8} Autonomous m
336
348
  console.log(chalk.red("\u274C No API key configured. Run: agdi auth"));
337
349
  return;
338
350
  }
339
- const { createLLMProvider } = await import("./core-W346W5AW.js");
351
+ const { createLLMProvider } = await import("./core-FSXMKRED.js");
340
352
  const { runSquadCommand } = await import("./squad-EJ7C6UCQ.js");
341
353
  const llm = createLLMProvider(activeConfig.provider, {
342
354
  apiKey: activeConfig.apiKey,
@@ -364,7 +376,7 @@ program.command("squad [prompt]").alias("s").description("\u{1F9B8} Autonomous m
364
376
  });
365
377
  program.command("import <url>").alias("i").description("\u{1F4E6} Import a GitHub repository").option("-o, --output <dir>", "Output directory (default: repo name)").action(async (url, options) => {
366
378
  try {
367
- if (!requireNodeRuntime("agdi import")) return;
379
+ if (!await requireNodeRuntime("agdi import")) return;
368
380
  const { runImportCommand } = await import("./import-5AFTGDG7.js");
369
381
  await runImportCommand(url, options.output);
370
382
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agdi",
3
- "version": "2.11.6",
3
+ "version": "2.11.7",
4
4
  "description": "AI-powered coding assistant CLI",
5
5
  "type": "module",
6
6
  "bin": {