@nexrall/code-core 1.4.16 → 1.4.18
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/tools/executor.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAyB,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/tools/executor.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAyB,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAwlEtE,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,WAAW,CAAC,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,EAClC,OAAO,CAAC,EAAE,aAAa,EACvB,OAAO,CAAC,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC,CAiBrB"}
|
package/dist/tools/executor.js
CHANGED
|
@@ -437,6 +437,22 @@ async function listDirectory(input, workDir) {
|
|
|
437
437
|
const dirPath = typeof input.path === 'string' ? input.path : '.';
|
|
438
438
|
try {
|
|
439
439
|
const resolved = resolvePath(dirPath, workDir);
|
|
440
|
+
// Give an actionable error when the path is a FILE, not a directory — the
|
|
441
|
+
// inverse of deleteFile/copyFile/preflightEdit's "path is a directory, not
|
|
442
|
+
// a file" guard. Without this, fs.readdirSync throws Node's raw system
|
|
443
|
+
// error verbatim (`ENOTDIR: not a directory, scandir '<path>'`), which
|
|
444
|
+
// names an obscure libuv syscall the model has never heard of and gives
|
|
445
|
+
// no hint that read_file is the right tool for that path.
|
|
446
|
+
let stat;
|
|
447
|
+
try {
|
|
448
|
+
stat = fs.statSync(resolved);
|
|
449
|
+
}
|
|
450
|
+
catch {
|
|
451
|
+
return { error: `Path not found: ${resolved}.` };
|
|
452
|
+
}
|
|
453
|
+
if (!stat.isDirectory()) {
|
|
454
|
+
return { error: `Path is a file, not a directory: ${resolved}. Use read_file to view its contents.` };
|
|
455
|
+
}
|
|
440
456
|
const entries = fs.readdirSync(resolved, { withFileTypes: true });
|
|
441
457
|
// Sort: directories first, then files, each group alphabetically
|
|
442
458
|
const dirs = entries
|
|
@@ -936,8 +952,16 @@ async function searchFiles(input, workDir) {
|
|
|
936
952
|
walkDir(resolved, (filePath) => {
|
|
937
953
|
const name = path.basename(filePath);
|
|
938
954
|
const nameLower = name.toLowerCase();
|
|
955
|
+
// Also match against the path relative to the search root — a pattern
|
|
956
|
+
// containing "/" (e.g. "tools/executor.ts", "src/agent/loop") can
|
|
957
|
+
// never match a bare basename (which never contains "/"), so without
|
|
958
|
+
// this a perfectly valid path-shaped query always silently returned
|
|
959
|
+
// "No matching files found" even though the file exists.
|
|
960
|
+
const rel = path.relative(resolved, filePath).replace(/\\/g, '/');
|
|
961
|
+
const relLower = rel.toLowerCase();
|
|
939
962
|
// Support glob-style wildcards (* and ?) in addition to substring + regex
|
|
940
|
-
if (nameLower.includes(patternLower) || matchesGlob(name, pattern) || matchesPattern(name, pattern)
|
|
963
|
+
if (nameLower.includes(patternLower) || matchesGlob(name, pattern) || matchesPattern(name, pattern) ||
|
|
964
|
+
relLower.includes(patternLower) || matchesGlob(rel, pattern) || matchesPattern(rel, pattern)) {
|
|
941
965
|
matches.push(filePath);
|
|
942
966
|
}
|
|
943
967
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexrall/code-core",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.18",
|
|
4
4
|
"description": "Core agent loop, tools, and extension primitives for Nexrall Code — embed an AI coding agent in any Node.js application.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Nexrall <support@nexrall.com> (https://nexrall.com)",
|