fluxflow-cli 1.18.8 → 1.18.10

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.
Files changed (2) hide show
  1. package/dist/fluxflow.js +174 -109
  2. package/package.json +1 -1
package/dist/fluxflow.js CHANGED
@@ -1206,7 +1206,11 @@ var init_exec_command = __esm({
1206
1206
  if (isActiveCommandPty && typeof activeChildProcess.destroy === "function") {
1207
1207
  activeChildProcess.destroy();
1208
1208
  } else if (typeof activeChildProcess.kill === "function") {
1209
- activeChildProcess.kill("SIGKILL");
1209
+ if (process.platform === "win32") {
1210
+ spawn("taskkill", ["/pid", activeChildProcess.pid, "/f", "/t"]);
1211
+ } else {
1212
+ activeChildProcess.kill("SIGKILL");
1213
+ }
1210
1214
  }
1211
1215
  } catch (err) {
1212
1216
  }
@@ -4806,19 +4810,19 @@ var init_ai = __esm({
4806
4810
  TERMINATION_SIGNAL = true;
4807
4811
  };
4808
4812
  TOOL_LABELS2 = {
4809
- "write_file": "Writing File",
4810
- "update_file": "Updating File",
4811
- "read_folder": "Listing Directory",
4812
- "view_file": "Reading File",
4813
- "exec_command": "Running Command",
4814
- "web_search": "Searching Web",
4815
- "web_scrape": "Reading Site",
4813
+ "write_file": "Writing",
4814
+ "update_file": "Editing",
4815
+ "read_folder": "Reading",
4816
+ "view_file": "Reading",
4817
+ "exec_command": "Executing Command",
4818
+ "web_search": "Searching",
4819
+ "web_scrape": "Reading",
4816
4820
  "memory": "Updating Memory",
4817
- "search_keyword": "Finding Files",
4818
- "ask": "Asking User",
4819
- "write_pdf": "Creating PDF",
4820
- "write_docx": "Creating Document",
4821
- "generate_image": "Generating Image"
4821
+ "search_keyword": "Searching",
4822
+ "ask": "User Input",
4823
+ "write_pdf": "Creating",
4824
+ "write_docx": "Creating",
4825
+ "generate_image": "Generating"
4822
4826
  };
4823
4827
  getToolDetail = (toolName, argsStr) => {
4824
4828
  try {
@@ -5343,67 +5347,90 @@ ${newMemoryListStr}
5343
5347
  const isContext32k = (sessionStats?.tokens || 0) >= 32e3;
5344
5348
  const memoryPrompt = getMemoryPrompt(otherMemories, mainUserMemories, isMemoryEnabled, isContext32k);
5345
5349
  const dateTimeStr = (/* @__PURE__ */ new Date()).toLocaleString([], { year: "numeric", month: "numeric", day: "numeric", hour: "2-digit", minute: "2-digit", hour12: true });
5346
- const getDirTree = (dir, prefix = "", depth = 1) => {
5350
+ const COLLAPSED_DIRS_GLOBAL = [".git", "node_modules", ".gemini", "dist", "build", ".next", "out", ".cache", "bin", "obj", "vendor", "venv", ".idea", ".gradle", ".terraform", "target", "coverage", ".vscode"];
5351
+ const safeReaddirWithTypes = (dir) => {
5347
5352
  try {
5348
- const files = fs16.readdirSync(dir);
5349
- const sep = path15.sep;
5350
- if (files.length > 100) {
5351
- return `${prefix}\u2514\u2500\u2500 ${path15.basename(dir)}${sep} ...100+ files...
5352
- `;
5353
+ return fs16.readdirSync(dir, { withFileTypes: true });
5354
+ } catch (e) {
5355
+ return [];
5356
+ }
5357
+ };
5358
+ const countFolders = (dir, currentCount = { value: 0 }, depth = 1) => {
5359
+ if (currentCount.value > 6200 || depth > 7) return currentCount.value;
5360
+ const entries = safeReaddirWithTypes(dir);
5361
+ for (const entry of entries) {
5362
+ if (currentCount.value > 6200) break;
5363
+ if (COLLAPSED_DIRS_GLOBAL.includes(entry.name)) continue;
5364
+ if (entry.isDirectory()) {
5365
+ currentCount.value++;
5366
+ countFolders(path15.join(dir, entry.name), currentCount, depth + 1);
5353
5367
  }
5354
- let result = "";
5355
- const COLLAPSED_DIRS = [".git", "node_modules", ".gemini", "dist", "build", ".next", "out", ".cache", "bin", "obj", "vendor", "venv", ".idea", ".gradle", ".terraform", "target", "coverage", ".vscode"];
5356
- const filtered = files.filter((f) => !COLLAPSED_DIRS.includes(f));
5357
- const collapsedInDir = files.filter((f) => COLLAPSED_DIRS.includes(f)).sort();
5358
- const sorted = filtered.sort((a, b) => {
5359
- try {
5360
- const aStat = fs16.statSync(path15.join(dir, a));
5361
- const bStat = fs16.statSync(path15.join(dir, b));
5362
- if (aStat.isDirectory() && !bStat.isDirectory()) return -1;
5363
- if (!aStat.isDirectory() && bStat.isDirectory()) return 1;
5364
- } catch (e) {
5365
- }
5366
- return a.localeCompare(b);
5367
- });
5368
- sorted.push(...collapsedInDir);
5369
- sorted.forEach((file, index) => {
5370
- const isLast = index === sorted.length - 1;
5371
- const filePath = path15.join(dir, file);
5372
- const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
5373
- const childPrefix = prefix + (isLast ? " " : "\u2502 ");
5374
- if (COLLAPSED_DIRS.includes(file)) {
5375
- result += `${prefix}${connector}${file}${sep}...
5368
+ }
5369
+ return currentCount.value;
5370
+ };
5371
+ const getDirTree = (dir, maxDepth, prefix = "", depth = 1) => {
5372
+ const entries = safeReaddirWithTypes(dir);
5373
+ const sep = path15.sep;
5374
+ if (entries.length > 100) {
5375
+ return `${prefix}\u2514\u2500\u2500 ${path15.basename(dir)}${sep} ...100+ files...
5376
5376
  `;
5377
- return;
5378
- }
5379
- try {
5380
- const stat = fs16.statSync(filePath);
5381
- if (stat.isDirectory()) {
5382
- const subFiles = fs16.readdirSync(filePath);
5383
- if (subFiles.length > 80 || depth > 7) {
5384
- result += `${prefix}${connector}${file}${sep} ...depth exceeded...
5377
+ }
5378
+ let result = "";
5379
+ const COLLAPSED_DIRS = COLLAPSED_DIRS_GLOBAL;
5380
+ const filtered = entries.filter((e) => !COLLAPSED_DIRS.includes(e.name));
5381
+ const collapsedInDir = entries.filter((e) => COLLAPSED_DIRS.includes(e.name)).map((e) => e.name).sort();
5382
+ filtered.sort((a, b) => {
5383
+ if (a.isDirectory() && !b.isDirectory()) return -1;
5384
+ if (!a.isDirectory() && b.isDirectory()) return 1;
5385
+ return a.name.localeCompare(b.name);
5386
+ });
5387
+ const finalItems = [
5388
+ ...filtered.map((e) => ({ name: e.name, isDir: e.isDirectory() })),
5389
+ ...collapsedInDir.map((name) => ({ name, isDir: true, isCollapsed: true }))
5390
+ ];
5391
+ finalItems.forEach((item, index) => {
5392
+ const isLast = index === finalItems.length - 1;
5393
+ const filePath = path15.join(dir, item.name);
5394
+ const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
5395
+ const childPrefix = prefix + (isLast ? " " : "\u2502 ");
5396
+ if (item.isCollapsed) {
5397
+ result += `${prefix}${connector}${item.name}${sep}...
5385
5398
  `;
5386
- } else {
5387
- result += `${prefix}${connector}${file}${sep}
5399
+ return;
5400
+ }
5401
+ if (item.isDir) {
5402
+ if (depth > maxDepth) {
5403
+ result += `${prefix}${connector}${item.name}${sep} ...depth exceeded...
5404
+ `;
5405
+ } else {
5406
+ const subEntries = safeReaddirWithTypes(filePath);
5407
+ if (subEntries.length > 80) {
5408
+ result += `${prefix}${connector}${item.name}${sep} ...80+ files...
5388
5409
  `;
5389
- result += getDirTree(filePath, childPrefix, depth + 1);
5390
- }
5391
5410
  } else {
5392
- result += `${prefix}${connector}${file}
5411
+ result += `${prefix}${connector}${item.name}${sep}
5393
5412
  `;
5413
+ result += getDirTree(filePath, maxDepth, childPrefix, depth + 1);
5394
5414
  }
5395
- } catch (e) {
5396
- result += `${prefix}${connector}${file}
5397
- `;
5398
5415
  }
5399
- });
5400
- return result;
5401
- } catch (e) {
5402
- return "";
5403
- }
5416
+ } else {
5417
+ result += `${prefix}${connector}${item.name}
5418
+ `;
5419
+ }
5420
+ });
5421
+ return result;
5404
5422
  };
5405
5423
  yield { type: "status", content: "Gathering Context..." };
5406
- let dirStructure = process.cwd() + "\n" + getDirTree(process.cwd());
5424
+ await new Promise((resolve) => setTimeout(resolve, 500));
5425
+ const totalFolders = countFolders(process.cwd());
5426
+ let dynamicMaxDepth = 7;
5427
+ if (totalFolders > 4096) dynamicMaxDepth = 1;
5428
+ else if (totalFolders > 3072) dynamicMaxDepth = 2;
5429
+ else if (totalFolders > 2048) dynamicMaxDepth = 3;
5430
+ else if (totalFolders > 1024) dynamicMaxDepth = 4;
5431
+ else if (totalFolders > 512) dynamicMaxDepth = 6;
5432
+ else if (totalFolders > 256) dynamicMaxDepth = 7;
5433
+ let dirStructure = totalFolders > 6144 ? `FileSystem length exceeded for indexing` : process.cwd() + "\n" + getDirTree(process.cwd(), dynamicMaxDepth);
5407
5434
  const firstUserMsg = `[SYSTEM METADATA (PRIORITY: DYNAMIC)] Time: ${dateTimeStr} | v${versionFluxflow2}
5408
5435
  CWD: ${process.cwd()}
5409
5436
  **DIRECTORY STRUCTURE**
@@ -5632,20 +5659,20 @@ ${thinkingLevel != "Fast" ? "[SYSTEM] **STRICTLY FOLLOW THINKING POLICY AS CRITI
5632
5659
  yield { type: "status", content: `${currentLabel}...` };
5633
5660
  if (process.stdout.isTTY) {
5634
5661
  const TOOL_TITLES = {
5635
- "web_search": "Searching Web",
5636
- "web_scrape": "Reading Website",
5637
- "view_file": "Reading File",
5638
- "read_folder": "Listing Folder",
5639
- "list_files": "Listing Folder",
5640
- "write_file": "Writing File",
5641
- "update_file": "Updating File",
5642
- "write_pdf": "Creating PDF",
5643
- "write_docx": "Creating Word Doc",
5644
- "search_keyword": "Searching Keywords",
5645
- "exec_command": "Running Command",
5646
- "ask": "Asking User",
5662
+ "web_search": "Searching",
5663
+ "web_scrape": "Reading",
5664
+ "view_file": "Reading",
5665
+ "read_folder": "Reading",
5666
+ "list_files": "Reading",
5667
+ "write_file": "Writing",
5668
+ "update_file": "Editing",
5669
+ "write_pdf": "Creating",
5670
+ "write_docx": "Creating",
5671
+ "search_keyword": "Searching",
5672
+ "exec_command": "Executing",
5673
+ "ask": "User Input",
5647
5674
  "memory": "Updating Memory",
5648
- "generate_image": "Generating Image"
5675
+ "generate_image": "Generating"
5649
5676
  };
5650
5677
  const toolTitle = TOOL_TITLES[potentialTool] || "Working";
5651
5678
  process.stdout.write(`\x1B]0;${toolTitle}...\x07`);
@@ -5768,10 +5795,10 @@ ${thinkingLevel != "Fast" ? "[SYSTEM] **STRICTLY FOLLOW THINKING POLICY AS CRITI
5768
5795
  let label = "";
5769
5796
  if (normToolName === "web_search") {
5770
5797
  const { query, limit = 10 } = parseArgs(toolCall.args);
5771
- label = `\u{1F50D} SEARCHED: "${query}" (${limit})`.toUpperCase();
5798
+ label = `\u{1F50D} Searched: ${query}`;
5772
5799
  } else if (normToolName === "web_scrape") {
5773
5800
  const url = parseArgs(toolCall.args).url || "...";
5774
- label = `\u{1F4D6} READ SITE: ${url}`.toUpperCase();
5801
+ label = `\u{1F4D6} Visited: ${url}`;
5775
5802
  } else if (normToolName === "view_file") {
5776
5803
  const { path: targetPath2, StartLine, EndLine, start_line, end_line, startLine, endLine } = parseArgs(toolCall.args);
5777
5804
  const rawStart = StartLine || start_line || startLine;
@@ -5792,34 +5819,35 @@ ${thinkingLevel != "Fast" ? "[SYSTEM] **STRICTLY FOLLOW THINKING POLICY AS CRITI
5792
5819
  }
5793
5820
  const pathLower = targetPath2.toLowerCase();
5794
5821
  const isPdf = pathLower.endsWith(".pdf");
5822
+ const isOfficeFile = pathLower.endsWith(".docx") || pathLower.endsWith(".doc") || pathLower.endsWith(".ppt") || pathLower.endsWith(".pptx") || pathLower.endsWith(".xls") || pathLower.endsWith(".xlsx");
5795
5823
  const isImage = /\.(png|jpg|jpeg|webp|gif|bmp)$/.test(pathLower);
5796
- if (isPdf) {
5797
- label = `\u{1F4C4} ANALYZED PDF: ${targetPath2}`.toUpperCase();
5824
+ if (isPdf || isOfficeFile) {
5825
+ label = `\u{1F4C4} Viewed: ${targetPath2}`;
5798
5826
  } else if (isImage) {
5799
- label = `\u{1F4F8} ANALYZED IMAGE: ${targetPath2}`.toUpperCase();
5827
+ label = `\u{1F4F8} Viewed: ${targetPath2}`;
5800
5828
  } else {
5801
- label = `\u{1F4C4} ANALYZED FILE: ${targetPath2} | LINES: ${sLine}-${actualEndLine} OF ${totalLines}`.toUpperCase();
5829
+ label = `\u{1F4C4} Read: ${targetPath2} | ${sLine}-${actualEndLine} from ${totalLines} lines`;
5802
5830
  }
5803
5831
  } else if (normToolName === "list_files" || normToolName === "read_folder") {
5804
- const action = normToolName === "list_files" ? "LIST" : "ANALYSED";
5805
- label = `\u{1F4C2} ${action} FOLDER: ${parseArgs(toolCall.args).path || "."}`.toUpperCase();
5832
+ const action = normToolName === "list_files" ? "List" : "Viewed";
5833
+ const path17 = parseArgs(toolCall.args).path;
5834
+ label = `\u{1F4C2} ${action}: ${path17 === "." ? "./" : path17}`;
5806
5835
  } else if (normToolName === "write_file" || normToolName === "update_file") {
5807
- const action = normToolName === "write_file" ? "WRITTEN" : "PATCHED";
5808
- label = `\u{1F4BE} ${action}: ${parseArgs(toolCall.args).path || "..."}`.toUpperCase();
5836
+ const action = normToolName === "write_file" ? "Created" : "Edited";
5837
+ label = `\u{1F4BE} ${action}: ${parseArgs(toolCall.args).path || "..."}`;
5809
5838
  } else if (normToolName === "write_pdf") {
5810
- label = `\u{1F4D1} PDF CREATED: ${parseArgs(toolCall.args).path || "..."}`.toUpperCase();
5839
+ label = `\u{1F4D1} Created: ${parseArgs(toolCall.args).path || "..."}`;
5811
5840
  } else if (normToolName === "write_docx") {
5812
- label = `\u{1F4DD} DOCX CREATED: ${parseArgs(toolCall.args).path || "..."}`.toUpperCase();
5841
+ label = `\u{1F4DD} Created: ${parseArgs(toolCall.args).path || "..."}`;
5813
5842
  } else if (normToolName === "search_keyword") {
5814
- const { keyword } = parseArgs(toolCall.args);
5815
- label = `\u{1F50E} KEYWORD SEARCHED: "${keyword}"`.toUpperCase();
5843
+ label = "";
5816
5844
  } else if (normToolName === "generate_image") {
5817
5845
  const { path: argPath, outputPath, output } = parseArgs(toolCall.args);
5818
- label = `\u{1F3A8} IMAGE GENERATED: ${argPath || outputPath || output || "generated_image.png"}`.toUpperCase();
5846
+ label = `\u{1F3A8} Generated: ${argPath || outputPath || output || "generated_image.png"}`;
5819
5847
  } else if (normToolName === "exec_command" || normToolName === "ask") {
5820
5848
  label = "";
5821
5849
  } else {
5822
- label = `EXECUTED: ${toolCall.toolName}`.toUpperCase();
5850
+ label = `Executed: ${toolCall.toolName}`;
5823
5851
  }
5824
5852
  if (normToolName === "exec_command") {
5825
5853
  const { command } = parseArgs(toolCall.args);
@@ -5859,8 +5887,8 @@ ${thinkingLevel != "Fast" ? "[SYSTEM] **STRICTLY FOLLOW THINKING POLICY AS CRITI
5859
5887
  if (isExternalOff && !absoluteTarget.startsWith(absoluteCwd)) {
5860
5888
  const denyMsg = `Access Denied. You are not allowed to access files outside the current workspace.`;
5861
5889
  if (normToolName === "write_file" || normToolName === "update_file") {
5862
- const action = normToolName === "write_file" ? "WRITE DENIED" : "UPDATE DENIED";
5863
- const deniedLabel = `\u{1F4BE} ${action}: ${parsedArgs.path || "..."}`.toUpperCase();
5890
+ const action = normToolName === "write_file" ? "Write Canceled" : "Edit Canceled";
5891
+ const deniedLabel = `\u{1F4BE} ${action}: ${parsedArgs.path || "..."}`;
5864
5892
  const boxWidth = Math.min(deniedLabel.length + 4, 115);
5865
5893
  const boxTop = `\u256D${"\u2500".repeat(boxWidth)}\u256E`;
5866
5894
  const boxMid = `\u2502 ${deniedLabel.padEnd(boxWidth - 2).substring(0, boxWidth - 2)} \u2502`;
@@ -6014,6 +6042,24 @@ ${boxBottom}` };
6014
6042
  binaryPart = result.binaryPart;
6015
6043
  result = result.text;
6016
6044
  }
6045
+ if (normToolName === "search_keyword") {
6046
+ const { keyword, file } = parseArgs(toolCall.args);
6047
+ let matchCount = 0;
6048
+ if (result) {
6049
+ const m = result.match(/Found (\d+) matches/i);
6050
+ if (m) {
6051
+ matchCount = parseInt(m[1]);
6052
+ }
6053
+ }
6054
+ const postLabel = `\u{1F50E} Searched: "${keyword}"${file ? ` in "${file}"` : " ./"} -> ${matchCount} Match${matchCount === 1 ? "" : "es"}`;
6055
+ const boxWidth = Math.min(postLabel.length + 4, 115);
6056
+ const boxTop = `\u256D${"\u2500".repeat(boxWidth)}\u256E`;
6057
+ const boxMid = `\u2502 ${postLabel.padEnd(boxWidth - 2).substring(0, boxWidth - 2)} \u2502`;
6058
+ const boxBottom = `\u2570${"\u2500".repeat(boxWidth)}\u256F`;
6059
+ yield { type: "visual_feedback", content: `${boxTop}
6060
+ ${boxMid}
6061
+ ${boxBottom}` };
6062
+ }
6017
6063
  if (normToolName === "exec_command" && settings.onExecEnd) {
6018
6064
  await new Promise((resolve) => setTimeout(resolve, 800));
6019
6065
  settings.onExecEnd();
@@ -7798,16 +7844,28 @@ ${hintText}`, color: "magenta" }];
7798
7844
  }
7799
7845
  }
7800
7846
  const fileContent = exportLines.join("\n");
7801
- fs18.writeFileSync(exportPath, fileContent, "utf8");
7802
- setMessages((prev) => {
7803
- setCompletedIndex(prev.length + 1);
7804
- return [...prev, {
7805
- id: Date.now(),
7806
- role: "system",
7807
- text: `\u{1F4E4} [EXPORT] Chat exported successfully to "${exportFile}"`,
7808
- isMeta: true
7809
- }];
7810
- });
7847
+ try {
7848
+ fs18.writeFileSync(exportPath, fileContent, "utf8");
7849
+ setMessages((prev) => {
7850
+ setCompletedIndex(prev.length + 1);
7851
+ return [...prev, {
7852
+ id: Date.now(),
7853
+ role: "system",
7854
+ text: `\u{1F4E4} [EXPORT] Chat exported successfully to "${exportFile}"`,
7855
+ isMeta: true
7856
+ }];
7857
+ });
7858
+ } catch (err) {
7859
+ setMessages((prev) => {
7860
+ setCompletedIndex(prev.length + 1);
7861
+ return [...prev, {
7862
+ id: Date.now(),
7863
+ role: "system",
7864
+ text: `\u274C [EXPORT ERROR] Failed to export chat: ${err.message}`,
7865
+ isMeta: true
7866
+ }];
7867
+ });
7868
+ }
7811
7869
  break;
7812
7870
  }
7813
7871
  case "/chats": {
@@ -7903,11 +7961,18 @@ ${list || "No saved chats found."}`, isMeta: true }];
7903
7961
  return [...prev, { id: "init-err-" + Date.now(), role: "system", text: "\u274C ERROR: FluxFlow.md already exists in this directory.", isMeta: true }];
7904
7962
  });
7905
7963
  } else {
7906
- fs18.writeFileSync(filePath, template);
7907
- setMessages((prev) => {
7908
- setCompletedIndex(prev.length + 1);
7909
- return [...prev, { id: "init-ok-" + Date.now(), role: "system", text: "\u2705 [SUCCESS] FluxFlow.md has been initialized. You can now customize it for this project.", isMeta: true }];
7910
- });
7964
+ try {
7965
+ fs18.writeFileSync(filePath, template);
7966
+ setMessages((prev) => {
7967
+ setCompletedIndex(prev.length + 1);
7968
+ return [...prev, { id: "init-ok-" + Date.now(), role: "system", text: "\u2705 [SUCCESS] FluxFlow.md has been initialized. You can now customize it for this project.", isMeta: true }];
7969
+ });
7970
+ } catch (err) {
7971
+ setMessages((prev) => {
7972
+ setCompletedIndex(prev.length + 1);
7973
+ return [...prev, { id: "init-err-" + Date.now(), role: "system", text: `\u274C ERROR: Failed to initialize FluxFlow.md: ${err.message}`, isMeta: true }];
7974
+ });
7975
+ }
7911
7976
  }
7912
7977
  } else {
7913
7978
  setMessages((prev) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluxflow-cli",
3
- "version": "1.18.8",
3
+ "version": "1.18.10",
4
4
  "date": "2026-05-30",
5
5
  "description": "A high-fidelity agentic terminal assistant for the Flux Era.",
6
6
  "keywords": [