Fixes and improvement (#378)

* Fix: Install only selected MCP servers and ensure valid empty backups

This commit addresses two separate issues:

1.  **MCP Installation:** The `install` command was installing all MCP servers instead of only the ones selected by the user. The `_install` method in `setup/components/mcp.py` was iterating through all available servers, not the user's selection. This has been fixed to respect the `selected_mcp_servers` configuration. A new test has been added to verify this fix.

2.  **Backup Creation:** The `create_backup` method in `setup/core/installer.py` created an invalid `.tar.gz` file when the backup source was empty. This has been fixed to ensure that a valid, empty tar archive is always created. A test was added for this as well.
Co-authored-by: Mithun Gowda B <mithungowda.b7411@gmail.com>
Co-authored-by: Jules <jules-ai-assistant@users.noreply.github.com>

* Fix: Correct installer validation for MCP and MCP Docs components

This commit fixes a validation issue in the installer where it would incorrectly fail after a partial installation of MCP servers.

The `MCPComponent` validation logic was checking for all "required" servers, regardless of whether they were selected by the user. This has been corrected to only validate the servers that were actually installed, by checking against the list of installed servers stored in the metadata. The metadata storage has also been fixed to only record the installed servers.

The `MCPDocsComponent` was failing validation because it was not being registered in the metadata if no documentation files were installed. This has been fixed by ensuring the post-installation hook runs even when no files are copied.

New tests have been added for both components to verify the corrected logic.

Co-authored-by: Mithun Gowda B <mithungowda.b7411@gmail.com>
Co-authored-by: Jules <jules-ai-assistant@users.noreply.github.com>

* Fix: Allow re-installation of components and correct validation logic

This commit fixes a bug that prevented new MCP servers from being installed on subsequent runs of the installer. It also fixes the validation logic that was causing failures after a partial installation.

The key changes are:
1.  A new `is_reinstallable` method has been added to the base `Component` class. This allows certain components (like the `mcp` component) to be re-run even if they are already marked as installed.
2.  The installer logic has been updated to respect this new method.
3.  The `MCPComponent` now correctly stores only the installed servers in the metadata.
4.  The validation logic for `MCPComponent` and `MCPDocsComponent` has been corrected to prevent incorrect failures.

New tests have been added to verify all aspects of the new logic.

Co-authored-by: Mithun Gowda B <mithungowda.b7411@gmail.com>
Co-authored-by: Jules <jules-ai-assistant@users.noreply.github.com>

* feat: Display authors in UI header and update author info

This commit implements the user's request to display author names and emails in the UI header of the installer.

The key changes are:
1.  The `__email__` field in `SuperClaude/__init__.py` has been updated to include both authors' emails.
2.  The `display_header` function in `setup/utils/ui.py` has been modified to read the author and email information and display it.
3.  A new test has been added to `tests/test_ui.py` to verify the new UI output.

Co-authored-by: Mithun Gowda B <mithungowda.b7411@gmail.com>
Co-authored-by: Jules <jules-ai-assistant@users.noreply.github.com>

* feat: Version bump to 4.1.0 and various fixes

This commit prepares the project for the v4.1.0 release. It includes a version bump across all relevant files and incorporates several bug fixes and feature enhancements from recent tasks.

Key changes in this release:

- **Version Bump**: The project version has been updated from 4.0.9 to 4.1.0 in all configuration files, documentation, and source code.

- **Installer Fixes**:
  - Components can now be marked as `reinstallable`, allowing them to be re-run on subsequent installations. This fixes a bug where new MCP servers could not be added.
  - The validation logic for `mcp` and `mcp_docs` components has been corrected to avoid incorrect failures.
  - A bug in the backup creation process that created invalid empty archives has been fixed.

- **UI Enhancements**:
  - Author names and emails are now displayed in the installer UI header.

- **Metadata Updates**:
  - Mithun Gowda B has been added as an author.

- **New Tests**:
  - Comprehensive tests have been added for the installer logic, MCP components, and UI changes to ensure correctness and prevent regressions.

Co-authored-by: Mithun Gowda B <mithungowda.b7411@gmail.com>
Co-authored-by: Jules <jules-ai-assistant@users.noreply.github.com>

* fix: Resolve dependencies for partial installs and other fixes

This commit addresses several issues, the main one being a dependency resolution failure during partial installations.

Key changes:
- **Dependency Resolution**: The installer now correctly resolves the full dependency tree when a user requests to install a subset of components. This fixes the "Unknown component: core" error.
- **Component Re-installation**: A new `is_reinstallable` flag allows components like `mcp` to be re-run on subsequent installs, enabling the addition of new servers.
- **Validation Logic**: The validation for `mcp` and `mcp_docs` has been corrected to avoid spurious failures.
- **UI and Metadata**: Author information has been added to the UI header and source files.
- **Version Bump**: The project version has been updated to 4.1.0.
- **Tests**: New tests have been added to cover all the above changes.

Co-authored-by: Mithun Gowda B <mithungowda.b7411@gmail.com>
Co-authored-by: Jules <jules-ai-assistant@users.noreply.github.com>

* fix: Installer fixes and version bump to 4.1.0

This commit includes a collection of fixes for the installer logic, UI enhancements, and a version bump to 4.1.0.

Key changes:
- **Dependency Resolution**: The installer now correctly resolves the full dependency tree for partial installations, fixing the "Unknown component: core" error.
- **Component Re-installation**: A new `is_reinstallable` flag allows components like `mcp` to be re-run to add new servers.
- **MCP Installation**: The non-interactive installation of the `mcp` component now correctly prompts the user to select servers.
- **Validation Logic**: The post-installation validation logic has been corrected to only validate components from the current session and to use the correct list of installed servers.
- **UI & Metadata**: Author information has been added to the UI and source files.
- **Version Bump**: The project version has been updated from 4.0.9 to 4.1.0 across all files.
- **Tests**: New tests have been added to cover all the bug fixes.

Co-authored-by: Mithun Gowda B <mithungowda.b7411@gmail.com>
Co-authored-by: Jules <jules-ai-assistant@users.noreply.github.com>

* feat: Add --authors flag and multiple installer fixes

This commit introduces the `--authors` flag to display author information and includes a collection of fixes for the installer logic.

Key changes:
- **New Feature**: Added an `--authors` flag that displays the names, emails, and GitHub usernames of the project authors.
- **Dependency Resolution**: Fixed a critical bug where partial installations would fail due to unresolved dependencies.
- **Component Re-installation**: Added a mechanism to allow components to be "reinstallable", fixing an issue that prevented adding new MCP servers on subsequent runs.
- **MCP Installation**: The non-interactive installation of the `mcp` component now correctly prompts for server selection.
- **Validation Logic**: Corrected the post-installation validation to prevent spurious errors.
- **Version Bump**: The project version has been updated to 4.1.0.
- **Metadata**: Author and GitHub information has been added to the source files.
- **UI**: The installer header now displays author information.
- **Tests**: Added new tests for all new features and bug fixes.

Co-authored-by: Mithun Gowda B <mithungowda.b7411@gmail.com>
Co-authored-by: Jules <jules-ai-assistant@users.noreply.github.com>

* Add Docker support and framework enhancements

- Add serena-docker.json MCP configuration
- Update MCP configs and installer components
- Enhance CLI commands with new functionality
- Add symbols utility for framework operations
- Improve UI and logging components

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

* Bump version from 4.1.1 to 4.1.2

- Update version across all package files
- Update documentation and README files
- Update Python module version strings
- Update feature configuration files

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Co-Authored-By: Mithun Gowda B <mithungowda.b7411@gmail.com>

* Bump version from 4.1.2 to 4.1.3

- Update version across all package files
- Update documentation and README files
- Update Python module version strings
- Update feature configuration files

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Co-Authored-By: Mithun Gowda B <mithungowda.b7411@gmail.com>

* Fix home directory detection for immutable distros

- Add get_home_directory() function to handle /var/home/$USER paths
- Support Fedora Silverblue, Universal Blue, and other immutable distros
- Replace all Path.home() calls throughout the setup system
- Add fallback methods for edge cases and compatibility
- Create test script for immutable distro validation

Fixes:
- Incorrect home path detection on immutable Linux distributions
- Installation failures on Fedora Silverblue/Universal Blue
- Issues with Claude Code configuration paths

Technical changes:
- New get_home_directory() in utils/environment.py
- Updated all CLI commands, validators, and core components
- Maintains backward compatibility with standard systems
- Robust fallback chain for edge cases

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Co-Authored-By: Mithun Gowda B <mithungowda.b7411@gmail.com>

* Fix circular import and complete immutable distro support

- Move get_home_directory() to separate paths.py module
- Resolve circular import between environment.py and logger.py
- Update all import statements across the setup system
- Verify functionality with comprehensive testing

Technical changes:
- Created setup/utils/paths.py for path utilities
- Updated imports in all affected modules
- Maintains full backward compatibility
- Fixes installation on immutable distros

Testing completed:
-  Basic home directory detection works
-  Installation system integration works
-  Environment utilities integration works
-  Immutable distro logic validated

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Co-Authored-By: Mithun Gowda B <mithungowda.b7411@gmail.com>

* Fix mcp_docs installation bugs

- Fix mcp_docs component incorrectly marking as installed when no MCP servers selected
- Add MCP server selection prompt when mcp_docs component is explicitly requested
- Return False instead of calling _post_install() when no servers selected or files found
- Add user-friendly warning when mcp_docs requested without server selection
- Remove mcp_docs from installation when no servers are available

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

* Fix MCP server name mapping for documentation files

- Add mapping for sequential-thinking -> MCP_Sequential.md
- Add mapping for morphllm-fast-apply -> MCP_Morphllm.md
- Ensures mcp_docs installation works with all MCP server naming conventions

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

* Enable mcp_docs component reinstallation

- Add is_reinstallable() method returning True to allow repeat installations
- Fixes issue where mcp_docs was skipped on subsequent installation attempts
- Enables users to change MCP server selections and update documentation

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

* Fix repeat installation issues for mcp_docs

- Ensure mcp component is auto-added when mcp_docs is selected with servers
- Fix component_files tracking to only include successfully copied files
- Ensures CLAUDE.md gets properly updated with MCP documentation imports
- Fixes issue where MCP servers weren't installed on repeat attempts

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

* Fix MCP component metadata tracking and debug logging

- Fix servers_count to track actually installed servers instead of total available
- Add installed_servers list to metadata for better tracking
- Add debug logging to trace component auto-addition
- Ensures MCP component appears properly in metadata when servers are installed

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

* Fix pyproject.toml license format and add missing classifier

- Fix license format from string to {text = "MIT"} format
- Add missing "License :: OSI Approved :: MIT License" classifier
- Fix indentation consistency in classifiers section
- Resolves setup.py installation errors and PEP 621 compliance

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

* Fix MCP incremental installation and auto-detection system

PROBLEM FIXED:
- MCP component only registered servers selected during current session
- mcp_docs component only installed docs for newly selected servers
- Users had to reinstall everything when adding new MCP servers
- Installation failed if no servers selected but servers existed

SOLUTION IMPLEMENTED:
- Add auto-detection of existing MCP servers from config files (.claude.json, claude_desktop_config.json)
- Add CLI detection via 'claude mcp list' output parsing
- Add smart server merging (existing + selected + previously installed)
- Add server name normalization for common variations
- Fix CLI logic to allow mcp_docs installation without server selection
- Add graceful error handling for corrupted configs

KEY FEATURES:
 Auto-detects existing MCP servers from multiple config locations
 Supports incremental installation (add new servers without breaking existing)
 Works with or without --install-dir argument
 Handles server name variations (sequential vs sequential-thinking, etc.)
 Maintains metadata persistence across installation sessions
 Graceful fallback when config files are corrupted
 Compatible with both interactive and non-interactive modes

TESTED SCENARIOS:
- Fresh installation with no MCP servers 
- Auto-detection with existing servers 
- Incremental server additions 
- Mixed mode (new + existing servers) 
- Error handling with corrupted configs 
- Default vs custom installation directories 
- Interactive vs command-line modes 

Files changed:
- setup/cli/commands/install.py: Allow mcp_docs auto-detection mode
- setup/components/mcp.py: Add comprehensive auto-detection logic
- setup/components/mcp_docs.py: Add auto-detection for documentation

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

* Integrate SuperClaude framework flags into help command

ENHANCEMENT:
- Add comprehensive flag documentation to /sc:help command
- Include all 25 SuperClaude framework flags with descriptions
- Organize flags into logical categories (Mode, MCP, Analysis, Execution, Output)
- Add practical usage examples showing flag combinations
- Include flag priority rules and precedence hierarchy

NEW SECTIONS ADDED:
 Mode Activation Flags (5 flags): --brainstorm, --introspect, --task-manage, --orchestrate, --token-efficient
 MCP Server Flags (8 flags): --c7, --seq, --magic, --morph, --serena, --play, --all-mcp, --no-mcp
 Analysis Depth Flags (3 flags): --think, --think-hard, --ultrathink
 Execution Control Flags (6 flags): --delegate, --concurrency, --loop, --iterations, --validate, --safe-mode
 Output Optimization Flags (3 flags): --uc, --scope, --focus
 Flag Priority Rules: Clear hierarchy and precedence guidelines
 Usage Examples: 4 practical examples showing real-world flag combinations

IMPACT:
- Users can now discover all SuperClaude capabilities from /sc:help
- Single source of truth for commands AND flags
- Improved discoverability of advanced features
- Clear guidance on flag usage and combinations
- Help content nearly doubled (68 → 148 lines) with valuable reference information

Files changed:
- SuperClaude/Commands/help.md: Integrate FLAGS.md content with structured tables and examples

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

* Remove non-existent commands from modes.md documentation

PROBLEM FIXED:
- Documentation contained references to fake/non-existent commands
- Commands like sc:fix, sc:simple-pix, sc:update, sc:develop, sc:modernize, sc:simple-fix don't exist in CLI
- Confusing users who try to use these commands and get errors
- Inconsistency between documentation and actual SuperClaude command availability

COMMANDS REMOVED/REPLACED:
 /sc:simple-fix →  /sc:troubleshoot (real command)
 /sc:develop →  /sc:implement (real command)
 /sc:modernize →  /sc:improve (real command)

AFFECTED FILES:
- Docs/User-Guide/modes.md: Fixed all non-existent command references
- Docs/User-Guide-jp/modes.md: Fixed Japanese translation with same issues
- Docs/User-Guide-zh/modes.md: Fixed Chinese translation with same issues

VERIFICATION:
 All remaining /sc: commands verified to exist in SuperClaude/Commands/
 No more references to fake commands in any language version
 Examples now use only real, working SuperClaude commands
 User experience improved - no more confusion from non-working commands

REAL COMMANDS REFERENCED:
- /sc:analyze, /sc:brainstorm, /sc:help, /sc:implement
- /sc:improve, /sc:reflect, /sc:troubleshoot
- All verified to exist in CLI implementation

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

* Version bump to 4.1.4

CHANGELOG:
 Added comprehensive flag documentation to /sc:help command
 Fixed MCP incremental installation and auto-detection system
 Cleaned up documentation by removing non-existent commands
 Enhanced user experience with complete capability reference

VERSION UPDATES:
- Updated VERSION file: 4.1.3 → 4.1.4
- Updated pyproject.toml: 4.1.3 → 4.1.4
- Updated package.json: 4.1.3 → 4.1.4
- Updated all Python __init__.py fallback versions
- Updated all documentation references across all languages
- Updated setup/data/features.json component versions
- Updated CHANGELOG.md with comprehensive 4.1.4 release notes

SCOPE OF CHANGES:
📦 Core files: VERSION, pyproject.toml, package.json, __init__.py files
📚 Documentation: All .md files across English, Japanese, Chinese
🔧 Setup files: features.json, base.py version references
📝 Project files: README files, CHANGELOG, SECURITY, CONTRIBUTING

VERIFICATION:
 No remaining 4.1.3 references found
 29 files now properly reference 4.1.4
 All language versions consistently updated
 Package metadata properly versioned for distribution

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Jules <jules-ai-assistant@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Happy <yesreply@happy.engineering>
This commit is contained in:
Mithun Gowda B 2025-09-20 10:38:42 +02:00 committed by GitHub
parent 8cf810adb9
commit 89a5cf33d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
38 changed files with 800 additions and 371 deletions

View File

@ -7,9 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [4.1.3] - 2025-09-15 ## [4.1.4] - 2025-09-20
### Added
- Comprehensive flag documentation integrated into `/sc:help` command
- All 25 SuperClaude framework flags now discoverable from help system
- Practical usage examples and flag priority rules
### Fixed
- MCP incremental installation and auto-detection system
- Auto-detection of existing MCP servers from .claude.json and claude_desktop_config.json
- Smart server merging (existing + selected + previously installed)
- Documentation cleanup: removed non-existent commands (sc:fix, sc:simple-pix, sc:update, sc:develop, sc:modernize, sc:simple-fix)
- CLI logic to allow mcp_docs installation without server selection
### Changed ### Changed
- Version bump from 4.1.0 to 4.1.3 - MCP component now supports true incremental installation
- mcp_docs component auto-detects and installs documentation for all detected servers
- Improved error handling and graceful fallback for corrupted config files
- Enhanced user experience with single-source reference for all SuperClaude capabilities
## [4.1.0] - 2025-09-13 ## [4.1.0] - 2025-09-13
### Added ### Added

View File

@ -518,7 +518,7 @@ This code of conduct draws inspiration from several established community standa
**Last Updated**: December 2024 (SuperClaude Framework v4.0) **Last Updated**: December 2024 (SuperClaude Framework v4.0)
**Next Review**: June 2025 (Semi-annual review cycle) **Next Review**: June 2025 (Semi-annual review cycle)
**Version**: 4.1.3 (Updated for v4 community structure and governance) **Version**: 4.1.4 (Updated for v4 community structure and governance)
**Review Schedule:** **Review Schedule:**
- **Semi-Annual Reviews**: Policy effectiveness assessment and community feedback integration - **Semi-Annual Reviews**: Policy effectiveness assessment and community feedback integration

View File

@ -27,7 +27,7 @@ SuperClaude Framework transforms Claude Code into a structured development platf
**Good Bug Report Example:** **Good Bug Report Example:**
``` ```
**Environment:** **Environment:**
- SuperClaude: 4.1.3 - SuperClaude: 4.1.4
- OS: Ubuntu 22.04 - OS: Ubuntu 22.04
- Claude Code: 1.5.2 - Claude Code: 1.5.2
- Python: 3.9.7 - Python: 3.9.7

View File

@ -5,7 +5,7 @@
### **Transform Claude Code with 21 Commands, 14 Agents & 6 MCP Servers** ### **Transform Claude Code with 21 Commands, 14 Agents & 6 MCP Servers**
<p align="center"> <p align="center">
<img src="https://img.shields.io/badge/version-4.1.3-blue?style=for-the-badge" alt="Version"> <img src="https://img.shields.io/badge/version-4.1.4-blue?style=for-the-badge" alt="Version">
<img src="https://img.shields.io/badge/Python-3.8+-green?style=for-the-badge" alt="Python"> <img src="https://img.shields.io/badge/Python-3.8+-green?style=for-the-badge" alt="Python">
<img src="https://img.shields.io/badge/Platform-Linux%20|%20macOS%20|%20Windows-orange?style=for-the-badge" alt="Platform"> <img src="https://img.shields.io/badge/Platform-Linux%20|%20macOS%20|%20Windows-orange?style=for-the-badge" alt="Platform">
</p> </p>
@ -266,7 +266,7 @@ SuperClaude install --dry-run
```bash ```bash
# Verify SuperClaude version # Verify SuperClaude version
python3 -m SuperClaude --version python3 -m SuperClaude --version
# Expected: SuperClaude 4.1.3 # Expected: SuperClaude 4.1.4
# List installed components # List installed components
SuperClaude install --list-components SuperClaude install --list-components

View File

@ -6,7 +6,7 @@
<p align="center"> <p align="center">
<img src="https://img.shields.io/badge/Framework-Context_Engineering-purple?style=for-the-badge" alt="Framework"> <img src="https://img.shields.io/badge/Framework-Context_Engineering-purple?style=for-the-badge" alt="Framework">
<img src="https://img.shields.io/badge/Version-4.1.3-blue?style=for-the-badge" alt="Version"> <img src="https://img.shields.io/badge/Version-4.1.4-blue?style=for-the-badge" alt="Version">
<img src="https://img.shields.io/badge/Time_to_Start-5_Minutes-green?style=for-the-badge" alt="Quick Start"> <img src="https://img.shields.io/badge/Time_to_Start-5_Minutes-green?style=for-the-badge" alt="Quick Start">
</p> </p>
@ -486,7 +486,7 @@ Create custom workflows
</p> </p>
<p align="center"> <p align="center">
<sub>SuperClaude v4.1.3 - Context Engineering for Claude Code</sub> <sub>SuperClaude v4.1.4 - Context Engineering for Claude Code</sub>
</p> </p>
</div> </div>

View File

@ -13,7 +13,7 @@ Test: /sc:brainstorm "test" should ask questions
### 2. Installation Verification ### 2. Installation Verification
```bash ```bash
python3 -m SuperClaude --version # Should show 4.1.3 python3 -m SuperClaude --version # Should show 4.1.4
# If not working: # If not working:
# For pipx users # For pipx users
@ -71,7 +71,7 @@ pip3 install SuperClaude
``` ```
## Verification Checklist ## Verification Checklist
- [ ] `python3 -m SuperClaude --version` returns 4.1.3 - [ ] `python3 -m SuperClaude --version` returns 4.1.4
- [ ] `/sc:brainstorm "test"` works in Claude Code - [ ] `/sc:brainstorm "test"` works in Claude Code
- [ ] `SuperClaude install --list-components` shows components - [ ] `SuperClaude install --list-components` shows components

View File

@ -6,7 +6,7 @@ Quick fixes to advanced diagnostics for SuperClaude Framework issues.
**Installation Verification:** **Installation Verification:**
```bash ```bash
python3 -m SuperClaude --version # Should show 4.1.3 python3 -m SuperClaude --version # Should show 4.1.4
SuperClaude install --list-components SuperClaude install --list-components
``` ```
@ -19,7 +19,7 @@ SuperClaude install --list-components
``` ```
**Resolution Checklist:** **Resolution Checklist:**
- [ ] Version commands work and show 4.1.3 - [ ] Version commands work and show 4.1.4
- [ ] `/sc:` commands respond in Claude Code - [ ] `/sc:` commands respond in Claude Code
- [ ] MCP servers listed: `SuperClaude install --list-components | grep mcp` - [ ] MCP servers listed: `SuperClaude install --list-components | grep mcp`

View File

@ -92,7 +92,7 @@ SuperClaude は、Claude Code が特殊な動作を実行するために読み
```shell ```shell
# Verify SuperClaude is working (primary method) # Verify SuperClaude is working (primary method)
python3 -m SuperClaude --version python3 -m SuperClaude --version
# Example output: SuperClaude 4.1.3 # Example output: SuperClaude 4.1.4
# Claude Code CLI version check # Claude Code CLI version check
claude --version claude --version

View File

@ -358,10 +358,10 @@ Standard Approach: Consistent, professional baseline for all tasks
/sc:implement "user login" --brainstorm /sc:implement "user login" --brainstorm
# Add reasoning transparency to debugging # Add reasoning transparency to debugging
/sc:fix auth-issue --introspect # 認証問題を透明な推理でデバッグ
# Enable task management for simple operations # Enable task management for simple operations
/sc:update styles.css --task-manage # システマチックなタスク管理でスタイルファイルを更新
``` ```
### モードの境界と優先順位 ### モードの境界と優先順位
@ -407,7 +407,7 @@ Standard Approach: Consistent, professional baseline for all tasks
→ 🎯 Phase coordination with quality gates → 🎯 Phase coordination with quality gates
# Phase 3: Implementation (Orchestration Mode coordinates tools) # Phase 3: Implementation (Orchestration Mode coordinates tools)
/sc:develop frontend + backend /sc:implement "frontend and backend systems"
→ 🎯 Magic (UI) + Context7 (patterns) + Sequential (architecture) → 🎯 Magic (UI) + Context7 (patterns) + Sequential (architecture)
→ ⚡ Parallel execution optimization → ⚡ Parallel execution optimization
``` ```
@ -422,7 +422,7 @@ Standard Approach: Consistent, professional baseline for all tasks
→ 💡 Pattern recognition across similar issues → 💡 Pattern recognition across similar issues
# Systematic resolution (Task Management coordinates) # Systematic resolution (Task Management coordinates)
/sc:fix auth-system --comprehensive # 認証システムを包括的に修正
→ 📋 Phase 1: Root cause analysis → 📋 Phase 1: Root cause analysis
→ 📋 Phase 2: Solution implementation → 📋 Phase 2: Solution implementation
→ 📋 Phase 3: Testing and validation → 📋 Phase 3: Testing and validation
@ -436,7 +436,7 @@ Standard Approach: Consistent, professional baseline for all tasks
```shell ```shell
# Large refactoring with multiple constraints # Large refactoring with multiple constraints
/sc:modernize legacy-system/ --introspect --uc --orchestrate /sc:improve legacy-system/ --introspect --uc --orchestrate
→ 🔍 Transparent reasoning (Introspection) → 🔍 Transparent reasoning (Introspection)
→ ⚡ Compressed communication (Token Efficiency) → ⚡ Compressed communication (Token Efficiency)
→ 🎯 Optimal tool coordination (Orchestration) → 🎯 Optimal tool coordination (Orchestration)
@ -529,7 +529,7 @@ Standard Approach: Consistent, professional baseline for all tasks
# Problem: Simple tasks getting complex coordination # Problem: Simple tasks getting complex coordination
# Quick Fix: Reduce scope or use simpler commands # Quick Fix: Reduce scope or use simpler commands
/sc:implement "function" --no-task-manage # Disable coordination /sc:implement "function" --no-task-manage # Disable coordination
/sc:simple-fix bug.js # Use basic commands /sc:troubleshoot bug.js # Use basic commands
# Check if task really is complex (>3 files, >2 directories) # Check if task really is complex (>3 files, >2 directories)
``` ```

View File

@ -67,7 +67,7 @@ SuperClaude 提供行为上下文文件Claude Code 通过读取这些文件
```bash ```bash
# 验证 SuperClaude 是否正常工作(主要方法) # 验证 SuperClaude 是否正常工作(主要方法)
python3 -m SuperClaude --version python3 -m SuperClaude --version
# 示例输出SuperClaude 4.1.3 # 示例输出SuperClaude 4.1.4
# Claude Code CLI 版本检查 # Claude Code CLI 版本检查
claude --version claude --version

View File

@ -297,10 +297,10 @@ Standard Approach: Consistent, professional baseline for all tasks
/sc:implement "user login" --brainstorm /sc:implement "user login" --brainstorm
# 为调试添加推理透明度 # 为调试添加推理透明度
/sc:fix auth-issue --introspect # 使用透明推理调试认证问题
# 为简单操作启用任务管理 # 为简单操作启用任务管理
/sc:update styles.css --task-manage # 系统化任务管理更新样式文件
``` ```
### 模式边界和优先级 ### 模式边界和优先级
@ -337,7 +337,7 @@ Standard Approach: Consistent, professional baseline for all tasks
→ 🎯 带质量门控的阶段协调 → 🎯 带质量门控的阶段协调
# 阶段 3实现编排模式协调工具 # 阶段 3实现编排模式协调工具
/sc:develop frontend + backend /sc:implement "frontend and backend systems"
→ 🎯 Magic (UI) + Context7 (模式) + Sequential (架构) → 🎯 Magic (UI) + Context7 (模式) + Sequential (架构)
→ ⚡ 并行执行优化 → ⚡ 并行执行优化
``` ```
@ -351,7 +351,7 @@ Standard Approach: Consistent, professional baseline for all tasks
→ 💡 跨相似问题的模式识别 → 💡 跨相似问题的模式识别
# 系统性解决(任务管理协调) # 系统性解决(任务管理协调)
/sc:fix auth-system --comprehensive # 全面修复认证系统
→ 📋 阶段 1根因分析 → 📋 阶段 1根因分析
→ 📋 阶段 2解决方案实现 → 📋 阶段 2解决方案实现
→ 📋 阶段 3测试和验证 → 📋 阶段 3测试和验证
@ -362,7 +362,7 @@ Standard Approach: Consistent, professional baseline for all tasks
**高复杂度场景:** **高复杂度场景:**
```bash ```bash
# 带多重约束的大型重构 # 带多重约束的大型重构
/sc:modernize legacy-system/ --introspect --uc --orchestrate /sc:improve legacy-system/ --introspect --uc --orchestrate
→ 🔍 透明推理introspect内省 → 🔍 透明推理introspect内省
→ ⚡ 压缩通信uc令牌效率 → ⚡ 压缩通信uc令牌效率
→ 🎯 最优工具协调orchestrate编排 → 🎯 最优工具协调orchestrate编排
@ -436,7 +436,7 @@ Standard Approach: Consistent, professional baseline for all tasks
# 问题:简单任务得到复杂协调 # 问题:简单任务得到复杂协调
# 快速修复:减少范围或使用更简单的命令 # 快速修复:减少范围或使用更简单的命令
/sc:implement "function" --no-task-manage # 禁用协调 /sc:implement "function" --no-task-manage # 禁用协调
/sc:simple-fix bug.js # 使用基本命令 /sc:troubleshoot bug.js # 使用基本命令
# 检查任务是否真正复杂(>3 文件,>2 目录) # 检查任务是否真正复杂(>3 文件,>2 目录)
``` ```

View File

@ -67,7 +67,7 @@ SuperClaude provides behavioral context files that Claude Code reads to adopt sp
```bash ```bash
# Verify SuperClaude is working (primary method) # Verify SuperClaude is working (primary method)
python3 -m SuperClaude --version python3 -m SuperClaude --version
# Example output: SuperClaude 4.1.3 # Example output: SuperClaude 4.1.4
# Claude Code CLI version check # Claude Code CLI version check
claude --version claude --version

View File

@ -298,10 +298,10 @@ Standard Approach: Consistent, professional baseline for all tasks
/sc:implement "user login" --brainstorm /sc:implement "user login" --brainstorm
# Add reasoning transparency to debugging # Add reasoning transparency to debugging
/sc:fix auth-issue --introspect # Debug authentication issue with transparent reasoning
# Enable task management for simple operations # Enable task management for simple operations
/sc:update styles.css --task-manage # Update styles.css with systematic task management
``` ```
### Mode Boundaries and Priority ### Mode Boundaries and Priority
@ -338,7 +338,7 @@ Standard Approach: Consistent, professional baseline for all tasks
→ 🎯 Phase coordination with quality gates → 🎯 Phase coordination with quality gates
# Phase 3: Implementation (Orchestration Mode coordinates tools) # Phase 3: Implementation (Orchestration Mode coordinates tools)
/sc:develop frontend + backend /sc:implement "frontend and backend systems"
→ 🎯 Magic (UI) + Context7 (patterns) + Sequential (architecture) → 🎯 Magic (UI) + Context7 (patterns) + Sequential (architecture)
→ ⚡ Parallel execution optimization → ⚡ Parallel execution optimization
``` ```
@ -352,7 +352,7 @@ Standard Approach: Consistent, professional baseline for all tasks
→ 💡 Pattern recognition across similar issues → 💡 Pattern recognition across similar issues
# Systematic resolution (Task Management coordinates) # Systematic resolution (Task Management coordinates)
/sc:fix auth-system --comprehensive # Fix authentication system comprehensively
→ 📋 Phase 1: Root cause analysis → 📋 Phase 1: Root cause analysis
→ 📋 Phase 2: Solution implementation → 📋 Phase 2: Solution implementation
→ 📋 Phase 3: Testing and validation → 📋 Phase 3: Testing and validation
@ -363,7 +363,7 @@ Standard Approach: Consistent, professional baseline for all tasks
**High-Complexity Scenarios:** **High-Complexity Scenarios:**
```bash ```bash
# Large refactoring with multiple constraints # Large refactoring with multiple constraints
/sc:modernize legacy-system/ --introspect --uc --orchestrate /sc:improve legacy-system/ --introspect --uc --orchestrate
→ 🔍 Transparent reasoning (Introspection) → 🔍 Transparent reasoning (Introspection)
→ ⚡ Compressed communication (Token Efficiency) → ⚡ Compressed communication (Token Efficiency)
→ 🎯 Optimal tool coordination (Orchestration) → 🎯 Optimal tool coordination (Orchestration)
@ -437,7 +437,7 @@ For troubleshooting help, see:
# Problem: Simple tasks getting complex coordination # Problem: Simple tasks getting complex coordination
# Quick Fix: Reduce scope or use simpler commands # Quick Fix: Reduce scope or use simpler commands
/sc:implement "function" --no-task-manage # Disable coordination /sc:implement "function" --no-task-manage # Disable coordination
/sc:simple-fix bug.js # Use basic commands /sc:troubleshoot bug.js # Use basic commands
# Check if task really is complex (>3 files, >2 directories) # Check if task really is complex (>3 files, >2 directories)
``` ```

View File

@ -5,7 +5,7 @@
### **Claude Codeを構造化開発プラットフォームに変換** ### **Claude Codeを構造化開発プラットフォームに変換**
<p align="center"> <p align="center">
<img src="https://img.shields.io/badge/version-4.1.3-blue" alt="Version"> <img src="https://img.shields.io/badge/version-4.1.4-blue" alt="Version">
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License"> <img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License">
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome"> <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome">
</p> </p>

View File

@ -5,7 +5,7 @@
### **将Claude Code转换为结构化开发平台** ### **将Claude Code转换为结构化开发平台**
<p align="center"> <p align="center">
<img src="https://img.shields.io/badge/version-4.1.3-blue" alt="Version"> <img src="https://img.shields.io/badge/version-4.1.4-blue" alt="Version">
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License"> <img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License">
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome"> <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome">
</p> </p>

View File

@ -14,7 +14,7 @@
<a href="https://github.com/SuperClaude-Org/SuperQwen_Framework" target="_blank"> <a href="https://github.com/SuperClaude-Org/SuperQwen_Framework" target="_blank">
<img src="https://img.shields.io/badge/Try-SuperQwen_Framework-orange" alt="Try SuperQwen Framework"/> <img src="https://img.shields.io/badge/Try-SuperQwen_Framework-orange" alt="Try SuperQwen Framework"/>
</a> </a>
<img src="https://img.shields.io/badge/version-4.1.3-blue" alt="Version"> <img src="https://img.shields.io/badge/version-4.1.4-blue" alt="Version">
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License"> <img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License">
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome"> <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome">
</p> </p>

View File

@ -723,7 +723,7 @@ For organizations requiring dedicated security support:
**Last Updated**: December 2024 (SuperClaude Framework v4.0) **Last Updated**: December 2024 (SuperClaude Framework v4.0)
**Next Review**: March 2025 (Quarterly review cycle) **Next Review**: March 2025 (Quarterly review cycle)
**Version**: 4.1.3 (Updated for v4 architectural changes) **Version**: 4.1.4 (Updated for v4 architectural changes)
**Review Schedule:** **Review Schedule:**
- **Quarterly Reviews**: Security policy accuracy and completeness assessment - **Quarterly Reviews**: Security policy accuracy and completeness assessment

View File

@ -51,12 +51,92 @@ Here is a complete list of all available SuperClaude (`/sc`) commands.
| `/sc:troubleshoot` | Diagnose and resolve issues in code, builds, deployments, and system behavior | | `/sc:troubleshoot` | Diagnose and resolve issues in code, builds, deployments, and system behavior |
| `/sc:workflow` | Generate structured implementation workflows from PRDs and feature requirements | | `/sc:workflow` | Generate structured implementation workflows from PRDs and feature requirements |
## SuperClaude Framework Flags
SuperClaude supports behavioral flags to enable specific execution modes and tool selection patterns. Use these flags with any `/sc` command to customize behavior.
### Mode Activation Flags
| Flag | Trigger | Behavior |
|------|---------|----------|
| `--brainstorm` | Vague project requests, exploration keywords | Activate collaborative discovery mindset, ask probing questions |
| `--introspect` | Self-analysis requests, error recovery | Expose thinking process with transparency markers |
| `--task-manage` | Multi-step operations (>3 steps) | Orchestrate through delegation, systematic organization |
| `--orchestrate` | Multi-tool operations, parallel execution | Optimize tool selection matrix, enable parallel thinking |
| `--token-efficient` | Context usage >75%, large-scale operations | Symbol-enhanced communication, 30-50% token reduction |
### MCP Server Flags
| Flag | Trigger | Behavior |
|------|---------|----------|
| `--c7` / `--context7` | Library imports, framework questions | Enable Context7 for curated documentation lookup |
| `--seq` / `--sequential` | Complex debugging, system design | Enable Sequential for structured multi-step reasoning |
| `--magic` | UI component requests (/ui, /21) | Enable Magic for modern UI generation from 21st.dev |
| `--morph` / `--morphllm` | Bulk code transformations | Enable Morphllm for efficient multi-file pattern application |
| `--serena` | Symbol operations, project memory | Enable Serena for semantic understanding and session persistence |
| `--play` / `--playwright` | Browser testing, E2E scenarios | Enable Playwright for real browser automation and testing |
| `--all-mcp` | Maximum complexity scenarios | Enable all MCP servers for comprehensive capability |
| `--no-mcp` | Native-only execution needs | Disable all MCP servers, use native tools |
### Analysis Depth Flags
| Flag | Trigger | Behavior |
|------|---------|----------|
| `--think` | Multi-component analysis needs | Standard structured analysis (~4K tokens), enables Sequential |
| `--think-hard` | Architectural analysis, system-wide dependencies | Deep analysis (~10K tokens), enables Sequential + Context7 |
| `--ultrathink` | Critical system redesign, legacy modernization | Maximum depth analysis (~32K tokens), enables all MCP servers |
### Execution Control Flags
| Flag | Trigger | Behavior |
|------|---------|----------|
| `--delegate [auto\|files\|folders]` | >7 directories OR >50 files | Enable sub-agent parallel processing with intelligent routing |
| `--concurrency [n]` | Resource optimization needs | Control max concurrent operations (range: 1-15) |
| `--loop` | Improvement keywords (polish, refine, enhance) | Enable iterative improvement cycles with validation gates |
| `--iterations [n]` | Specific improvement cycle requirements | Set improvement cycle count (range: 1-10) |
| `--validate` | Risk score >0.7, resource usage >75% | Pre-execution risk assessment and validation gates |
| `--safe-mode` | Resource usage >85%, production environment | Maximum validation, conservative execution |
### Output Optimization Flags
| Flag | Trigger | Behavior |
|------|---------|----------|
| `--uc` / `--ultracompressed` | Context pressure, efficiency requirements | Symbol communication system, 30-50% token reduction |
| `--scope [file\|module\|project\|system]` | Analysis boundary needs | Define operational scope and analysis depth |
| `--focus [performance\|security\|quality\|architecture\|accessibility\|testing]` | Domain-specific optimization | Target specific analysis domain and expertise application |
### Flag Priority Rules
- **Safety First**: `--safe-mode` > `--validate` > optimization flags
- **Explicit Override**: User flags > auto-detection
- **Depth Hierarchy**: `--ultrathink` > `--think-hard` > `--think`
- **MCP Control**: `--no-mcp` overrides all individual MCP flags
- **Scope Precedence**: system > project > module > file
### Usage Examples
```bash
# Deep analysis with Context7 enabled
/sc:analyze --think-hard --context7 src/
# UI development with Magic and validation
/sc:implement --magic --validate "Add user dashboard"
# Token-efficient task management
/sc:task --token-efficient --delegate auto "Refactor authentication system"
# Safe production deployment
/sc:build --safe-mode --validate --focus security
```
## Boundaries ## Boundaries
**Will:** **Will:**
- Display comprehensive list of available SuperClaude commands - Display comprehensive list of available SuperClaude commands
- Provide clear descriptions of each command's functionality - Provide clear descriptions of each command's functionality
- Present information in readable tabular format - Present information in readable tabular format
- Show all available SuperClaude framework flags and their usage
- Provide flag usage examples and priority rules
**Will Not:** **Will Not:**
- Execute any commands or create any files - Execute any commands or create any files

View File

@ -17,7 +17,7 @@ from pathlib import Path
try: try:
__version__ = (Path(__file__).parent.parent / "VERSION").read_text().strip() __version__ = (Path(__file__).parent.parent / "VERSION").read_text().strip()
except Exception: except Exception:
__version__ = "4.1.3" # Fallback __version__ = "4.1.4" # Fallback
__author__ = "NomenAK, Mithun Gowda B" __author__ = "NomenAK, Mithun Gowda B"
__email__ = "anton.knoery@gmail.com, mithungowda.b7411@gmail.com" __email__ = "anton.knoery@gmail.com, mithungowda.b7411@gmail.com"
__github__ = "NomenAK, mithun50" __github__ = "NomenAK, mithun50"

View File

@ -1 +1 @@
4.1.3 4.1.4

View File

@ -1,6 +1,6 @@
{ {
"name": "@bifrost_inc/superclaude", "name": "@bifrost_inc/superclaude",
"version": "4.1.3", "version": "4.1.4",
"description": "SuperClaude Framework NPM wrapper - Official Node.js wrapper for the Python SuperClaude package. Enhances Claude Code with specialized commands and AI development tools.", "description": "SuperClaude Framework NPM wrapper - Official Node.js wrapper for the Python SuperClaude package. Enhances Claude Code with specialized commands and AI development tools.",
"scripts": { "scripts": {
"postinstall": "node ./bin/install.js", "postinstall": "node ./bin/install.js",

View File

@ -4,18 +4,19 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "SuperClaude" name = "SuperClaude"
version = "4.1.3" version = "4.1.4"
authors = [ authors = [
{name = "NomenAK", email = "anton.knoery@gmail.com"}, {name = "NomenAK", email = "anton.knoery@gmail.com"},
{name = "Mithun Gowda B", email = "mithungowda.b7411@gmail.com"} {name = "Mithun Gowda B", email = "mithungowda.b7411@gmail.com"}
] ]
description = "SuperClaude Framework Management Hub - AI-enhanced development framework for Claude Code" description = "SuperClaude Framework Management Hub - AI-enhanced development framework for Claude Code"
readme = "README.md" readme = "README.md"
license = "MIT" license = {text = "MIT"}
requires-python = ">=3.8" requires-python = ">=3.8"
classifiers = [ classifiers = [
"Development Status :: 4 - Beta", "Development Status :: 4 - Beta",
"Intended Audience :: Developers", "Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent", "Operating System :: OS Independent",
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.8",

View File

@ -8,7 +8,7 @@ from pathlib import Path
try: try:
__version__ = (Path(__file__).parent.parent / "VERSION").read_text().strip() __version__ = (Path(__file__).parent.parent / "VERSION").read_text().strip()
except Exception: except Exception:
__version__ = "4.1.3" # Fallback __version__ = "4.1.4" # Fallback
__author__ = "NomenAK, Mithun Gowda B" __author__ = "NomenAK, Mithun Gowda B"
@ -17,5 +17,8 @@ SETUP_DIR = Path(__file__).parent
PROJECT_ROOT = SETUP_DIR.parent PROJECT_ROOT = SETUP_DIR.parent
DATA_DIR = SETUP_DIR / "data" DATA_DIR = SETUP_DIR / "data"
# Import home directory detection for immutable distros
from .utils.paths import get_home_directory
# Installation target # Installation target
DEFAULT_INSTALL_DIR = Path.home() / ".claude" DEFAULT_INSTALL_DIR = get_home_directory() / ".claude"

View File

@ -10,7 +10,7 @@ from pathlib import Path
try: try:
__version__ = (Path(__file__).parent.parent.parent / "VERSION").read_text().strip() __version__ = (Path(__file__).parent.parent.parent / "VERSION").read_text().strip()
except Exception: except Exception:
__version__ = "4.1.3" # Fallback __version__ = "4.1.4" # Fallback
def get_command_info(): def get_command_info():

View File

@ -8,6 +8,7 @@ import time
import tarfile import tarfile
import json import json
from pathlib import Path from pathlib import Path
from ...utils.paths import get_home_directory
from datetime import datetime from datetime import datetime
from typing import List, Optional, Dict, Any, Tuple from typing import List, Optional, Dict, Any, Tuple
import argparse import argparse
@ -494,7 +495,7 @@ def run(args: argparse.Namespace) -> int:
operation.setup_operation_logging(args) operation.setup_operation_logging(args)
logger = get_logger() logger = get_logger()
# ✅ Inserted validation code # ✅ Inserted validation code
expected_home = Path.home().resolve() expected_home = get_home_directory().resolve()
actual_dir = args.install_dir.resolve() actual_dir = args.install_dir.resolve()
if not str(actual_dir).startswith(str(expected_home)): if not str(actual_dir).startswith(str(expected_home)):

View File

@ -6,6 +6,7 @@ Refactored from install.py for unified CLI hub
import sys import sys
import time import time
from pathlib import Path from pathlib import Path
from ...utils.paths import get_home_directory
from typing import List, Optional, Dict, Any from typing import List, Optional, Dict, Any
import argparse import argparse
@ -125,16 +126,28 @@ def get_components_to_install(args: argparse.Namespace, registry: ComponentRegis
else: else:
components = args.components components = args.components
# If mcp is specified non-interactively, we should still ask which servers to install. # If mcp or mcp_docs is specified non-interactively, we should still ask which servers to install.
if 'mcp' in components: if 'mcp' in components or 'mcp_docs' in components:
selected_servers = select_mcp_servers(registry) selected_servers = select_mcp_servers(registry)
if not hasattr(config_manager, '_installation_context'): if not hasattr(config_manager, '_installation_context'):
config_manager._installation_context = {} config_manager._installation_context = {}
config_manager._installation_context["selected_mcp_servers"] = selected_servers config_manager._installation_context["selected_mcp_servers"] = selected_servers
# If the user selected some servers, but didn't select mcp_docs, add it. # If the user selected some servers, ensure both mcp and mcp_docs are included
if selected_servers and 'mcp_docs' not in components: if selected_servers:
if 'mcp' not in components:
components.append('mcp')
logger.debug(f"Auto-added 'mcp' component for selected servers: {selected_servers}")
if 'mcp_docs' not in components:
components.append('mcp_docs') components.append('mcp_docs')
logger.debug(f"Auto-added 'mcp_docs' component for selected servers: {selected_servers}")
logger.info(f"Final components to install: {components}")
# If mcp_docs was explicitly requested but no servers selected, allow auto-detection
elif not selected_servers and 'mcp_docs' in components:
logger.info("mcp_docs component will auto-detect existing MCP servers")
logger.info("Documentation will be installed for any detected servers")
return components return components
@ -187,7 +200,7 @@ def select_mcp_servers(registry: ComponentRegistry) -> List[str]:
try: try:
# Get MCP component to access server list # Get MCP component to access server list
mcp_instance = registry.get_component_instance("mcp", Path.home() / ".claude") mcp_instance = registry.get_component_instance("mcp", get_home_directory() / ".claude")
if not mcp_instance or not hasattr(mcp_instance, 'mcp_servers'): if not mcp_instance or not hasattr(mcp_instance, 'mcp_servers'):
logger.error("Could not access MCP server information") logger.error("Could not access MCP server information")
return [] return []
@ -526,7 +539,7 @@ def run(args: argparse.Namespace) -> int:
operation.setup_operation_logging(args) operation.setup_operation_logging(args)
logger = get_logger() logger = get_logger()
# ✅ Enhanced security validation with symlink protection # ✅ Enhanced security validation with symlink protection
expected_home = Path.home().resolve() expected_home = get_home_directory().resolve()
install_dir_original = args.install_dir install_dir_original = args.install_dir
install_dir_resolved = args.install_dir.resolve() install_dir_resolved = args.install_dir.resolve()

View File

@ -6,6 +6,7 @@ Refactored from uninstall.py for unified CLI hub
import sys import sys
import time import time
from pathlib import Path from pathlib import Path
from ...utils.paths import get_home_directory
from typing import List, Optional, Dict, Any from typing import List, Optional, Dict, Any
import argparse import argparse
@ -766,7 +767,7 @@ def run(args: argparse.Namespace) -> int:
operation.setup_operation_logging(args) operation.setup_operation_logging(args)
logger = get_logger() logger = get_logger()
# ✅ Inserted validation code # ✅ Inserted validation code
expected_home = Path.home().resolve() expected_home = get_home_directory().resolve()
actual_dir = args.install_dir.resolve() actual_dir = args.install_dir.resolve()
if not str(actual_dir).startswith(str(expected_home)): if not str(actual_dir).startswith(str(expected_home)):

View File

@ -6,6 +6,7 @@ Refactored from update.py for unified CLI hub
import sys import sys
import time import time
from pathlib import Path from pathlib import Path
from ...utils.paths import get_home_directory
from typing import List, Optional, Dict, Any from typing import List, Optional, Dict, Any
import argparse import argparse
@ -384,7 +385,7 @@ def run(args: argparse.Namespace) -> int:
from setup.cli.base import __version__ from setup.cli.base import __version__
# ✅ Inserted validation code # ✅ Inserted validation code
expected_home = Path.home().resolve() expected_home = get_home_directory().resolve()
actual_dir = args.install_dir.resolve() actual_dir = args.install_dir.resolve()
if not str(actual_dir).startswith(str(expected_home)): if not str(actual_dir).startswith(str(expected_home)):

View File

@ -402,6 +402,130 @@ class MCPComponent(Component):
self.logger.warning(f"Error checking MCP server status: {e}") self.logger.warning(f"Error checking MCP server status: {e}")
return False return False
def _detect_existing_mcp_servers_from_config(self) -> List[str]:
"""Detect existing MCP servers from Claude Desktop config"""
detected_servers = []
try:
# Try to find Claude Desktop config file
config_paths = [
self.install_dir / "claude_desktop_config.json",
Path.home() / ".claude" / "claude_desktop_config.json",
Path.home() / ".claude.json", # Claude CLI config
Path.home() / "AppData" / "Roaming" / "Claude" / "claude_desktop_config.json", # Windows
Path.home() / "Library" / "Application Support" / "Claude" / "claude_desktop_config.json", # macOS
]
config_file = None
for path in config_paths:
if path.exists():
config_file = path
break
if not config_file:
self.logger.debug("No Claude Desktop config file found")
return detected_servers
import json
with open(config_file, 'r') as f:
config = json.load(f)
# Extract MCP server names from mcpServers section
mcp_servers = config.get("mcpServers", {})
for server_name in mcp_servers.keys():
# Map common name variations to our standard names
normalized_name = self._normalize_server_name(server_name)
if normalized_name and normalized_name in self.mcp_servers:
detected_servers.append(normalized_name)
if detected_servers:
self.logger.info(f"Detected existing MCP servers from config: {detected_servers}")
except Exception as e:
self.logger.warning(f"Could not read Claude Desktop config: {e}")
return detected_servers
def _detect_existing_mcp_servers_from_cli(self) -> List[str]:
"""Detect existing MCP servers from Claude CLI"""
detected_servers = []
try:
result = self._run_command_cross_platform(
["claude", "mcp", "list"],
capture_output=True,
text=True,
timeout=60
)
if result.returncode != 0:
self.logger.debug(f"Could not list MCP servers: {result.stderr}")
return detected_servers
# Parse the output to extract server names
output_lines = result.stdout.strip().split('\n')
for line in output_lines:
line = line.strip().lower()
if line and not line.startswith('#') and not line.startswith('no'):
# Extract server name (usually the first word or before first space/colon)
server_name = line.split()[0] if line.split() else ""
normalized_name = self._normalize_server_name(server_name)
if normalized_name and normalized_name in self.mcp_servers:
detected_servers.append(normalized_name)
if detected_servers:
self.logger.info(f"Detected existing MCP servers from CLI: {detected_servers}")
except Exception as e:
self.logger.warning(f"Could not detect existing MCP servers from CLI: {e}")
return detected_servers
def _normalize_server_name(self, server_name: str) -> Optional[str]:
"""Normalize server name to match our internal naming"""
if not server_name:
return None
server_name = server_name.lower().strip()
# Map common variations to our standard names
name_mappings = {
"context7": "context7",
"sequential-thinking": "sequential-thinking",
"sequential": "sequential-thinking",
"magic": "magic",
"playwright": "playwright",
"serena": "serena",
"morphllm": "morphllm-fast-apply",
"morphllm-fast-apply": "morphllm-fast-apply",
"morph": "morphllm-fast-apply"
}
return name_mappings.get(server_name)
def _merge_server_lists(self, existing_servers: List[str], selected_servers: List[str], previous_servers: List[str]) -> List[str]:
"""Merge existing, selected, and previously installed servers"""
all_servers = set()
# Add all detected servers
all_servers.update(existing_servers)
all_servers.update(selected_servers)
all_servers.update(previous_servers)
# Filter to only include servers we know how to install
valid_servers = [s for s in all_servers if s in self.mcp_servers]
if valid_servers:
self.logger.info(f"Total servers to manage: {valid_servers}")
if existing_servers:
self.logger.info(f" - Existing: {existing_servers}")
if selected_servers:
self.logger.info(f" - Newly selected: {selected_servers}")
if previous_servers:
self.logger.info(f" - Previously installed: {previous_servers}")
return valid_servers
def _install_mcp_server(self, server_info: Dict[str, Any], config: Dict[str, Any]) -> bool: def _install_mcp_server(self, server_info: Dict[str, Any], config: Dict[str, Any]) -> bool:
"""Install a single MCP server""" """Install a single MCP server"""
if server_info.get("install_method") == "uv": if server_info.get("install_method") == "uv":
@ -506,7 +630,7 @@ class MCPComponent(Component):
return False return False
def _install(self, config: Dict[str, Any]) -> bool: def _install(self, config: Dict[str, Any]) -> bool:
"""Install MCP component""" """Install MCP component with auto-detection of existing servers"""
self.logger.info("Installing SuperClaude MCP servers...") self.logger.info("Installing SuperClaude MCP servers...")
# Validate prerequisites # Validate prerequisites
@ -516,26 +640,47 @@ class MCPComponent(Component):
self.logger.error(error) self.logger.error(error)
return False return False
# Auto-detect existing servers
self.logger.info("Auto-detecting existing MCP servers...")
existing_from_config = self._detect_existing_mcp_servers_from_config()
existing_from_cli = self._detect_existing_mcp_servers_from_cli()
existing_servers = list(set(existing_from_config + existing_from_cli))
# Get selected servers from config # Get selected servers from config
selected_servers = config.get("selected_mcp_servers", []) selected_servers = config.get("selected_mcp_servers", [])
if not selected_servers: # Get previously installed servers from metadata
self.logger.info("No MCP servers selected for installation.") previous_servers = self.settings_manager.get_metadata_setting("mcp.servers", [])
# Merge all server lists
all_servers = self._merge_server_lists(existing_servers, selected_servers, previous_servers)
if not all_servers:
self.logger.info("No MCP servers detected or selected. Skipping MCP installation.")
# Still run post-install to update metadata
return self._post_install() return self._post_install()
self.logger.info(f"Installing selected MCP servers: {', '.join(selected_servers)}") self.logger.info(f"Managing MCP servers: {', '.join(all_servers)}")
# Install each selected MCP server # Install/verify each server
installed_count = 0 installed_count = 0
failed_servers = [] failed_servers = []
self.installed_servers_in_session = [] verified_servers = []
for server_name in selected_servers: for server_name in all_servers:
if server_name in self.mcp_servers: if server_name in self.mcp_servers:
server_info = self.mcp_servers[server_name] server_info = self.mcp_servers[server_name]
# Check if already installed and working
if self._check_mcp_server_installed(server_name):
self.logger.info(f"MCP server {server_name} already installed and working")
installed_count += 1
verified_servers.append(server_name)
else:
# Try to install
if self._install_mcp_server(server_info, config): if self._install_mcp_server(server_info, config):
installed_count += 1 installed_count += 1
self.installed_servers_in_session.append(server_name) verified_servers.append(server_name)
else: else:
failed_servers.append(server_name) failed_servers.append(server_name)
@ -544,7 +689,10 @@ class MCPComponent(Component):
self.logger.error(f"Required MCP server {server_name} failed to install") self.logger.error(f"Required MCP server {server_name} failed to install")
return False return False
else: else:
self.logger.warning(f"Unknown MCP server '{server_name}' selected for installation.") self.logger.warning(f"Unknown MCP server '{server_name}' cannot be managed by SuperClaude")
# Update the list of successfully managed servers
self.installed_servers_in_session = verified_servers
# Verify installation # Verify installation
if not config.get("dry_run", False): if not config.get("dry_run", False):
@ -570,9 +718,9 @@ class MCPComponent(Component):
if failed_servers: if failed_servers:
self.logger.warning(f"Some MCP servers failed to install: {failed_servers}") self.logger.warning(f"Some MCP servers failed to install: {failed_servers}")
self.logger.success(f"MCP component partially installed ({installed_count} servers)") self.logger.success(f"MCP component partially managed ({installed_count} servers)")
else: else:
self.logger.success(f"MCP component installed successfully ({installed_count} servers)") self.logger.success(f"MCP component successfully managing ({installed_count} servers)")
return self._post_install() return self._post_install()
@ -587,7 +735,8 @@ class MCPComponent(Component):
self.settings_manager.add_component_registration("mcp", { self.settings_manager.add_component_registration("mcp", {
"version": __version__, "version": __version__,
"category": "integration", "category": "integration",
"servers_count": len(self.mcp_servers) "servers_count": len(self.installed_servers_in_session),
"installed_servers": self.installed_servers_in_session
}) })
self.logger.info("Updated metadata with MCP component registration") self.logger.info("Updated metadata with MCP component registration")

View File

@ -23,10 +23,12 @@ class MCPDocsComponent(Component):
self.server_docs_map = { self.server_docs_map = {
"context7": "MCP_Context7.md", "context7": "MCP_Context7.md",
"sequential": "MCP_Sequential.md", "sequential": "MCP_Sequential.md",
"sequential-thinking": "MCP_Sequential.md", # Handle both naming conventions
"magic": "MCP_Magic.md", "magic": "MCP_Magic.md",
"playwright": "MCP_Playwright.md", "playwright": "MCP_Playwright.md",
"serena": "MCP_Serena.md", "serena": "MCP_Serena.md",
"morphllm": "MCP_Morphllm.md" "morphllm": "MCP_Morphllm.md",
"morphllm-fast-apply": "MCP_Morphllm.md" # Handle both naming conventions
} }
super().__init__(install_dir, Path("")) super().__init__(install_dir, Path(""))
@ -40,6 +42,13 @@ class MCPDocsComponent(Component):
"category": "documentation" "category": "documentation"
} }
def is_reinstallable(self) -> bool:
"""
Allow mcp_docs to be reinstalled to handle different server selections.
This enables users to add or change MCP server documentation.
"""
return True
def set_selected_servers(self, selected_servers: List[str]) -> None: def set_selected_servers(self, selected_servers: List[str]) -> None:
"""Set which MCP servers were selected for documentation installation""" """Set which MCP servers were selected for documentation installation"""
self.selected_servers = selected_servers self.selected_servers = selected_servers
@ -81,19 +90,111 @@ class MCPDocsComponent(Component):
files.append(self.server_docs_map[server_name]) files.append(self.server_docs_map[server_name])
return files return files
def _detect_existing_mcp_servers_from_config(self) -> List[str]:
"""Detect existing MCP servers from Claude Desktop config"""
detected_servers = []
try:
# Try to find Claude Desktop config file
config_paths = [
self.install_dir / "claude_desktop_config.json",
Path.home() / ".claude" / "claude_desktop_config.json",
Path.home() / ".claude.json", # Claude CLI config
Path.home() / "AppData" / "Roaming" / "Claude" / "claude_desktop_config.json", # Windows
Path.home() / "Library" / "Application Support" / "Claude" / "claude_desktop_config.json", # macOS
]
config_file = None
for path in config_paths:
if path.exists():
config_file = path
break
if not config_file:
self.logger.debug("No Claude Desktop config file found")
return detected_servers
import json
with open(config_file, 'r') as f:
config = json.load(f)
# Extract MCP server names from mcpServers section
mcp_servers = config.get("mcpServers", {})
for server_name in mcp_servers.keys():
# Map common name variations to our doc file names
normalized_name = self._normalize_server_name(server_name)
if normalized_name and normalized_name in self.server_docs_map:
detected_servers.append(normalized_name)
if detected_servers:
self.logger.info(f"Detected existing MCP servers from config: {detected_servers}")
except Exception as e:
self.logger.warning(f"Could not read Claude Desktop config: {e}")
return detected_servers
def _normalize_server_name(self, server_name: str) -> Optional[str]:
"""Normalize server name to match our documentation mapping"""
if not server_name:
return None
server_name = server_name.lower().strip()
# Map common variations to our server_docs_map keys
name_mappings = {
"context7": "context7",
"sequential-thinking": "sequential-thinking",
"sequential": "sequential-thinking",
"magic": "magic",
"playwright": "playwright",
"serena": "serena",
"morphllm": "morphllm",
"morphllm-fast-apply": "morphllm",
"morph": "morphllm"
}
return name_mappings.get(server_name)
def _install(self, config: Dict[str, Any]) -> bool: def _install(self, config: Dict[str, Any]) -> bool:
"""Install MCP documentation component""" """Install MCP documentation component with auto-detection"""
self.logger.info("Installing MCP server documentation...") self.logger.info("Installing MCP server documentation...")
# Auto-detect existing servers
self.logger.info("Auto-detecting existing MCP servers for documentation...")
detected_servers = self._detect_existing_mcp_servers_from_config()
# Get selected servers from config # Get selected servers from config
selected_servers = config.get("selected_mcp_servers", []) selected_servers = config.get("selected_mcp_servers", [])
self.set_selected_servers(selected_servers)
self.component_files = self._discover_component_files()
if not selected_servers: # Get previously documented servers from metadata
self.logger.info("No MCP servers selected - skipping documentation installation") previous_servers = self.settings_manager.get_metadata_setting("components.mcp_docs.servers_documented", [])
# Merge all server lists
all_servers = list(set(detected_servers + selected_servers + previous_servers))
# Filter to only servers we have documentation for
valid_servers = [s for s in all_servers if s in self.server_docs_map]
if not valid_servers:
self.logger.info("No MCP servers detected or selected for documentation installation")
# Still proceed to update metadata
self.set_selected_servers([])
self.component_files = []
return self._post_install() return self._post_install()
self.logger.info(f"Installing documentation for MCP servers: {', '.join(valid_servers)}")
if detected_servers:
self.logger.info(f" - Detected from config: {detected_servers}")
if selected_servers:
self.logger.info(f" - Newly selected: {selected_servers}")
if previous_servers:
self.logger.info(f" - Previously documented: {previous_servers}")
# Set the servers for which we'll install documentation
self.set_selected_servers(valid_servers)
self.component_files = self._discover_component_files()
# Validate installation # Validate installation
success, errors = self.validate_prerequisites() success, errors = self.validate_prerequisites()
if not success: if not success:
@ -106,15 +207,18 @@ class MCPDocsComponent(Component):
if not files_to_install: if not files_to_install:
self.logger.warning("No MCP documentation files found to install") self.logger.warning("No MCP documentation files found to install")
return self._post_install() return False
# Copy documentation files # Copy documentation files
success_count = 0 success_count = 0
successfully_copied_files = []
for source, target in files_to_install: for source, target in files_to_install:
self.logger.debug(f"Copying {source.name} to {target}") self.logger.debug(f"Copying {source.name} to {target}")
if self.file_manager.copy_file(source, target): if self.file_manager.copy_file(source, target):
success_count += 1 success_count += 1
successfully_copied_files.append(source.name)
self.logger.debug(f"Successfully copied {source.name}") self.logger.debug(f"Successfully copied {source.name}")
else: else:
self.logger.error(f"Failed to copy {source.name}") self.logger.error(f"Failed to copy {source.name}")
@ -123,7 +227,9 @@ class MCPDocsComponent(Component):
self.logger.error(f"Only {success_count}/{len(files_to_install)} documentation files copied successfully") self.logger.error(f"Only {success_count}/{len(files_to_install)} documentation files copied successfully")
return False return False
self.logger.success(f"MCP documentation installed successfully ({success_count} files for {len(selected_servers)} servers)") # Update component_files to only include successfully copied files
self.component_files = successfully_copied_files
self.logger.success(f"MCP documentation installed successfully ({success_count} files for {len(valid_servers)} servers)")
return self._post_install() return self._post_install()

View File

@ -8,6 +8,7 @@ import shutil
from typing import Tuple, List, Dict, Any, Optional from typing import Tuple, List, Dict, Any, Optional
from pathlib import Path from pathlib import Path
import re import re
from ..utils.paths import get_home_directory
# Handle packaging import - if not available, use a simple version comparison # Handle packaging import - if not available, use a simple version comparison
try: try:
@ -407,7 +408,7 @@ class Validator:
# Check disk space # Check disk space
if "disk_space_mb" in requirements: if "disk_space_mb" in requirements:
success, message = self.check_disk_space( success, message = self.check_disk_space(
Path.home(), get_home_directory(),
requirements["disk_space_mb"] requirements["disk_space_mb"]
) )
if not success: if not success:
@ -504,7 +505,7 @@ class Validator:
# Add disk space info # Add disk space info
try: try:
home_path = Path.home() home_path = get_home_directory()
stat_result = shutil.disk_usage(home_path) stat_result = shutil.disk_usage(home_path)
info["disk_space"] = { info["disk_space"] = {
"total_gb": stat_result.total / (1024**3), "total_gb": stat_result.total / (1024**3),
@ -620,7 +621,7 @@ class Validator:
diagnostics["recommendations"].append(self.get_installation_help("claude_cli")) diagnostics["recommendations"].append(self.get_installation_help("claude_cli"))
# Check disk space # Check disk space
disk_success, disk_msg = self.check_disk_space(Path.home()) disk_success, disk_msg = self.check_disk_space(get_home_directory())
diagnostics["checks"]["disk_space"] = { diagnostics["checks"]["disk_space"] = {
"status": "pass" if disk_success else "fail", "status": "pass" if disk_success else "fail",
"message": disk_msg "message": disk_msg

View File

@ -2,7 +2,7 @@
"components": { "components": {
"core": { "core": {
"name": "core", "name": "core",
"version": "4.1.3", "version": "4.1.4",
"description": "SuperClaude framework documentation and core files", "description": "SuperClaude framework documentation and core files",
"category": "core", "category": "core",
"dependencies": [], "dependencies": [],
@ -11,7 +11,7 @@
}, },
"commands": { "commands": {
"name": "commands", "name": "commands",
"version": "4.1.3", "version": "4.1.4",
"description": "SuperClaude slash command definitions", "description": "SuperClaude slash command definitions",
"category": "commands", "category": "commands",
"dependencies": ["core"], "dependencies": ["core"],
@ -20,7 +20,7 @@
}, },
"mcp": { "mcp": {
"name": "mcp", "name": "mcp",
"version": "4.1.3", "version": "4.1.4",
"description": "MCP server configuration management via .claude.json", "description": "MCP server configuration management via .claude.json",
"category": "integration", "category": "integration",
"dependencies": ["core"], "dependencies": ["core"],
@ -29,7 +29,7 @@
}, },
"modes": { "modes": {
"name": "modes", "name": "modes",
"version": "4.1.3", "version": "4.1.4",
"description": "SuperClaude behavioral modes (Brainstorming, Introspection, Task Management, Token Efficiency)", "description": "SuperClaude behavioral modes (Brainstorming, Introspection, Task Management, Token Efficiency)",
"category": "modes", "category": "modes",
"dependencies": ["core"], "dependencies": ["core"],
@ -38,7 +38,7 @@
}, },
"mcp_docs": { "mcp_docs": {
"name": "mcp_docs", "name": "mcp_docs",
"version": "4.1.3", "version": "4.1.4",
"description": "MCP server documentation and usage guides", "description": "MCP server documentation and usage guides",
"category": "documentation", "category": "documentation",
"dependencies": ["core"], "dependencies": ["core"],
@ -47,7 +47,7 @@
}, },
"agents": { "agents": {
"name": "agents", "name": "agents",
"version": "4.1.3", "version": "4.1.4",
"description": "14 specialized AI agents with domain expertise and intelligent routing", "description": "14 specialized AI agents with domain expertise and intelligent routing",
"category": "agents", "category": "agents",
"dependencies": ["core"], "dependencies": ["core"],

View File

@ -12,12 +12,13 @@ from typing import Dict, Optional
from datetime import datetime from datetime import datetime
from .ui import display_info, display_success, display_warning, Colors from .ui import display_info, display_success, display_warning, Colors
from .logger import get_logger from .logger import get_logger
from .paths import get_home_directory
def _get_env_tracking_file() -> Path: def _get_env_tracking_file() -> Path:
"""Get path to environment variable tracking file""" """Get path to environment variable tracking file"""
from .. import DEFAULT_INSTALL_DIR from .. import DEFAULT_INSTALL_DIR
install_dir = Path.home() / ".claude" install_dir = get_home_directory() / ".claude"
install_dir.mkdir(exist_ok=True) install_dir.mkdir(exist_ok=True)
return install_dir / "superclaude_env_vars.json" return install_dir / "superclaude_env_vars.json"
@ -90,7 +91,7 @@ def detect_shell_config() -> Optional[Path]:
Returns: Returns:
Path to the shell configuration file, or None if not found Path to the shell configuration file, or None if not found
""" """
home = Path.home() home = get_home_directory()
# Check in order of preference # Check in order of preference
configs = [ configs = [
@ -340,7 +341,7 @@ def cleanup_environment_variables(env_vars_to_remove: Dict[str, str], create_res
def _create_restore_script(env_vars: Dict[str, str]) -> Optional[Path]: def _create_restore_script(env_vars: Dict[str, str]) -> Optional[Path]:
"""Create a script to restore environment variables""" """Create a script to restore environment variables"""
try: try:
home = Path.home() home = get_home_directory()
if os.name == 'nt': # Windows if os.name == 'nt': # Windows
script_path = home / "restore_superclaude_env.bat" script_path = home / "restore_superclaude_env.bat"
with open(script_path, 'w') as f: with open(script_path, 'w') as f:
@ -423,7 +424,7 @@ def create_env_file(api_keys: Dict[str, str], env_file_path: Optional[Path] = No
True if .env file was created successfully, False otherwise True if .env file was created successfully, False otherwise
""" """
if env_file_path is None: if env_file_path is None:
env_file_path = Path.home() / ".env" env_file_path = get_home_directory() / ".env"
logger = get_logger() logger = get_logger()

View File

@ -11,6 +11,7 @@ from enum import Enum
from .ui import Colors from .ui import Colors
from .symbols import symbols from .symbols import symbols
from .paths import get_home_directory
class LogLevel(Enum): class LogLevel(Enum):
@ -36,7 +37,7 @@ class Logger:
file_level: Minimum level for file output file_level: Minimum level for file output
""" """
self.name = name self.name = name
self.log_dir = log_dir or (Path.home() / ".claude" / "logs") self.log_dir = log_dir or (get_home_directory() / ".claude" / "logs")
self.console_level = console_level self.console_level = console_level
self.file_level = file_level self.file_level = file_level
self.session_start = datetime.now() self.session_start = datetime.now()

54
setup/utils/paths.py Normal file
View File

@ -0,0 +1,54 @@
"""
Path utilities for SuperClaude installation system
Handles cross-platform path operations and immutable distro support
"""
import os
from pathlib import Path
def get_home_directory() -> Path:
"""
Get the correct home directory path, handling immutable distros.
On immutable distros like Fedora Silverblue/Universal Blue,
the home directory is at /var/home/$USER instead of /home/$USER.
This function properly detects the actual home directory.
Returns:
Path: The actual home directory path
"""
# First try the standard method
try:
home = Path.home()
# Verify the path actually exists and is accessible
if home.exists() and home.is_dir():
return home
except Exception:
pass
# Fallback methods for edge cases and immutable distros
# Method 1: Use $HOME environment variable
home_env = os.environ.get('HOME')
if home_env:
home_path = Path(home_env)
if home_path.exists() and home_path.is_dir():
return home_path
# Method 2: Check for immutable distro patterns
username = os.environ.get('USER') or os.environ.get('USERNAME')
if username:
# Check common immutable distro paths
immutable_paths = [
Path(f'/var/home/{username}'), # Fedora Silverblue/Universal Blue
Path(f'/home/{username}'), # Standard Linux
]
for path in immutable_paths:
if path.exists() and path.is_dir():
return path
# Method 3: Last resort - use the original Path.home() even if it seems wrong
# This ensures we don't crash the installation
return Path.home()

View File

@ -32,6 +32,7 @@ import os
from pathlib import Path from pathlib import Path
from typing import List, Optional, Tuple, Set from typing import List, Optional, Tuple, Set
import urllib.parse import urllib.parse
from .paths import get_home_directory
class SecurityValidator: class SecurityValidator:
@ -410,7 +411,7 @@ class SecurityValidator:
if is_claude_dir: if is_claude_dir:
try: try:
home_path = Path.home() home_path = get_home_directory()
except (RuntimeError, OSError): except (RuntimeError, OSError):
# If we can't determine home directory, skip .claude special handling # If we can't determine home directory, skip .claude special handling
cls._log_security_decision("WARN", f"Cannot determine home directory for .claude validation: {abs_target}") cls._log_security_decision("WARN", f"Cannot determine home directory for .claude validation: {abs_target}")
@ -432,7 +433,7 @@ class SecurityValidator:
if ':' in abs_target_str and '\\users\\' in abs_target_str: if ':' in abs_target_str and '\\users\\' in abs_target_str:
try: try:
# Check if target is within the user's actual home directory # Check if target is within the user's actual home directory
home_path = Path.home() home_path = get_home_directory()
abs_target.relative_to(home_path) abs_target.relative_to(home_path)
# Path is valid - within user's home directory # Path is valid - within user's home directory
except ValueError: except ValueError:

View File

@ -17,13 +17,14 @@ from datetime import datetime, timedelta
from .ui import display_info, display_warning, display_success, Colors from .ui import display_info, display_warning, display_success, Colors
from .logger import get_logger from .logger import get_logger
from .paths import get_home_directory
class UpdateChecker: class UpdateChecker:
"""Handles automatic update checking for SuperClaude""" """Handles automatic update checking for SuperClaude"""
PYPI_URL = "https://pypi.org/pypi/SuperClaude/json" PYPI_URL = "https://pypi.org/pypi/SuperClaude/json"
CACHE_FILE = Path.home() / ".claude" / ".update_check" CACHE_FILE = get_home_directory() / ".claude" / ".update_check"
CHECK_INTERVAL = 86400 # 24 hours in seconds CHECK_INTERVAL = 86400 # 24 hours in seconds
TIMEOUT = 2 # seconds TIMEOUT = 2 # seconds
@ -162,7 +163,7 @@ class UpdateChecker:
) )
if result.returncode == 0: if result.returncode == 0:
# Check if it's a user installation # Check if it's a user installation
if '--user' in result.stdout or Path.home() in Path(result.stdout): if '--user' in result.stdout or get_home_directory() in Path(result.stdout):
return 'pip-user' return 'pip-user'
return 'pip' return 'pip'
except: except: