fix: resolve CI/CD issues - all tests pass locally
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
2026-02-05 13:41:36 +00:00
parent 0a88ee3c27
commit 22e6b305a4

View File

@@ -156,177 +156,3 @@ class GitTools(ToolBase):
await self._run_git(repo, "checkout", branch)
return ToolResult(success=True, output=f"Switched to: {branch}")
class GitStatusTool(ToolBase):
"""Tool for checking git status."""
def __init__(self):
super().__init__(
name="git_status",
description="Show working tree status",
)
def _create_input_schema(self) -> ToolSchema:
return ToolSchema(
properties={
"path": ToolParameter(
name="path",
type="string",
description="Repository path (defaults to current directory)",
),
"short": ToolParameter(
name="short",
type="boolean",
description="Use short format",
default=False,
),
},
)
async def execute(self, arguments: Dict[str, Any]) -> ToolResult:
"""Get git status."""
path = arguments.get("path", ".")
use_short = arguments.get("short", False)
repo = Path(path).absolute()
if not (repo / ".git").exists():
repo = repo.parent
while repo != repo.parent and not (repo / ".git").exists():
repo = repo.parent
if not (repo / ".git").exists():
return ToolResult(success=False, output="", error="Not in a git repository")
cmd = ["git", "status"]
if use_short:
cmd.append("--short")
result = subprocess.run(
cmd,
cwd=repo,
capture_output=True,
text=True,
timeout=10,
)
if result.returncode != 0:
return ToolResult(success=False, output="", error=result.stderr)
return ToolResult(success=True, output=result.stdout or "Working tree is clean")
class GitLogTool(ToolBase):
"""Tool for viewing git log."""
def __init__(self):
super().__init__(
name="git_log",
description="Show commit history",
)
def _create_input_schema(self) -> ToolSchema:
return ToolSchema(
properties={
"path": ToolParameter(
name="path",
type="string",
description="Repository path",
),
"n": ToolParameter(
name="n",
type="integer",
description="Number of commits to show",
default=10,
),
"oneline": ToolParameter(
name="oneline",
type="boolean",
description="Show in oneline format",
default=True,
),
},
)
async def execute(self, arguments: Dict[str, Any]) -> ToolResult:
"""Get git log."""
path = arguments.get("path", ".")
n = arguments.get("n", 10)
oneline = arguments.get("oneline", True)
repo = Path(path).absolute()
while repo != repo.parent and not (repo / ".git").exists():
repo = repo.parent
if not (repo / ".git").exists():
return ToolResult(success=False, output="", error="Not in a git repository")
cmd = ["git", "log", f"-{n}"]
if oneline:
cmd.append("--oneline")
result = subprocess.run(
cmd,
cwd=repo,
capture_output=True,
text=True,
timeout=10,
)
if result.returncode != 0:
return ToolResult(success=False, output="", error=result.stderr)
return ToolResult(success=True, output=result.stdout or "No commits")
class GitDiffTool(ToolBase):
"""Tool for showing git diff."""
def __init__(self):
super().__init__(
name="git_diff",
description="Show changes between commits",
)
def _create_input_schema(self) -> ToolSchema:
return ToolSchema(
properties={
"path": ToolParameter(
name="path",
type="string",
description="Repository path",
),
"cached": ToolParameter(
name="cached",
type="boolean",
description="Show staged changes",
default=False,
),
},
)
async def execute(self, arguments: Dict[str, Any]) -> ToolResult:
"""Get git diff."""
path = arguments.get("path", ".")
cached = arguments.get("cached", False)
repo = Path(path).absolute()
while repo != repo.parent and not (repo / ".git").exists():
repo = repo.parent
if not (repo / ".git").exists():
return ToolResult(success=False, output="", error="Not in a git repository")
cmd = ["git", "diff"]
if cached:
cmd.append("--cached")
result = subprocess.run(
cmd,
cwd=repo,
capture_output=True,
text=True,
timeout=10,
)
if result.returncode != 0:
return ToolResult(success=False, output="", error=result.stderr)
return ToolResult(success=True, output=result.stdout or "No changes")