@corbat-tech/coco 2.15.1 → 2.17.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/README.md +11 -0
- package/dist/cli/index.js +1751 -1528
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +67 -11
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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)) {
|
|
@@ -16723,13 +16764,25 @@ var SENSITIVE_ENV_PATTERNS = [
|
|
|
16723
16764
|
];
|
|
16724
16765
|
var bashExecTool = defineTool({
|
|
16725
16766
|
name: "bash_exec",
|
|
16726
|
-
description: `Execute a bash/shell command
|
|
16767
|
+
description: `Execute a bash/shell command in the user's shell environment.
|
|
16768
|
+
|
|
16769
|
+
Runs with the user's full PATH and inherited environment \u2014 any tool installed
|
|
16770
|
+
on the user's machine is available: kubectl, gcloud, aws, docker, git, node,
|
|
16771
|
+
pnpm, and others. Credentials configured locally are inherited automatically:
|
|
16772
|
+
kubeconfig contexts, gcloud auth, AWS profiles, SSH keys, etc.
|
|
16773
|
+
|
|
16774
|
+
IMPORTANT: never claim you cannot run a command because you lack credentials
|
|
16775
|
+
or access \u2014 the environment is the user's own shell. Always attempt; report
|
|
16776
|
+
failure only if the command actually returns a non-zero exit code.
|
|
16727
16777
|
|
|
16728
16778
|
Examples:
|
|
16729
|
-
- List files:
|
|
16730
|
-
- Run npm script:
|
|
16731
|
-
- Check disk space:
|
|
16732
|
-
- Find process:
|
|
16779
|
+
- List files: { "command": "ls -la" }
|
|
16780
|
+
- Run npm script: { "command": "npm run build" }
|
|
16781
|
+
- Check disk space: { "command": "df -h" }
|
|
16782
|
+
- Find process: { "command": "ps aux | grep node" }
|
|
16783
|
+
- Kubernetes logs: { "command": "kubectl logs -n my-ns deploy/my-app --since=30m" }
|
|
16784
|
+
- Cloud CLI: { "command": "gcloud container clusters list" }
|
|
16785
|
+
- AWS CLI: { "command": "aws s3 ls s3://my-bucket" }`,
|
|
16733
16786
|
category: "bash",
|
|
16734
16787
|
parameters: z.object({
|
|
16735
16788
|
command: z.string().describe("Command to execute"),
|
|
@@ -16823,12 +16876,15 @@ ${message}
|
|
|
16823
16876
|
});
|
|
16824
16877
|
var bashBackgroundTool = defineTool({
|
|
16825
16878
|
name: "bash_background",
|
|
16826
|
-
description: `Execute a command in the background (returns immediately with PID).
|
|
16879
|
+
description: `Execute a command in the background in the user's shell environment (returns immediately with PID).
|
|
16880
|
+
|
|
16881
|
+
Like bash_exec, runs with the user's full PATH and inherited environment \u2014 any
|
|
16882
|
+
tool available in the user's shell (docker, kubectl, gcloud, etc.) can be used.
|
|
16827
16883
|
|
|
16828
16884
|
Examples:
|
|
16829
|
-
- Start dev server:
|
|
16830
|
-
- Run watcher:
|
|
16831
|
-
- Start database:
|
|
16885
|
+
- Start dev server: { "command": "npm run dev" }
|
|
16886
|
+
- Run watcher: { "command": "npx nodemon src/index.ts" }
|
|
16887
|
+
- Start database: { "command": "docker-compose up" }`,
|
|
16832
16888
|
category: "bash",
|
|
16833
16889
|
parameters: z.object({
|
|
16834
16890
|
command: z.string().describe("Command to execute"),
|
|
@@ -20068,7 +20124,7 @@ Examples:
|
|
|
20068
20124
|
}
|
|
20069
20125
|
});
|
|
20070
20126
|
var DEFAULT_TIMEOUT_MS5 = 3e4;
|
|
20071
|
-
var DEFAULT_MAX_LENGTH =
|
|
20127
|
+
var DEFAULT_MAX_LENGTH = 8e3;
|
|
20072
20128
|
var MAX_DOWNLOAD_SIZE = 10 * 1024 * 1024;
|
|
20073
20129
|
var BLOCKED_SCHEMES = ["file:", "ftp:", "data:", "javascript:"];
|
|
20074
20130
|
var PRIVATE_IP_PATTERNS = [
|