fix(coding-agent/tools): fixed path resolution to accept bare directory names in path lists
- Fixed path resolution to accept bare directory names without trailing slashes in comma/space-separated path lists. - Added existence check for bare path tokens before rejecting them as invalid, allowing directory names like 'packages' to be resolved correctly. - Added test case verifying grep tool accepts bare space-separated directory names without trailing slashes.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
# Changelog
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- Added `todo.eager` setting to automatically create a comprehensive todo list after the first user message
|
||||
@@ -17,6 +16,7 @@
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed path resolution to accept bare directory names without trailing slashes in comma/space-separated path lists (e.g., `apps packages phases`)
|
||||
- Per-role `modelRoles` thinking selectors now propagate through commit/title helper model selection, legacy commit analysis, and agentic commit sessions while preserving default thinking inheritance when no role override is configured
|
||||
|
||||
## [13.10.1] - 2026-03-10
|
||||
|
||||
@@ -349,7 +349,13 @@ async function areDelimitedTokensResolvable(
|
||||
}
|
||||
|
||||
if (!allowBareExistingTokens && !looksLikeDelimitedPathToken(token)) {
|
||||
return false;
|
||||
// Bare names like "packages" don't look like path tokens syntactically,
|
||||
// but may still be valid directory names. Check existence before rejecting.
|
||||
const resolvedExactPath = resolveToCwd(token, cwd);
|
||||
if (!(await pathExists(resolvedExactPath))) {
|
||||
return false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
const basePath = parseBasePath(token);
|
||||
|
||||
@@ -194,4 +194,25 @@ describe("search tool path lists", () => {
|
||||
expect(details?.fileCount).toBe(6);
|
||||
expect(details?.scopePath).toBe("apps/, packages/, phases/");
|
||||
});
|
||||
|
||||
it("grep accepts bare space-separated directory names (no trailing slash)", async () => {
|
||||
const tools = await createTools(createTestSession(tempDir));
|
||||
const tool = tools.find(entry => entry.name === "grep");
|
||||
expect(tool).toBeDefined();
|
||||
if (!tool) throw new Error("Missing grep tool");
|
||||
|
||||
const result = await tool.execute("grep-bare-space-paths", {
|
||||
pattern: "shared-needle",
|
||||
path: "apps packages phases",
|
||||
});
|
||||
const text = getText(result);
|
||||
const details = result.details as { fileCount?: number; scopePath?: string } | undefined;
|
||||
|
||||
expect(text).toContain("# apps");
|
||||
expect(text).toContain("# packages");
|
||||
expect(text).toContain("# phases");
|
||||
expect(text).not.toContain("# other");
|
||||
expect(details?.fileCount).toBe(3);
|
||||
expect(details?.scopePath).toBe("apps, packages, phases");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user