storkit: merge 349_story_mcp_tools_for_git_operations

This commit is contained in:
Dave
2026-03-20 15:17:10 +00:00
parent 02ee48911e
commit d838dd7127
2 changed files with 874 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ use std::sync::Arc;
pub mod agent_tools;
pub mod diagnostics;
pub mod git_tools;
pub mod merge_tools;
pub mod qa_tools;
pub mod shell_tools;
@@ -1025,6 +1026,101 @@ fn handle_tools_list(id: Option<Value>) -> JsonRpcResponse {
},
"required": ["command", "working_dir"]
}
},
{
"name": "git_status",
"description": "Return the working tree status of an agent's worktree (staged, unstaged, and untracked files). The worktree_path must be inside .storkit/worktrees/. Push and remote operations are not available.",
"inputSchema": {
"type": "object",
"properties": {
"worktree_path": {
"type": "string",
"description": "Absolute path to the worktree directory. Must be inside .storkit/worktrees/."
}
},
"required": ["worktree_path"]
}
},
{
"name": "git_diff",
"description": "Return diff output for an agent's worktree. Supports unstaged (default), staged, or a commit range. The worktree_path must be inside .storkit/worktrees/.",
"inputSchema": {
"type": "object",
"properties": {
"worktree_path": {
"type": "string",
"description": "Absolute path to the worktree directory. Must be inside .storkit/worktrees/."
},
"staged": {
"type": "boolean",
"description": "If true, show staged diff (--staged). Default: false."
},
"commit_range": {
"type": "string",
"description": "Optional commit range (e.g. 'HEAD~3..HEAD', 'abc123..def456')."
}
},
"required": ["worktree_path"]
}
},
{
"name": "git_add",
"description": "Stage files by path in an agent's worktree. The worktree_path must be inside .storkit/worktrees/.",
"inputSchema": {
"type": "object",
"properties": {
"worktree_path": {
"type": "string",
"description": "Absolute path to the worktree directory. Must be inside .storkit/worktrees/."
},
"paths": {
"type": "array",
"items": { "type": "string" },
"description": "List of file paths to stage (relative to worktree_path)."
}
},
"required": ["worktree_path", "paths"]
}
},
{
"name": "git_commit",
"description": "Commit staged changes in an agent's worktree with the given message. The worktree_path must be inside .storkit/worktrees/. Push and remote operations are not available.",
"inputSchema": {
"type": "object",
"properties": {
"worktree_path": {
"type": "string",
"description": "Absolute path to the worktree directory. Must be inside .storkit/worktrees/."
},
"message": {
"type": "string",
"description": "Commit message."
}
},
"required": ["worktree_path", "message"]
}
},
{
"name": "git_log",
"description": "Return commit history for an agent's worktree with configurable count and format. The worktree_path must be inside .storkit/worktrees/.",
"inputSchema": {
"type": "object",
"properties": {
"worktree_path": {
"type": "string",
"description": "Absolute path to the worktree directory. Must be inside .storkit/worktrees/."
},
"count": {
"type": "integer",
"description": "Number of commits to return (default: 10, max: 500)."
},
"format": {
"type": "string",
"description": "git pretty-format string (default: '%H%x09%s%x09%an%x09%ai')."
}
},
"required": ["worktree_path"]
}
}
]
}),
@@ -1107,6 +1203,12 @@ async fn handle_tools_call(
"move_story" => diagnostics::tool_move_story(&args, ctx),
// Shell command execution
"run_command" => shell_tools::tool_run_command(&args, ctx).await,
// Git operations
"git_status" => git_tools::tool_git_status(&args, ctx).await,
"git_diff" => git_tools::tool_git_diff(&args, ctx).await,
"git_add" => git_tools::tool_git_add(&args, ctx).await,
"git_commit" => git_tools::tool_git_commit(&args, ctx).await,
"git_log" => git_tools::tool_git_log(&args, ctx).await,
_ => Err(format!("Unknown tool: {tool_name}")),
};
@@ -1217,7 +1319,12 @@ mod tests {
assert!(names.contains(&"move_story"));
assert!(names.contains(&"delete_story"));
assert!(names.contains(&"run_command"));
assert_eq!(tools.len(), 43);
assert!(names.contains(&"git_status"));
assert!(names.contains(&"git_diff"));
assert!(names.contains(&"git_add"));
assert!(names.contains(&"git_commit"));
assert!(names.contains(&"git_log"));
assert_eq!(tools.len(), 48);
}
#[test]