mirror of
https://github.com/SuperClaude-Org/SuperClaude_Framework.git
synced 2025-12-29 16:16:08 +00:00
docs: comprehensive documentation update and command system enhancement
- Update all command documentation with improved clarity and examples - Enhance user guides with simplified activation patterns - Improve installation and setup documentation - Refine command system implementation in setup components - Update changelog with recent improvements 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -71,7 +71,7 @@ class CommandsComponent(Component):
|
||||
errors.append(f"Missing command files: {missing_files}")
|
||||
|
||||
# Check write permissions to install directory
|
||||
commands_dir = self.install_dir / "commands"
|
||||
commands_dir = self.install_dir / "commands" / "sc"
|
||||
has_perms, missing = SecurityValidator.check_permissions(
|
||||
self.install_dir, {'write'}
|
||||
)
|
||||
@@ -92,7 +92,7 @@ class CommandsComponent(Component):
|
||||
|
||||
for filename in self.command_files:
|
||||
source = source_dir / filename
|
||||
target = self.install_dir / "commands" / filename
|
||||
target = self.install_dir / "commands" / "sc" / filename
|
||||
files.append((source, target))
|
||||
|
||||
return files
|
||||
@@ -119,6 +119,9 @@ class CommandsComponent(Component):
|
||||
try:
|
||||
self.logger.info("Installing SuperClaude command definitions...")
|
||||
|
||||
# Check for and migrate existing commands from old location
|
||||
self._migrate_existing_commands()
|
||||
|
||||
# Validate installation
|
||||
success, errors = self.validate_prerequisites()
|
||||
if not success:
|
||||
@@ -131,7 +134,7 @@ class CommandsComponent(Component):
|
||||
|
||||
# Validate all files for security
|
||||
source_dir = self._get_source_dir()
|
||||
commands_dir = self.install_dir / "commands"
|
||||
commands_dir = self.install_dir / "commands" / "sc"
|
||||
is_safe, security_errors = SecurityValidator.validate_component_files(
|
||||
files_to_install, source_dir, commands_dir
|
||||
)
|
||||
@@ -185,8 +188,8 @@ class CommandsComponent(Component):
|
||||
try:
|
||||
self.logger.info("Uninstalling SuperClaude commands component...")
|
||||
|
||||
# Remove command files
|
||||
commands_dir = self.install_dir / "commands"
|
||||
# Remove command files from sc subdirectory
|
||||
commands_dir = self.install_dir / "commands" / "sc"
|
||||
removed_count = 0
|
||||
|
||||
for filename in self.command_files:
|
||||
@@ -197,13 +200,39 @@ class CommandsComponent(Component):
|
||||
else:
|
||||
self.logger.warning(f"Could not remove {filename}")
|
||||
|
||||
# Remove commands directory if empty
|
||||
# Also check and remove any old commands in root commands directory
|
||||
old_commands_dir = self.install_dir / "commands"
|
||||
old_removed_count = 0
|
||||
|
||||
for filename in self.command_files:
|
||||
old_file_path = old_commands_dir / filename
|
||||
if old_file_path.exists() and old_file_path.is_file():
|
||||
if self.file_manager.remove_file(old_file_path):
|
||||
old_removed_count += 1
|
||||
self.logger.debug(f"Removed old {filename}")
|
||||
else:
|
||||
self.logger.warning(f"Could not remove old {filename}")
|
||||
|
||||
if old_removed_count > 0:
|
||||
self.logger.info(f"Also removed {old_removed_count} commands from old location")
|
||||
|
||||
removed_count += old_removed_count
|
||||
|
||||
# Remove sc subdirectory if empty
|
||||
try:
|
||||
if commands_dir.exists():
|
||||
remaining_files = list(commands_dir.iterdir())
|
||||
if not remaining_files:
|
||||
commands_dir.rmdir()
|
||||
self.logger.debug("Removed empty commands directory")
|
||||
self.logger.debug("Removed empty sc commands directory")
|
||||
|
||||
# Also remove parent commands directory if empty
|
||||
parent_commands_dir = self.install_dir / "commands"
|
||||
if parent_commands_dir.exists():
|
||||
remaining_files = list(parent_commands_dir.iterdir())
|
||||
if not remaining_files:
|
||||
parent_commands_dir.rmdir()
|
||||
self.logger.debug("Removed empty parent commands directory")
|
||||
except Exception as e:
|
||||
self.logger.warning(f"Could not remove commands directory: {e}")
|
||||
|
||||
@@ -242,7 +271,7 @@ class CommandsComponent(Component):
|
||||
self.logger.info(f"Updating commands component from {current_version} to {target_version}")
|
||||
|
||||
# Create backup of existing command files
|
||||
commands_dir = self.install_dir / "commands"
|
||||
commands_dir = self.install_dir / "commands" / "sc"
|
||||
backup_files = []
|
||||
|
||||
if commands_dir.exists():
|
||||
@@ -287,10 +316,10 @@ class CommandsComponent(Component):
|
||||
"""Validate commands component installation"""
|
||||
errors = []
|
||||
|
||||
# Check if commands directory exists
|
||||
commands_dir = self.install_dir / "commands"
|
||||
# Check if sc commands directory exists
|
||||
commands_dir = self.install_dir / "commands" / "sc"
|
||||
if not commands_dir.exists():
|
||||
errors.append("Commands directory not found")
|
||||
errors.append("SC commands directory not found")
|
||||
return False, errors
|
||||
|
||||
# Check if all command files exist
|
||||
@@ -343,6 +372,67 @@ class CommandsComponent(Component):
|
||||
"files_installed": len(self.command_files),
|
||||
"command_files": self.command_files,
|
||||
"estimated_size": self.get_size_estimate(),
|
||||
"install_directory": str(self.install_dir / "commands"),
|
||||
"install_directory": str(self.install_dir / "commands" / "sc"),
|
||||
"dependencies": self.get_dependencies()
|
||||
}
|
||||
}
|
||||
|
||||
def _migrate_existing_commands(self) -> None:
|
||||
"""Migrate existing commands from old location to new sc subdirectory"""
|
||||
try:
|
||||
old_commands_dir = self.install_dir / "commands"
|
||||
new_commands_dir = self.install_dir / "commands" / "sc"
|
||||
|
||||
# Check if old commands exist in root commands directory
|
||||
migrated_count = 0
|
||||
commands_to_migrate = []
|
||||
|
||||
if old_commands_dir.exists():
|
||||
for filename in self.command_files:
|
||||
old_file_path = old_commands_dir / filename
|
||||
if old_file_path.exists() and old_file_path.is_file():
|
||||
commands_to_migrate.append(filename)
|
||||
|
||||
if commands_to_migrate:
|
||||
self.logger.info(f"Found {len(commands_to_migrate)} existing commands to migrate to sc/ subdirectory")
|
||||
|
||||
# Ensure new directory exists
|
||||
if not self.file_manager.ensure_directory(new_commands_dir):
|
||||
self.logger.error(f"Could not create sc commands directory: {new_commands_dir}")
|
||||
return
|
||||
|
||||
# Move files from old to new location
|
||||
for filename in commands_to_migrate:
|
||||
old_file_path = old_commands_dir / filename
|
||||
new_file_path = new_commands_dir / filename
|
||||
|
||||
try:
|
||||
# Copy file to new location
|
||||
if self.file_manager.copy_file(old_file_path, new_file_path):
|
||||
# Remove old file
|
||||
if self.file_manager.remove_file(old_file_path):
|
||||
migrated_count += 1
|
||||
self.logger.debug(f"Migrated {filename} to sc/ subdirectory")
|
||||
else:
|
||||
self.logger.warning(f"Could not remove old {filename}")
|
||||
else:
|
||||
self.logger.warning(f"Could not copy {filename} to sc/ subdirectory")
|
||||
except Exception as e:
|
||||
self.logger.warning(f"Error migrating {filename}: {e}")
|
||||
|
||||
if migrated_count > 0:
|
||||
self.logger.success(f"Successfully migrated {migrated_count} commands to /sc: namespace")
|
||||
self.logger.info("Commands are now available as /sc:analyze, /sc:build, etc.")
|
||||
|
||||
# Try to remove old commands directory if empty
|
||||
try:
|
||||
if old_commands_dir.exists():
|
||||
remaining_files = [f for f in old_commands_dir.iterdir() if f.is_file()]
|
||||
if not remaining_files:
|
||||
# Only remove if no user files remain
|
||||
old_commands_dir.rmdir()
|
||||
self.logger.debug("Removed empty old commands directory")
|
||||
except Exception as e:
|
||||
self.logger.debug(f"Could not remove old commands directory: {e}")
|
||||
|
||||
except Exception as e:
|
||||
self.logger.warning(f"Error during command migration: {e}")
|
||||
Reference in New Issue
Block a user