test-commit.sh•1.1 kB
#!/bin/bash
# Test script for commit_changes tool
# Usage: ./test-commit.sh [repoOwner] [repoName] [branch] [message] [file_path] [file_content]
REPO_OWNER=${1:-"sadaf987"}
REPO_NAME=${2:-"github_sdk"}
BRANCH=${3:-"main"}
MESSAGE=${4:-"Fixed bug in app.js"}
FILE_PATH=${5:-"app.js"}
FILE_CONTENT=${6:-"console.log('fixed bug')"}
echo "Testing commit_changes tool..."
echo "Repository: $REPO_OWNER/$REPO_NAME"
echo "Branch: $BRANCH"
echo "Message: $MESSAGE"
echo "File: $FILE_PATH"
echo ""
curl -X POST http://localhost:3001/mcp \
-H "Content-Type: application/json" \
-d "{
\"jsonrpc\": \"2.0\",
\"method\": \"tools/call\",
\"params\": {
\"name\": \"commit_changes\",
\"arguments\": {
\"repoOwner\": \"$REPO_OWNER\",
\"repoName\": \"$REPO_NAME\",
\"branchName\": \"$BRANCH\",
\"commitMessage\": \"$MESSAGE\",
\"filesToCommit\": [
{
\"path\": \"$FILE_PATH\",
\"content\": \"$FILE_CONTENT\"
}
]
}
},
\"id\": 1
}" | python3 -m json.tool 2>/dev/null || cat
echo ""