@corbat-tech/coco 2.15.1 → 2.16.0
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/index.js +154 -17
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +43 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16551,10 +16551,37 @@ Examples:
|
|
|
16551
16551
|
}
|
|
16552
16552
|
}
|
|
16553
16553
|
});
|
|
16554
|
+
var TREE_IGNORED_DIRS = /* @__PURE__ */ new Set([
|
|
16555
|
+
"node_modules",
|
|
16556
|
+
"dist",
|
|
16557
|
+
"build",
|
|
16558
|
+
"out",
|
|
16559
|
+
".next",
|
|
16560
|
+
".nuxt",
|
|
16561
|
+
".cache",
|
|
16562
|
+
".turbo",
|
|
16563
|
+
".parcel-cache",
|
|
16564
|
+
"coverage",
|
|
16565
|
+
".nyc_output",
|
|
16566
|
+
"vendor",
|
|
16567
|
+
"__pycache__",
|
|
16568
|
+
".venv",
|
|
16569
|
+
"venv",
|
|
16570
|
+
"env",
|
|
16571
|
+
"target",
|
|
16572
|
+
".gradle",
|
|
16573
|
+
".mvn",
|
|
16574
|
+
"bin",
|
|
16575
|
+
"obj"
|
|
16576
|
+
]);
|
|
16577
|
+
var MAX_TREE_LINES = 500;
|
|
16554
16578
|
var treeTool = defineTool({
|
|
16555
16579
|
name: "tree",
|
|
16556
16580
|
description: `Display directory structure as a tree.
|
|
16557
16581
|
|
|
16582
|
+
Large dependency directories (node_modules, dist, .next, etc.) are excluded
|
|
16583
|
+
automatically. Output is capped at ${MAX_TREE_LINES} lines to keep context lean.
|
|
16584
|
+
|
|
16558
16585
|
Examples:
|
|
16559
16586
|
- Current dir: { }
|
|
16560
16587
|
- Specific dir: { "path": "src" }
|
|
@@ -16574,9 +16601,12 @@ Examples:
|
|
|
16574
16601
|
let totalFiles = 0;
|
|
16575
16602
|
let totalDirs = 0;
|
|
16576
16603
|
const lines = [path17__default.basename(absolutePath) + "/"];
|
|
16604
|
+
let truncated = false;
|
|
16577
16605
|
async function buildTree(dir, prefix, currentDepth) {
|
|
16578
16606
|
if (currentDepth > (depth ?? 4)) return;
|
|
16607
|
+
if (lines.length >= MAX_TREE_LINES) return;
|
|
16579
16608
|
let items = await fs16__default.readdir(dir, { withFileTypes: true });
|
|
16609
|
+
items = items.filter((item) => !TREE_IGNORED_DIRS.has(item.name));
|
|
16580
16610
|
if (!showHidden) {
|
|
16581
16611
|
items = items.filter((item) => !item.name.startsWith("."));
|
|
16582
16612
|
}
|
|
@@ -16589,6 +16619,10 @@ Examples:
|
|
|
16589
16619
|
return a.name.localeCompare(b.name);
|
|
16590
16620
|
});
|
|
16591
16621
|
for (let i = 0; i < items.length; i++) {
|
|
16622
|
+
if (lines.length >= MAX_TREE_LINES) {
|
|
16623
|
+
truncated = true;
|
|
16624
|
+
return;
|
|
16625
|
+
}
|
|
16592
16626
|
const item = items[i];
|
|
16593
16627
|
const isLast = i === items.length - 1;
|
|
16594
16628
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
@@ -16604,10 +16638,17 @@ Examples:
|
|
|
16604
16638
|
}
|
|
16605
16639
|
}
|
|
16606
16640
|
await buildTree(absolutePath, "", 1);
|
|
16641
|
+
if (truncated) {
|
|
16642
|
+
lines.push(
|
|
16643
|
+
`
|
|
16644
|
+
[... output truncated at ${MAX_TREE_LINES} lines. Use a deeper path or lower depth to see more.]`
|
|
16645
|
+
);
|
|
16646
|
+
}
|
|
16607
16647
|
return {
|
|
16608
16648
|
tree: lines.join("\n"),
|
|
16609
16649
|
totalFiles,
|
|
16610
|
-
totalDirs
|
|
16650
|
+
totalDirs,
|
|
16651
|
+
truncated
|
|
16611
16652
|
};
|
|
16612
16653
|
} catch (error) {
|
|
16613
16654
|
if (isENOENT(error)) {
|
|
@@ -20068,7 +20109,7 @@ Examples:
|
|
|
20068
20109
|
}
|
|
20069
20110
|
});
|
|
20070
20111
|
var DEFAULT_TIMEOUT_MS5 = 3e4;
|
|
20071
|
-
var DEFAULT_MAX_LENGTH =
|
|
20112
|
+
var DEFAULT_MAX_LENGTH = 8e3;
|
|
20072
20113
|
var MAX_DOWNLOAD_SIZE = 10 * 1024 * 1024;
|
|
20073
20114
|
var BLOCKED_SCHEMES = ["file:", "ftp:", "data:", "javascript:"];
|
|
20074
20115
|
var PRIVATE_IP_PATTERNS = [
|