fluxflow-cli 2.6.4 → 2.6.5
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/fluxflow.js +86 -46
- package/package.json +2 -2
package/dist/fluxflow.js
CHANGED
|
@@ -2157,11 +2157,11 @@ ${mode === "Flux" ? "- **File Tools >> Code in chat**\n" : ""}
|
|
|
2157
2157
|
|
|
2158
2158
|
${mode === "Flux" ? `- PROJECT TOOLS (path = relative to CWD, path separator: '/') -
|
|
2159
2159
|
1. [tool:functions.ReadFile(path="...", startLine=number, endLine=number)]. ${aiProvider !== "Google" ? `${isMultiModal ? `Supports images/docs. User gives image/doc: VIEW FIRST` : `No Multimodal support`}` : `Supports images/docs. User gives image/doc: VIEW FIRST`}
|
|
2160
|
-
2. [tool:functions.FileMap(path="path/file")]. Shows file structure, dependency, functions, variable maps. Token Efficient than ReadFile
|
|
2160
|
+
2. [tool:functions.FileMap(path="path/file")]. Shows file structure, dependency, functions, variable maps. Token Efficient than ReadFile
|
|
2161
2161
|
3. [tool:functions.ReadFolder(path="...")]. Detailed DIR stats
|
|
2162
2162
|
4. [tool:functions.PatchFile(path="...", replaceContent1="exact string", newContent1="...", ...MAX 10)]. Surgical Patch. **Multiple patch on same file/path? Use replaceContent2, newContent2 etc >>> multiple spams**. Unsure? ReadFile >> guessing. **MUST VERIFY DIFF**
|
|
2163
2163
|
5. [tool:functions.WriteFile(path="...", content="...")]. Creates/Overwrites. File Exist? PatchFile > WriteFile. Verify Imports
|
|
2164
|
-
6. [tool:functions.SearchKeyword(keyword="...", file="optional")]. Global project search. If 'file' is provided, searches only that file. Finds definitions/logic without reading every file
|
|
2164
|
+
6. [tool:functions.SearchKeyword(keyword="...", file="optional")]. Global project search. If 'file' is provided, searches only that file. Finds definitions/logic without reading every file. Usage: Can search for relevent lines/logic area to read specifically for edit
|
|
2165
2165
|
7. [tool:functions.Run(command="...")]. Runs ${osDetected === "Windows" ? isPsAvailable() ? `${isPtyAvailable ? "Interactive " : ""}WINDOWS POWERSHELL ONLY` : `${isPtyAvailable ? "Interactive " : ""}WINDOWS CMD ONLY` : `${isPtyAvailable ? "Interactive " : ""}BASH`} command. Destructive/Irreversible ops -> Ask user. **TOOL DENY RULE APPLIES**. **1 CALL LIMIT OR 3 CONSECUTIVE RUN TOOL ONLY**
|
|
2166
2166
|
8. [tool:functions.WritePDF(path="...", content="...", orientation="...")]. PROACTIVE A4 PAGE BREAKS MUST IN CSS. HTML/CSS for PREMIUM layout
|
|
2167
2167
|
9. [tool:functions.WriteDoc(path="...", content="...")]. A4 Word document
|
|
@@ -5579,46 +5579,70 @@ var init_parsers = __esm({
|
|
|
5579
5579
|
import fs18 from "fs-extra";
|
|
5580
5580
|
import path17 from "path";
|
|
5581
5581
|
import { createRequire } from "module";
|
|
5582
|
+
function sanitize(text, limit = 50) {
|
|
5583
|
+
if (!text) return "";
|
|
5584
|
+
const clean = text.replace(/\s+/g, " ").trim();
|
|
5585
|
+
return clean.length > limit ? clean.substring(0, limit - 3) + "..." : clean;
|
|
5586
|
+
}
|
|
5582
5587
|
function getDisplayName(node) {
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
return tagName2 ? tagName2.text : null;
|
|
5588
|
-
}
|
|
5589
|
-
const tagName = node.children.find((c) => c.type === "tag_name");
|
|
5590
|
-
return tagName ? tagName.text : null;
|
|
5588
|
+
const type = node.type;
|
|
5589
|
+
if (type === "if_statement") {
|
|
5590
|
+
const cond = node.childForFieldName("condition");
|
|
5591
|
+
return cond ? `if (${sanitize(cond.text, 40)})` : "if";
|
|
5591
5592
|
}
|
|
5592
|
-
if (
|
|
5593
|
-
|
|
5594
|
-
const
|
|
5595
|
-
return
|
|
5593
|
+
if (type === "else_clause") return "else";
|
|
5594
|
+
if (type === "while_statement" || type === "do_statement") {
|
|
5595
|
+
const cond = node.childForFieldName("condition");
|
|
5596
|
+
return `${type.split("_")[0]} (${cond ? sanitize(cond.text, 40) : ""})`;
|
|
5596
5597
|
}
|
|
5597
|
-
if (
|
|
5598
|
-
|
|
5598
|
+
if (type === "for_statement" || type === "for_in_statement" || type === "for_of_statement") {
|
|
5599
|
+
const text = node.text.split("\n")[0];
|
|
5600
|
+
const match = text.match(/for\s*(?:await\s*)?\((.*)\)/);
|
|
5601
|
+
if (match) return `for (${sanitize(match[1], 40)})`;
|
|
5602
|
+
return "for";
|
|
5599
5603
|
}
|
|
5600
|
-
if (
|
|
5601
|
-
const
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5604
|
+
if (type === "switch_statement") {
|
|
5605
|
+
const val = node.childForFieldName("value");
|
|
5606
|
+
return `switch (${val ? sanitize(val.text, 40) : ""})`;
|
|
5607
|
+
}
|
|
5608
|
+
if (type === "try_statement") return "try";
|
|
5609
|
+
if (type === "catch_clause") return "catch";
|
|
5610
|
+
if (type === "element" || type === "script_element" || type === "style_element" || type === "jsx_element" || type === "jsx_self_closing_element") {
|
|
5611
|
+
const opening = node.childForFieldName("opening_element") || node.childForFieldName("start_tag") || node.children.find((c) => c.type === "start_tag") || node;
|
|
5612
|
+
const tagName = opening.childForFieldName("name") || opening.childForFieldName("tag_name") || opening.children.find((c) => c.type === "tag_name");
|
|
5613
|
+
return tagName ? `<${sanitize(tagName.text, 30)}>` : null;
|
|
5614
|
+
}
|
|
5615
|
+
if (["import_declaration", "import_from_statement", "import_statement", "preproc_include"].includes(type)) {
|
|
5616
|
+
return sanitize(node.text.split("\n")[0], 60);
|
|
5617
|
+
}
|
|
5618
|
+
if (type === "pair") {
|
|
5619
|
+
const key = node.childForFieldName("key");
|
|
5620
|
+
return key ? sanitize(key.text.replace(/["']/g, ""), 40) : null;
|
|
5621
|
+
}
|
|
5622
|
+
if (type === "assignment_expression") {
|
|
5623
|
+
const left = node.childForFieldName("left");
|
|
5624
|
+
return left ? `${sanitize(left.text, 30)} = ...` : null;
|
|
5606
5625
|
}
|
|
5607
|
-
|
|
5626
|
+
if (type === "variable_declarator") {
|
|
5627
|
+
const id = node.childForFieldName("name") || node.children.find((c) => ["identifier", "object_pattern", "array_pattern"].includes(c.type));
|
|
5628
|
+
return id ? sanitize(id.text, 40) : null;
|
|
5629
|
+
}
|
|
5630
|
+
const nameNode = node.childForFieldName("name") || node.childForFieldName("declarator") || node.children.find((c) => ["identifier", "type_identifier", "field_identifier", "property_identifier", "shorthand_property_identifier"].includes(c.type));
|
|
5608
5631
|
if (nameNode) {
|
|
5609
|
-
if (nameNode.type
|
|
5610
|
-
const
|
|
5611
|
-
|
|
5632
|
+
if (nameNode.type.includes("declarator")) {
|
|
5633
|
+
const id = nameNode.descendantsOfType("identifier")[0] || nameNode.descendantsOfType("field_identifier")[0];
|
|
5634
|
+
if (id) return sanitize(id.text, 40);
|
|
5612
5635
|
}
|
|
5613
|
-
return nameNode.text;
|
|
5614
|
-
}
|
|
5615
|
-
if (node.type === "lexical_declaration" || node.type === "variable_declaration") {
|
|
5616
|
-
const decl = node.children.find((c) => c.type === "variable_declarator");
|
|
5617
|
-
if (decl) return getDisplayName(decl);
|
|
5636
|
+
return sanitize(nameNode.text, 40);
|
|
5618
5637
|
}
|
|
5619
|
-
if (
|
|
5620
|
-
|
|
5621
|
-
|
|
5638
|
+
if (["arrow_function", "function_expression", "function_declaration"].includes(type)) {
|
|
5639
|
+
let p = node.parent;
|
|
5640
|
+
while (p && p.type !== "program") {
|
|
5641
|
+
const pName = getDisplayName(p);
|
|
5642
|
+
if (pName) return pName;
|
|
5643
|
+
if (!PASSTHROUGH_TYPES.has(p.type)) break;
|
|
5644
|
+
p = p.parent;
|
|
5645
|
+
}
|
|
5622
5646
|
}
|
|
5623
5647
|
return null;
|
|
5624
5648
|
}
|
|
@@ -5639,36 +5663,43 @@ function getNextInterestingNodes(node) {
|
|
|
5639
5663
|
function toCamelCase(str) {
|
|
5640
5664
|
return str.replace(/_([a-z])/g, (g) => g[1].toUpperCase());
|
|
5641
5665
|
}
|
|
5642
|
-
function traverse(node, depth = 0, isLast = true, prefix = "") {
|
|
5643
|
-
const MAX_DEPTH =
|
|
5666
|
+
function traverse(node, depth = 0, isLast = true, prefix = "", parentName = null) {
|
|
5667
|
+
const MAX_DEPTH = 12;
|
|
5644
5668
|
if (depth > MAX_DEPTH) return "";
|
|
5645
5669
|
const type = node.type;
|
|
5670
|
+
const name = getDisplayName(node);
|
|
5646
5671
|
const isInteresting = INTERESTING_TYPES.has(type) || depth === 0;
|
|
5672
|
+
const children = getNextInterestingNodes(node);
|
|
5673
|
+
const isPassthrough = isInteresting && depth > 0 && (PASSTHROUGH_TYPES.has(type) && children.length > 0 || name !== null && name === parentName && children.length > 0);
|
|
5647
5674
|
let result = "";
|
|
5648
5675
|
let nextPrefix = prefix;
|
|
5649
|
-
|
|
5676
|
+
let nextDepth = depth;
|
|
5677
|
+
let nextParentName = parentName;
|
|
5678
|
+
if (isInteresting && !isPassthrough) {
|
|
5650
5679
|
const startLine = node.startPosition.row + 1;
|
|
5651
5680
|
const endLine = node.endPosition.row + 1;
|
|
5652
|
-
const name = getDisplayName(node);
|
|
5653
5681
|
const camelType = toCamelCase(type);
|
|
5654
5682
|
const label = name ? `${camelType} [${name}]` : camelType;
|
|
5655
5683
|
if (depth === 0) {
|
|
5656
5684
|
result += `\u{1F4C1} ROOT (Lines: ${startLine}-${endLine})
|
|
5657
5685
|
`;
|
|
5686
|
+
nextPrefix = prefix;
|
|
5658
5687
|
} else {
|
|
5659
5688
|
result += `${prefix}${isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 "}${label} (Lines: ${startLine}-${endLine})
|
|
5660
5689
|
`;
|
|
5661
5690
|
nextPrefix += isLast ? " " : "\u2502 ";
|
|
5662
5691
|
}
|
|
5692
|
+
nextDepth = depth + 1;
|
|
5693
|
+
nextParentName = name;
|
|
5663
5694
|
}
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
const
|
|
5667
|
-
result += traverse(child,
|
|
5695
|
+
children.forEach((child, index) => {
|
|
5696
|
+
const isLastChildInLoop = index === children.length - 1;
|
|
5697
|
+
const effectiveIsLast = isPassthrough ? isLast && isLastChildInLoop : isLastChildInLoop;
|
|
5698
|
+
result += traverse(child, nextDepth, effectiveIsLast, nextPrefix, nextParentName);
|
|
5668
5699
|
});
|
|
5669
5700
|
return result;
|
|
5670
5701
|
}
|
|
5671
|
-
var require2, TreeSitter, isParserInitialized, INTERESTING_TYPES, file_map;
|
|
5702
|
+
var require2, TreeSitter, isParserInitialized, INTERESTING_TYPES, PASSTHROUGH_TYPES, file_map;
|
|
5672
5703
|
var init_file_map = __esm({
|
|
5673
5704
|
"src/tools/file_map.js"() {
|
|
5674
5705
|
init_parsers();
|
|
@@ -5682,15 +5713,21 @@ var init_file_map = __esm({
|
|
|
5682
5713
|
"function_declaration",
|
|
5683
5714
|
"method_definition",
|
|
5684
5715
|
"arrow_function",
|
|
5716
|
+
"function_expression",
|
|
5685
5717
|
"if_statement",
|
|
5718
|
+
"else_clause",
|
|
5686
5719
|
"for_statement",
|
|
5720
|
+
"for_in_statement",
|
|
5721
|
+
"for_of_statement",
|
|
5687
5722
|
"while_statement",
|
|
5688
5723
|
"do_statement",
|
|
5689
5724
|
"switch_statement",
|
|
5690
5725
|
"try_statement",
|
|
5691
|
-
"
|
|
5692
|
-
"
|
|
5726
|
+
"catch_clause",
|
|
5727
|
+
"variable_declarator",
|
|
5693
5728
|
"export_statement",
|
|
5729
|
+
"lexical_declaration",
|
|
5730
|
+
"variable_declaration",
|
|
5694
5731
|
"interface_declaration",
|
|
5695
5732
|
"type_alias_declaration",
|
|
5696
5733
|
"enum_declaration",
|
|
@@ -5705,6 +5742,8 @@ var init_file_map = __esm({
|
|
|
5705
5742
|
"preproc_include",
|
|
5706
5743
|
"method_declaration",
|
|
5707
5744
|
"constructor_declaration",
|
|
5745
|
+
"assignment_expression",
|
|
5746
|
+
"pair",
|
|
5708
5747
|
// C/C++
|
|
5709
5748
|
"class_specifier",
|
|
5710
5749
|
"struct_specifier",
|
|
@@ -5715,6 +5754,7 @@ var init_file_map = __esm({
|
|
|
5715
5754
|
"script_element",
|
|
5716
5755
|
"style_element"
|
|
5717
5756
|
]);
|
|
5757
|
+
PASSTHROUGH_TYPES = /* @__PURE__ */ new Set(["export_statement", "lexical_declaration", "variable_declaration", "variable_declarator", "pair", "assignment_expression"]);
|
|
5718
5758
|
file_map = async (args) => {
|
|
5719
5759
|
let filePath;
|
|
5720
5760
|
try {
|
|
@@ -5763,7 +5803,7 @@ var init_file_map = __esm({
|
|
|
5763
5803
|
parser.setLanguage(Lang);
|
|
5764
5804
|
const sourceCode = await fs18.readFile(absolutePath, "utf8");
|
|
5765
5805
|
const tree = parser.parse(sourceCode);
|
|
5766
|
-
const map = traverse(tree.rootNode);
|
|
5806
|
+
const map = traverse(tree.rootNode, 0, true, " ");
|
|
5767
5807
|
return `\u{1F4C4} File Map for: ${filePath}
|
|
5768
5808
|
${map}`;
|
|
5769
5809
|
} catch (err) {
|