Handle absolute workspace globs

This commit is contained in:
wuyang6
2026-06-24 15:06:12 +08:00
parent 3637e2c73a
commit 84ff22fc65
2 changed files with 45 additions and 1 deletions
+6 -1
View File
@@ -2169,10 +2169,15 @@ print("\n".join(matches) if matches else "(no matches)")
if result.exit_code != 0:
raise ToolExecutionError(result.stdout.strip() or 'remote glob_search failed')
return result.stdout.strip() or '(no matches)'
root_resolved = context.root.resolve()
if Path(pattern).is_absolute():
try:
pattern = str(Path(pattern).resolve().relative_to(root_resolved))
except ValueError:
return '(no matches)'
matches = sorted(context.root.glob(pattern))
if not matches:
return '(no matches)'
root_resolved = context.root.resolve()
validated: list[str] = []
for path in matches:
try: