feat: add review_pending_changes tool and enforce absolute path security
- Add new review_pending_changes tool for comprehensive pre-commit reviews - Implement filesystem sandboxing with MCP_PROJECT_ROOT - Enforce absolute paths for all file/directory operations - Add comprehensive git utilities for repository management - Update all tools to use centralized path validation - Add extensive test coverage for new features and security model - Update documentation with new tool and path requirements - Remove obsolete demo and guide files 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -77,39 +77,50 @@ async def run_manual_live_tests():
|
||||
|
||||
# Test collaboration/clarification request
|
||||
print("\n🔄 Testing dynamic context request (collaboration)...")
|
||||
|
||||
|
||||
# Create a specific test case designed to trigger clarification
|
||||
# We'll use analyze tool with a question that requires seeing files
|
||||
analyze_tool = AnalyzeTool()
|
||||
|
||||
|
||||
# Ask about dependencies without providing package files
|
||||
result = await analyze_tool.execute({
|
||||
"files": [temp_path], # Only Python file, no package.json
|
||||
"question": "What npm packages and their versions does this project depend on? List all dependencies.",
|
||||
"thinking_mode": "minimal" # Fast test
|
||||
})
|
||||
|
||||
result = await analyze_tool.execute(
|
||||
{
|
||||
"files": [temp_path], # Only Python file, no package.json
|
||||
"question": "What npm packages and their versions does this project depend on? List all dependencies.",
|
||||
"thinking_mode": "minimal", # Fast test
|
||||
}
|
||||
)
|
||||
|
||||
if result and result[0].text:
|
||||
response_data = json.loads(result[0].text)
|
||||
print(f" Response status: {response_data['status']}")
|
||||
|
||||
if response_data['status'] == 'requires_clarification':
|
||||
|
||||
if response_data["status"] == "requires_clarification":
|
||||
print("✅ Dynamic context request successfully triggered!")
|
||||
clarification = json.loads(response_data['content'])
|
||||
clarification = json.loads(response_data["content"])
|
||||
print(f" Gemini asks: {clarification.get('question', 'N/A')}")
|
||||
if 'files_needed' in clarification:
|
||||
if "files_needed" in clarification:
|
||||
print(f" Files requested: {clarification['files_needed']}")
|
||||
# Verify it's asking for package-related files
|
||||
expected_files = ['package.json', 'package-lock.json', 'yarn.lock']
|
||||
if any(f in str(clarification['files_needed']) for f in expected_files):
|
||||
expected_files = [
|
||||
"package.json",
|
||||
"package-lock.json",
|
||||
"yarn.lock",
|
||||
]
|
||||
if any(
|
||||
f in str(clarification["files_needed"])
|
||||
for f in expected_files
|
||||
):
|
||||
print(" ✅ Correctly identified missing package files!")
|
||||
else:
|
||||
print(" ⚠️ Unexpected files requested")
|
||||
else:
|
||||
# This is a failure - we specifically designed this to need clarification
|
||||
print("❌ Expected clarification request but got direct response")
|
||||
print(" This suggests the dynamic context feature may not be working")
|
||||
print(" Response:", response_data.get('content', '')[:200])
|
||||
print(
|
||||
" This suggests the dynamic context feature may not be working"
|
||||
)
|
||||
print(" Response:", response_data.get("content", "")[:200])
|
||||
return False
|
||||
else:
|
||||
print("❌ Collaboration test failed - no response")
|
||||
|
||||
Reference in New Issue
Block a user