@bonginkan/maria 4.3.27 → 4.3.29

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/cli.cjs CHANGED
@@ -1704,7 +1704,7 @@ var init_AuthenticationManager = __esm({
1704
1704
  const response = await fetch(`${this.apiBase}/api/user/profile`, {
1705
1705
  headers: {
1706
1706
  "Authorization": `Bearer ${tokens2.accessToken}`,
1707
- "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.27"}`
1707
+ "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.29"}`
1708
1708
  }
1709
1709
  });
1710
1710
  if (response.status === 401) {
@@ -2407,7 +2407,7 @@ async function callApi(path60, init3 = {}) {
2407
2407
  "Authorization": `Bearer ${token}`,
2408
2408
  "X-Device-Id": getDeviceId(),
2409
2409
  "X-Session-Id": getSessionId() || "",
2410
- "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.27"}`,
2410
+ "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.29"}`,
2411
2411
  "Content-Type": init3.headers?.["Content-Type"] || "application/json"
2412
2412
  });
2413
2413
  const doFetch = async (token) => {
@@ -16121,8 +16121,8 @@ var require_package = __commonJS({
16121
16121
  "package.json"(exports, module) {
16122
16122
  module.exports = {
16123
16123
  name: "@bonginkan/maria",
16124
- version: "4.3.27",
16125
- description: "\u{1F680} MARIA v4.3.27 - Enterprise AI Development Platform with identity system and character voice implementation. Features 74 production-ready commands with comprehensive fallback implementation, local LLM support, and zero external dependencies. Includes natural language coding, AI safety evaluation, intelligent evolution system, episodic memory with PII masking, and real-time monitoring dashboard. Built with TypeScript AST-powered code generation, OAuth2.0 + PKCE authentication, quantum-resistant cryptography, and enterprise-grade performance.",
16124
+ version: "4.3.29",
16125
+ description: "\u{1F680} MARIA v4.3.29 - Enterprise AI Development Platform with identity system and character voice implementation. Features 74 production-ready commands with comprehensive fallback implementation, local LLM support, and zero external dependencies. Includes natural language coding, AI safety evaluation, intelligent evolution system, episodic memory with PII masking, and real-time monitoring dashboard. Built with TypeScript AST-powered code generation, OAuth2.0 + PKCE authentication, quantum-resistant cryptography, and enterprise-grade performance.",
16126
16126
  keywords: [
16127
16127
  "ai",
16128
16128
  "cli",
@@ -19285,7 +19285,7 @@ async function applyPlans(plans, opts) {
19285
19285
  try {
19286
19286
  for (const plan of plans) {
19287
19287
  if (opts.signal?.aborted) throw abortErr();
19288
- const target = path10__namespace.default.join(opts.root, plan.path);
19288
+ const target = plan.absPath ? plan.absPath : path10__namespace.default.join(opts.root, plan.path);
19289
19289
  const dir = path10__namespace.default.dirname(target);
19290
19290
  await fs19.promises.mkdir(dir, { recursive: true });
19291
19291
  const exists2 = await fileExists(target);
@@ -22827,8 +22827,19 @@ async function runImagePipeline(params2, opts) {
22827
22827
  metrics: { durationMs, retries: totalRetries, fallbacks: 0 },
22828
22828
  trace: Math.random().toString(36).slice(2, 8).toUpperCase()
22829
22829
  };
22830
- const items = successes.filter(Boolean).map((b) => ({ bytes: b, ext: `.${params2.format}` }));
22831
- const saved = await saveArtifacts({ root: opts.root, kind: "image", baseDir: opts.outDir, flat: true, skipManifest: true }, items, manifest);
22830
+ const baseDir = opts.outDir && opts.outDir.length > 0 ? opts.outDir : "image";
22831
+ const rawPrefix = (params2.prompt || "").slice(0, 20).replace(/\s+/g, "_");
22832
+ let promptPrefix = rawPrefix.replace(/[\x00-\x1F<>:"/\\|?*]/g, "_").replace(/[. ]+$/g, "");
22833
+ if (!promptPrefix) promptPrefix = "untitled";
22834
+ if (/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i.test(promptPrefix)) promptPrefix = `${promptPrefix}_`;
22835
+ const utc = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
22836
+ const filtered = successes.filter(Boolean);
22837
+ const items = filtered.map((b, i2) => ({
22838
+ bytes: b,
22839
+ ext: `.${params2.format}`,
22840
+ logicalName: `${promptPrefix}-${utc}${filtered.length > 1 ? `-${String(i2 + 1).padStart(2, "0")}` : ""}`
22841
+ }));
22842
+ const saved = await saveArtifacts({ root: opts.root, kind: "image", baseDir, flat: true, skipManifest: true }, items, manifest);
22832
22843
  progress.done();
22833
22844
  return {
22834
22845
  saved,
@@ -23244,7 +23255,6 @@ var init_image_command = __esm({
23244
23255
  const spinner = new ProcessAnimation();
23245
23256
  spinner.start();
23246
23257
  try {
23247
- const useRemote = String(process.env.MARIA_USE_REMOTE_MEDIA || "").toLowerCase() === "1" && await authManager.isAuthenticated();
23248
23258
  if (useRemote) {
23249
23259
  try {
23250
23260
  const body = {
@@ -23277,14 +23287,23 @@ var init_image_command = __esm({
23277
23287
  const pathMod = await import('path');
23278
23288
  const fsMod = await import('fs/promises');
23279
23289
  const savedPaths = [];
23290
+ const baseDir = "image";
23291
+ const rawPrefix = (cli.prompt || "").slice(0, 20).replace(/\s+/g, "_");
23292
+ let promptPrefix = rawPrefix.replace(/[\x00-\x1F<>:"/\\|?*]/g, "_").replace(/[. ]+$/g, "");
23293
+ if (!promptPrefix) promptPrefix = "untitled";
23294
+ if (/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i.test(promptPrefix)) promptPrefix = `${promptPrefix}_`;
23295
+ const utc = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
23296
+ let idx = 0;
23280
23297
  for (const f3 of filesInline) {
23281
23298
  const original = String(f3.file || "").replace(/^[\\/]+/, "");
23282
- const name2 = pathMod.basename(original);
23283
- const full = pathMod.resolve(root, name2);
23299
+ const ext2 = pathMod.extname(original) || `.${cli.format}`;
23300
+ const name2 = `${promptPrefix}-${utc}${filesInline.length > 1 ? `-${String(++idx).padStart(2, "0")}` : ""}${ext2}`;
23301
+ const rel = pathMod.join(baseDir, name2);
23302
+ const full = pathMod.resolve(root, rel);
23284
23303
  await fsMod.mkdir(pathMod.dirname(full), { recursive: true });
23285
23304
  const buf = Buffer.from(String(f3.bytesBase64 || ""), "base64");
23286
23305
  await fsMod.writeFile(full, buf);
23287
- savedPaths.push(name2);
23306
+ savedPaths.push(rel.replace(/\\/g, "/"));
23288
23307
  }
23289
23308
  const { formatImageOutput: formatImageOutput3 } = await Promise.resolve().then(() => (init_cli_style(), cli_style_exports));
23290
23309
  const output4 = await formatImageOutput3(root, {
@@ -23310,18 +23329,24 @@ var init_image_command = __esm({
23310
23329
  const fsMod = await import('fs/promises');
23311
23330
  const base = (process.env.MARIA_API_BASE || "https://api.maria-code.ai").replace(/\/$/, "");
23312
23331
  const savedPaths = [];
23332
+ const baseDir = "image";
23333
+ const promptPrefix = (cli.prompt || "").slice(0, 20).replace(/\s+/g, "_").replace(/[^A-Za-z0-9_\-]/g, "_") || "untitled";
23334
+ const utc = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
23335
+ let idx = 0;
23313
23336
  for (const relRaw of filesList) {
23314
23337
  const originalRel = String(relRaw || "").replace(/^[\\/]+/, "");
23315
23338
  const url2 = `${base}/${originalRel}`;
23316
- const name2 = pathMod.basename(originalRel);
23317
- const full = pathMod.resolve(root, name2);
23339
+ const ext2 = pathMod.extname(originalRel) || `.${cli.format}`;
23340
+ const name2 = `${promptPrefix}-${utc}${filesList.length > 1 ? `-${String(++idx).padStart(2, "0")}` : ""}${ext2}`;
23341
+ const rel = pathMod.join(baseDir, name2);
23342
+ const full = pathMod.resolve(root, rel);
23318
23343
  await fsMod.mkdir(pathMod.dirname(full), { recursive: true });
23319
23344
  const res2 = await fetch(url2);
23320
23345
  if (!res2.ok) throw new Error(`Failed to download image: ${res2.status}`);
23321
23346
  const arrayBuf = await res2.arrayBuffer();
23322
23347
  const buf = Buffer.from(arrayBuf);
23323
23348
  await fsMod.writeFile(full, buf);
23324
- savedPaths.push(name2);
23349
+ savedPaths.push(rel.replace(/\\/g, "/"));
23325
23350
  }
23326
23351
  const { formatImageOutput: formatImageOutput3 } = await Promise.resolve().then(() => (init_cli_style(), cli_style_exports));
23327
23352
  const output4 = await formatImageOutput3(root, {
@@ -23577,8 +23602,17 @@ async function runVideoPipeline(params2, opts) {
23577
23602
  metrics: { durationMs: Date.now() - started, retries: 0, fallbacks: 0 },
23578
23603
  trace: Math.random().toString(36).slice(2, 8).toUpperCase()
23579
23604
  };
23580
- const baseDir = opts.outDir || path10__namespace.join("artifacts", "media", "videos", String(manifest2.trace));
23581
- const saved2 = await saveArtifacts({ root: opts.root, kind: "video", baseDir, flat: true }, [{ bytes, ext: ext2 }], manifest2);
23605
+ const baseDir = opts.outDir && opts.outDir.length > 0 ? opts.outDir : "video";
23606
+ const rawPrefix = (params2.prompt || "").slice(0, 20).replace(/\s+/g, "_");
23607
+ let promptPrefix = rawPrefix.replace(/[\x00-\x1F<>:\"/\\|?*]/g, "_").replace(/[. ]+$/g, "");
23608
+ if (!promptPrefix) promptPrefix = "untitled";
23609
+ if (/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i.test(promptPrefix)) promptPrefix = `${promptPrefix}_`;
23610
+ const utc = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
23611
+ const saved2 = await saveArtifacts(
23612
+ { root: opts.root, kind: "video", baseDir, flat: true },
23613
+ [{ bytes, ext: ext2, logicalName: `${promptPrefix}-${utc}` }],
23614
+ manifest2
23615
+ );
23582
23616
  return { saved: saved2, durationMs: Date.now() - started, frames: 0, warnFallback: false, retries: 0 };
23583
23617
  }
23584
23618
  } catch {
@@ -23624,14 +23658,28 @@ async function runVideoPipeline(params2, opts) {
23624
23658
  }
23625
23659
  const outBuf = await muxFramesToMp4(tmpDir, params2.fps);
23626
23660
  {
23627
- const baseDir = opts.outDir || path10__namespace.join("artifacts", "media", "videos", String(manifest.trace));
23628
- saved = await saveArtifacts({ root: opts.root, kind: "video", baseDir, flat: true }, [{ bytes: outBuf, ext: ".mp4" }], manifest);
23661
+ const baseDir = opts.outDir && opts.outDir.length > 0 ? opts.outDir : "video";
23662
+ const rawPrefix = (params2.prompt || "").slice(0, 20).replace(/\s+/g, "_");
23663
+ let promptPrefix = rawPrefix.replace(/[\x00-\x1F<>:\"/\\|?*]/g, "_").replace(/[. ]+$/g, "");
23664
+ if (!promptPrefix) promptPrefix = "untitled";
23665
+ if (/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i.test(promptPrefix)) promptPrefix = `${promptPrefix}_`;
23666
+ const utc = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
23667
+ saved = await saveArtifacts(
23668
+ { root: opts.root, kind: "video", baseDir, flat: true },
23669
+ [{ bytes: outBuf, ext: ".mp4", logicalName: `${promptPrefix}-${utc}` }],
23670
+ manifest
23671
+ );
23629
23672
  }
23630
23673
  await fsp__namespace.rm(tmpDir, { recursive: true, force: true });
23631
23674
  } else {
23632
- const items = frames.map((b, i2) => ({ bytes: b, ext: `.png`, logicalName: `frame-${String(i2 + 1).padStart(4, "0")}` }));
23675
+ const rawPrefix = (params2.prompt || "").slice(0, 20).replace(/\s+/g, "_");
23676
+ let promptPrefix = rawPrefix.replace(/[\x00-\x1F<>:\"/\\|?*]/g, "_").replace(/[. ]+$/g, "");
23677
+ if (!promptPrefix) promptPrefix = "untitled";
23678
+ if (/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i.test(promptPrefix)) promptPrefix = `${promptPrefix}_`;
23679
+ const utc = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
23680
+ const items = frames.map((b, i2) => ({ bytes: b, ext: `.png`, logicalName: `${promptPrefix}-${utc}-frame-${String(i2 + 1).padStart(4, "0")}` }));
23633
23681
  {
23634
- const baseDir = opts.outDir || path10__namespace.join("artifacts", "media", "videos", String(manifest.trace));
23682
+ const baseDir = opts.outDir && opts.outDir.length > 0 ? opts.outDir : "video";
23635
23683
  saved = await saveArtifacts({ root: opts.root, kind: "video", baseDir, flat: true }, items, manifest);
23636
23684
  }
23637
23685
  warnFallback = true;
@@ -23692,8 +23740,8 @@ var init_video_command = __esm({
23692
23740
  const spinner = new ProcessAnimation();
23693
23741
  spinner.start();
23694
23742
  try {
23695
- const useRemote = String(process.env.MARIA_USE_REMOTE_MEDIA || "").toLowerCase() === "1" && await authManager.isAuthenticated();
23696
- if (useRemote) {
23743
+ const useRemote2 = String(process.env.MARIA_USE_REMOTE_MEDIA || "").toLowerCase() === "1" && await authManager.isAuthenticated();
23744
+ if (useRemote2) {
23697
23745
  try {
23698
23746
  const body = {
23699
23747
  prompt: cli.prompt,
@@ -23723,14 +23771,23 @@ var init_video_command = __esm({
23723
23771
  const pathMod = await import('path');
23724
23772
  const fsMod = await import('fs/promises');
23725
23773
  const savedPaths = [];
23774
+ const baseDir = "video";
23775
+ const rawPrefix = (cli.prompt || "").slice(0, 20).replace(/\s+/g, "_");
23776
+ let promptPrefix = rawPrefix.replace(/[\x00-\x1F<>:"/\\|?*]/g, "_").replace(/[. ]+$/g, "");
23777
+ if (!promptPrefix) promptPrefix = "untitled";
23778
+ if (/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i.test(promptPrefix)) promptPrefix = `${promptPrefix}_`;
23779
+ const utc = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
23780
+ let idx = 0;
23726
23781
  for (const f3 of filesInline) {
23727
23782
  const original = String(f3.file || "").replace(/^[\\/]+/, "");
23728
- const name2 = pathMod.basename(original || `video.${cli.format}`);
23729
- const full = pathMod.resolve(root, name2);
23783
+ const ext2 = pathMod.extname(original) || `.${cli.format}`;
23784
+ const name2 = `${promptPrefix}-${utc}${filesInline.length > 1 ? `-${String(++idx).padStart(2, "0")}` : ""}${ext2}`;
23785
+ const rel = pathMod.join(baseDir, name2);
23786
+ const full = pathMod.resolve(root, rel);
23730
23787
  await fsMod.mkdir(pathMod.dirname(full), { recursive: true });
23731
23788
  const buf = Buffer.from(String(f3.bytesBase64 || ""), "base64");
23732
23789
  await fsMod.writeFile(full, buf);
23733
- savedPaths.push(name2);
23790
+ savedPaths.push(rel.replace(/\\/g, "/"));
23734
23791
  }
23735
23792
  const { formatVideoOutput: formatVideoOutput3 } = await Promise.resolve().then(() => (init_cli_style(), cli_style_exports));
23736
23793
  const output4 = await formatVideoOutput3(root, {
@@ -23759,18 +23816,24 @@ var init_video_command = __esm({
23759
23816
  const fsMod = await import('fs/promises');
23760
23817
  const base = (process.env.MARIA_API_BASE || "https://api.maria-code.ai").replace(/\/$/, "");
23761
23818
  const savedPaths = [];
23819
+ const baseDir = "video";
23820
+ const promptPrefix = (cli.prompt || "").slice(0, 20).replace(/\s+/g, "_").replace(/[^A-Za-z0-9_\-]/g, "_") || "untitled";
23821
+ const utc = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
23822
+ let idx = 0;
23762
23823
  for (const relRaw of filesFromApi) {
23763
- const rel = String(relRaw || "").replace(/^[\\/]+/, "");
23764
- const url2 = `${base}/${rel}`;
23765
- const name2 = pathMod.basename(rel);
23766
- const full = pathMod.resolve(root, name2);
23824
+ const relApi = String(relRaw || "").replace(/^[\\/]+/, "");
23825
+ const url2 = `${base}/${relApi}`;
23826
+ const ext2 = pathMod.extname(relApi) || `.${cli.format}`;
23827
+ const name2 = `${promptPrefix}-${utc}${filesFromApi.length > 1 ? `-${String(++idx).padStart(2, "0")}` : ""}${ext2}`;
23828
+ const rel = pathMod.join(baseDir, name2);
23829
+ const full = pathMod.resolve(root, rel);
23767
23830
  await fsMod.mkdir(pathMod.dirname(full), { recursive: true });
23768
23831
  const res2 = await fetch(url2);
23769
23832
  if (!res2.ok) throw new Error(`Failed to download video: ${res2.status}`);
23770
23833
  const arrayBuf = await res2.arrayBuffer();
23771
23834
  const buf = Buffer.from(arrayBuf);
23772
23835
  await fsMod.writeFile(full, buf);
23773
- savedPaths.push(name2);
23836
+ savedPaths.push(rel.replace(/\\/g, "/"));
23774
23837
  }
23775
23838
  const { formatVideoOutput: formatVideoOutput3 } = await Promise.resolve().then(() => (init_cli_style(), cli_style_exports));
23776
23839
  const output4 = await formatVideoOutput3(root, {
@@ -25753,7 +25816,7 @@ var init_about_command = __esm({
25753
25816
  async execute(args2, context2) {
25754
25817
  const output3 = [];
25755
25818
  output3.push("");
25756
- output3.push(chalk40__default.default.cyan.bold("\u{1F916} About MARIA v4.3.27"));
25819
+ output3.push(chalk40__default.default.cyan.bold("\u{1F916} About MARIA v4.3.29"));
25757
25820
  output3.push(chalk40__default.default.gray("\u2550".repeat(40)));
25758
25821
  output3.push("");
25759
25822
  output3.push(chalk40__default.default.white.bold("MARIA - Minimal API, Maximum Power"));
@@ -38018,6 +38081,10 @@ async function normalizePlans(plans, opts) {
38018
38081
  const profile = await scanRepo(opts.root);
38019
38082
  const out = [];
38020
38083
  for (const fp of plans) {
38084
+ if (fp.noNormalize) {
38085
+ out.push(fp);
38086
+ continue;
38087
+ }
38021
38088
  const n = normalizePlanItem(fp, profile);
38022
38089
  if (!n.kind) n.kind = guessKindByPath(n.path);
38023
38090
  out.push(n);
@@ -38062,7 +38129,7 @@ async function validatePlan(plans, opts) {
38062
38129
  skipped.push(fp.path);
38063
38130
  continue;
38064
38131
  }
38065
- const full = path10__namespace.default.join(opts.root, rel);
38132
+ const full = fp.absPath ? fp.absPath : path10__namespace.default.join(opts.root, rel);
38066
38133
  if (!full.startsWith(path10__namespace.default.resolve(opts.root))) {
38067
38134
  warnings.push(`Outside root denied: ${fp.path}`);
38068
38135
  skipped.push(fp.path);
@@ -38193,10 +38260,10 @@ function formatPlan(summary, opts) {
38193
38260
  budget.diffLines = Math.min(budget.diffLines, 20);
38194
38261
  lines.push("", `Diff preview (truncated to ${budget.diffLines} lines per file):`);
38195
38262
  for (const f3 of summary.files) {
38196
- if (f3.action === "skip") continue;
38197
- const before = readCurrentFileSafe(opts.root, f3.path);
38263
+ if (f3.action !== "modify") continue;
38264
+ const before = readCurrentFileSafe(opts.root, f3.path, f3.absPath);
38198
38265
  const after = f3.preview || "";
38199
- const diff = buildUnifiedDiff(f3.path, before, after, budget);
38266
+ const diff = buildUnifiedDiff(f3.path, before, after, budget, f3.absPath);
38200
38267
  lines.push(diff, "");
38201
38268
  }
38202
38269
  }
@@ -38233,9 +38300,10 @@ function formatPlanAsDiff(files, opts) {
38233
38300
  let shownFiles = 0;
38234
38301
  for (const f3 of files) {
38235
38302
  if (budget.globalMaxFiles !== void 0 && shownFiles >= budget.globalMaxFiles) break;
38236
- const before = readCurrentFileSafe(opts.root, f3.path);
38303
+ if (f3.action !== "modify") continue;
38304
+ const before = readCurrentFileSafe(opts.root, f3.path, f3.absPath);
38237
38305
  const after = f3.preview || "";
38238
- const diff = buildUnifiedDiff(f3.path, before, after, budget);
38306
+ const diff = buildUnifiedDiff(f3.path, before, after, budget, f3.absPath);
38239
38307
  const diffBytes = Buffer.byteLength(diff, "utf8");
38240
38308
  if (budget.globalMaxBytes !== void 0 && bytesUsed + diffBytes > budget.globalMaxBytes && shownFiles > 0) {
38241
38309
  lines.push(`
@@ -38252,11 +38320,11 @@ function formatPlanAsDiff(files, opts) {
38252
38320
  }
38253
38321
  return lines.join("\n");
38254
38322
  }
38255
- function readCurrentFileSafe(root, rel) {
38256
- if (!root) return "";
38323
+ function readCurrentFileSafe(root, rel, abs) {
38324
+ if (!root && !abs) return "";
38257
38325
  try {
38258
38326
  const fs49 = __require("fs");
38259
- const p = __require("path").join(root, rel);
38327
+ const p = abs ? abs : __require("path").join(root, rel);
38260
38328
  return fs49.existsSync(p) ? fs49.readFileSync(p, "utf8") : "";
38261
38329
  } catch {
38262
38330
  return "";
@@ -38273,7 +38341,7 @@ function normalizeDiffBudget(b) {
38273
38341
  globalMaxFiles: Number.isFinite(b?.globalMaxFiles) ? b.globalMaxFiles : envGlobalFiles
38274
38342
  };
38275
38343
  }
38276
- function buildUnifiedDiff(relPath, before, after, b) {
38344
+ function buildUnifiedDiff(relPath, before, after, b, abs) {
38277
38345
  const beforeLines = before.split(/\r?\n/);
38278
38346
  const afterLines = after.split(/\r?\n/);
38279
38347
  let i2 = 0;
@@ -38282,14 +38350,15 @@ function buildUnifiedDiff(relPath, before, after, b) {
38282
38350
  while (j < beforeLines.length - i2 && j < afterLines.length - i2 && beforeLines[beforeLines.length - 1 - j] === afterLines[afterLines.length - 1 - j]) j++;
38283
38351
  const oldMid = beforeLines.slice(i2, beforeLines.length - j);
38284
38352
  const newMid = afterLines.slice(i2, afterLines.length - j);
38285
- const header = [`--- a/${relPath}`, `+++ b/${relPath}`];
38353
+ const headerPath = abs ? abs : relPath;
38354
+ const header = [`--- ${headerPath}`, `+++ ${headerPath}`];
38286
38355
  const body = [];
38287
38356
  const ctxPrefix = Math.max(0, i2 - 3);
38288
38357
  Math.min(beforeLines.length, beforeLines.length - j + 3);
38289
38358
  const preCtx = beforeLines.slice(ctxPrefix, i2).map((l) => ` ${l}`);
38290
38359
  const postCtx = beforeLines.slice(beforeLines.length - j, Math.min(beforeLines.length - j + 3, beforeLines.length)).map((l) => ` ${l}`);
38291
- const del = oldMid.map((l) => `-${l}`);
38292
- const add = newMid.map((l) => `+${l}`);
38360
+ const del = oldMid.map((l) => colorRed(`-${l}`));
38361
+ const add = newMid.map((l) => colorGreen(`+${l}`));
38293
38362
  body.push(...preCtx);
38294
38363
  body.push(...del);
38295
38364
  body.push(...add);
@@ -38306,6 +38375,22 @@ function buildUnifiedDiff(relPath, before, after, b) {
38306
38375
  }
38307
38376
  return out;
38308
38377
  }
38378
+ function colorGreen(s2) {
38379
+ try {
38380
+ const chalk43 = __require("chalk");
38381
+ return chalk43.green(s2);
38382
+ } catch {
38383
+ return s2;
38384
+ }
38385
+ }
38386
+ function colorRed(s2) {
38387
+ try {
38388
+ const chalk43 = __require("chalk");
38389
+ return chalk43.red(s2);
38390
+ } catch {
38391
+ return s2;
38392
+ }
38393
+ }
38309
38394
  function languageLabel(lang, filePath) {
38310
38395
  if (lang) {
38311
38396
  const l = lang.toLowerCase();
@@ -38932,6 +39017,20 @@ var init_policy = __esm({
38932
39017
  }
38933
39018
  });
38934
39019
 
39020
+ // src/utils/esm-compat.ts
39021
+ var esm_compat_exports = {};
39022
+ __export(esm_compat_exports, {
39023
+ loadGlobby: () => loadGlobby
39024
+ });
39025
+ async function loadGlobby() {
39026
+ const mod = await import('globby');
39027
+ return mod?.globby ?? mod?.default ?? mod;
39028
+ }
39029
+ var init_esm_compat = __esm({
39030
+ "src/utils/esm-compat.ts"() {
39031
+ }
39032
+ });
39033
+
38935
39034
  // src/services/code-orchestrator/Orchestrator.ts
38936
39035
  var Orchestrator_exports = {};
38937
39036
  __export(Orchestrator_exports, {
@@ -38966,6 +39065,20 @@ async function orchestrate(request, opts) {
38966
39065
  const initial = [];
38967
39066
  const fallbackNotices = [];
38968
39067
  const withNotices = (base) => fallbackNotices.length > 0 ? [...fallbackNotices, ...base] : base;
39068
+ const explicitFilesRaw = parseExplicitFilenames(request);
39069
+ const explicitFiles = explicitFilesRaw.length > 0 ? await resolveExplicitPaths(opts.root, explicitFilesRaw, request) : [];
39070
+ const explicitAbsMap = /* @__PURE__ */ Object.create(null);
39071
+ if (explicitFiles.length > 0) {
39072
+ const pathMod = await import('path');
39073
+ for (const rel of explicitFiles) {
39074
+ explicitAbsMap[rel] = pathMod.join(opts.root, rel);
39075
+ }
39076
+ }
39077
+ const isEditIntent = detectEditIntent(request, {
39078
+ hasAttachments: !!(opts.attachedFiles && opts.attachedFiles.length > 0),
39079
+ explicitFilesCount: explicitFiles.length
39080
+ });
39081
+ const editContext = isEditIntent && explicitFiles.length > 0 ? await buildEditContext(opts.root, explicitFiles, 200, 512 * 1024) : "";
38969
39082
  if (opts.attachedFiles && opts.attachedFiles.length > 0) {
38970
39083
  const mapRes = await mapAttachmentsToTargets(opts.attachedFiles, {
38971
39084
  root: opts.root,
@@ -38985,7 +39098,6 @@ async function orchestrate(request, opts) {
38985
39098
  }
38986
39099
  }
38987
39100
  const onlyAttached = !!opts.flags.onlyAttached;
38988
- const explicitFiles = parseExplicitFilenames(request);
38989
39101
  if (!onlyAttached) {
38990
39102
  let codeOutput = "";
38991
39103
  if (process.env.MARIA_E2E_FAKE_CODE === "1") {
@@ -39005,9 +39117,17 @@ async function orchestrate(request, opts) {
39005
39117
  "[BEGIN file: path]\n<content>\n[END]",
39006
39118
  "Do not include any prose before/after; no menus/questions/suggestions; start immediately with ``` or [BEGIN file: ...]."
39007
39119
  ].join("\n");
39120
+ const requestPreamble = isEditIntent ? [
39121
+ "// EDIT MODE: modify existing files, preserve unrelated content.",
39122
+ "// Follow existing structure and only touch requested files.",
39123
+ editContext ? "// Current file snapshots provided below." : ""
39124
+ ].filter(Boolean).join("\n") : "";
39008
39125
  const enriched = `${FILE_FORMAT_INSTRUCTIONS}
39009
39126
 
39010
- ${request}`;
39127
+ ${requestPreamble}
39128
+ ${request}
39129
+
39130
+ ${editContext}`;
39011
39131
  const response = await executeCode(enriched);
39012
39132
  const raw = (response.output || response?.data?.content || "").trim();
39013
39133
  if (!raw) {
@@ -39052,24 +39172,27 @@ ${request}`;
39052
39172
  const htmlIdx = blocks.findIndex((b) => /html/i.test(b.language));
39053
39173
  const htmlFile = explicitFiles.find((f3) => f3.toLowerCase().endsWith(".html"));
39054
39174
  if (htmlIdx >= 0 && htmlFile) {
39055
- initial.push({ path: htmlFile, kind: "source", action: "create", description: "HTML page", language: "html", preview: blocks[htmlIdx].code });
39175
+ initial.push({ path: htmlFile, absPath: explicitAbsMap[htmlFile], noNormalize: true, kind: "source", action: "create", description: "HTML page", language: "html", preview: blocks[htmlIdx].code });
39056
39176
  mapped.add(htmlFile);
39057
39177
  }
39058
39178
  const jsIdx = blocks.findIndex((b) => /(ts|tsx|jsx|javascript|js)/i.test(b.language));
39059
39179
  const jsFile = explicitFiles.find((f3) => f3.toLowerCase().endsWith(".js"));
39060
39180
  if (jsIdx >= 0 && jsFile && !mapped.has(jsFile)) {
39061
- initial.push({ path: jsFile, kind: "source", action: "create", description: "Script", language: "javascript", preview: blocks[jsIdx].code });
39181
+ initial.push({ path: jsFile, absPath: explicitAbsMap[jsFile], noNormalize: true, kind: "source", action: "create", description: "Script", language: "javascript", preview: blocks[jsIdx].code });
39062
39182
  mapped.add(jsFile);
39063
39183
  }
39064
39184
  const cssIdx = blocks.findIndex((b) => /css/i.test(b.language));
39065
39185
  const cssFile = explicitFiles.find((f3) => f3.toLowerCase().endsWith(".css"));
39066
39186
  if (cssIdx >= 0 && cssFile && !mapped.has(cssFile)) {
39067
- initial.push({ path: cssFile, kind: "source", action: "create", description: "Stylesheet", language: "css", preview: blocks[cssIdx].code });
39187
+ initial.push({ path: cssFile, absPath: explicitAbsMap[cssFile], noNormalize: true, kind: "source", action: "create", description: "Stylesheet", language: "css", preview: blocks[cssIdx].code });
39068
39188
  mapped.add(cssFile);
39069
39189
  }
39070
39190
  for (const f3 of explicitFiles) {
39071
39191
  if (mapped.has(f3)) continue;
39072
- initial.push(scaffoldForFilename(f3, explicitFiles));
39192
+ const plan = scaffoldForFilename(f3, explicitFiles);
39193
+ plan.absPath = explicitAbsMap[f3];
39194
+ plan.noNormalize = true;
39195
+ initial.push(plan);
39073
39196
  }
39074
39197
  } else {
39075
39198
  for (let i2 = 0; i2 < blocks.length; i2++) {
@@ -39087,12 +39210,26 @@ ${request}`;
39087
39210
  }
39088
39211
  }
39089
39212
  }
39213
+ if (!isEditIntent) {
39214
+ const proposedTop = deriveProjectFolderName(request);
39215
+ const { folderName, detectedTop } = await ensureTopFolder(opts.root, proposedTop, initial);
39216
+ if (folderName) {
39217
+ for (const p of initial) {
39218
+ if (!startsWithTopFolder(p.path, detectedTop || folderName)) {
39219
+ p.path = prefixWithTopFolder(p.path, folderName);
39220
+ }
39221
+ }
39222
+ }
39223
+ }
39090
39224
  if (explicitFiles.length > 0 && initial.filter((f3) => !!f3.preview).length === 0) {
39091
39225
  for (const f3 of explicitFiles) {
39092
39226
  initial.push(scaffoldForFilename(f3, explicitFiles));
39093
39227
  }
39094
39228
  }
39095
- const normalized = await normalizePlans(initial, { root: opts.root });
39229
+ const normalized = await normalizePlans(
39230
+ initial.map((p) => p.noNormalize ? p : p),
39231
+ { root: opts.root }
39232
+ );
39096
39233
  try {
39097
39234
  const [{ access: access18 }, path60] = await Promise.all([
39098
39235
  import('fs/promises'),
@@ -39100,8 +39237,12 @@ ${request}`;
39100
39237
  ]);
39101
39238
  for (const p of normalized) {
39102
39239
  try {
39103
- await access18(path60.join(opts.root, p.path));
39240
+ const absCandidate = p.absPath ? p.absPath : path60.join(opts.root, p.path);
39241
+ await access18(absCandidate);
39104
39242
  p.action = "modify";
39243
+ if (isEditIntent) {
39244
+ p.overwritePolicy = "allow";
39245
+ }
39105
39246
  } catch {
39106
39247
  p.action = "create";
39107
39248
  }
@@ -39109,10 +39250,12 @@ ${request}`;
39109
39250
  } catch {
39110
39251
  }
39111
39252
  const validated = await validatePlan(normalized, { root: opts.root, profile, flags: { maxFiles: opts.flags.maxFiles, yes: opts.flags.yes, interactive: !!opts.flags.interactive, ...opts.flags } });
39112
- const outputMode = resolveOutputMode(opts.flags.output, validated.files.length, !!opts.flags.hideCode);
39113
- const displayFiles = validated.files.concat(
39114
- (validated.skipped || []).map((p) => ({ path: p, kind: "source", action: "skip", description: "" }))
39115
- );
39253
+ const hasAnyModify = validated.files.some((f3) => f3.action === "modify") || isEditIntent;
39254
+ const outputMode = !opts.flags.hideCode && hasAnyModify ? "diff" : resolveOutputMode(opts.flags.output, validated.files.length, !!opts.flags.hideCode);
39255
+ const skippedSetForLookup = new Set(validated.skipped || []);
39256
+ const skippedPlans = normalized.filter((f3) => skippedSetForLookup.has(f3.path));
39257
+ const remainingSkipped = (validated.skipped || []).filter((p) => !skippedPlans.some((sp) => sp.path === p)).map((p) => ({ path: p, kind: "source", action: "skip", description: "" }));
39258
+ const displayFiles = validated.files.concat(skippedPlans).concat(remainingSkipped);
39116
39259
  const summary = summarizePlan(displayFiles);
39117
39260
  const lines = [
39118
39261
  formatPlan(summary, {
@@ -39150,6 +39293,7 @@ ${request}`;
39150
39293
  if (softIssues.hasTrailingWhitespace) lines.push(warnLine("Proposed changes contain trailing whitespace"));
39151
39294
  if (softIssues.hasConflictMarkers) lines.push(warnLine("Proposed changes contain conflict markers"));
39152
39295
  }
39296
+ const preApplyOutput = withNotices(lines);
39153
39297
  let appliedCount = 0;
39154
39298
  let durationMs = 0;
39155
39299
  let rolledBack = false;
@@ -39161,7 +39305,7 @@ ${request}`;
39161
39305
  return { plan: normalized, validated, summaryLines: withNotices([errorLine("working tree not clean (commit or stash first). Re-run after cleaning your git status.")]) };
39162
39306
  }
39163
39307
  }
39164
- const allowOverwrite = opts.flags.overwriteAllowed === true || !!opts.flags.yes;
39308
+ const allowOverwrite = opts.flags.overwriteAllowed === true || !!opts.flags.yes || isEditIntent;
39165
39309
  const applyRes = await applyPlans(approved, { root: opts.root, overwriteAllowed: allowOverwrite, rollback: opts.flags.rollback !== false, signal: opts.abortSignal, onProgress: (w, t2) => {
39166
39310
  }, eol: profile.eol });
39167
39311
  appliedCount = applyRes.appliedCount;
@@ -39191,7 +39335,7 @@ ${request}`;
39191
39335
  const savedList = [].concat(applyRes.created, applyRes.modified);
39192
39336
  const savedAbs = savedList.map((rel) => path10__namespace.default.resolve(opts.root, rel));
39193
39337
  const footer = savedAbs.length > 0 ? ["Saved files (full paths):", ...savedAbs.map((p) => `- ${p}`)] : [];
39194
- return { plan: normalized, validated, applied: { count: appliedCount, durationMs, rolledBack }, summaryLines: withNotices([msg, ...footer]) };
39338
+ return { plan: normalized, validated, applied: { count: appliedCount, durationMs, rolledBack }, summaryLines: [...preApplyOutput, "", msg, ...footer] };
39195
39339
  } catch (e2) {
39196
39340
  if (e2?.name === "AbortError") {
39197
39341
  await journalResume(opts.root, request, validated.files);
@@ -39412,6 +39556,218 @@ function parseExplicitFilenames(request) {
39412
39556
  }
39413
39557
  return out;
39414
39558
  }
39559
+ function detectEditIntent(request, ctx2) {
39560
+ const r2 = request.toLowerCase();
39561
+ const editKeywords = ["modify", "edit", "update", "fix", "refactor", "change", "patch", "\u5DEE\u5206", "\u4FEE\u6B63", "\u5909\u66F4", "\u65E2\u5B58", "\u8FFD\u8A18"];
39562
+ const mentionsEdit = editKeywords.some((k) => r2.includes(k));
39563
+ return ctx2.hasAttachments || ctx2.explicitFilesCount > 0 || mentionsEdit;
39564
+ }
39565
+ function sanitizeFolderName(name2) {
39566
+ const base = name2.toLowerCase().replace(/[`~!@#$%^&*()+=\[\]{}|;:'",<>/?\\]/g, " ").replace(/\s+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48);
39567
+ return base || "project";
39568
+ }
39569
+ function deriveProjectFolderName(request) {
39570
+ const words = request.toLowerCase().replace(/[^a-z0-9\s-]/g, " ").split(/\s+/).filter((w) => w.length > 2).slice(0, 4).join("-");
39571
+ return sanitizeFolderName(words || "project");
39572
+ }
39573
+ function startsWithTopFolder(p, folder) {
39574
+ if (!folder) return false;
39575
+ const seg = p.replace(/^\/+/, "").split("/")[0];
39576
+ return seg.toLowerCase() === folder.toLowerCase();
39577
+ }
39578
+ function prefixWithTopFolder(p, folder) {
39579
+ const rel = p.replace(/^\/+/, "");
39580
+ return `${folder}/${rel}`;
39581
+ }
39582
+ async function ensureTopFolder(root, proposed, plans) {
39583
+ const tops = /* @__PURE__ */ new Set();
39584
+ for (const p of plans) {
39585
+ const seg = p.path.replace(/^\/+/, "").split("/")[0] || "";
39586
+ if (seg) tops.add(seg);
39587
+ }
39588
+ if (tops.size === 1) {
39589
+ const only = Array.from(tops)[0];
39590
+ const unique2 = await ensureUniqueFolder(root, only);
39591
+ return { folderName: unique2, detectedTop: only };
39592
+ }
39593
+ const unique = await ensureUniqueFolder(root, proposed);
39594
+ return { folderName: unique };
39595
+ }
39596
+ async function ensureUniqueFolder(root, base) {
39597
+ const fs49 = await import('fs/promises');
39598
+ const pathMod = await import('path');
39599
+ let name2 = sanitizeFolderName(base);
39600
+ let suffix = 0;
39601
+ for (; suffix < Number.MAX_SAFE_INTEGER; ) {
39602
+ const candidate = suffix === 0 ? name2 : `${name2}-${String(suffix).padStart(2, "0")}`;
39603
+ try {
39604
+ await fs49.access(pathMod.join(root, candidate));
39605
+ suffix += 1;
39606
+ } catch {
39607
+ return candidate;
39608
+ }
39609
+ }
39610
+ throw new Error("ensureUniqueFolder: exhausted attempts to find a unique folder name");
39611
+ }
39612
+ async function buildEditContext(root, files, maxLines, maxBytes) {
39613
+ try {
39614
+ const fs49 = await import('fs/promises');
39615
+ const pathMod = await import('path');
39616
+ const sections = [];
39617
+ for (const rel of files) {
39618
+ const full = pathMod.join(root, rel);
39619
+ try {
39620
+ const buf = await fs49.readFile(full);
39621
+ const clipped = buf.length > maxBytes ? buf.subarray(0, maxBytes) : buf;
39622
+ const text = clipped.toString("utf8").replace(/\r\n/g, "\n");
39623
+ const lines = text.split("\n").slice(0, maxLines).join("\n");
39624
+ sections.push(`[BEGIN file: ${rel}]
39625
+ ${lines}
39626
+ [END]`);
39627
+ } catch {
39628
+ }
39629
+ }
39630
+ if (sections.length === 0) return "";
39631
+ return ["// Current repository files (read-only context):", ...sections].join("\n");
39632
+ } catch {
39633
+ return "";
39634
+ }
39635
+ }
39636
+ async function resolveExplicitPaths(root, files, hintText) {
39637
+ const fs49 = await import('fs/promises');
39638
+ const pathMod = await import('path');
39639
+ const { loadGlobby: loadGlobby2 } = await Promise.resolve().then(() => (init_esm_compat(), esm_compat_exports));
39640
+ const globby = await loadGlobby2();
39641
+ const ignore = [
39642
+ "**/node_modules/**",
39643
+ "**/.git/**",
39644
+ "**/dist/**",
39645
+ "**/build/**",
39646
+ "**/.maria/**",
39647
+ "**/.next/**",
39648
+ "**/coverage/**"
39649
+ ];
39650
+ const hintTokens = Array.from(new Set(hintText.toLowerCase().replace(/[^a-z0-9_/.-]+/g, " ").split(/\s+/).filter(Boolean)));
39651
+ async function findBest(rel) {
39652
+ const normalized = rel.replace(/^\/+/, "").replace(/\\/g, "/");
39653
+ const fullExact = pathMod.join(root, normalized);
39654
+ try {
39655
+ await fs49.access(fullExact);
39656
+ return normalized;
39657
+ } catch {
39658
+ }
39659
+ const lowerRel = normalized.toLowerCase();
39660
+ const ext2 = (pathMod.extname(normalized) || "").toLowerCase();
39661
+ const base = pathMod.basename(normalized);
39662
+ const nameNoExt = base.replace(/\.[^.]+$/, "").toLowerCase();
39663
+ const parentPath = pathMod.dirname(normalized);
39664
+ const parent = parentPath.split("/").pop() || "";
39665
+ const dirParts = parentPath === "." ? [] : parentPath.split("/").filter(Boolean).map((s2) => s2.toLowerCase());
39666
+ const patterns = [];
39667
+ patterns.push(`**/${normalized}`);
39668
+ if (parent && parent !== "." && parent !== "/") patterns.push(`**/${parent}/${base}`);
39669
+ if (base) patterns.push(`**/${base}`);
39670
+ patterns.push(`**/*${base}`);
39671
+ if (!ext2) {
39672
+ patterns.push(`**/${nameNoExt}.*`);
39673
+ }
39674
+ const uniqPatterns = Array.from(new Set(patterns));
39675
+ const candidatesSet = /* @__PURE__ */ new Set();
39676
+ for (const pat of uniqPatterns) {
39677
+ const found = await globby(pat, { cwd: root, absolute: false, gitignore: true, ignore });
39678
+ for (const f3 of found) {
39679
+ candidatesSet.add(f3.replace(/\\/g, "/"));
39680
+ }
39681
+ if (candidatesSet.size > 200) break;
39682
+ }
39683
+ let candidates = Array.from(candidatesSet);
39684
+ if (dirParts.length > 0) {
39685
+ const filtered = candidates.filter((relp) => {
39686
+ const segs = relp.toLowerCase().split("/");
39687
+ let pos = -1;
39688
+ for (const part of dirParts) {
39689
+ const next = segs.indexOf(part, pos + 1);
39690
+ if (next === -1) return false;
39691
+ pos = next;
39692
+ }
39693
+ return true;
39694
+ });
39695
+ if (filtered.length > 0) candidates = filtered;
39696
+ }
39697
+ if (candidates.length === 0) {
39698
+ const prefixes = ["", "src/", "app/", "pages/"];
39699
+ for (const pre of prefixes) {
39700
+ const cand = pathMod.join(root, pre + normalized);
39701
+ try {
39702
+ await fs49.access(cand);
39703
+ return (pre + normalized).replace(/^\/+/, "");
39704
+ } catch {
39705
+ }
39706
+ }
39707
+ if (dirParts.length > 0) {
39708
+ if (/^(src|app|pages)\//i.test(normalized)) return normalized;
39709
+ const pref = await pickExistingFolderPrefix(root, parentPath);
39710
+ const combined = (pref + normalized).replace(/^\/+/, "").replace(/^(src\/)src\//i, "$1");
39711
+ return combined;
39712
+ }
39713
+ return normalized.replace(/^(src\/)src\//i, "$1");
39714
+ }
39715
+ function score(relPath) {
39716
+ const lower2 = relPath.toLowerCase();
39717
+ let s2 = 0;
39718
+ if (lower2.endsWith(lowerRel)) s2 += 80;
39719
+ if (lower2.split("/").pop() === base.toLowerCase()) s2 += 40;
39720
+ if (ext2 && lower2.endsWith(ext2)) s2 += 10;
39721
+ if (lower2.startsWith("src/")) s2 += 18;
39722
+ if (parent && lower2.includes(`/${parent.toLowerCase()}/`)) s2 += 15;
39723
+ if (parentPath && lower2.endsWith(`/${parentPath.toLowerCase()}/${base.toLowerCase()}`)) s2 += 40;
39724
+ if (dirParts.length > 0) {
39725
+ for (const part of dirParts) {
39726
+ if (lower2.includes(`/${part}/`)) s2 += 20;
39727
+ else s2 -= 120;
39728
+ }
39729
+ }
39730
+ for (const t2 of hintTokens) {
39731
+ if (t2.length >= 3 && lower2.includes(`/${t2}/`)) {
39732
+ s2 += 2;
39733
+ }
39734
+ }
39735
+ s2 -= Math.min(10, Math.floor(relPath.length / 80));
39736
+ return s2;
39737
+ }
39738
+ let best = candidates[0];
39739
+ let bestScore = score(best);
39740
+ for (let i2 = 1; i2 < candidates.length; i2++) {
39741
+ const c = candidates[i2];
39742
+ const sc = score(c);
39743
+ if (sc > bestScore) {
39744
+ best = c;
39745
+ bestScore = sc;
39746
+ }
39747
+ }
39748
+ return best.replace(/^\/+/, "");
39749
+ }
39750
+ const out = [];
39751
+ for (const f3 of files) {
39752
+ out.push(await findBest(f3));
39753
+ }
39754
+ return out;
39755
+ }
39756
+ async function pickExistingFolderPrefix(root, parentPath) {
39757
+ const fs49 = await import('fs/promises');
39758
+ const pathMod = await import('path');
39759
+ const parts = parentPath.replace(/^\/+/, "").split("/").filter(Boolean);
39760
+ const prefixes = ["src", "app", "pages", ""];
39761
+ for (const pre of prefixes) {
39762
+ const test = pre ? pathMod.join(root, pre, ...parts) : pathMod.join(root, ...parts);
39763
+ try {
39764
+ await fs49.access(test);
39765
+ return pre ? `${pre}/` : "";
39766
+ } catch {
39767
+ }
39768
+ }
39769
+ return "src/";
39770
+ }
39415
39771
  function scaffoldForFilename(filename, all) {
39416
39772
  const lower2 = filename.toLowerCase();
39417
39773
  if (lower2.endsWith(".html")) {
@@ -40625,16 +40981,6 @@ var init_loader = __esm({
40625
40981
  }
40626
40982
  });
40627
40983
 
40628
- // src/utils/esm-compat.ts
40629
- async function loadGlobby() {
40630
- const mod = await import('globby');
40631
- return mod?.globby ?? mod?.default ?? mod;
40632
- }
40633
- var init_esm_compat = __esm({
40634
- "src/utils/esm-compat.ts"() {
40635
- }
40636
- });
40637
-
40638
40984
  // src/services/init/scanner.ts
40639
40985
  var scanner_exports = {};
40640
40986
  __export(scanner_exports, {