fix: use ignore-walk for sys msg

This commit is contained in:
Nate 2025-07-13 22:29:32 -07:00
parent 25a67cf947
commit eb59dcc76a
3 changed files with 143 additions and 24 deletions

130
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "@continuedev/cli", "name": "@continuedev/cli",
"version": "0.0.17", "version": "1.0.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@continuedev/cli", "name": "@continuedev/cli",
"version": "0.0.17", "version": "1.0.1",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@continuedev/openai-adapters": "^1.0.18", "@continuedev/openai-adapters": "^1.0.18",
@ -18,7 +18,9 @@
"chalk": "^5.4.1", "chalk": "^5.4.1",
"diff": "^7.0.0", "diff": "^7.0.0",
"dotenv": "^16.5.0", "dotenv": "^16.5.0",
"ignore-walk": "^7.0.0",
"ink": "^6.0.1", "ink": "^6.0.1",
"minimatch": "^10.0.3",
"open": "^10.1.0", "open": "^10.1.0",
"react": "^19.1.0", "react": "^19.1.0",
"readline-sync": "^1.4.10", "readline-sync": "^1.4.10",
@ -33,6 +35,7 @@
"@semantic-release/github": "^11.0.3", "@semantic-release/github": "^11.0.3",
"@semantic-release/npm": "^12.0.2", "@semantic-release/npm": "^12.0.2",
"@types/diff": "^7.0.2", "@types/diff": "^7.0.2",
"@types/ignore-walk": "^4.0.3",
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
"@types/readline-sync": "^1.4.8", "@types/readline-sync": "^1.4.8",
"@types/uuid": "^9.0.8", "@types/uuid": "^9.0.8",
@ -1237,6 +1240,25 @@
"node": ">=18" "node": ">=18"
} }
}, },
"node_modules/@isaacs/balanced-match": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz",
"integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==",
"engines": {
"node": "20 || >=22"
}
},
"node_modules/@isaacs/brace-expansion": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz",
"integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==",
"dependencies": {
"@isaacs/balanced-match": "^4.0.1"
},
"engines": {
"node": "20 || >=22"
}
},
"node_modules/@istanbuljs/load-nyc-config": { "node_modules/@istanbuljs/load-nyc-config": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz",
@ -2744,6 +2766,15 @@
"integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==", "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/ignore-walk": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/ignore-walk/-/ignore-walk-4.0.3.tgz",
"integrity": "sha512-6V7wDsk0nz8LtRC7qeC0GfXadFLT4FdCtVbXhxoIGRdkn2kLr20iMLupRGiBhlZ79WWWqaObIdR3nkXfUrBPdQ==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/istanbul-lib-coverage": { "node_modules/@types/istanbul-lib-coverage": {
"version": "2.0.6", "version": "2.0.6",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz",
@ -3342,7 +3373,6 @@
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/base64-js": { "node_modules/base64-js": {
@ -3400,11 +3430,10 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/brace-expansion": { "node_modules/brace-expansion": {
"version": "1.1.11", "version": "1.1.12",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -3985,8 +4014,7 @@
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true, "dev": true
"license": "MIT"
}, },
"node_modules/config-chain": { "node_modules/config-chain": {
"version": "1.1.13", "version": "1.1.13",
@ -5630,6 +5658,18 @@
"node": ">= 6" "node": ">= 6"
} }
}, },
"node_modules/glob/node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/globals": { "node_modules/globals": {
"version": "11.12.0", "version": "11.12.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
@ -5930,6 +5970,39 @@
"node": ">= 4" "node": ">= 4"
} }
}, },
"node_modules/ignore-walk": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-7.0.0.tgz",
"integrity": "sha512-T4gbf83A4NH95zvhVYZc+qWocBBGlpzUXLPGurJggw/WIOwicfXJChLDP/iBZnN5WqROSu5Bm3hhle4z8a8YGQ==",
"dependencies": {
"minimatch": "^9.0.0"
},
"engines": {
"node": "^18.17.0 || >=20.5.0"
}
},
"node_modules/ignore-walk/node_modules/brace-expansion": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/ignore-walk/node_modules/minimatch": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=16 || 14 >=14.17"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/import-fresh": { "node_modules/import-fresh": {
"version": "3.3.1", "version": "3.3.1",
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz",
@ -6652,6 +6725,18 @@
"url": "https://github.com/chalk/chalk?sponsor=1" "url": "https://github.com/chalk/chalk?sponsor=1"
} }
}, },
"node_modules/jake/node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/java-properties": { "node_modules/java-properties": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/java-properties/-/java-properties-1.0.2.tgz", "resolved": "https://registry.npmjs.org/java-properties/-/java-properties-1.0.2.tgz",
@ -8202,16 +8287,17 @@
} }
}, },
"node_modules/minimatch": { "node_modules/minimatch": {
"version": "3.1.2", "version": "10.0.3",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.3.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "integrity": "sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==",
"dev": true,
"license": "ISC",
"dependencies": { "dependencies": {
"brace-expansion": "^1.1.7" "@isaacs/brace-expansion": "^5.0.0"
}, },
"engines": { "engines": {
"node": "*" "node": "20 || >=22"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
} }
}, },
"node_modules/minimist": { "node_modules/minimist": {
@ -13188,6 +13274,18 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/test-exclude/node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/thenify": { "node_modules/thenify": {
"version": "3.3.1", "version": "3.3.1",
"resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz",

View file

@ -40,7 +40,9 @@
"chalk": "^5.4.1", "chalk": "^5.4.1",
"diff": "^7.0.0", "diff": "^7.0.0",
"dotenv": "^16.5.0", "dotenv": "^16.5.0",
"ignore-walk": "^7.0.0",
"ink": "^6.0.1", "ink": "^6.0.1",
"minimatch": "^10.0.3",
"open": "^10.1.0", "open": "^10.1.0",
"react": "^19.1.0", "react": "^19.1.0",
"readline-sync": "^1.4.10", "readline-sync": "^1.4.10",
@ -52,6 +54,7 @@
"@semantic-release/github": "^11.0.3", "@semantic-release/github": "^11.0.3",
"@semantic-release/npm": "^12.0.2", "@semantic-release/npm": "^12.0.2",
"@types/diff": "^7.0.2", "@types/diff": "^7.0.2",
"@types/ignore-walk": "^4.0.3",
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
"@types/readline-sync": "^1.4.8", "@types/readline-sync": "^1.4.8",
"@types/uuid": "^9.0.8", "@types/uuid": "^9.0.8",

View file

@ -1,6 +1,9 @@
import { execSync } from "child_process"; import { execSync } from "child_process";
import * as fs from "fs"; import * as fs from "fs";
import pkg from "ignore-walk";
import { Minimatch } from "minimatch";
import * as path from "path"; import * as path from "path";
const { WalkerSync } = pkg;
/** /**
* Check if current directory is a git repository * Check if current directory is a git repository
@ -19,14 +22,29 @@ function isGitRepo(): boolean {
*/ */
function getDirectoryStructure(): string { function getDirectoryStructure(): string {
try { try {
const result = execSync( const walker = new WalkerSync({
'find . -type f -name "*.ts" -o -name "*.js" -o -name "*.json" -o -name "*.md" | head -20', path: process.cwd(),
{ includeEmpty: false,
encoding: "utf-8", follow: false,
cwd: process.cwd(), ignoreFiles: [".gitignore", ".continueignore", ".customignore"],
} });
);
return result.trim() || "No structure available"; (walker.ignoreRules as any)[".customignore"] = [
new Minimatch(".git/*", {
matchBase: true,
dot: true,
flipNegate: true,
nocase: true,
}),
];
const files = walker.start().result as string[];
const filteredFiles = files
.slice(0, 100)
.map((file: string) => `./${file}`);
return filteredFiles.join("\n") || "No structure available";
} catch { } catch {
return "Directory structure not available"; return "Directory structure not available";
} }