From 42946f8445f13f4444aa67ecb1f503ed6d91eb79 Mon Sep 17 00:00:00 2001 From: mithun50 Date: Thu, 13 Nov 2025 15:37:56 +0100 Subject: [PATCH] fix: prioritize package location for commands path resolution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed path resolution in _get_commands_source() to check package location first before falling back to plugins/ directory. Changes: - Priority 1: package_root/commands/ (installed package via pipx/pip) - Priority 2: plugins/superclaude/commands/ (source checkout) - Return package location on failure (clearer error message) This fixes the error: "Command source directory not found: /path/to/.local/pipx/venvs/ superclaude/lib/python3.13/plugins/superclaude/commands" The function was trying plugins/ path first and returning it even when it didn't exist. Now it correctly prioritizes the installed package location where commands are actually bundled. Note: install_skill.py already had correct logic and doesn't need changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/superclaude/cli/install_commands.py | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/superclaude/cli/install_commands.py b/src/superclaude/cli/install_commands.py index f889397..e45776e 100644 --- a/src/superclaude/cli/install_commands.py +++ b/src/superclaude/cli/install_commands.py @@ -94,32 +94,32 @@ def _get_commands_source() -> Path: Get source directory for commands Commands are stored in: - plugins/superclaude/commands/ + 1. package_root/commands/ (installed package) + 2. plugins/superclaude/commands/ (source checkout) Returns: Path to commands source directory """ - # Get package root (src/superclaude/) + # Get package root (superclaude/ when installed, src/superclaude/ in dev) package_root = Path(__file__).resolve().parent.parent - # Check if running from source checkout + # Priority 1: Try commands/ in package (for installed package via pipx/pip) + # This will be site-packages/superclaude/commands/ + package_commands_dir = package_root / "commands" + if package_commands_dir.exists(): + return package_commands_dir + + # Priority 2: Try plugins/superclaude/commands/ in project root (for source checkout) # package_root = src/superclaude/ # repo_root = src/superclaude/../../ = project root repo_root = package_root.parent.parent + plugins_commands_dir = repo_root / "plugins" / "superclaude" / "commands" - # Try plugins/superclaude/commands/ in project root - commands_dir = repo_root / "plugins" / "superclaude" / "commands" + if plugins_commands_dir.exists(): + return plugins_commands_dir - if commands_dir.exists(): - return commands_dir - - # If not found, try relative to package (for installed package) - # This would be in site-packages/superclaude/commands/ - alt_commands_dir = package_root / "commands" - if alt_commands_dir.exists(): - return alt_commands_dir - - return commands_dir # Return first candidate even if doesn't exist + # If neither exists, return package location (will fail with clear error) + return package_commands_dir def list_available_commands() -> List[str]: