@bonginkan/maria 4.4.6 → 4.4.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.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # MARIA - AI Development Platform v4.4.6
1
+ # MARIA - AI Development Platform v4.4.7
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@bonginkan/maria.svg)](https://www.npmjs.com/package/@bonginkan/maria)
4
4
  [![License](https://img.shields.io/badge/license-Multi--tier-blue.svg)](LICENSE)
@@ -10,7 +10,7 @@
10
10
 
11
11
  > **Enterprise-grade AI development platform with 100% command availability and comprehensive fallback support**
12
12
 
13
- ## 🚀 What's New in v4.4.6 (October, 2025)
13
+ ## 🚀 What's New in v4.4.7 (October, 2025)
14
14
  ### Functional enhancements
15
15
  - **Improved coding**
16
16
  - **Enhanced video/image support**
@@ -933,7 +933,7 @@ await secureWorkflow.executeWithAuth(workflowDefinition, securityContext);
933
933
  ### Quick Installation
934
934
  ```bash
935
935
  # Install globally (recommended)
936
- npm install -g @bonginkan/maria@4.4.6
936
+ npm install -g @bonginkan/maria@4.4.7
937
937
 
938
938
  # Verify installation
939
939
  maria --version # Should show v4.3.9
@@ -1137,7 +1137,7 @@ MARIA CODE is distributed under a comprehensive licensing system designed for in
1137
1137
 
1138
1138
  *MARIA v4.1.4 represents the pinnacle of multimodal AI development platform evolution - combining revolutionary voice-to-code capabilities, advanced memory systems, and comprehensive command ecosystems with enterprise-grade security and performance. This release establishes MARIA as the definitive choice for developers and Fortune 500 enterprises seeking intelligent, multimodal development experiences with GraphRAG intelligence, multilingual support, and zero-anxiety coding workflows.*
1139
1139
 
1140
- **Transform your development experience today**: `npm install -g @bonginkan/maria@4.4.6`
1140
+ **Transform your development experience today**: `npm install -g @bonginkan/maria@4.4.7`
1141
1141
 
1142
1142
  🌐 **Official Website**: [https://maria-code.ai](https://maria-code.ai)
1143
1143
  💬 **Community**: [https://discord.gg/SMSmSGcEQy](https://discord.gg/SMSmSGcEQy)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": "lite-1.0.0",
3
- "generatedAt": "2025-10-26T11:13:53.603Z",
3
+ "generatedAt": "2025-10-27T07:38:20.479Z",
4
4
  "totalCommands": 30,
5
5
  "readyCount": 30,
6
6
  "partialCount": 0,
@@ -26089,8 +26089,8 @@ var require_package = __commonJS({
26089
26089
  "package.json"(exports, module) {
26090
26090
  module.exports = {
26091
26091
  name: "@bonginkan/maria",
26092
- version: "4.4.6",
26093
- description: "\u{1F680} MARIA v4.4.6 - 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.",
26092
+ version: "4.4.7",
26093
+ description: "\u{1F680} MARIA v4.4.7 - 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.",
26094
26094
  keywords: [
26095
26095
  "ai",
26096
26096
  "cli",
@@ -28245,7 +28245,7 @@ var init_AuthenticationManager = __esm({
28245
28245
  const response = await fetch(`${this.apiBase}/api/user/profile`, {
28246
28246
  headers: {
28247
28247
  "Authorization": `Bearer ${tokens2.accessToken}`,
28248
- "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.4.6"}`
28248
+ "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.4.7"}`
28249
28249
  }
28250
28250
  });
28251
28251
  if (response.status === 401) {
@@ -28922,7 +28922,7 @@ async function callApi(path69, init3 = {}) {
28922
28922
  "Authorization": `Bearer ${token}`,
28923
28923
  "X-Device-Id": getDeviceId(),
28924
28924
  "X-Session-Id": getSessionId() || "",
28925
- "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.4.6"}`,
28925
+ "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.4.7"}`,
28926
28926
  "Content-Type": init3.headers?.["Content-Type"] || "application/json"
28927
28927
  });
28928
28928
  const doFetch = async (token) => {
@@ -29771,9 +29771,14 @@ async function executeChat(messages, options) {
29771
29771
  } catch {
29772
29772
  }
29773
29773
  }
29774
+ const injectedAtt = globalThis.__maria_attachments_for_next_call__;
29775
+ try {
29776
+ globalThis.__maria_attachments_for_next_call__ = void 0;
29777
+ } catch {
29778
+ }
29774
29779
  const response = await callAPI("/v1/ai-proxy", {
29775
29780
  method: "POST",
29776
- body: { messages, taskType: "chat", ...options?.provider ? { provider: options.provider } : {}, ...options?.model ? { model: options.model } : {} }
29781
+ body: { messages, taskType: "chat", ...options?.provider ? { provider: options.provider } : {}, ...options?.model ? { model: options.model } : {}, ...Array.isArray(injectedAtt) && injectedAtt.length ? { metadata: { attachments: injectedAtt } } : {} }
29777
29782
  });
29778
29783
  if (process.env.MARIA_DEBUG === "1") {
29779
29784
  try {
@@ -29917,7 +29922,7 @@ async function collectFileAttachmentsFromText(text, cwd2 = process.cwd(), option
29917
29922
  continue;
29918
29923
  }
29919
29924
  const ext2 = (path13__namespace.extname(abs) || "").toLowerCase();
29920
- const mime = ext2 === ".pdf" ? "application/pdf" : ext2 === ".png" ? "image/png" : ext2 === ".jpg" || ext2 === ".jpeg" ? "image/jpeg" : ext2 === ".webp" ? "image/webp" : ext2 === ".gif" ? "image/gif" : ext2 === ".bmp" ? "image/bmp" : ext2 === ".svg" ? "image/svg+xml" : ext2 === ".tif" || ext2 === ".tiff" ? "image/tiff" : ext2 === ".heic" ? "image/heic" : ext2 === ".heif" ? "image/heif" : "text/plain";
29925
+ const mime = ext2 === ".pdf" ? "application/pdf" : ext2 === ".png" ? "image/png" : ext2 === ".jpg" || ext2 === ".jpeg" ? "image/jpeg" : ext2 === ".webp" ? "image/webp" : ext2 === ".gif" ? "image/gif" : ext2 === ".bmp" ? "image/bmp" : ext2 === ".svg" ? "image/svg+xml" : ext2 === ".tif" || ext2 === ".tiff" ? "image/tiff" : ext2 === ".heic" ? "image/heic" : ext2 === ".heif" ? "image/heif" : ext2 === ".md" ? "text/markdown" : ext2 === ".txt" ? "text/plain" : ext2 === ".json" ? "application/json" : ext2 === ".yml" || ext2 === ".yaml" ? "application/x-yaml" : ext2 === ".xml" ? "application/xml" : ext2 === ".docx" ? "application/vnd.openxmlformats-officedocument.wordprocessingml.document" : ext2 === ".doc" ? "application/msword" : "text/plain";
29921
29926
  attachments.push({ name: path13__namespace.basename(abs), path: abs, mime, data_base64: buf.toString("base64") });
29922
29927
  seen.add(key);
29923
29928
  } catch {
@@ -40866,7 +40871,7 @@ var init_about_command = __esm({
40866
40871
  async execute(args2, context2) {
40867
40872
  const output3 = [];
40868
40873
  output3.push("");
40869
- output3.push(chalk14__default.default.cyan.bold("About MARIA v4.4.6"));
40874
+ output3.push(chalk14__default.default.cyan.bold("About MARIA v4.4.7"));
40870
40875
  output3.push(chalk14__default.default.gray("\u2550".repeat(40)));
40871
40876
  output3.push("");
40872
40877
  output3.push(chalk14__default.default.white.bold("MARIA - Minimal API, Maximum Power"));
@@ -40946,7 +40951,7 @@ var init_contact_command = __esm({
40946
40951
  output3.push("");
40947
40952
  output3.push(chalk14__default.default.white.bold("\u{1F3E2} Company Information:"));
40948
40953
  output3.push(" Company: Bonginkan");
40949
- output3.push(" Product: MARIA v4.4.6");
40954
+ output3.push(" Product: MARIA v4.4.7");
40950
40955
  output3.push(" Website: https://bonginkan.ai");
40951
40956
  output3.push(" Product Site: https://maria-code.ai");
40952
40957
  output3.push("");
@@ -56200,6 +56205,32 @@ var init_image_command = __esm({
56200
56205
  try {
56201
56206
  const root = context2.environment.cwd;
56202
56207
  const cli = normalizeImageArgs(args2.raw, root);
56208
+ try {
56209
+ const routed = globalThis.__maria_routed_attachments;
56210
+ if (Array.isArray(routed) && routed.length) {
56211
+ const textSnippets = [];
56212
+ for (const a of routed.slice(0, 4)) {
56213
+ const mime = String(a.mime || "").toLowerCase();
56214
+ const isDoc = /^(text\/|application\/(pdf|json|xml|yaml|yml|msword|vnd\.openxmlformats))/i.test(mime) || /\.(md|txt|json|xml|ya?ml|pdf|docx?)$/i.test(String(a.name || a.path || ""));
56215
+ if (!isDoc) continue;
56216
+ const b64 = String(a.data_base64 || "");
56217
+ if (!b64) continue;
56218
+ try {
56219
+ const buf = Buffer.from(b64, "base64");
56220
+ const text = /pdf/.test(mime) ? "" : buf.toString("utf8");
56221
+ if (text) textSnippets.push(text.slice(0, 800));
56222
+ } catch {
56223
+ }
56224
+ }
56225
+ if (textSnippets.length) {
56226
+ cli.prompt = `${cli.prompt}
56227
+
56228
+ [context]
56229
+ ${textSnippets.join("\n---\n")}`.slice(0, 4e3);
56230
+ }
56231
+ }
56232
+ } catch {
56233
+ }
56203
56234
  if (cli.planOnly || cli.dryRun || !cli.apply) {
56204
56235
  const line = `Plan: ${cli.count} images ${cli.size[0]}x${cli.size[1]} ${cli.format} model=${cli.model || "auto"} concurrency=${cli.concurrency} retry=${cli.retry}`;
56205
56236
  const next = `Next: /image "${cli.prompt}" --size ${cli.size[0]}x${cli.size[1]} --format ${cli.format} --count ${cli.count} --apply`;
@@ -56751,6 +56782,32 @@ var init_video_command = __esm({
56751
56782
  try {
56752
56783
  const root = context2.environment.cwd;
56753
56784
  const cli = normalizeVideoArgs(args2.raw, root);
56785
+ try {
56786
+ const routed = globalThis.__maria_routed_attachments;
56787
+ if (Array.isArray(routed) && routed.length) {
56788
+ const textSnippets = [];
56789
+ for (const a of routed.slice(0, 4)) {
56790
+ const mime = String(a.mime || "").toLowerCase();
56791
+ const isDoc = /^(text\/|application\/(pdf|json|xml|yaml|yml|msword|vnd\.openxmlformats))/i.test(mime) || /\.(md|txt|json|xml|ya?ml|pdf|docx?)$/i.test(String(a.name || a.path || ""));
56792
+ if (!isDoc) continue;
56793
+ const b64 = String(a.data_base64 || "");
56794
+ if (!b64) continue;
56795
+ try {
56796
+ const buf = Buffer.from(b64, "base64");
56797
+ const text = /pdf/.test(mime) ? "" : buf.toString("utf8");
56798
+ if (text) textSnippets.push(text.slice(0, 800));
56799
+ } catch {
56800
+ }
56801
+ }
56802
+ if (textSnippets.length) {
56803
+ cli.prompt = `${cli.prompt}
56804
+
56805
+ [context]
56806
+ ${textSnippets.join("\n---\n")}`.slice(0, 4e3);
56807
+ }
56808
+ }
56809
+ } catch {
56810
+ }
56754
56811
  try {
56755
56812
  const hook = global.__MARIA_VIDEO_LLM_INFER__;
56756
56813
  if (hook) {
@@ -57449,7 +57506,7 @@ function detectChaptersFromIdea(idea, fallback2) {
57449
57506
  }
57450
57507
  return fallback2;
57451
57508
  }
57452
- async function generatePlan(prompt, lang, title, genre, llm, forcedLocal) {
57509
+ async function generatePlan(prompt, lang, title, genre, llm, forcedLocal, attachments) {
57453
57510
  const system = [
57454
57511
  "You generate a detailed novel outline (plot).",
57455
57512
  "Return Markdown with clear sections: Title, Logline, Themes, Characters, Chapter Outline.",
@@ -57486,12 +57543,13 @@ ${user}`;
57486
57543
  ${user}`, taskType: "creative" };
57487
57544
  if (llm?.provider) body.provider = llm.provider;
57488
57545
  if (llm?.model) body.model = llm.model;
57546
+ if (Array.isArray(attachments) && attachments.length) body.metadata = { attachments };
57489
57547
  const resp = await callAPI("/v1/ai-proxy", { method: "POST", body });
57490
57548
  const out = (resp?.data?.content || resp?.output || "").trim();
57491
57549
  return out;
57492
57550
  }
57493
57551
  }
57494
- async function generateChapters(planMarkdown, lang, chapters, llm, forcedLocal) {
57552
+ async function generateChapters(planMarkdown, lang, chapters, llm, forcedLocal, attachments) {
57495
57553
  const system = [
57496
57554
  "You expand a novel outline into chapter texts.",
57497
57555
  "Return only JSON array: [{ index: number, title: string, content: string }].",
@@ -57522,6 +57580,7 @@ ${planMarkdown}`;
57522
57580
  const body = { prompt, taskType: "creative" };
57523
57581
  if (llm?.provider) body.provider = llm.provider;
57524
57582
  if (llm?.model) body.model = llm.model;
57583
+ if (Array.isArray(attachments) && attachments.length) body.metadata = { attachments };
57525
57584
  const resp = await callAPI("/v1/ai-proxy", { method: "POST", body });
57526
57585
  raw = (resp?.data?.content || resp?.output || "").trim();
57527
57586
  }
@@ -57628,6 +57687,12 @@ var init_novel_command = __esm({
57628
57687
  if (Array.isArray(routed) && routed.length) autoAttachments = autoAttachments.concat(routed);
57629
57688
  } catch {
57630
57689
  }
57690
+ let routedAttachments = [];
57691
+ try {
57692
+ const routed = globalThis.__maria_routed_attachments;
57693
+ if (Array.isArray(routed) && routed.length) routedAttachments = routed;
57694
+ } catch {
57695
+ }
57631
57696
  let inferred = {};
57632
57697
  try {
57633
57698
  const spin = new ProcessAnimation();
@@ -57707,7 +57772,7 @@ var init_novel_command = __esm({
57707
57772
  const spin = new ProcessAnimation();
57708
57773
  spin.start();
57709
57774
  try {
57710
- plan = await generatePlan(ideaText, langDetected, title, genre, { provider: effectiveProvider, model: explicitModel }, forcedLocalSel);
57775
+ plan = await generatePlan(ideaText, langDetected, title, genre, { provider: effectiveProvider, model: explicitModel }, forcedLocalSel, routedAttachments);
57711
57776
  } finally {
57712
57777
  try {
57713
57778
  spin.stop();
@@ -57743,7 +57808,7 @@ var init_novel_command = __esm({
57743
57808
  const spin = new ProcessAnimation();
57744
57809
  spin.start();
57745
57810
  try {
57746
- return await generateChapters(plan, langDetected, chapters, { provider: effectiveProvider, model: explicitModel }, forcedLocalSel);
57811
+ return await generateChapters(plan, langDetected, chapters, { provider: effectiveProvider, model: explicitModel }, forcedLocalSel, routedAttachments);
57747
57812
  } finally {
57748
57813
  try {
57749
57814
  spin.stop();
@@ -58331,6 +58396,10 @@ async function getRepoFiles(root) {
58331
58396
  _repoFileIndexCache = { root, files: out };
58332
58397
  return out;
58333
58398
  }
58399
+ function isDocMime(m2) {
58400
+ const s2 = String(m2 || "").toLowerCase();
58401
+ return s2.startsWith("text/") || s2 === "application/pdf" || s2 === "application/json" || s2 === "application/xml" || s2 === "application/x-yaml" || s2 === "application/yaml" || s2 === "application/msword" || s2 === "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
58402
+ }
58334
58403
  function languageFromExt(ext2) {
58335
58404
  const e2 = ext2.toLowerCase().replace(/^\./, "");
58336
58405
  if (e2 === "ts") return "typescript";
@@ -58548,7 +58617,16 @@ async function orchestrate(request, opts) {
58548
58617
  const fallbackNotices = [];
58549
58618
  const withNotices = (base) => fallbackNotices.length > 0 ? [...fallbackNotices, ...base] : base;
58550
58619
  const explicitFilesRaw = parseExplicitFilenames(request);
58551
- const explicitFiles = explicitFilesRaw.length > 0 ? await resolveExplicitPaths(opts.root, explicitFilesRaw, request) : [];
58620
+ let explicitFiles = explicitFilesRaw.length > 0 ? await resolveExplicitPaths(opts.root, explicitFilesRaw, request) : [];
58621
+ const isDocRelPath = (p2) => {
58622
+ const lower2 = p2.toLowerCase();
58623
+ if (lower2.startsWith(".maria/")) return true;
58624
+ const ext2 = lower2.includes(".") ? lower2.slice(lower2.lastIndexOf(".")) : "";
58625
+ return [".md", ".markdown", ".txt", ".json", ".yaml", ".yml", ".xml"].includes(ext2);
58626
+ };
58627
+ if (explicitFiles.length > 0) {
58628
+ explicitFiles = explicitFiles.filter((p2) => !isDocRelPath(p2));
58629
+ }
58552
58630
  dbg("explicitFiles", { raw: explicitFilesRaw, resolved: explicitFiles });
58553
58631
  const explicitAbsMap = /* @__PURE__ */ Object.create(null);
58554
58632
  if (explicitFiles.length > 0) {
@@ -58559,7 +58637,11 @@ async function orchestrate(request, opts) {
58559
58637
  }
58560
58638
  const isEditIntent = await detectEditIntentLLM(opts.root, request, {
58561
58639
  explicitFiles,
58562
- attachmentsCount: Array.isArray(opts.attachedFiles) ? opts.attachedFiles.length : 0
58640
+ attachmentsCount: (() => {
58641
+ if (!Array.isArray(opts.attachedFiles) || opts.attachedFiles.length === 0) return 0;
58642
+ const docOnly = opts.attachedFiles.every((a) => isDocMime(a.mime));
58643
+ return docOnly ? 0 : opts.attachedFiles.length;
58644
+ })()
58563
58645
  });
58564
58646
  dbg("intent", { isEditIntent });
58565
58647
  let editTargets = explicitFiles;
@@ -58583,6 +58665,22 @@ async function orchestrate(request, opts) {
58583
58665
  dbg("attachment.map", { mappedCount: mapRes.mapped.length, warnings: mapRes.warnings });
58584
58666
  mapRes.warnings.slice();
58585
58667
  for (const m2 of mapRes.mapped) {
58668
+ try {
58669
+ const mime = m2?.attachment?.mime;
58670
+ if (isDocMime(mime)) {
58671
+ if (opts.flags.planOnly || opts.flags.dryRun || !opts.flags.apply) {
58672
+ initial.push({
58673
+ path: m2.path,
58674
+ kind: "doc",
58675
+ action: m2.exists ? "modify" : "create",
58676
+ description: m2.exists ? "Documentation (attached)" : "Documentation (attached)",
58677
+ preview: m2.attachment.content
58678
+ });
58679
+ }
58680
+ continue;
58681
+ }
58682
+ } catch {
58683
+ }
58586
58684
  initial.push({
58587
58685
  path: m2.path,
58588
58686
  kind: "source",
@@ -58627,10 +58725,17 @@ async function orchestrate(request, opts) {
58627
58725
  }
58628
58726
  } catch {
58629
58727
  }
58630
- const targetDirsAbs = Array.from(new Set(targetFilesAbs.map((p2) => p2.split("/").slice(0, -1).join("/")).filter(Boolean)));
58631
- const targetFilesSection = targetFilesAbs.length > 0 ? ["// TARGET FILES (absolute):", ...targetFilesAbs.map((p2) => `// - ${p2}`)].join("\n") : "";
58728
+ const isDocPath = (p2) => {
58729
+ const lower2 = p2.toLowerCase();
58730
+ if (lower2.includes("/.maria/")) return true;
58731
+ const ext2 = lower2.includes(".") ? lower2.slice(lower2.lastIndexOf(".")) : "";
58732
+ return [".md", ".markdown", ".txt", ".json", ".yaml", ".yml", ".xml"].includes(ext2);
58733
+ };
58734
+ const docOnlyTargets = targetFilesAbs.length > 0 && targetFilesAbs.every(isDocPath);
58735
+ const targetDirsAbs = docOnlyTargets ? [] : Array.from(new Set(targetFilesAbs.map((p2) => p2.split("/").slice(0, -1).join("/")).filter(Boolean)));
58736
+ const targetFilesSection = !docOnlyTargets && targetFilesAbs.length > 0 ? ["// TARGET FILES (absolute):", ...targetFilesAbs.map((p2) => `// - ${p2}`)].join("\n") : "";
58632
58737
  const targetDirsSection = targetDirsAbs.length > 0 ? ["// TARGET DIRECTORIES (absolute):", ...targetDirsAbs.map((p2) => `// - ${p2}`)].join("\n") : "";
58633
- const requestPreamble = isEditIntent ? [
58738
+ const requestPreamble = isEditIntent && !docOnlyTargets ? [
58634
58739
  "// EDIT MODE RULES:",
58635
58740
  "// 1) Read the entire target file(s) BEFORE making changes. Assume omitted lines must remain exactly as-is.",
58636
58741
  "// 2) Preserve unrelated content and formatting (indentation, EOLs, imports order, license headers, path/file references, and any other unrelated properties). Keep them AS IS.",
@@ -58652,12 +58757,30 @@ ${request}
58652
58757
 
58653
58758
  ${editContext}`;
58654
58759
  dbg("executeCode.prompt.head", enriched.slice(0, 1400));
58655
- const ctxAttachments = Array.isArray(opts.attachedFiles) && opts.attachedFiles.length > 0 ? opts.attachedFiles.map((f3) => ({
58656
- name: f3.originalName,
58657
- path: f3.pathHint,
58658
- mime: f3.mime || "text/plain",
58659
- data_base64: f3.content ? Buffer.from(f3.content, "utf8").toString("base64") : void 0
58660
- })).map((a) => a.data_base64 ? a : { ...a, data_base64: void 0 }) : [];
58760
+ const ctxAttachments = Array.isArray(opts.attachedFiles) && opts.attachedFiles.length > 0 ? await (async () => {
58761
+ const fs58 = await import('fs/promises');
58762
+ const out = [];
58763
+ for (const f3 of opts.attachedFiles) {
58764
+ try {
58765
+ const name2 = f3.originalName;
58766
+ const p2 = f3.pathHint;
58767
+ const mime = f3.mime || "text/plain";
58768
+ let data_base64 = void 0;
58769
+ if (f3.content && f3.content.length > 0) {
58770
+ data_base64 = Buffer.from(f3.content, "utf8").toString("base64");
58771
+ } else if (p2) {
58772
+ try {
58773
+ const buf = await fs58.readFile(p2);
58774
+ data_base64 = buf.toString("base64");
58775
+ } catch {
58776
+ }
58777
+ }
58778
+ out.push({ name: name2, path: p2, mime, data_base64 });
58779
+ } catch {
58780
+ }
58781
+ }
58782
+ return out;
58783
+ })() : [];
58661
58784
  const pathAttachments = [];
58662
58785
  const attachedPathSet = /* @__PURE__ */ new Set();
58663
58786
  if (explicitFiles.length > 0) {
@@ -59472,7 +59595,7 @@ ${h2.head}`);
59472
59595
  "1) If the request references existing repository directory/file paths, prefer EDIT_EXISTING unless it explicitly asks to scaffold a new project.",
59473
59596
  "2) Phrases like 'fix', 'improve', 'update', 'change', 'patch', 'make it work', or 'by editing the existing files' imply EDIT_EXISTING.",
59474
59597
  "3) Phrases like create/new project/scaffold/from scratch/template imply CREATE_NEW.",
59475
- "4) Attachments or explicit file paths increase likelihood of EDIT_EXISTING.",
59598
+ "4) If the only referenced paths are documentation files (e.g., .md/.txt/.json/.yaml/.yml) or files under hidden planning folders (e.g., .maria/), do NOT treat that as evidence for EDIT_EXISTING; prefer CREATE_NEW unless explicitly asked to edit.",
59476
59599
  'Output MUST be EXACTLY this JSON object with no extra text/code blocks: { "intent": "EDIT_EXISTING" | "CREATE_NEW" }'
59477
59600
  ].join("\n");
59478
59601
  const evidence = {
@@ -59489,7 +59612,16 @@ ${h2.head}`);
59489
59612
  "Repo snapshot (trimmed):",
59490
59613
  headSnippets.join("\n\n")
59491
59614
  ].join("\n\n");
59492
- if (existingDirs.length > 0 || existingFiles.length > 0 || ctx2.explicitFiles && ctx2.explicitFiles.length > 0 || ctx2.attachmentsCount > 0 || anyExistingPathMentioned) {
59615
+ const isDocPath = (p2) => {
59616
+ const lower2 = p2.toLowerCase();
59617
+ if (lower2.startsWith(".maria/")) return true;
59618
+ const ext2 = lower2.includes(".") ? lower2.slice(lower2.lastIndexOf(".")) : "";
59619
+ return [".md", ".markdown", ".txt", ".json", ".yaml", ".yml", ".xml"].includes(ext2);
59620
+ };
59621
+ const docExistingCount = existingFiles.filter(isDocPath).length;
59622
+ const codeExistingCount = existingFiles.length - docExistingCount;
59623
+ const explicitDocOnly = Array.isArray(ctx2.explicitFiles) && ctx2.explicitFiles.length > 0 && ctx2.explicitFiles.every(isDocPath);
59624
+ if (existingDirs.length > 0 || codeExistingCount > 0 || ctx2.attachmentsCount > 0 && !explicitDocOnly) {
59493
59625
  return true;
59494
59626
  }
59495
59627
  let startedLocalSpinner = false;
@@ -59520,12 +59652,19 @@ ${h2.head}`);
59520
59652
  if (m2) jsonText = m2[0];
59521
59653
  }
59522
59654
  const parsed = jsonText ? JSON.parse(jsonText) : {};
59523
- if (existingDirs.length > 0 || existingFiles.length > 0 || anyExistingPathMentioned || ctx2.explicitFiles && ctx2.explicitFiles.length > 0 || ctx2.attachmentsCount > 0) {
59524
- return true;
59525
- }
59655
+ if (existingDirs.length > 0 || codeExistingCount > 0) return true;
59656
+ if (explicitDocOnly) return false;
59526
59657
  return parsed?.intent === "EDIT_EXISTING";
59527
59658
  } catch {
59528
- return ctx2.explicitFiles && ctx2.explicitFiles.length > 0 || ctx2.attachmentsCount > 0 || existingDirs.length > 0 || existingFiles.length > 0 || anyExistingPathMentioned;
59659
+ const isDocPath = (p2) => {
59660
+ const lower2 = p2.toLowerCase();
59661
+ if (lower2.startsWith(".maria/")) return true;
59662
+ const ext2 = lower2.includes(".") ? lower2.slice(lower2.lastIndexOf(".")) : "";
59663
+ return [".md", ".markdown", ".txt", ".json", ".yaml", ".yml", ".xml"].includes(ext2);
59664
+ };
59665
+ const explicitDocOnly = Array.isArray(ctx2.explicitFiles) && ctx2.explicitFiles.length > 0 && ctx2.explicitFiles.every(isDocPath);
59666
+ if (explicitDocOnly) return false;
59667
+ return existingDirs.length > 0;
59529
59668
  }
59530
59669
  }
59531
59670
  function sanitizeFolderName(name2) {
@@ -59715,6 +59854,16 @@ async function resolveExplicitPaths(root, files, hintText) {
59715
59854
  const out = [];
59716
59855
  for (const desired of files) {
59717
59856
  const normalized = desired.replace(/^\/+/, "").replace(/\\/g, "/");
59857
+ try {
59858
+ const pathMod2 = await import('path');
59859
+ if (pathMod2.isAbsolute(normalized)) {
59860
+ const rel = pathMod2.relative(root, normalized).replace(/\\/g, "/");
59861
+ if (!rel || rel.startsWith("..")) {
59862
+ continue;
59863
+ }
59864
+ }
59865
+ } catch {
59866
+ }
59718
59867
  if (allFiles.includes(normalized)) {
59719
59868
  out.push(normalized);
59720
59869
  continue;
@@ -59934,7 +60083,28 @@ var init_code_command = __esm({
59934
60083
  if (opts.dryRun && !opts.previewLines) opts.previewLines = 50;
59935
60084
  const root = opts.root || process.cwd();
59936
60085
  const { orchestrate: orchestrate2 } = await Promise.resolve().then(() => (init_Orchestrator(), Orchestrator_exports));
59937
- const attachments = await this.collectAttachedFiles(context2).catch(() => []);
60086
+ let attachments = await this.collectAttachedFiles(context2).catch(() => []);
60087
+ try {
60088
+ const { collectFileAttachmentsFromText: collectFileAttachmentsFromText2 } = await Promise.resolve().then(() => (init_attachment_utils(), attachment_utils_exports));
60089
+ const detected = await collectFileAttachmentsFromText2(request, process.cwd(), { maxBytes: 12 * 1024 * 1024 });
60090
+ if (Array.isArray(detected) && detected.length) {
60091
+ const seen = new Set(attachments.map((a) => (a.pathHint || a.originalName).toLowerCase()));
60092
+ for (const d of detected) {
60093
+ const key = String(d.path || d.name || "").toLowerCase();
60094
+ if (!key || seen.has(key)) continue;
60095
+ let content = "";
60096
+ if (d.data_base64) {
60097
+ try {
60098
+ content = Buffer.from(d.data_base64, "base64").toString("utf8");
60099
+ } catch {
60100
+ }
60101
+ }
60102
+ attachments.push({ originalName: d.name || key, pathHint: d.path, content, size: content ? Buffer.byteLength(content, "utf8") : 0, mime: d.mime });
60103
+ seen.add(key);
60104
+ }
60105
+ }
60106
+ } catch {
60107
+ }
59938
60108
  try {
59939
60109
  if (process.env.MARIA_DEBUG === "1") {
59940
60110
  const attView = attachments.map((a) => ({ name: a.originalName, size: a.size, mime: a.mime, pathHint: a.pathHint })).slice(0, 50);