feat: add git_status, git_log, git_diff orchestrator tools
Read-only wrappers around git commands, project-scoped. Covers working tree status, commit history browsing (with optional path filter), and diffs between refs or the working tree — cleaner than shell_exec for code review and change verification. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -82,6 +82,11 @@ from tools.agent_notes import (
|
||||
agent_notes_append as _agent_notes_append,
|
||||
agent_notes_clear as _agent_notes_clear,
|
||||
)
|
||||
from tools.git import (
|
||||
git_status as _git_status,
|
||||
git_log as _git_log,
|
||||
git_diff as _git_diff,
|
||||
)
|
||||
from tools.agents import spawn_agent as _spawn_agent
|
||||
from tools.homeassistant import (
|
||||
ha_get_state as _ha_get_state,
|
||||
@@ -102,6 +107,7 @@ import tools.reminders as _mod_reminders
|
||||
import tools.scratch as _mod_scratch
|
||||
import tools.notify as _mod_notify
|
||||
import tools.agent_notes as _mod_agent_notes
|
||||
import tools.git as _mod_git
|
||||
import tools.agents as _mod_agents
|
||||
import tools.homeassistant as _mod_homeassistant
|
||||
|
||||
@@ -110,6 +116,7 @@ import tools.homeassistant as _mod_homeassistant
|
||||
TOOL_CATEGORIES: dict[str, list[str]] = {
|
||||
"Web": ["web_search", "http_fetch", "web_read", "http_post"],
|
||||
"Project Files": ["project_file_read", "project_file_list", "file_stat", "file_grep", "file_diff", "file_syntax_check"],
|
||||
"Git": ["git_status", "git_log", "git_diff"],
|
||||
"System Files": ["file_read", "file_list", "file_write", "session_read", "session_search"],
|
||||
"Shell": ["shell_exec", "claude_allow_dir"],
|
||||
"System": ["cortex_restart", "cortex_logs", "cortex_status", "cortex_update"],
|
||||
@@ -189,6 +196,9 @@ _CALLABLES: dict[str, callable] = {
|
||||
"agent_notes_write": _agent_notes_write,
|
||||
"agent_notes_append": _agent_notes_append,
|
||||
"agent_notes_clear": _agent_notes_clear,
|
||||
"git_status": _git_status,
|
||||
"git_log": _git_log,
|
||||
"git_diff": _git_diff,
|
||||
"spawn_agent": _spawn_agent,
|
||||
"ha_get_state": _ha_get_state,
|
||||
"ha_get_states": _ha_get_states,
|
||||
@@ -319,6 +329,11 @@ TOOL_RISK: dict[str, str] = {
|
||||
"agent_notes_append": "low",
|
||||
"agent_notes_clear": "low",
|
||||
|
||||
# Git — all read-only inspections
|
||||
"git_status": "low",
|
||||
"git_log": "low",
|
||||
"git_diff": "low",
|
||||
|
||||
# Agents — spawning a subprocess with broad permissions is high
|
||||
"spawn_agent": "high",
|
||||
|
||||
@@ -343,6 +358,7 @@ def _role_allowed(tool_name: str, role: str) -> bool:
|
||||
_ALL_DECLARATIONS: list[types.FunctionDeclaration] = (
|
||||
_mod_web.DECLARATIONS
|
||||
+ _mod_files.DECLARATIONS
|
||||
+ _mod_git.DECLARATIONS
|
||||
+ _mod_system.DECLARATIONS
|
||||
+ _mod_tasks.DECLARATIONS
|
||||
+ _mod_cron.DECLARATIONS
|
||||
|
||||
Reference in New Issue
Block a user