322a3d1846
* fix: resolve UV path override not being detected in System Requirements Fixes #538 The System Requirements panel showed "UV Package Manager: Not Found" even when a valid UV path override was configured in Advanced Settings. Root cause: PlatformDetectorBase.DetectUv() only searched PATH with bare command names ("uvx", "uv") and never consulted PathResolverService which respects the user's override setting. Changes: - Refactor DetectUv() to use PathResolverService.GetUvxPath() which checks override path first, then system PATH, then falls back to "uvx" - Add TryValidateUvExecutable() to verify executables by running --version instead of just checking File.Exists - Prioritize PATH environment variable in EnumerateUvxCandidates() for better compatibility with official uv install scripts - Fix process output read order (ReadToEnd before WaitForExit) to prevent potential deadlocks Co-Authored-By: ChatGLM 4.7 <noreply@zhipuai.com> * fix: improve uv/uvx detection robustness on macOS and Linux - Read both stdout and stderr when validating uv/uvx executables - Respect WaitForExit timeout return value instead of ignoring it - Fix version parsing to handle extra tokens like "(Homebrew 2025-01-01)" - Resolve bare commands ("uv"/"uvx") to absolute paths after validation - Rename FindExecutableInPath to FindUvxExecutableInPath for clarity Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: unify process execution with ExecPath.TryRun and add Windows PATH augmentation Replace direct Process.Start calls with ExecPath.TryRun across all platform detectors. This change: - Fixes potential deadlocks by using async output reading - Adds proper timeout handling with process termination - Removes redundant fallback logic and simplifies version parsing - Adds Windows PATH augmentation with common uv, npm, and Python installation paths Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: improve version parsing to handle both spaces and parentheses The version extraction logic now properly handles outputs like: - "uvx 0.9.18" -> "0.9.18" - "uvx 0.9.18 (hash date)" -> "0.9.18" - "uvx 0.9.18 extra info" -> "0.9.18" Uses Math.Min to find the first occurrence of either space or parenthesis. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: improve platform detectors with absolute path resolution - Add absolute path resolution in TryValidatePython and TryValidateUvWithPath for better UI display - Fix BuildAugmentedPath to avoid PATH duplication - Add comprehensive comments for version parsing logic - Ensure cross-platform consistency across all three detectors - Fix override path validation logic with clear state handling - Fix platform detector path resolution and Python version detection - Use UserProfile consistently in GetClaudeCliPath instead of Personal - All platforms now use protected BuildAugmentedPath method This change improves user experience by displaying full paths in the UI while maintaining robust fallback behavior if path resolution fails. Co-Authored-By: GLM4.7 <noreply@zhipuai.com> * fix: improve error handling in PathResolverService by logging exceptions * Remove .meta files added after fork and update .gitignore * Update .gitignore * save .meta * refactor: unify uv/uvx naming and path detection across platforms - Rename TryValidateUvExecutable -> TryValidateUvxExecutable for consistency - Add cross-platform FindInPath() helper in ExecPath.cs - Remove platform-specific where/which implementations in favor of unified helper - Add Windows-specific DetectUv() override with enhanced uv/uvx detection - Add WinGet shim path support for Windows uvx installation - Update UI labels: "UV Path" -> "UVX Path" - Only show uvx path status when override is configured Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: improve validation light(uvxPathStatus) logic for UVX path overrides and system paths * refactor: streamline UV version validation and unify path detection methods across platform detectors * fix: add type handling for Claude Code client in config JSON builder * fix: correct command from 'uvx' to 'uv' for Python version listing in WindowsPlatformDetector * feat: add uvx path fallback with warning UI - When override path is invalid, automatically fall back to system path - Add HasUvxPathFallback flag to track fallback state - Show yellow warning indicator when using fallback - Display clear messages for invalid override paths - Updated all platform detectors (Windows, macOS, Linux) to support fallback logic * refactor: remove GetDetails method from PlatformDetectorBase * Update ExecPath.cs update Windows Path lookup --------- Co-authored-by: ChatGLM 4.7 <noreply@zhipuai.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Shutong Wu <51266340+Scriptwonder@users.noreply.github.com>
78 lines
2.6 KiB
C#
78 lines
2.6 KiB
C#
namespace MCPForUnity.Editor.Services
|
|
{
|
|
/// <summary>
|
|
/// Service for resolving paths to required tools and supporting user overrides
|
|
/// </summary>
|
|
public interface IPathResolverService
|
|
{
|
|
/// <summary>
|
|
/// Gets the uvx package manager path (respects override if set)
|
|
/// </summary>
|
|
/// <returns>Path to the uvx executable, or null if not found</returns>
|
|
string GetUvxPath();
|
|
|
|
/// <summary>
|
|
/// Gets the Claude CLI path (respects override if set)
|
|
/// </summary>
|
|
/// <returns>Path to the claude executable, or null if not found</returns>
|
|
string GetClaudeCliPath();
|
|
|
|
/// <summary>
|
|
/// Checks if Python is detected on the system
|
|
/// </summary>
|
|
/// <returns>True if Python is found</returns>
|
|
bool IsPythonDetected();
|
|
|
|
/// <summary>
|
|
/// Checks if Claude CLI is detected on the system
|
|
/// </summary>
|
|
/// <returns>True if Claude CLI is found</returns>
|
|
bool IsClaudeCliDetected();
|
|
|
|
/// <summary>
|
|
/// Sets an override for the uvx path
|
|
/// </summary>
|
|
/// <param name="path">Path to override with</param>
|
|
void SetUvxPathOverride(string path);
|
|
|
|
/// <summary>
|
|
/// Sets an override for the Claude CLI path
|
|
/// </summary>
|
|
/// <param name="path">Path to override with</param>
|
|
void SetClaudeCliPathOverride(string path);
|
|
|
|
/// <summary>
|
|
/// Clears the uvx path override
|
|
/// </summary>
|
|
void ClearUvxPathOverride();
|
|
|
|
/// <summary>
|
|
/// Clears the Claude CLI path override
|
|
/// </summary>
|
|
void ClearClaudeCliPathOverride();
|
|
|
|
/// <summary>
|
|
/// Gets whether a uvx path override is active
|
|
/// </summary>
|
|
bool HasUvxPathOverride { get; }
|
|
|
|
/// <summary>
|
|
/// Gets whether a Claude CLI path override is active
|
|
/// </summary>
|
|
bool HasClaudeCliPathOverride { get; }
|
|
|
|
/// <summary>
|
|
/// Gets whether the uvx path used a fallback from override to system path
|
|
/// </summary>
|
|
bool HasUvxPathFallback { get; }
|
|
|
|
/// <summary>
|
|
/// Validates the provided uv executable by running "--version" and parsing the output.
|
|
/// </summary>
|
|
/// <param name="uvPath">Absolute or relative path to the uv/uvx executable.</param>
|
|
/// <param name="version">Parsed version string if successful.</param>
|
|
/// <returns>True when the executable runs and returns a uv version string.</returns>
|
|
bool TryValidateUvxExecutable(string uvPath, out string version);
|
|
}
|
|
}
|