refactor: Complete simplification - require all binary paths explicitly

BREAKING CHANGE: All binary paths must now be explicitly configured.

Changes to code:
- Added docker_binary_path setting to GiteaContextServerSettings
- Updated find_docker_binary() to require explicit docker path
- Clear error messages with platform-specific examples
- Consistent approach: no auto-detection for any binaries

Changes to documentation:
- Updated README.md with docker_binary_path requirement
- Rewrote default_settings.jsonc with explicit configuration examples
- Shortened installation_instructions.md to fit Zed UI
- Added 'which' command instructions to find binary paths
- Documented common paths for macOS, Linux, Windows
- Explained WASM limitations clearly

Why this approach:
- WASM cannot access PATH reliably (especially on macOS)
- WASM cannot detect host OS
- WASM cannot check file existence
- Explicit configuration is reliable and works everywhere
- Users have full control over which binaries are used
- Configuration is done once and works consistently

This completes the simplification:
 No auto-detection attempts
 Clear, actionable error messages
 Comprehensive documentation
 Works reliably on Linux, macOS, and Windows
 Tested on Linux x86_64 and macOS M4
This commit is contained in:
2025-11-10 21:45:08 -07:00
parent 0627ebe404
commit e6e1ef2144
4 changed files with 385 additions and 365 deletions

View File

@@ -39,6 +39,8 @@ struct GiteaContextServerSettings {
#[serde(default)]
use_docker: Option<bool>,
#[serde(default)]
docker_binary_path: Option<String>,
#[serde(default)]
docker_image: Option<String>,
}
@@ -188,8 +190,8 @@ fn build_binary_command(settings: &GiteaContextServerSettings) -> Result<Command
/// Build a command to run gitea-mcp in Docker
fn build_docker_command(settings: &GiteaContextServerSettings) -> Result<Command> {
// Find docker binary - MUST have a full path for Zed's Command struct
let docker_cmd = find_docker_binary()?;
// Find docker binary - explicit path required
let docker_cmd = find_docker_binary(settings)?;
// Use configured docker image or default
let docker_image = settings
@@ -238,12 +240,37 @@ fn build_docker_command(settings: &GiteaContextServerSettings) -> Result<Command
}
/// Find the docker binary
/// Returns "docker" and relies on the system's PATH to find it
/// This is more reliable across platforms than trying to detect docker location in WASM
fn find_docker_binary() -> Result<String> {
// Just return "docker" - the system will find it in PATH
// If docker isn't installed or not in PATH, the execution will fail with a clear error
Ok("docker".to_string())
///
/// WASM Limitation: Cannot access PATH reliably, so explicit configuration is required
/// when use_docker is true.
fn find_docker_binary(settings: &GiteaContextServerSettings) -> Result<String> {
if let Some(path) = &settings.docker_binary_path {
return Ok(path.clone());
}
// No explicit docker path - return error with instructions
Err("Docker binary path not configured.\n\
\n\
When using Docker mode, you must specify the docker binary path:\n\
\n\
{\n\
\"context_servers\": {\n\
\"tendril-gitea-mcp\": {\n\
\"settings\": {\n\
\"gitea_access_token\": \"your_token\",\n\
\"use_docker\": true,\n\
\"docker_binary_path\": \"/usr/bin/docker\"\n\
}\n\
}\n\
}\n\
}\n\
\n\
Common paths:\n\
• macOS: /usr/local/bin/docker or /Applications/Docker.app/Contents/Resources/bin/docker\n\
• Linux: /usr/bin/docker\n\
\n\
Find your docker path with: which docker"
.into())
}
/// Resolve the gitea-mcp binary path