This commit is contained in:
@@ -10,6 +10,7 @@ from agent_builder.builder import (
|
||||
_build_project_backend,
|
||||
_builder_skill_files,
|
||||
_with_builder_skills,
|
||||
_workspace_backend_with_grep_compat,
|
||||
)
|
||||
from agent_builder.config import Settings
|
||||
from agent_builder.tools import A2A_PACK_MIN_VERSION, _strip_unsupported_pricing_fields
|
||||
@@ -209,3 +210,49 @@ inline = Pricing(price_per_call_usd=0.01, compute={"runtime_seconds": 600}, tota
|
||||
backend.artifacts_root,
|
||||
"/agents/svgwrite-agent/.agent-builder",
|
||||
)
|
||||
|
||||
def test_project_backend_grep_compat_qualifies_relative_glob(self) -> None:
|
||||
class _LegacyBackend:
|
||||
def __init__(self, workspace: object) -> None:
|
||||
self.workspace = workspace
|
||||
self.calls: list[tuple[str | None, str | None]] = []
|
||||
|
||||
def _norm(self, path: str | None) -> str:
|
||||
return (path or "").strip("/")
|
||||
|
||||
def grep(
|
||||
self,
|
||||
pattern: str,
|
||||
path: str | None = None,
|
||||
glob: str | None = None,
|
||||
):
|
||||
self.calls.append((path, glob))
|
||||
matches = (
|
||||
[{"path": "/agents/github-repo-inspector/agent.py"}]
|
||||
if glob == "agents/github-repo-inspector/agent.py"
|
||||
else []
|
||||
)
|
||||
return type("GrepResult", (), {"error": None, "matches": matches})()
|
||||
|
||||
backend = _workspace_backend_with_grep_compat(_LegacyBackend, object())
|
||||
|
||||
result = backend.grep(
|
||||
"_github_client",
|
||||
path="/agents/github-repo-inspector",
|
||||
glob="agent.py",
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
backend.calls,
|
||||
[
|
||||
("/agents/github-repo-inspector", "agent.py"),
|
||||
(
|
||||
"/agents/github-repo-inspector",
|
||||
"agents/github-repo-inspector/agent.py",
|
||||
),
|
||||
],
|
||||
)
|
||||
self.assertEqual(
|
||||
result.matches,
|
||||
[{"path": "/agents/github-repo-inspector/agent.py"}],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user