diff --git a/.claude/commands/index.md b/.claude/commands/index.md index 8572e91..b8fdc2a 100644 --- a/.claude/commands/index.md +++ b/.claude/commands/index.md @@ -3,12 +3,12 @@ @include shared/universal-constants.yml#Universal_Legend ## Ultra-Compressed Reference -Commands: `/cmd --flags` | 18 total | Universal flags available +Commands: `/cmd --flags` | 19 total | Universal flags available @include shared/flag-inheritance.yml#Universal_Always ## Command Categories -**Analysis**: `/analyze` `/scan` `/explain` +**Analysis**: `/analyze` `/scan` `/explain` `/review` **Build**: `/build` `/deploy` `/migrate` **Manage**: `/task` `/load` `/cleanup` **Dev**: `/test` `/troubleshoot` `/improve` @@ -16,7 +16,7 @@ Commands: `/cmd --flags` | 18 total | Universal flags available ## Commands w/ Primary Flags **Dev**: `/build` --init|feature|react | `/dev-setup` --install|ci | `/test` --coverage|e2e -**Analysis**: `/analyze` --code|arch | `/troubleshoot` --fix|prod | `/improve` --perf|quality | `/explain` --depth +**Analysis**: `/analyze` --code|arch | `/review` --files|commit|pr | `/troubleshoot` --fix|prod | `/improve` --perf|quality | `/explain` --depth **Ops**: `/deploy` --env|rollback | `/migrate` --dry-run | `/scan` --security | `/estimate` --detailed | `/cleanup` --all | `/git` --commit|sync **Design**: `/design` --api|ddd | `/document` --api|user | `/spawn` --task **Manage**: `/task` --create|status | `/load` --context @@ -24,7 +24,7 @@ Commands: `/cmd --flags` | 18 total | Universal flags available **Setup**: `/load` → `/dev-setup --install` → `/build --init` → `/test` **Feature**: `/analyze` → `/design --api` → `/build --tdd` → `/test --e2e` → `/deploy` **Debug**: `/troubleshoot --fix` → `/test` → `/git --commit` -**Quality**: `/analyze --code --think` → `/improve --quality` → `/scan --validate` +**Quality**: `/review --quality --evidence` → `/improve --quality` → `/scan --validate` **Security**: `/scan --security --owasp` → `/improve` → `/scan --validate` ### Advanced Flag Combinations diff --git a/.claude/commands/review.md b/.claude/commands/review.md new file mode 100644 index 0000000..708bfd8 --- /dev/null +++ b/.claude/commands/review.md @@ -0,0 +1,75 @@ +**Purpose**: AI-powered code review and quality analysis + +--- + +@include shared/universal-constants.yml#Universal_Legend + +## Command Execution +Execute: immediate. --plan→show plan first +Legend: Generated based on symbols used in command +Purpose: "[Action][Subject] in $ARGUMENTS" + +Perform comprehensive code review and quality analysis on files, commits, or pull requests specified in $ARGUMENTS. + +@include shared/flag-inheritance.yml#Universal_Always + +Examples: +- `/review --files src/auth.ts --persona-security` - Security-focused file review +- `/review --commit HEAD --quality --evidence` - Quality review with sources +- `/review --pr 123 --all --interactive` - Comprehensive PR review +- `/review --files src/ --persona-performance --think` - Performance analysis + +## Command-Specific Flags +--files: "Review specific files or directories" +--commit: "Review changes in specified commit (HEAD, hash, range)" +--pr: "Review pull request changes (git diff main..branch)" +--quality: "Focus on code quality issues (DRY, SOLID, complexity)" +--evidence: "Include sources and documentation for all suggestions" +--fix: "Suggest specific fixes for identified issues" +--summary: "Generate executive summary of review findings" + +@include shared/quality-patterns.yml#Code_Quality_Metrics + +@include shared/security-patterns.yml#OWASP_Top_10 + +@include shared/compression-performance-patterns.yml#Performance_Baselines + +@include shared/architecture-patterns.yml#DDD_Building_Blocks + +## Review Process & Methodology + +**1. Context Analysis:** Understanding codebase patterns | Identifying architectural style | Recognizing team conventions | Establishing review scope + +**2. Multi-Dimensional Scan:** Quality assessment across all dimensions | Persona-specific deep dives | Cross-reference analysis | Dependency impact review + +**3. Evidence Collection:** Research best practices via Context7 | Cite authoritative sources | Reference documentation | Provide measurable metrics + +**4. Prioritized Findings:** Critical issues first | Security vulnerabilities highlighted | Performance bottlenecks identified | Quality improvements suggested + +**5. Actionable Recommendations:** Specific fix suggestions | Alternative approaches | Refactoring opportunities | Prevention strategies + +**Evidence-Based Analysis:** All suggestions must cite authoritative sources | Reference official docs via Context7 | Cross-reference industry standards | Performance claims require measurable evidence + +**Persona Specialization:** Security→Vulnerabilities+compliance | Performance→Bottlenecks+optimization | Architecture→Patterns+maintainability | QA→Coverage+validation + +@include shared/research-patterns.yml#Mandatory_Research_Flows + +@include shared/quality-patterns.yml#Validation_Sequence + +## Persona Integration + +**--persona-security:** Security-first analysis | Threat modeling | Vulnerability scanning | Compliance checking | Risk assessment + +**--persona-performance:** Performance optimization focus | Bottleneck identification | Resource analysis | Scalability review + +**--persona-architect:** System design evaluation | Pattern assessment | Maintainability review | Technical debt analysis + +**--persona-qa:** Testing coverage analysis | Edge case identification | Quality metrics | Validation strategies + +**--persona-refactorer:** Code improvement opportunities | Refactoring suggestions | Cleanup recommendations | Pattern application + +@include shared/execution-patterns.yml#Servers + +@include shared/docs-patterns.yml#Standard_Notifications + +@include shared/universal-constants.yml#Standard_Messages_Templates \ No newline at end of file diff --git a/.claude/commands/shared/compression-performance-patterns.yml b/.claude/commands/shared/compression-performance-patterns.yml index e5e3ac5..fd96aea 100644 --- a/.claude/commands/shared/compression-performance-patterns.yml +++ b/.claude/commands/shared/compression-performance-patterns.yml @@ -121,6 +121,12 @@ Performance_Baselines: CPU_Utilization: "Track intensive operations" Network_Usage: "MCP server communication overhead" Disk_I_O: "File operations efficiency" + + Review_Scope_Limits: + Single_File: "Files >1000 lines flagged for review scope" + Directory: "Directories >50 files require batch processing" + Repository: "Repos >10K files get incremental analysis" + Large_File_Warning: "Files >5MB may require streaming analysis" ``` ## MCP Performance Integration diff --git a/COMMANDS.md b/COMMANDS.md index d87b33b..f5853e8 100644 --- a/COMMANDS.md +++ b/COMMANDS.md @@ -15,6 +15,7 @@ **Example Commands**: ```bash +/review --files src/ --quality --evidence # Comprehensive code review with evidence /analyze --code --persona-architect # Code analysis with architect mindset /build --react --magic --tdd # Build React app with AI components /troubleshoot --prod --five-whys --seq # Production debugging with reasoning @@ -154,7 +155,27 @@ Create, run, and maintain testing strategies across the stack. /test --mutation --strict # Test quality validation ``` -### 🔍 Analysis & Improvement Commands (4) +### 🔍 Analysis & Improvement Commands (5) + +#### `/review` - AI-Powered Code Review +Comprehensive code review and quality analysis with evidence-based recommendations. + +**Command-Specific Flags:** +- `--files` - Review specific files or directories +- `--commit` - Review changes in specified commit (HEAD, hash, range) +- `--pr` - Review pull request changes (git diff main..branch) +- `--quality` - Focus on code quality issues (DRY, SOLID, complexity) +- `--evidence` - Include sources and documentation for all suggestions +- `--fix` - Suggest specific fixes for identified issues +- `--summary` - Generate executive summary of review findings + +**Examples:** +```bash +/review --files src/auth.ts --persona-security # Security-focused file review +/review --commit HEAD --quality --evidence # Quality review with sources +/review --pr 123 --all --interactive # Comprehensive PR review +/review --files src/ --persona-performance --think # Performance analysis +``` #### `/analyze` - Multi-Dimensional Analysis Comprehensive analysis of code, architecture, performance, and security. @@ -442,6 +463,14 @@ Load and analyze project context. /test --performance --load ``` +**Quality Assurance** +```bash +/review --quality --evidence --persona-qa +/improve --quality --refactor --strict +/scan --validate --quality +/test --coverage --mutation +``` + ### 💡 Best Practices 1. **Always validate risky operations** diff --git a/README.md b/README.md index 5c8c842..5b72216 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Switch between different approaches with persona flags: **v2.0.1 Update**: All 9 personas are now universal flags, available on every command for consistent access to specialized approaches. -### ⚡ **18 Commands** +### ⚡ **19 Commands** Development lifecycle coverage: **Development Commands** @@ -97,6 +97,7 @@ Development lifecycle coverage: **Analysis & Quality** ```bash +/review --quality --evidence --persona-qa # AI-powered code review /analyze --architecture --seq # System analysis /troubleshoot --prod --five-whys # Issue resolution /improve --performance --iterate # Optimization @@ -223,7 +224,8 @@ SuperClaude encourages: - `/dev-setup` - Development environment setup - `/test` - Testing framework -### Analysis & Improvement (4 Commands) +### Analysis & Improvement (5 Commands) +- `/review` - AI-powered code review with evidence-based recommendations - `/analyze` - Code and system analysis - `/troubleshoot` - Debugging and issue resolution - `/improve` - Enhancement and optimization @@ -255,7 +257,7 @@ SuperClaude v2's architecture enables extensibility: - **@include System** – Template engine for configuration **🎯 Unified Command System** -- **18 Commands** – Development lifecycle coverage +- **19 Commands** – Development lifecycle coverage - **Flag Inheritance** – Universal flags on all commands - **Persona Integration** – 9 cognitive modes as flags - **Template Validation** – Reference integrity checking @@ -370,7 +372,7 @@ Join the community: [Discussions](https://github.com/NomenAK/SuperClaude/discuss - **Maintenance**: Centralized configuration **📊 Framework Details:** -- **Commands**: 18 specialized commands +- **Commands**: 19 specialized commands - **Personas**: 9 cognitive approaches - **MCP Servers**: 4 integrations - **Methodology**: Evidence-based approach diff --git a/install.sh b/install.sh index 31723f2..d89cc7c 100755 --- a/install.sh +++ b/install.sh @@ -4,7 +4,7 @@ # Installs SuperClaude configuration framework to enhance Claude Code # Version: 2.0.0 # License: MIT -# Repository: https://github.com/nshkrdotcom/SuperClaude +# Repository: https://github.com/NomenAK/SuperClaude set -e # Exit on error set -o pipefail # Exit on pipe failure @@ -201,15 +201,9 @@ compare_versions() { fi # Split versions into arrays - local v1_parts v2_parts - IFS='.' read -ra v1_parts <<< "$version1" || { - log_error "compare_versions: Failed to parse version1: $version1" - return 1 - } - IFS='.' read -ra v2_parts <<< "$version2" || { - log_error "compare_versions: Failed to parse version2: $version2" - return 1 - } + local v1_parts=() v2_parts=() + IFS='.' read -ra v1_parts <<< "$version1" + IFS='.' read -ra v2_parts <<< "$version2" # Compare each part for i in {0..2}; do @@ -646,6 +640,7 @@ get_source_files() { -not -name "*.log" \ -not -name "*.logs" \ -not -name "settings.local.json" \ + -not -name "CLAUDE.md" \ 2>/dev/null | sed 's|^\.claude/||' | sort); then log_error "get_source_files: Failed to enumerate files in .claude directory" return 1 @@ -1090,12 +1085,10 @@ if [[ "$UNINSTALL_MODE" = true ]]; then fi # Only remove files that we know we installed - if [[ -f ".claude/$installed_file" ]] || \ - [[ "$installed_file" == "CLAUDE.md" && -f "CLAUDE.md" ]] || \ - [[ "$installed_file" == "VERSION" ]] || \ - [[ "$installed_file" == ".checksums" ]] || \ - [[ "$installed_file" =~ ^commands/ ]] || \ - [[ "$installed_file" =~ ^shared/ ]]; then + if [[ -f "$current_dir/.claude/$installed_file" ]] || + [[ "$installed_file" == "CLAUDE.md" && -f "$current_dir/CLAUDE.md" ]] || + [[ "$installed_file" == "VERSION" && -f "$current_dir/VERSION" ]] || + [[ "$installed_file" == ".checksums" && -f "$current_dir/.checksums" ]]; then if [[ "$DRY_RUN" = true ]]; then echo " Would remove: $installed_file" else @@ -1105,7 +1098,7 @@ if [[ "$UNINSTALL_MODE" = true ]]; then ((removed_count++)) fi fi - done < <(find . -type f) + done < <(get_installed_files "$INSTALL_DIR") # Remove empty directories, but not the main directory if it contains preserved files if [[ "$DRY_RUN" != true ]]; then @@ -1538,7 +1531,6 @@ copy_with_update_check() { # Retry copy operation with error capture while [[ $retry_count -lt $max_retries ]]; do if cp_error=$(cp "$src_file" "$dest_file.new" 2>&1); then - sync 2>/dev/null || true # Ensure file is written target_file="$dest_file.new" copy_performed=true break @@ -1559,7 +1551,6 @@ copy_with_update_check() { # Retry copy operation with error capture while [[ $retry_count -lt $max_retries ]]; do if cp_error=$(cp "$src_file" "$dest_file" 2>&1); then - sync 2>/dev/null || true # Ensure file is written copy_performed=true break else @@ -1579,7 +1570,6 @@ copy_with_update_check() { if [[ "$DRY_RUN" != true ]]; then # File is identical, still copy to ensure permissions are correct if cp_error=$(cp "$src_file" "$dest_file" 2>&1); then - sync 2>/dev/null || true # Ensure file is written copy_performed=true else log_warning "Failed to update identical file $basename_file: $cp_error" @@ -1618,7 +1608,6 @@ copy_with_update_check() { # Try to re-copy the file once more if cp_error=$(cp "$src_file" "$target_file" 2>&1); then - sync 2>/dev/null || true # Ensure file is written sleep 0.1 # Brief pause before verification if verify_file_integrity "$src_file" "$target_file"; then log_verbose "Recovery successful: integrity verified for $basename_file" @@ -1853,4 +1842,4 @@ else echo "" echo "For manual installation, see README.md" exit 1 -fi \ No newline at end of file +fi