Migration from Docker to Standalone Python Server (#73)
* Migration from docker to standalone server Migration handling Fixed tests Use simpler in-memory storage Support for concurrent logging to disk Simplified direct connections to localhost * Migration from docker / redis to standalone script Updated tests Updated run script Fixed requirements Use dotenv Ask if user would like to install MCP in Claude Desktop once Updated docs * More cleanup and references to docker removed * Cleanup * Comments * Fixed tests * Fix GitHub Actions workflow for standalone Python architecture - Install requirements-dev.txt for pytest and testing dependencies - Remove Docker setup from simulation tests (now standalone) - Simplify linting job to use requirements-dev.txt - Update simulation tests to run directly without Docker Fixes unit test failures in CI due to missing pytest dependency. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Remove simulation tests from GitHub Actions - Removed simulation-tests job that makes real API calls - Keep only unit tests (mocked, no API costs) and linting - Simulation tests should be run manually with real API keys - Reduces CI costs and complexity GitHub Actions now only runs: - Unit tests (569 tests, all mocked) - Code quality checks (ruff, black) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Fixed tests * Fixed tests --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
9d72545ecd
commit
4151c3c3a5
@@ -17,7 +17,6 @@ if TYPE_CHECKING:
|
||||
from tools.models import ToolModelCategory
|
||||
|
||||
from systemprompts import PRECOMMIT_PROMPT
|
||||
from utils.file_utils import translate_file_paths, translate_path_for_environment
|
||||
from utils.git_utils import find_git_repositories, get_git_status, run_git_command
|
||||
from utils.token_utils import estimate_tokens
|
||||
|
||||
@@ -28,10 +27,10 @@ DEFAULT_CONTEXT_WINDOW = 200_000
|
||||
|
||||
# Field descriptions to avoid duplication between Pydantic and JSON schema
|
||||
PRECOMMIT_FIELD_DESCRIPTIONS = {
|
||||
"path": "Starting directory to search for git repositories (must be FULL absolute paths - DO NOT SHORTEN).",
|
||||
"path": "Starting absolute path to the directory to search for git repositories (must be FULL absolute paths - DO NOT SHORTEN).",
|
||||
"prompt": (
|
||||
"The original user request description for the changes. Provides critical context for the review. "
|
||||
"If original request is limited or not available, you MUST study the changes carefully, think deeply "
|
||||
"MANDATORY: if original request is limited or not available, you MUST study the changes carefully, think deeply "
|
||||
"about the implementation intent, analyze patterns across all modifications, infer the logic and "
|
||||
"requirements from the code changes and provide a thorough starting point."
|
||||
),
|
||||
@@ -49,11 +48,11 @@ PRECOMMIT_FIELD_DESCRIPTIONS = {
|
||||
"thinking_mode": "Thinking depth mode for the assistant.",
|
||||
"files": (
|
||||
"Optional files or directories to provide as context (must be FULL absolute paths - DO NOT SHORTEN). "
|
||||
"These files are not part of the changes but provide helpful context like configs, docs, or related code."
|
||||
"These additional files are not part of the changes but provide helpful context like configs, docs, or related code."
|
||||
),
|
||||
"images": (
|
||||
"Optional images showing expected UI changes, design requirements, or visual references for the changes "
|
||||
"being validated"
|
||||
"being validated (must be FULL absolute paths - DO NOT SHORTEN). "
|
||||
),
|
||||
}
|
||||
|
||||
@@ -235,22 +234,10 @@ class Precommit(BaseTool):
|
||||
|
||||
raise ValueError(f"MCP_SIZE_CHECK:{ToolOutput(**size_check).model_dump_json()}")
|
||||
|
||||
# Translate the path and files if running in Docker
|
||||
translated_path = translate_path_for_environment(request.path)
|
||||
translated_files = translate_file_paths(request.files)
|
||||
|
||||
# File size validation happens at MCP boundary in server.py
|
||||
|
||||
# Check if the path translation resulted in an error path
|
||||
if translated_path.startswith("/inaccessible/"):
|
||||
raise ValueError(
|
||||
f"The path '{request.path}' is not accessible from within the Docker container. "
|
||||
f"The Docker container can only access files within the mounted workspace. "
|
||||
f"Please ensure the path is within the mounted directory or adjust your Docker volume mounts."
|
||||
)
|
||||
|
||||
# Find all git repositories
|
||||
repositories = find_git_repositories(translated_path, request.max_depth)
|
||||
repositories = find_git_repositories(request.path, request.max_depth)
|
||||
|
||||
if not repositories:
|
||||
return "No git repositories found in the specified path."
|
||||
@@ -421,12 +408,12 @@ class Precommit(BaseTool):
|
||||
context_files_summary = []
|
||||
context_tokens = 0
|
||||
|
||||
if translated_files:
|
||||
if request.files:
|
||||
remaining_tokens = max_tokens - total_tokens
|
||||
|
||||
# Use centralized file handling with filtering for duplicate prevention
|
||||
file_content, processed_files = self._prepare_file_content_for_prompt(
|
||||
translated_files,
|
||||
request.files,
|
||||
request.continuation_id,
|
||||
"Context files",
|
||||
max_tokens=remaining_tokens + 1000, # Add back the reserve that was calculated
|
||||
@@ -437,7 +424,7 @@ class Precommit(BaseTool):
|
||||
if file_content:
|
||||
context_tokens = estimate_tokens(file_content)
|
||||
context_files_content = [file_content]
|
||||
context_files_summary.append(f"✅ Included: {len(translated_files)} context files")
|
||||
context_files_summary.append(f"✅ Included: {len(request.files)} context files")
|
||||
else:
|
||||
context_files_summary.append("WARNING: No context files could be read or files too large")
|
||||
|
||||
@@ -540,7 +527,7 @@ class Precommit(BaseTool):
|
||||
)
|
||||
|
||||
# Add instruction for requesting files if needed
|
||||
if not translated_files:
|
||||
if not request.files:
|
||||
prompt_parts.append(
|
||||
"\nIf you need additional context files to properly review these changes "
|
||||
"(such as configuration files, documentation, or related code), "
|
||||
|
||||
Reference in New Issue
Block a user