Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:00:50 +08:00
commit c5931553a6
106 changed files with 49995 additions and 0 deletions

801
commands/dev/auto.md Normal file
View File

@@ -0,0 +1,801 @@
---
name: dev:auto
description: Fully autonomous development from requirements to production-ready code with testing and validation
delegates-to: autonomous-agent:orchestrator
---
# Dev-Auto Command
## Command: `/dev:auto`
Fully autonomous development from requirements to release-ready implementation. This command handles the entire development lifecycle including planning, implementation, testing, debugging, validation, and optional release - all automatically with minimal human intervention.
**🤖 Full Autonomous Development:**
- **Zero to Release**: From user requirement to production-ready code
- **Incremental Development**: Commits each working milestone
- **Continuous Validation**: Tests and validates at every step
- **Auto-Debugging**: Automatically fixes failures and bugs
- **Quality Assurance**: Ensures ≥ 85/100 quality score
- **Learning Integration**: Improves from every development cycle
## How It Works
1. **Requirements Analysis**: Breaks down user requirements into implementable tasks
2. **Development Planning**: Creates phased development plan with milestones
3. **Incremental Implementation**: Implements each milestone with automatic commits
4. **Continuous Testing**: Tests after each change, debugs automatically if failed
5. **Parameter Validation**: Validates consistency (common failure point)
6. **Quality Control**: Runs quality checks, auto-fixes issues
7. **Requirements Verification**: Ensures implementation matches requirements
8. **Optional Release**: Can trigger `/release-dev` when complete
## Usage
### Basic Usage
```bash
# Simple feature request
/dev:auto "add MQTT broker with certificate support"
# Complex feature with multiple parts
/dev:auto "implement user authentication with JWT, including login, logout, and token refresh"
# Bug fix with testing
/dev:auto "fix memory leak in data processing module and add comprehensive tests"
# Refactoring task
/dev:auto "refactor authentication module to use dependency injection pattern"
```
### Advanced Options
```bash
# Development with automatic release
/dev:auto "add email notification system" --auto-release
# Specify quality threshold (default: 85)
/dev:auto "add caching layer" --quality-threshold 90
# Maximum debug iterations per milestone (default: 5)
/dev:auto "fix login bug" --max-debug-iterations 3
# Skip tests (not recommended)
/dev:auto "update documentation" --skip-tests
# Verbose logging for debugging
/dev:auto "implement API endpoint" --verbose
# Dry run (planning only, no implementation)
/dev:auto "add OAuth support" --dry-run
```
### Incremental Commit Options
```bash
# Commit frequency
/dev:auto "large feature" --commit-per-milestone # Default
/dev:auto "large feature" --commit-per-file # More frequent
/dev:auto "large feature" --commit-per-step # Very frequent
# Skip commits (single commit at end)
/dev:auto "small feature" --no-incremental-commits
```
### Testing Options
```bash
# Test types to run
/dev:auto "add API" --run-unit-tests --run-integration-tests
/dev:auto "add UI" --run-e2e-tests
# Test coverage requirement (default: 80%)
/dev:auto "add feature" --test-coverage 90
# Generate tests automatically
/dev:auto "add feature" --auto-generate-tests
```
## Development Workflow
### Phase 1: Requirements Analysis (10-30 seconds)
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📋 REQUIREMENTS ANALYSIS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
User Request: "add MQTT broker with certificate support"
Requirement Breakdown:
+- 1. MQTT Broker Setup
| +- Dependencies: paho-mqtt or similar
| +- Configuration: broker URL, port, credentials
| +- Complexity: Medium
|
+- 2. Certificate Management
| +- SSL/TLS certificate loading
| +- Certificate validation
| +- Secure storage of credentials
| +- Complexity: Medium
|
+- 3. Connection Management
| +- Connect/disconnect logic
| +- Reconnection handling
| +- Connection state monitoring
| +- Complexity: Medium
|
+- 4. Message Publishing/Subscribing
| +- Topic management
| +- QoS handling
| +- Error handling
| +- Complexity: Medium
|
+- 5. Testing & Documentation
+- Unit tests
+- Integration tests
+- Documentation
+- Complexity: Simple
Technology Stack Detected:
+- Language: Python (detected from project)
+- Framework: Flask/FastAPI (if web API)
+- MQTT Library: paho-mqtt (recommended)
+- Testing: pytest
Estimated Time: 45-90 minutes
Milestones: 5 major milestones
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
### Phase 2: Development Planning (5-10 seconds)
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📐 DEVELOPMENT PLAN
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Development Strategy: Incremental with milestones
Milestone 1: Dependencies & Configuration
+- Install paho-mqtt library
+- Create configuration module
+- Add certificate path configuration
+- Estimated: 10 minutes
+- Commit: "feat: add MQTT dependencies and configuration"
Milestone 2: Certificate Management
+- Implement certificate loader
+- Add certificate validation
+- Implement secure storage
+- Estimated: 15 minutes
+- Commit: "feat: implement certificate management for MQTT"
Milestone 3: MQTT Connection Layer
+- Implement connection class
+- Add connect/disconnect methods
+- Implement reconnection logic
+- Add connection state monitoring
+- Estimated: 20 minutes
+- Commit: "feat: implement MQTT connection with auto-reconnect"
Milestone 4: Publish/Subscribe Interface
+- Implement publish method
+- Implement subscribe method
+- Add topic management
+- Handle QoS levels
+- Estimated: 20 minutes
+- Commit: "feat: add MQTT publish/subscribe interface"
Milestone 5: Testing & Documentation
+- Write unit tests
+- Write integration tests
+- Update documentation
+- Add usage examples
+- Estimated: 15 minutes
+- Commit: "test: add comprehensive MQTT tests and docs"
Success Criteria:
+- ✅ All tests pass (100%)
+- ✅ Certificate validation works
+- ✅ Reconnection logic tested
+- ✅ Documentation complete
+- ✅ Quality score ≥ 85/100
Starting development in 3 seconds...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
### Phase 3: Incremental Development Loop
Each milestone follows this loop:
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔨 MILESTONE 1/5: Dependencies & Configuration
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[IMPLEMENTATION]
Creating mqtt_config.py...
+- ✅ Configuration class created
+- ✅ Environment variable support added
+- ✅ Certificate path validation added
+- ✅ Default values configured
Creating requirements.txt entry...
+- ✅ Added: paho-mqtt==1.6.1
+- ✅ Updated lock file
[VALIDATION]
Parameter Consistency Check:
+- ✅ Config parameter names consistent
+- ✅ Type hints correct
+- ✅ No undefined variables
[TESTING]
Running unit tests...
+- test_config_loading: ✅ PASS
+- test_certificate_path_validation: ✅ PASS
+- test_env_variable_loading: ✅ PASS
+- Test Coverage: 95% (target: 80%)
[QUALITY CHECK]
+- Code Quality: 92/100 ✅
+- Standards: ✅ PEP 8 compliant
+- Documentation: ✅ Docstrings present
+- Security: ✅ No vulnerabilities
[COMMIT]
+- Staging files: 3 files
+- Commit message: "feat: add MQTT dependencies and configuration"
+- Commit hash: abc1234
+- ✅ Pushed to origin/main
Milestone 1: ✅ COMPLETE (elapsed: 8m 32s)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔨 MILESTONE 2/5: Certificate Management
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[IMPLEMENTATION]
Creating mqtt_certificates.py...
+- ✅ CertificateLoader class created
+- ✅ SSL context configuration
+- ✅ Certificate validation logic
+- ✅ Error handling added
[VALIDATION]
Parameter Consistency Check:
+- ✅ Certificate parameters match config
+- ✅ SSL context options consistent
+- ✅ Error messages standardized
[TESTING]
Running unit tests...
+- test_certificate_loading: ✅ PASS
+- test_invalid_certificate: ✅ PASS
+- test_certificate_validation: ❌ FAIL
| +- Error: SSL certificate verification failed
+- Test Coverage: 88%
[DEBUG LOOP - Iteration 1]
Analyzing failure...
+- Root Cause: Certificate path mismatch
+- Issue: Using absolute path instead of relative
+- Fix: Update certificate path resolution
Applying fix...
+- ✅ Updated path resolution logic
+- ✅ Added path normalization
Re-running tests...
+- test_certificate_loading: ✅ PASS
+- test_invalid_certificate: ✅ PASS
+- test_certificate_validation: ✅ PASS
+- Test Coverage: 92%
[QUALITY CHECK]
+- Code Quality: 90/100 ✅
+- Security: ✅ No hardcoded credentials
+- Documentation: ✅ Complete
[COMMIT]
+- Commit message: "feat: implement certificate management for MQTT"
+- Commit hash: def5678
+- ✅ Pushed to origin/main
Milestone 2: ✅ COMPLETE (elapsed: 12m 45s)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
... (Milestones 3-5 continue similarly) ...
```
### Phase 4: Requirements Verification (20-40 seconds)
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ REQUIREMENTS VERIFICATION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Original Request: "add MQTT broker with certificate support"
Implementation Checklist:
+- ✅ MQTT broker connection implemented
| +- ✅ Connect method working
| +- ✅ Disconnect method working
| +- ✅ Auto-reconnection implemented
|
+- ✅ Certificate support implemented
| +- ✅ SSL/TLS certificates loaded
| +- ✅ Certificate validation working
| +- ✅ Secure credential storage
|
+- ✅ Message handling implemented
| +- ✅ Publish method working
| +- ✅ Subscribe method working
| +- ✅ QoS levels supported
|
+- ✅ Error handling complete
| +- ✅ Connection errors handled
| +- ✅ Certificate errors handled
| +- ✅ Message errors handled
|
+- ✅ Testing complete
+- ✅ Unit tests: 24/24 passing
+- ✅ Integration tests: 6/6 passing
+- ✅ Test coverage: 94%
Quality Metrics:
+- Code Quality: 92/100 ✅ (threshold: 85)
+- Test Coverage: 94% ✅ (threshold: 80%)
+- Documentation: 90/100 ✅
+- Security: 95/100 ✅
+- Overall: 92/100 ✅
Completeness: 100% ✅
All requirements satisfied!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
### Phase 5: Final Report (10 seconds)
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ AUTONOMOUS DEVELOPMENT COMPLETE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📋 Requirement: add MQTT broker with certificate support
⏱️ Total Time: 48m 32s
🔄 Iterations: 1 (1 debug loop in Milestone 2)
📊 Final Quality: 92/100
✨ Implemented:
+- MQTT broker connection with auto-reconnect
+- SSL/TLS certificate management and validation
+- Publish/Subscribe interface with QoS support
+- Comprehensive error handling
+- Complete documentation and usage examples
📦 Files Created/Modified:
+- mqtt_config.py (new)
+- mqtt_certificates.py (new)
+- mqtt_client.py (new)
+- tests/test_mqtt.py (new)
+- requirements.txt (modified)
+- README.md (modified)
✅ Tests: 30/30 passing (100%)
+- Unit tests: 24/24
+- Integration tests: 6/6
📚 Documentation: 90/100
+- API documentation complete
+- Usage examples added
+- Configuration guide included
🔒 Security: 95/100
+- No hardcoded credentials
+- Secure certificate storage
+- Proper SSL/TLS configuration
🐛 Issues Fixed: 1
+- Certificate path resolution (Milestone 2)
📊 Code Metrics:
+- Lines Added: 486
+- Lines Modified: 23
+- Test Coverage: 94%
+- Cyclomatic Complexity: Low
🔄 Commits: 5 incremental commits
+- abc1234: feat: add MQTT dependencies and configuration
+- def5678: feat: implement certificate management for MQTT
+- ghi9012: feat: implement MQTT connection with auto-reconnect
+- jkl3456: feat: add MQTT publish/subscribe interface
+- mno7890: test: add comprehensive MQTT tests and docs
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 SUGGESTED NEXT ACTIONS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. [High Priority] Test MQTT integration end-to-end
-> /dev:auto "add integration tests for MQTT with real broker"
2. [Recommended] Release this feature
-> /dev:release --minor
3. [Optional] Add monitoring for MQTT connection
-> /dev:auto "add prometheus metrics for MQTT"
4. [Learning] View development analytics
-> /learn:performance
Choose option (1-4) or type custom command:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
### Optional: Auto-Release (if --auto-release flag used)
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🚀 AUTO-RELEASE TRIGGERED
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Triggering /dev:release...
[Release workflow output here - see /dev:release docs]
Release: v3.5.1 ✅
Links:
+- GitHub: https://github.com/user/repo/releases/tag/v3.5.1
+- Changelog: https://github.com/user/repo/blob/main/CHANGELOG.md
Total Time (dev + release): 51m 15s
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
## Debug Loop Details
When tests fail, the debug loop automatically:
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔧 DEBUG LOOP - Iteration 1/5
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Test Failure Detected:
+- Test: test_mqtt_publish
+- Error: ConnectionRefusedError: [Errno 111] Connection refused
+- Stack Trace: [truncated for brevity]
[ANALYSIS]
Root Cause Analysis:
+- Category: Integration Error
+- Specific Issue: MQTT broker not running
+- Affected Component: mqtt_client.py:45
+- Similar Patterns: Found 3 similar issues in patterns
Recommended Fix:
+- Option 1: Add connection retry logic (recommended)
+- Option 2: Mock MQTT broker for tests
+- Option 3: Skip integration tests in CI
Selected Fix: Option 1 (best success rate: 95%)
[IMPLEMENTATION]
Applying fix...
+- ✅ Added exponential backoff retry
+- ✅ Maximum 3 retry attempts
+- ✅ Configurable retry delay
+- ✅ Logging for retry attempts
[VALIDATION]
Parameter Consistency:
+- ✅ Retry parameters consistent
+- ✅ Timeout values aligned
+- ✅ Error messages standardized
[RE-TEST]
Running tests again...
+- test_mqtt_publish: ✅ PASS
+- test_mqtt_subscribe: ✅ PASS
+- All tests: 30/30 passing
Debug Loop: ✅ SUCCESS (resolved in 1 iteration)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
If debug loop fails after max iterations:
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[WARN] DEBUG LOOP - MAX ITERATIONS REACHED (5/5)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Unable to resolve issue automatically.
Issue Summary:
+- Test: test_complex_reconnection_logic
+- Error: Intermittent connection timeout
+- Attempts: 5 different fixes tried
+- Success Rate: 0/5
Attempted Fixes:
1. Increased timeout values - Failed
2. Added connection pooling - Failed
3. Implemented circuit breaker - Failed
4. Adjusted retry backoff - Failed
5. Modified SSL handshake - Failed
Manual Intervention Required:
This appears to be a complex integration issue that requires
human analysis. The following information has been collected:
Detailed Error Report: .claude/data/reports/debug-failure-2025-01-24.md
Code Changes Applied: 5 incremental commits
Test Logs: .claude/logs/test-failures.log
Recommendations for Manual Fix:
1. Review MQTT broker configuration
2. Check network connectivity and firewall rules
3. Verify SSL certificate chain is complete
4. Test with different MQTT broker versions
Would you like to:
1. Continue with partial implementation (current milestone only)
2. Rollback all changes and report issue
3. Commit current state for manual fix later
Choose option (1-3):
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
## Parameter Validation
Critical validation performed automatically:
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔍 PARAMETER VALIDATION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Checking parameter consistency across codebase...
Function Call Analysis:
+- mqtt_connect(broker_url, port, username, password)
+- Used in 8 locations
+- ✅ All parameters match function signature
Configuration Validation:
+- Config file: mqtt_config.py
+- Environment variables: .env
+- Function parameters: mqtt_client.py
+- ✅ All parameter names consistent
Type Safety Check:
+- Type hints present: ✅ 100%
+- Type consistency: ✅ All correct
+- ✅ No type mismatches found
Null Safety Check:
+- Null checks present: ✅ All critical paths
+- Default values defined: ✅ All optional params
+- ✅ No null pointer risks
Common Failure Patterns:
+- ✅ No undefined variables
+- ✅ No parameter name typos
+- ✅ No missing required parameters
+- ✅ No type conversion errors
Parameter Validation: ✅ PASS (100%)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
## Integration with Learning System
The `/dev-auto` command deeply integrates with pattern learning:
**Learning from Success**:
- Successful implementation approaches
- Effective milestone breakdown strategies
- Optimal test coverage strategies
- Best debugging techniques
- Common parameter patterns
**Learning from Failure**:
- Failed debug attempts
- Ineffective implementation patterns
- Common error causes
- Integration pitfalls
- Time-consuming approaches to avoid
**Pattern Storage**:
```json
{
"dev_auto_patterns": {
"task_type": "mqtt_integration",
"successful_approach": {
"milestones": 5,
"avg_milestone_time": "9.7 minutes",
"total_time": "48.5 minutes",
"debug_iterations": 1,
"quality_score": 92
},
"common_issues": [
{
"issue": "certificate_path_mismatch",
"frequency": 0.65,
"fix_success_rate": 0.95,
"recommended_fix": "use_relative_paths"
}
],
"skill_effectiveness": {
"code-analysis": 0.94,
"testing-strategies": 0.91,
"security-patterns": 0.88
},
"reuse_count": 12,
"average_improvement": "+18% quality, -23% time"
}
}
```
## Integration with Other Commands
### Complete Development Workflow
```bash
# Plan feature
/dev:auto "add feature" --dry-run
# Implement feature
/dev:auto "add feature"
# Validate quality
/analyze:quality
# Release
/dev:release
```
### With Validation Commands
```bash
# Development with validation
/dev:auto "implement API"
/validate:fullstack
/analyze:static
```
### With Learning Commands
```bash
# Check development patterns
/learn:analytics
# Development with pattern awareness
/dev:auto "similar feature to previous"
# Review performance
/learn:performance
```
## Agent Delegation
`/dev-auto` delegates to specialized agents:
- **code-analyzer**: For code structure analysis
- **test-engineer**: For test generation and debugging
- **quality-controller**: For quality validation and auto-fix
- **documentation-generator**: For documentation updates
- **security-auditor**: For security validation
- **frontend-analyzer**: For frontend-specific tasks
- **api-contract-validator**: For API contract validation
- **build-validator**: For build configuration
## Skills Integration
Auto-loads relevant skills based on task:
- **code-analysis**: For implementation guidance
- **testing-strategies**: For comprehensive testing
- **quality-standards**: For quality compliance
- **security-patterns**: For security best practices
- **documentation-best-practices**: For documentation
- **pattern-learning**: For continuous improvement
- **autonomous-development**: For development strategies
## Best Practices
### Writing Good Requirements
```bash
# Good: Specific and actionable
/dev:auto "add REST API endpoint for user registration with email validation"
# Bad: Too vague
/dev:auto "make the app better"
# Good: Clear scope
/dev:auto "refactor database layer to use repository pattern"
# Bad: Too broad
/dev:auto "fix everything"
# Good: Includes acceptance criteria
/dev:auto "add caching with Redis, must support TTL and invalidation"
```
### When to Use --auto-release
- Small, isolated features
- Bug fixes
- Documentation updates
- Non-breaking changes
### When NOT to Use --auto-release
- Major features requiring review
- Breaking changes
- Security-critical changes
- Changes requiring team discussion
### Quality Thresholds
- **85 (default)**: Production-ready standard
- **90**: High-quality applications
- **95**: Mission-critical systems
- **80**: Development/testing environments
## Troubleshooting
### Development Stuck in Loop
```bash
# Check current status
/dev:auto status
# Force exit debug loop
/dev:auto abort
# View detailed logs
cat .claude/logs/dev-auto-current.log
```
### Tests Keep Failing
```bash
# Increase max debug iterations
/dev:auto "feature" --max-debug-iterations 10
# Skip specific test types
/dev:auto "feature" --skip-integration-tests
# Manual fix mode
/dev:auto "feature" --manual-fix-on-failure
```
### Quality Check Fails
```bash
# Lower threshold temporarily
/dev:auto "feature" --quality-threshold 75
# Skip quality check (not recommended)
/dev:auto "feature" --skip-quality-check
# Run quality check separately
/analyze:quality
```
## Performance Metrics
Expected performance:
| Task Type | Avg Time | Success Rate | Iterations |
|-----------|----------|--------------|------------|
| Small Feature | 15-30 min | 95% | 0-1 |
| Medium Feature | 30-60 min | 88% | 1-2 |
| Large Feature | 1-3 hours | 78% | 2-4 |
| Bug Fix | 10-20 min | 92% | 0-1 |
| Refactoring | 20-45 min | 85% | 1-2 |
Success rate improves with learning:
- First 5 similar tasks: 75-80%
- After 10 similar tasks: 85-90%
- After 25 similar tasks: 90-95%
---
**Version**: 1.0.0
**Integration**: Uses orchestrator, test-engineer, quality-controller, code-analyzer agents
**Skills**: code-analysis, testing-strategies, quality-standards, autonomous-development
**Platform**: Cross-platform (Windows, Linux, Mac)
**Learning**: Full integration with pattern learning system

578
commands/dev/commit.md Normal file
View File

@@ -0,0 +1,578 @@
---
name: dev:commit
description: Intelligent commit management with automatic staging, conventional commits, and learning integration
delegates-to: autonomous-agent:git-repository-manager
---
# Dev-Commit Command
## Command: `/dev:commit`
**Smart commit management** - Analyzes changes, generates intelligent commit messages following conventional commit standards, stages appropriate files, and creates commits with learning integration. Does NOT create releases or tags.
**🔧 Intelligent Commit Features:**
- **Automatic Change Analysis**: Reviews all modified and new files
- **Smart File Staging**: Intelligently stages related files together
- **Conventional Commits**: Generates proper commit messages (feat:, fix:, docs:, etc.)
- **Multi-file Commits**: Groups related changes into logical commits
- **Interactive Mode**: Option to review before committing
- **Learning Integration**: Learns effective commit patterns over time
- **No Release**: Only commits - no tags, no releases, no version bumps
## How It Works
1. **Analyze Changes**: Reviews all uncommitted changes
2. **Categorize Changes**: Groups changes by type (features, fixes, docs, etc.)
3. **Generate Commit Messages**: Creates conventional commit messages
4. **Stage Files**: Intelligently stages files for each commit
5. **Create Commits**: Executes git commit with generated messages
6. **Push (Optional)**: Optionally pushes to remote
7. **Learn**: Stores commit patterns for future improvements
## Usage
### Basic Usage
```bash
# Analyze and commit all changes with smart grouping
/dev:commit
# Commit with custom message
/dev:commit "feat: add new authentication system"
# Commit specific files only
/dev:commit --files "src/auth.py,tests/test_auth.py"
```
### Automatic Commit Message Generation
```bash
# Let the agent analyze and generate appropriate messages
/dev:commit --auto
# Generate message but review before committing
/dev:commit --auto --interactive
# Use conventional commit format
/dev:commit --conventional
```
### Commit Grouping Options
```bash
# Group all changes into single commit
/dev:commit --single
# Create multiple commits grouped by type
/dev:commit --group-by-type
# Create commit per file
/dev:commit --per-file
# Create commit per directory
/dev:commit --per-directory
```
### Push Options
```bash
# Commit and push to remote
/dev:commit --push
# Commit and push to specific branch
/dev:commit --push --branch feature/new-feature
# Commit only (no push) - DEFAULT
/dev:commit --no-push
```
### Advanced Options
```bash
# Include untracked files
/dev:commit --include-untracked
# Exclude specific patterns
/dev:commit --exclude "*.log,*.tmp"
# Verbose output with reasoning
/dev:commit --verbose
# Dry run (show what would be committed)
/dev:commit --dry-run
```
## Output Format
### Terminal Output (Concise)
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔧 COMMIT ANALYSIS COMPLETE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Changes Analyzed: 12 files
Commit Strategy: Group by type
Proposed Commits:
1. feat: Add 6 new analysis commands
Files: 6 files in commands/analyze/ and commands/learn/
2. fix: Fix dashboard browser opening issues
Files: 2 files (lib/dashboard.py, lib/dashboard_launcher.py)
3. docs: Update plugin documentation
Files: 4 files (README.md, CLAUDE.md, etc.)
Execute commits? [Y/n]: Y
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ COMMITS CREATED
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[PASS] Commit 1: feat: Add 6 new analysis commands (abc1234)
[PASS] Commit 2: fix: Fix dashboard browser opening issues (def5678)
[PASS] Commit 3: docs: Update plugin documentation (ghi9012)
Total: 3 commits created
Pushed: No (use --push to push to remote)
⏱ Completed in 8 seconds
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
## Commit Message Generation
### Conventional Commit Format
The command automatically detects change types and generates appropriate conventional commit messages:
**Format**: `<type>(<scope>): <description>`
**Types:**
- `feat`: New features or functionality
- `fix`: Bug fixes
- `docs`: Documentation changes only
- `style`: Code style/formatting (no logic changes)
- `refactor`: Code refactoring (no feature/fix)
- `perf`: Performance improvements
- `test`: Adding or updating tests
- `chore`: Maintenance tasks (dependencies, configs, etc.)
- `ci`: CI/CD configuration changes
- `build`: Build system changes
**Examples:**
```bash
# Feature additions
feat: add JWT authentication system
feat(auth): implement refresh token mechanism
# Bug fixes
fix: resolve memory leak in data processing
fix(api): correct endpoint parameter validation
# Documentation
docs: update README with new commands
docs(api): add authentication examples
# Refactoring
refactor: simplify authentication logic
refactor(db): optimize query performance
# Tests
test: add integration tests for auth module
test(api): improve endpoint coverage
# Chores
chore: update dependencies to latest versions
chore(deps): bump python-jose to 1.6.1
```
## Smart File Staging
The command intelligently groups files for commits:
### Group by Type (Default)
```
Commit 1: feat: Add new commands
+- commands/analyze/explain.md
+- commands/analyze/repository.md
+- commands/learn/history.md
+- commands/learn/clone.md
Commit 2: fix: Fix dashboard issues
+- lib/dashboard.py
+- lib/dashboard_launcher.py
Commit 3: docs: Update documentation
+- README.md
+- CLAUDE.md
+- CHANGELOG.md
```
### Group by Directory
```
Commit 1: feat: Update analyze commands
+- commands/analyze/
+- explain.md
+- repository.md
Commit 2: feat: Update learn commands
+- commands/learn/
+- history.md
+- clone.md
Commit 3: fix: Update library
+- lib/
+- dashboard.py
+- dashboard_launcher.py
```
### Single Commit
```
Commit 1: chore: Update plugin with multiple improvements
+- commands/analyze/explain.md
+- commands/analyze/repository.md
+- commands/learn/history.md
+- commands/learn/clone.md
+- lib/dashboard.py
+- lib/dashboard_launcher.py
+- README.md
+- CLAUDE.md
```
## Change Detection
The command analyzes changes to determine appropriate commit messages:
### Feature Detection
Triggers `feat:` commit when:
- New files in `commands/`, `agents/`, `skills/`
- New function definitions
- New API endpoints
- New classes or modules
### Fix Detection
Triggers `fix:` commit when:
- Bug fix keywords in changes (fix, bug, issue, error)
- Modified error handling
- Modified validation logic
- Corrected typos or logic errors
### Documentation Detection
Triggers `docs:` commit when:
- Only markdown files modified
- Only docstrings modified
- Only comments modified
- README, CHANGELOG, or documentation files
### Refactor Detection
Triggers `refactor:` commit when:
- Code structure changes without logic changes
- Function/class renaming
- Code organization improvements
- Performance optimizations
## Integration with Learning System
The `/dev:commit` command integrates with pattern learning:
**Learning from Commits**:
- Effective commit message patterns
- Optimal file grouping strategies
- Common change type patterns
- Successful commit sizes
- Push timing patterns
**Pattern Storage**:
```json
{
"commit_patterns": {
"grouping_strategy": "by_type",
"avg_commits_per_session": 2.5,
"avg_files_per_commit": 4.2,
"effective_message_patterns": [
"feat: add {feature}",
"fix: resolve {issue}",
"docs: update {document}"
],
"success_metrics": {
"single_commit_clarity": 0.78,
"grouped_commit_clarity": 0.92,
"per_file_commit_clarity": 0.65
},
"reuse_count": 45,
"effectiveness_score": 0.91
}
}
```
**Continuous Improvement**:
- Learn which grouping strategies work best
- Improve commit message quality over time
- Optimize file staging decisions
- Reduce commit fragmentation
- Enhance clarity and traceability
## Interactive Mode
When using `--interactive`, the command shows a review before committing:
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📋 COMMIT REVIEW
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Commit 1 of 3
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Type: feat
Message: Add 6 new analysis and learning commands
Description:
Implements external repository analysis, task explanation,
commit history learning, feature cloning, and documentation
updates. Enhances learning capabilities significantly.
Files to be committed:
+- commands/analyze/explain.md (new, 26 KB)
+- commands/analyze/repository.md (new, 35 KB)
+- commands/learn/history.md (new, 24 KB)
+- commands/learn/clone.md (new, 21 KB)
+- commands/workspace/update-readme.md (new, 3.7 KB)
+- commands/workspace/update-about.md (new, 3.9 KB)
Total: 6 files, 113.6 KB
Options:
[c] Commit as shown
[e] Edit commit message
[s] Skip this commit
[m] Modify file selection
[q] Quit without committing
Choice:
```
## Best Practices
### When to Use `/dev:commit`
**Good use cases:**
- During active development (commit frequently)
- After completing a logical unit of work
- Before switching tasks or branches
- After fixing bugs or issues
- When you want smart commit organization
**Don't use for:**
- Creating releases (use `/dev:release` instead)
- Version tagging (use `/dev:release` instead)
- Publishing to package managers (use `/dev:release`)
### Commit Frequency
**Recommended patterns:**
- **Small features**: 1-2 commits
- **Medium features**: 3-5 commits grouped logically
- **Large features**: Multiple commits per logical component
- **Bug fixes**: 1 commit per bug
- **Documentation**: 1 commit per documentation update session
**Avoid:**
- Too many tiny commits (creates noise)
- Giant commits with unrelated changes (hard to review)
- Commits without clear purpose or message
### Commit Message Quality
**Good commit messages:**
```bash
feat: add JWT authentication with refresh tokens
fix: resolve memory leak in background task manager
docs: add comprehensive API documentation with examples
refactor: simplify validation logic using schemas
test: add integration tests for auth workflow
```
**Poor commit messages:**
```bash
update files
fix stuff
changes
wip
asdf
```
## Integration with Other Commands
### Development Workflow
```bash
# Work on feature
/dev:auto "add new feature"
# Commit progress regularly
/dev:commit --auto
# Continue working...
/dev:commit --auto
# When ready to release
/dev:release
```
### Pre-Release Workflow
```bash
# Commit all pending changes
/dev:commit --auto --group-by-type
# Validate quality
/analyze:quality
# Create release
/dev:release
```
### Feature Branch Workflow
```bash
# Create feature branch
git checkout -b feature/new-auth
# Work and commit
/dev:commit --auto
# Push to remote branch
/dev:commit --push --branch feature/new-auth
# Create PR when ready
/dev:pr-review
```
## Troubleshooting
### No Changes to Commit
```bash
# Check git status
git status
# Show what would be committed
/dev:commit --dry-run
# Include untracked files
/dev:commit --include-untracked
```
### Commit Failed
```bash
# Check for conflicts
git status
# Resolve conflicts manually
git add <resolved-files>
# Retry commit
/dev:commit --retry
```
### Wrong Files Staged
```bash
# Unstage all
git reset
# Specify files explicitly
/dev:commit --files "file1.py,file2.py"
```
### Push Failed
```bash
# Check remote status
git remote -v
# Pull first if needed
git pull origin main
# Retry push
/dev:commit --push --retry
```
## Performance Metrics
Expected performance:
| Task | Time | Success Rate |
|------|------|--------------|
| Analyze changes | 2-5s | 100% |
| Generate commit messages | 3-8s | 95% |
| Create single commit | 1-2s | 99% |
| Create multiple commits | 5-15s | 97% |
| Push to remote | 3-10s | 95% |
**Learning improvement:**
- After 10 commits: 20% faster message generation
- After 25 commits: 85% message quality (up from 70%)
- After 50 commits: 92% optimal grouping decisions
## Examples
### Example 1: Auto-commit with smart grouping
```bash
$ /dev:commit --auto
Analyzing changes...
Found: 8 modified files, 4 new files
Proposed commits:
1. feat: Add new authentication commands (6 files)
2. fix: Resolve dashboard rendering issue (2 files)
3. docs: Update README and CHANGELOG (4 files)
Creating commits...
[PASS] 3 commits created successfully
Total changes committed: 12 files
```
### Example 2: Custom commit with specific files
```bash
$ /dev:commit "feat: implement JWT token validation" --files "src/auth/jwt.py,tests/test_jwt.py"
Staging files...
+- src/auth/jwt.py
+- tests/test_jwt.py
Creating commit...
[PASS] Commit created: feat: implement JWT token validation (abc1234)
```
### Example 3: Interactive review mode
```bash
$ /dev:commit --auto --interactive
[Shows review interface for each proposed commit]
Commit 1: Accept (c)
Commit 2: Edit message (e)
Commit 3: Skip (s)
Result:
[PASS] 2 commits created
1 commit skipped
```
### Example 4: Commit and push
```bash
$ /dev:commit --auto --push
Creating commits...
[PASS] 3 commits created
Pushing to origin/main...
[PASS] Pushed successfully
Branch: main
Remote: origin
Commits: 3 new commits
```
---
**Version**: 1.0.0
**Integration**: Uses git-repository-manager agent
**Skills**: git-automation, pattern-learning, code-analysis
**Platform**: Cross-platform (Windows, Linux, Mac)
**Learning**: Full integration with pattern learning system
**Scope**: Commit management only - no releases, tags, or version bumps

View File

@@ -0,0 +1,355 @@
---
name: dev:model-switch
description: Switch between Claude and GLM AI models with secure token management
delegates-to: autonomous-agent:orchestrator
---
# Development Model Switch Command
Switch between Claude and GLM models in your Claude Code environment with secure token management and cross-platform compatibility.
## Usage
```bash
# Switch to GLM models (interactive setup)
/dev:model-switch --to glm
# Switch to Claude models (restore defaults)
/dev:model-switch --to claude
# Check current model configuration
/dev:model-switch --status
# Auto-switch based on task type (future feature)
/dev:model-switch --auto
# Set up initial configuration
/dev:model-switch --setup
```
## How It Works
### Model Configuration
The command modifies `~/.claude/settings.json` to configure model endpoints:
**GLM Configuration:**
```json
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "your_zai_api_key",
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.5-air",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.6",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.6"
}
}
```
**Claude Configuration (Default):**
```json
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "your_anthropic_api_key",
"ANTHROPIC_BASE_URL": "https://api.anthropic.com"
}
}
```
### Cross-Platform Implementation
**Windows (PowerShell):**
```powershell
# Create settings directory
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.claude"
# Update configuration
$config = Get-Content "$env:USERPROFILE\.claude\settings.json" | ConvertFrom-Json
$config.env.ANTHROPIC_BASE_URL = "https://api.z.ai/api/anthropic"
$config.env.ANTHROPIC_AUTH_TOKEN = $apiKey
$config | ConvertTo-Json | Set-Content "$env:USERPROFILE\.claude\settings.json"
```
**Linux/macOS (Bash):**
```bash
# Create settings directory
mkdir -p ~/.claude
# Update configuration
jq '.env.ANTHROPIC_BASE_URL = "https://api.z.ai/api/anthropic" |
jq '.env.ANTHROPIC_AUTH_TOKEN = "'$apiKey'"' ~/.claude/settings.json > ~/.claude/settings.json.tmp &&
mv ~/.claude/settings.json.tmp ~/.claude/settings.json
```
## Features
### 🔒 **Secure Token Management**
- **Token Validation**: Validates API key format before use
- **Secure Storage**: Stores tokens only in local settings file
- **Privacy First**: Never shares tokens with external services
- **Token Encryption**: Future enhancement for encrypted token storage
### 🌐 **Cross-Platform Compatibility**
- **Windows**: PowerShell script execution
- **Linux/macOS**: Bash script execution with jq fallback
- **Automatic Detection**: Detects platform and uses appropriate method
- **Fallback Options**: Manual instructions if automation fails
### 🎯 **Smart Configuration**
- **Backup Creation**: Automatically backs up current settings
- **Validation**: Validates JSON syntax before applying changes
- **Rollback**: Easy rollback to previous configuration
- **Status Checking**: Real-time configuration status display
### 🚀 **Future Automation**
- **Task-Based Switching**: Automatically switch models based on task complexity
- **Performance Optimization**: Choose models based on task requirements
- **Cost Management**: Optimize model usage for cost efficiency
- **Load Balancing**: Distribute tasks across available models
## Command Options
### Basic Switching
```bash
# Switch to GLM (interactive)
/dev:model-switch --to glm
# Switch to Claude (restore defaults)
/dev:model-switch --to claude
```
### Status and Information
```bash
# Check current configuration
/dev:model-switch --status
# Show available models
/dev:model-switch --list-models
# Validate current configuration
/dev:model-switch --validate
```
### Advanced Options
```bash
# Force switch without confirmation
/dev:model-switch --to glm --force
# Use specific GLM model
/dev:model-switch --to glm --model glm-4.6
# Backup current settings before switching
/dev:model-switch --to glm --backup
# Dry run (show changes without applying)
/dev:model-switch --to glm --dry-run
```
## Model Comparison
| Feature | Claude (Anthropic) | GLM (Z.AI) | Best For |
|---------|-------------------|-------------|-----------|
| **Response Quality** | Excellent | Very Good | General tasks |
| **Speed** | Fast | Very Fast | Quick tasks |
| **Cost** | Higher | Lower | Budget-conscious |
| **Chinese Support** | Good | Excellent | Chinese content |
| **Code Analysis** | Excellent | Good | Code review |
| **Creative Tasks** | Excellent | Very Good | Creative writing |
| **Technical Accuracy** | Excellent | Good | Technical docs |
## Security Best Practices
### 🔒 **Token Security**
- **Never share API keys** in plain text
- **Use environment variables** when possible
- **Rotate tokens regularly** for security
- **Monitor usage** for unauthorized access
- **Store securely** in encrypted format
### 🛡️ **Configuration Security**
- **Backup settings** before making changes
- **Validate JSON syntax** to prevent corruption
- **Use secure connections** (HTTPS only)
- **Close Claude windows** before applying changes
- **Verify changes** after applying
### 🔐 **Privacy Protection**
- **Local storage only** - no cloud sync of tokens
- **No telemetry** - usage data stays private
- **Secure deletion** - clear tokens when needed
- **Access control** - limit file permissions
- **Audit trail** - log configuration changes
## Examples
### Initial GLM Setup
```bash
# First-time GLM setup
/dev:model-switch --to glm
# Interactive prompts:
# 1. Enter your Z.AI API key: [sk-xxxxxxxx]
# 2. Validate API key... ✅ Valid
# 3. Back up current settings... ✅ Backed up
# 4. Apply GLM configuration... ✅ Applied
# 5. Restart Claude Code to apply changes
# Status after setup:
Current Model: GLM (glm-4.6)
API Endpoint: https://api.z.ai/api/anthropic
Token Status: ✅ Valid
Last Updated: 2025-01-26 20:45:30
```
### Quick Model Toggle
```bash
# Switch to GLM for Chinese content
/dev:model-switch --to glm --force
# Switch back to Claude for code analysis
/dev:model-switch --to claude
# Check current status
/dev:model-switch --status
```
### Advanced Configuration
```bash
# Use specific GLM model with backup
/dev:model-switch --to glm --model glm-4.5-air --backup
# Dry run to preview changes
/dev:model-switch --to glm --dry-run
# Validate configuration without switching
/dev:model-switch --validate --target glm
```
## Troubleshooting
### Common Issues
**API Key Invalid:**
```bash
# Check token format
/dev:model-switch --validate-token sk-xxxxxxxx
# Re-enter token
/dev:model-switch --to glm --renew-token
```
**Configuration Not Applied:**
```bash
# Check file permissions
/dev:model-switch --check-permissions
# Manually apply changes
/dev:model-switch --to glm --manual
```
**Model Not Responding:**
```bash
# Test API connection
/dev:model-switch --test-connection
# Switch to backup model
/dev:model-switch --fallback claude
```
### Platform-Specific Issues
**Windows PowerShell:**
```powershell
# Check PowerShell execution policy
Get-ExecutionPolicy
# Allow script execution
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
```
**Linux/macOS:**
```bash
# Check jq installation
jq --version
# Install jq if needed
# Ubuntu/Debian: sudo apt-get install jq
# macOS: brew install jq
# CentOS/RHEL: sudo yum install jq
```
### Recovery Options
```bash
# Restore from backup
/dev:model-switch --restore-backup
# Reset to defaults
/dev:model-switch --reset-defaults
# Generate new configuration
/dev:model-switch --generate-config
```
## Integration with Learning System
The model-switch command integrates with the autonomous learning system:
**Pattern Storage:**
```json
{
"model_switch_patterns": {
"task_type": "chinese_translation",
"preferred_model": "glm",
"success_rate": 0.92,
"performance_improvement": "+15%",
"cost_savings": "-40%"
}
}
```
**Auto-Switching Logic:**
- Analyze task requirements
- Match with historical performance
- Recommend optimal model
- Learn from user choices
- Optimize for cost and quality
## Future Enhancements
### 🚀 **Planned Features**
- **Multi-Model Load Balancing**: Distribute tasks across models
- **Performance Analytics**: Track model performance metrics
- **Cost Optimization**: Automatic cost-effective model selection
- **Smart Routing**: Route tasks to best-suited models
- **Token Management**: Automated token rotation and management
- **Model Comparison**: Side-by-side model performance testing
### 🔧 **Technical Improvements**
- **Encrypted Storage**: Secure token encryption
- **API Rate Limiting**: Intelligent rate limit handling
- **Connection Pooling**: Optimized connection management
- **Caching**: Response caching for faster performance
- **Monitoring**: Real-time model performance monitoring
---
**Version**: 1.0.0
**Integration**: Uses orchestrator agent with security-patterns skill
**Platform**: Cross-platform (Windows, Linux, Mac)
**Security**: Privacy-first with secure token management

635
commands/dev/pr-review.md Normal file
View File

@@ -0,0 +1,635 @@
---
name: dev:pr-review
description: CodeRabbit-style PR review with security scanning, test coverage, and one-click fixes
delegates-to: autonomous-agent:pr-reviewer
---
# Pull Request Review Command
Execute a comprehensive CodeRabbit-style review of a pull request with automated analysis, security scanning, and one-click fixes.
## Usage
```bash
/dev:pr-review [PR_NUMBER|BRANCH_NAME]
```
**Examples**:
```bash
/dev:pr-review 123 # Review PR #123
/dev:pr-review feature/auth # Review branch against main
/dev:pr-review # Review current branch changes
```
## Workflow
### 1. Initialize Review
- Detect PR context (number, branch, or current changes)
- Fetch PR metadata (title, author, description)
- Extract git diff and commit history
### 2. Delegate to PR Reviewer Agent
Execute comprehensive review via `pr-reviewer` agent:
```javascript
const review_result = await delegate_to_pr_reviewer({
pr_number: pr_number,
pr_data: {
title: pr_title,
author: pr_author,
description: pr_description,
files: changed_files,
diff: full_diff,
commits: commit_history
}
});
```
### 3. Analysis Pipeline
The PR reviewer agent executes:
**A. Summary Generation** (5-10s):
- Change categorization (features, bug fixes, refactoring, etc.)
- Files changed count and line statistics
- Complexity score calculation
**B. Line-by-Line Analysis** (30-60s):
- Code quality issues (naming, duplication, complexity)
- Best practice violations (SOLID, DRY, error handling)
- Performance concerns (N+1 queries, inefficient algorithms)
- Type annotations and documentation
**C. Security Scan** (20-40s via security-auditor):
- OWASP Top 10 vulnerability detection
- Input validation checks
- Authentication/authorization review
- Secrets exposure detection
- Dependency vulnerability scan
**D. Test Coverage Analysis** (15-30s):
- Calculate coverage for changed lines
- Identify untested functions
- Generate test suggestions
- Coverage delta calculation
**E. Automated Fix Generation** (10-20s):
- Generate one-click fixes for auto-fixable issues
- Provide suggestions with explanations
- Calculate confidence scores
**F. Risk Assessment** (5-10s):
- Calculate weighted risk score
- Identify risk factors (size, complexity, critical files)
- Generate recommendations
**G. Related PR Detection** (5-10s):
- Find PRs touching same files
- Detect similar changes
- Identify dependencies
### 4. Report Generation
Generate comprehensive review report:
```markdown
# Pull Request Review: #{PR_NUMBER}
## 📊 Summary
**Risk Level**: {RISK_LEVEL} ({RISK_SCORE}/100)
Files: {COUNT} | +{ADDITIONS} -{DELETIONS} | Complexity: {SCORE}/100
## 🔒 Security ({VULN_COUNT} issues)
🔴 Critical: {COUNT} | 🟠 High: {COUNT} | 🟡 Medium: {COUNT}
## 📈 Test Coverage
{COVERAGE}% ({DELTA > 0 ? '+' : ''}{DELTA}%) | Untested: {COUNT}
## 💡 Code Review ({ISSUE_COUNT} issues)
{DETAILED_REVIEWS_BY_FILE}
## ⚡ Performance ({ISSUE_COUNT} concerns)
{PERFORMANCE_ISSUES}
## 🎯 Recommendations
### Critical ({COUNT})
### Suggested ({COUNT})
### Nice to Have ({COUNT})
## ✅ Approval Checklist
- [ ] All critical issues resolved
- [ ] Test coverage adequate
- [ ] No new vulnerabilities
- [ ] Performance acceptable
```
### 5. Interactive Fix Application
Provide one-click fix application:
```python
# Auto-fixable issues presented with "Apply Fix" option
# User can select fixes to apply
# System applies fixes and creates commit
```
## Skills Integration
This command leverages:
**ast-analyzer**:
- Deep code structure analysis
- Complexity calculation
- Impact analysis
**security-patterns**:
- Vulnerability detection patterns
- Secure coding guidelines
**contextual-pattern-learning**:
- Find similar successful PRs
- Learn review patterns
- Improve accuracy over time
**code-analysis**:
- Code quality metrics
- Best practice validation
## Output Format
### Terminal Output (Tier 1: Concise Summary)
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PR REVIEW COMPLETE: #{PR_NUMBER}
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 Overview
Risk Level: {RISK_LEVEL} ({RISK_SCORE}/100)
Files: {COUNT} | +{ADDITIONS} -{DELETIONS}
Complexity: {SCORE}/100
🔒 Security Analysis
🔴 Critical: {COUNT} | 🟠 High: {COUNT} | 🟡 Medium: {COUNT}
Total New Vulnerabilities: {COUNT}
📈 Test Coverage
Coverage: {COVERAGE}% ({DELTA > 0 ? '+' : ''}{DELTA}%)
Untested Functions: {COUNT}
💡 Top 3 Issues
1. {SEVERITY} - {FILE}:{LINE} - {ISSUE}
2. {SEVERITY} - {FILE}:{LINE} - {ISSUE}
3. {SEVERITY} - {FILE}:{LINE} - {ISSUE}
🎯 Top 3 Recommendations
1. {CRITICAL_RECOMMENDATION}
2. {SUGGESTED_IMPROVEMENT}
3. {NICE_TO_HAVE}
✅ Auto-fixable Issues: {COUNT}/{TOTAL}
📄 Detailed Report: .data/reports/pr-review/pr-{NUMBER}-{DATE}.md
⏱️ Review completed in {DURATION}
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
### Detailed Report (Tier 2: Comprehensive File)
Saved to: `.data/reports/pr-review/pr-{NUMBER}-{YYYY-MM-DD}.md`
**Full Report Structure**:
```markdown
# Pull Request Review: #{PR_NUMBER}
**Generated**: {TIMESTAMP}
**Review Time**: {DURATION}
**Reviewer**: Autonomous PR Review Agent v1.0
---
## Table of Contents
1. [Summary](#summary)
2. [Security Analysis](#security-analysis)
3. [Test Coverage](#test-coverage)
4. [Code Review](#code-review)
5. [Performance Analysis](#performance-analysis)
6. [Recommendations](#recommendations)
7. [Related PRs](#related-prs)
8. [Approval Checklist](#approval-checklist)
---
## Summary
**Title**: {PR_TITLE}
**Author**: {AUTHOR}
**Status**: {STATUS}
**Risk Level**: {RISK_LEVEL} ({RISK_SCORE}/100)
### Changes Overview
- **Files Changed**: {COUNT}
- **Lines Added**: +{ADDITIONS}
- **Lines Removed**: -{DELETIONS}
- **Complexity Score**: {SCORE}/100
### Change Categories
-**Features**: {COUNT} files
- {FILE_LIST}
- 🐛 **Bug Fixes**: {COUNT} files
- {FILE_LIST}
- ♻️ **Refactoring**: {COUNT} files
- {FILE_LIST}
- 📝 **Documentation**: {COUNT} files
- {FILE_LIST}
-**Tests**: {COUNT} files
- {FILE_LIST}
### Risk Factors
| Factor | Score | Weight | Impact |
|--------|-------|--------|--------|
| Size | {SCORE}/100 | 20% | {IMPACT} |
| Complexity | {SCORE}/100 | 25% | {IMPACT} |
| Test Coverage | {SCORE}/100 | 25% | {IMPACT} |
| Critical Files | {SCORE}/100 | 20% | {IMPACT} |
| Security | {SCORE}/100 | 10% | {IMPACT} |
---
## Security Analysis
**New Vulnerabilities Detected**: {COUNT}
### Critical Issues (🔴)
#### {VULN_TITLE_1}
- **File**: `{FILE_PATH}`
- **Line**: {LINE_NUMBER}
- **Severity**: CRITICAL
- **CWE**: CWE-{NUMBER} - {CWE_NAME}
- **OWASP**: {OWASP_CATEGORY}
**Vulnerable Code**:
```{LANGUAGE}
{VULNERABLE_CODE}
```
**Description**: {DETAILED_DESCRIPTION}
**Remediation**:
```{LANGUAGE}
{FIXED_CODE}
```
**Explanation**: {EXPLANATION}
**Auto-fixable**: {YES/NO}
[Apply Fix] (One-click button)
---
### High Issues (🟠)
{SIMILAR_STRUCTURE}
### Medium Issues (🟡)
{SIMILAR_STRUCTURE}
### Low Issues (⚪)
{SIMILAR_STRUCTURE}
---
## Test Coverage
**Overall Coverage**: {COVERAGE}% ({DELTA > 0 ? '+' : ''}{DELTA}%)
- **Changed Lines Coverage**: {CHANGED_LINES_COV}%
- **Untested Functions**: {COUNT}
### Coverage by File
| File | Before | After | Delta | Untested Functions |
|------|--------|-------|-------|-------------------|
| {FILE} | {BEFORE}% | {AFTER}% | {DELTA}% | {COUNT} |
### Untested Functions
#### {FILE_PATH}
- `{FUNCTION_NAME}` (line {LINE})
- `{FUNCTION_NAME}` (line {LINE})
**Suggested Test**:
```{LANGUAGE}
{SUGGESTED_TEST_CODE}
```
---
## Code Review
### {FILE_PATH_1}
#### Line {LINE}: {ISSUE_TITLE}
**Severity**: {CRITICAL/HIGH/MEDIUM/LOW}
**Category**: {CODE_QUALITY/BEST_PRACTICE/PERFORMANCE}
**Original Code**:
```{LANGUAGE}
{ORIGINAL_CODE}
```
**Issue**: {DETAILED_ISSUE_DESCRIPTION}
**Suggested Fix**:
```{LANGUAGE}
{SUGGESTED_CODE}
```
**Explanation**: {WHY_THIS_IS_BETTER}
**Auto-fixable**: {YES/NO}
**Confidence**: {CONFIDENCE}%
[Apply Fix] (One-click button)
---
### {FILE_PATH_2}
{SIMILAR_STRUCTURE}
---
## Performance Analysis
**Potential Performance Impact**: {LOW/MEDIUM/HIGH}
### N+1 Query Issues ({COUNT})
#### {FILE}:{LINE} - {FUNCTION_NAME}
**Detected Pattern**: Loop with database query inside
**Current Code**:
```{LANGUAGE}
{CURRENT_CODE}
```
**Optimized Code**:
```{LANGUAGE}
{OPTIMIZED_CODE}
```
**Performance Improvement**: {ESTIMATED_IMPROVEMENT}
---
### Inefficient Algorithms ({COUNT})
{SIMILAR_STRUCTURE}
### Missing Indexes ({COUNT})
{SIMILAR_STRUCTURE}
### Large Data Operations ({COUNT})
{SIMILAR_STRUCTURE}
---
## Recommendations
### 🔴 Critical Actions Required ({COUNT})
1. **{CRITICAL_ISSUE_1}**
- **File**: {FILE}
- **Action**: {SPECIFIC_ACTION}
- **Impact**: {IMPACT_DESCRIPTION}
2. **{CRITICAL_ISSUE_2}**
{SIMILAR_STRUCTURE}
---
### 🟡 Suggested Improvements ({COUNT})
1. **{IMPROVEMENT_1}**
- **File**: {FILE}
- **Benefit**: {BENEFIT_DESCRIPTION}
- **Effort**: {LOW/MEDIUM/HIGH}
2. **{IMPROVEMENT_2}**
{SIMILAR_STRUCTURE}
---
### ⚪ Nice to Have ({COUNT})
1. **{NICE_TO_HAVE_1}**
- **File**: {FILE}
- **Benefit**: {MINOR_BENEFIT}
---
## Related PRs
### PRs Touching Same Files
- **#{PR_NUMBER}**: {TITLE}
- **Author**: {AUTHOR}
- **Status**: {STATUS}
- **Overlap**: {FILE_COUNT} files
- **Potential Conflict**: {YES/NO}
### Similar PRs
- **#{PR_NUMBER}**: {TITLE}
- **Similarity**: {PERCENTAGE}%
- **Lessons Learned**: {INSIGHTS}
### Dependent PRs
- **#{PR_NUMBER}**: {TITLE}
- **Dependency Type**: {BLOCKS/BLOCKED_BY}
---
## Approval Checklist
### Mandatory Requirements
- [ ] All critical security issues resolved
- [ ] Test coverage ≥ 70% for changed lines
- [ ] No new critical vulnerabilities introduced
- [ ] All tests passing
- [ ] Documentation updated
### Code Quality
- [ ] No code quality issues with severity > MEDIUM
- [ ] Best practices followed
- [ ] Performance impact acceptable
- [ ] No technical debt introduced
### Review Sign-off
- [ ] Security review complete
- [ ] Performance review complete
- [ ] Test coverage adequate
- [ ] Code review complete
---
## Review Metadata
**Review Generated**: {TIMESTAMP}
**Review Time**: {DURATION}
**Auto-fixable Issues**: {COUNT}/{TOTAL}
**Confidence Score**: {AVERAGE_CONFIDENCE}%
**Reviewer Agent**: pr-reviewer v1.0
**Security Scanner**: security-auditor v1.0
**AST Analyzer**: ast-analyzer v1.0
**Pattern Learner**: contextual-pattern-learning v3.0
---
## One-Click Fixes Available
{COUNT} issues can be fixed automatically. Apply all fixes with:
```bash
/apply-pr-fixes {PR_NUMBER}
```
Or apply individual fixes:
```bash
/apply-fix {ISSUE_ID}
```
---
**End of Report**
```
---
## Implementation Details
### Git Integration
```python
def fetch_pr_data(pr_identifier):
"""Fetch PR data from git or GitHub CLI."""
if pr_identifier.isdigit():
# Use gh CLI for PR number
pr_data = subprocess.run(
["gh", "pr", "view", pr_identifier, "--json",
"title,author,body,files,additions,deletions"],
capture_output=True
)
else:
# Use git for branch comparison
diff = subprocess.run(
["git", "diff", f"origin/main...{pr_identifier}"],
capture_output=True
)
commits = subprocess.run(
["git", "log", f"origin/main..{pr_identifier}",
"--oneline"],
capture_output=True
)
return parse_pr_data(pr_data)
```
### Fix Application
```python
def apply_fix(issue_id):
"""Apply automated fix for specific issue."""
issue = load_issue(issue_id)
if not issue.auto_fixable:
print("Issue not auto-fixable")
return False
# Apply Edit tool
Edit(
file_path=issue.file,
old_string=issue.original_code,
new_string=issue.suggested_code
)
# Run tests to verify
test_result = run_tests()
if test_result.success:
# Create commit
git_commit(f"Fix: {issue.title}\n\nAuto-applied fix from PR review")
return True
else:
# Rollback
git_checkout(issue.file)
return False
```
## Learning Integration
After each PR review, the learning engine captures:
1. **Review Patterns**:
- Which issues were found in which file types
- Success rate of automated fixes
- False positive rates
2. **Project Patterns**:
- Common issue patterns in this codebase
- Team coding style preferences
- Review thoroughness preferences
3. **Performance Metrics**:
- Review time by PR size
- Issue detection accuracy
- Fix application success rate
4. **Continuous Improvement**:
- Reduce false positives over time
- Improve fix suggestion quality
- Personalize review style to team
## Error Handling
```python
try:
review_result = comprehensive_pr_review(pr_number)
except GitError as e:
print(f"Git error: {e.message}")
print("Ensure you're in a git repository and PR exists")
except SecurityScanError as e:
print(f"Security scan failed: {e.message}")
print("Review will continue with partial results")
except Exception as e:
print(f"Review failed: {e}")
print("Saving partial results...")
save_partial_review(partial_data)
```
## Performance Expectations
| PR Size | Files | Lines | Review Time |
|---------|-------|-------|-------------|
| Small | 1-5 | <200 | 30-60s |
| Medium | 6-15 | 200-500 | 1-2min |
| Large | 16-30 | 500-1000 | 2-4min |
| XLarge | 31+ | 1000+ | 4-8min |
## Follow-up Commands
After review:
```bash
/apply-pr-fixes {PR_NUMBER} # Apply all auto-fixable issues
/apply-fix {ISSUE_ID} # Apply specific fix
/dev:pr-review-history # Show review history
/learn:analytics # Review performance analytics
```
---
This command provides comprehensive, CodeRabbit-level PR review capabilities with deep integration into the autonomous learning system.

766
commands/dev/release.md Normal file
View File

@@ -0,0 +1,766 @@
---
name: dev:release
description: Complete automated release workflow with platform detection (GitHub/GitLab/Bitbucket) and release creation
delegates-to: autonomous-agent:version-release-manager
---
# Release-Dev Command
## Command: `/dev:release`
**CRITICAL**: This command MUST execute ALL steps from version detection through GitHub release creation. The version-release-manager agent MUST complete the entire workflow without stopping early.
Streamlined release preparation and publishing workflow. This command automates the entire release process from version detection to GitHub/GitLab publishing with intelligent validation and automatic documentation updates.
## MANDATORY EXECUTION STEPS
**The version-release-manager agent MUST execute these steps in order and COMPLETE ALL OF THEM:**
### Step 1: Analyze Changes (REQUIRED)
- Run `git log --oneline` to review commits since last release
- Categorize changes (features, fixes, breaking changes)
- Determine version bump type (major/minor/patch)
### Step 2: Determine Version (REQUIRED)
- Read current version from `.claude-plugin/plugin.json`
- Calculate new version based on changes
- Confirm version follows semantic versioning
### Step 3: Update Version Files (REQUIRED)
- Update `.claude-plugin/plugin.json`
- Update `README.md` (all version references)
- Update `CLAUDE.md` (all version references)
- Update any other files with version numbers
### Step 4: Generate Documentation (REQUIRED)
- Generate `CHANGELOG.md` entry from git commits
- Create `RELEASE_NOTES_v{version}.md` with human-readable summary
- Update feature counts and component lists
### Step 5: Validate Consistency (REQUIRED)
- Verify all version numbers match
- Check documentation consistency
- Validate no old version references remain
### Step 6: Git Operations (REQUIRED)
- Stage all changes: `git add .`
- Create commit with message: `release: v{version} - {summary}`
- Create git tag: `git tag v{version}`
- Push to remote: `git push origin main`
- Push tags: `git push origin v{version}`
### Step 7: Create Repository Release (REQUIRED - DO NOT SKIP)
**This step is MANDATORY and MUST be executed based on detected platform:**
#### Step 7a: Detect Repository Platform (REQUIRED)
```bash
# Detect platform from git remote URL
git remote get-url origin
# Identify platform:
# - Contains "github.com" -> GitHub
# - Contains "gitlab.com" or "gitlab" -> GitLab
# - Contains "bitbucket.org" -> Bitbucket
# - Others -> Generic git repository (skip release creation)
```
#### Step 7b: Create Platform Release (REQUIRED if platform detected)
**For GitHub repositories:**
```bash
# Verify GitHub CLI is authenticated
gh auth status
# Create GitHub release
gh release create v{version} \
--title "Release v{version}: {title}" \
--notes-file RELEASE_NOTES_v{version}.md \
--latest
```
**For GitLab repositories:**
```bash
# Verify GitLab CLI is authenticated
glab auth status
# Create GitLab release
glab release create v{version} \
--name "Release v{version}: {title}" \
--notes "$(cat RELEASE_NOTES_v{version}.md)"
```
**For Bitbucket repositories:**
```bash
# Bitbucket uses git tags (already created in Step 6)
# No additional CLI command needed
echo "✅ Release created via git tag (Bitbucket)"
```
**For other git repositories:**
```bash
# Generic git repository without platform-specific features
echo "✅ Release created via git tag"
```
### Step 8: Verify Release (REQUIRED)
**Platform-specific verification:**
**For GitHub:**
```bash
gh release view v{version}
echo "✅ GitHub Release: https://github.com/{owner}/{repo}/releases/tag/v{version}"
```
**For GitLab:**
```bash
glab release view v{version}
echo "✅ GitLab Release: https://gitlab.com/{owner}/{repo}/-/releases/v{version}"
```
**For others:**
```bash
git tag -l v{version}
echo "✅ Git tag created: v{version}"
```
- Store release pattern for learning
**🚀 Quick Release Features:**
- **One-command release**: Automated end-to-end release workflow
- **Smart version detection**: Automatically determines version bump needed
- **Platform detection**: Automatically detects GitHub, GitLab, Bitbucket, or generic git
- **Platform-specific releases**: Creates releases using appropriate CLI (gh, glab, etc.)
- **Documentation sync**: Updates all docs, README, changelog automatically
- **Validation first**: Ensures quality before releasing
- **Auto-commit & push**: Handles all Git operations automatically
- **Multi-platform support**: GitHub, GitLab, Bitbucket, and generic git repositories
## How It Works
The workflow executes 8 MANDATORY steps in sequence:
1. **Analyze Changes**: Reviews all changes since last release
2. **Determine Version**: Auto-detects major/minor/patch based on commits
3. **Update Version Files**: Updates plugin.json, package.json, setup.py, etc.
4. **Sync Documentation**: Updates README, CHANGELOG, RELEASE_NOTES
5. **Validate Consistency**: Cross-checks all files for version consistency
6. **Git Operations**: Commits, tags, and pushes automatically
7. **Create Platform Release**: Detects platform (GitHub/GitLab/Bitbucket) and creates appropriate release
8. **Verify Release**: Confirms release was created successfully on detected platform
## Usage
### Quick Release (Recommended)
```bash
# Fully automated release with smart detection
/dev:release
# This will:
# - Analyze changes and determine version bump
# - Update all version files and documentation
# - Validate consistency across all files
# - Run quality checks (must pass ≥ 85/100)
# - Commit, tag, and push to remote
# - Create GitHub release with comprehensive notes (DEFAULT)
# - Optional: Publish to npm, PyPI, Docker (if specified)
```
### Specify Version Type
```bash
# Force specific version bump
/dev:release --patch # Bug fixes only (x.y.Z)
/dev:release --minor # New features (x.Y.0)
/dev:release --major # Breaking changes (X.0.0)
# Specify exact version
/dev:release --version 2.5.0
```
### Validation Options
```bash
# Skip quality validation (not recommended)
/dev:release --skip-validation
# Set minimum quality threshold (default: 85)
/dev:release --quality-threshold 90
# Dry run (preview without making changes)
/dev:release --dry-run
```
### Documentation Options
```bash
# Update specific documentation
/dev:release --update-changelog
/dev:release --update-readme
/dev:release --generate-release-notes
# Custom release notes file
/dev:release --release-notes ./CUSTOM_NOTES.md
```
### Platform Options
```bash
# GitHub release is now created by DEFAULT
/dev:release # Creates GitHub release automatically
# Additional platforms (optional)
/dev:release --npm # Also publish to npm
/dev:release --pypi # Also publish to PyPI
/dev:release --docker # Build and push Docker image
/dev:release --gitlab # GitLab instead of GitHub
# Multi-platform release
/dev:release --npm --docker # GitHub + npm + Docker
```
### Pre-release Options
```bash
# Create pre-release versions
/dev:release --pre-release alpha
/dev:release --pre-release beta
/dev:release --pre-release rc
# Example: v1.2.3-beta.1
/dev:release --minor --pre-release beta
```
## Workflow Stages
### Stage 1: Change Analysis (5-15 seconds)
Analyzes all changes since last release to determine version bump:
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 CHANGE ANALYSIS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Current Version: v3.3.2
Last Release: 2025-01-15 (9 days ago)
Commits Since Release: 24
Change Breakdown:
+- 🎉 Features: 3 commits
| +- feat: add /dev-auto command
| +- feat: add interactive suggestions
| +- feat: .gitignore management
+- 🐛 Bug Fixes: 2 commits
| +- fix: validation error handling
| +- fix: documentation typos
+- 📚 Documentation: 5 commits
+- ♻️ Refactoring: 1 commit
+- [WARN] Breaking Changes: None
Recommended Version: v3.4.0 (MINOR)
Reason: New features added, no breaking changes
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
### Stage 2: Version Update (5-10 seconds)
Updates version across all project files:
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📦 VERSION UPDATE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Updating version: v3.3.2 -> v3.4.0
Files Updated:
+- ✅ .claude-plugin/plugin.json
+- ✅ README.md (4 references)
+- ✅ CLAUDE.md (2 references)
+- ✅ package.json
+- ✅ docs/IMPLEMENTATION_SUMMARY.md
Total: 5 files, 8 version references updated
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
### Stage 3: Documentation Sync (10-20 seconds)
Automatically updates all documentation:
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📚 DOCUMENTATION SYNC
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
README.md:
+- Updated version badge
+- Updated feature list
+- Updated installation instructions
CHANGELOG.md:
+- Generated from commit history
+- Categorized changes:
| +- Added (3 features)
| +- Fixed (2 bugs)
| +- Changed (1 refactor)
| +- Documentation (5 docs)
+- Release date: 2025-01-24
RELEASE_NOTES.md:
+- Human-readable summary
+- Feature highlights
+- Bug fix details
+- Upgrade instructions
Documentation Status: ✅ All files synchronized
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
### Stage 4: Consistency Validation (10-15 seconds)
Cross-checks all files for consistency:
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ CONSISTENCY VALIDATION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Version Consistency:
+- ✅ All version references match: v3.4.0
+- ✅ No old version numbers found
+- ✅ Version format consistent
Documentation Consistency:
+- ✅ Feature counts match across files
+- ✅ Component counts accurate
+- ✅ All links valid
+- ✅ Examples up-to-date
Structure Consistency:
+- ✅ All agents registered (20)
+- ✅ All skills registered (14)
+- ✅ All commands registered (18)
+- ✅ Plugin.json valid
Validation Score: 100/100 ✅
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
### Stage 5: Quality Check (30-60 seconds)
Runs comprehensive quality validation:
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 QUALITY CHECK
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Code Quality:
+- ✅ Plugin structure valid
+- ✅ All YAML frontmatter valid
+- ✅ All JSON files valid
+- ✅ No syntax errors
Documentation Quality:
+- ✅ README complete (95/100)
+- ✅ All commands documented
+- ✅ All agents documented
+- ✅ Examples working
Standards Compliance:
+- ✅ Follows plugin guidelines
+- ✅ Naming conventions correct
+- ✅ File structure correct
Quality Score: 92/100 ✅ (Threshold: 85)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
### Stage 6: Git Operations (10-20 seconds)
Commits, tags, and pushes automatically:
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔧 GIT OPERATIONS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Staging Changes:
+- ✅ 5 files staged
+- ✅ No unexpected changes
Creating Commit:
+- Message: "release: v3.4.0 - Add /dev-auto and suggestions"
+- Files: 5 modified
+- ✅ Commit created: abc1234
Creating Tag:
+- Tag: v3.4.0
+- Message: "Release v3.4.0"
+- ✅ Tag created
Pushing to Remote:
+- ✅ Pushed to origin/main
+- ✅ Pushed tags
Git Status: ✅ All operations successful
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
### Stage 7: GitHub Repository Release (10-20 seconds)
Creates GitHub release with comprehensive release notes:
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🚀 GITHUB REPOSITORY RELEASE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
GitHub Authentication Check:
+- ✅ GitHub CLI authenticated
+- ✅ Repository access verified
+- ✅ Release permissions confirmed
Creating GitHub Release:
+- Version: v3.4.0
+- Title: "Release v3.4.0: [Release Summary]"
+- Release Notes: Generated from changelog
+- Assets: Source code archive
+- ✅ Published: https://github.com/user/repo/releases/tag/v3.4.0
Release Details:
+- Release Type: [MAJOR/MINOR/PATCH]
+- Changes: [Number] commits included
+- Features: [Number] new features
+- Bug Fixes: [Number] bug fixes
+- Quality Score: [Score]/100
GitHub Release Status: ✅ Successfully created
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
### Stage 8: Optional Platform Publishing (15-30 seconds)
Publishes to additional configured platforms (if specified):
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🚀 OPTIONAL PLATFORM PUBLISHING
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
npm Publishing:
+- Building package...
+- Running npm publish...
+- ✅ Published: https://npmjs.com/package/autonomous-agent@3.4.0
Docker Publishing:
+- Building image: user/autonomous-agent:3.4.0
+- Pushing to Docker Hub...
+- ✅ Published: docker pull user/autonomous-agent:3.4.0
Optional Release Status: ✅ Selected platforms published
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
### Stage 9: Learning Integration (5 seconds)
Stores release pattern for future optimization:
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🧠 LEARNING INTEGRATION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Pattern Stored:
+- Task Type: release
+- Version Bump: minor (3.3.2 -> 3.4.0)
+- Files Updated: 5
+- Quality Score: 92/100
+- Time Taken: 2m 15s
+- ✅ Stored to .claude-patterns/
Future Improvements:
+- Faster documentation sync (learned shortcuts)
+- Better changelog categorization
+- Optimized validation checks
Learning Status: ✅ Pattern captured
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
## Final Summary
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ RELEASE COMPLETE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Release: v3.4.0
Previous: v3.3.2
Type: MINOR (new features)
Summary:
+- 📦 Version updated across 5 files
+- 📚 Documentation synchronized
+- ✅ Validation passed (92/100)
+- 🔧 Git operations successful
+- 🚀 GitHub release created
+- 📦 Optional platforms published (if configured)
+- 🧠 Pattern learned for future
Total Time: 2m 30s
Links:
+- GitHub Release: https://github.com/user/repo/releases/tag/v3.4.0
+- Source Archive: https://github.com/user/repo/archive/refs/tags/v3.4.0.zip
+- npm: https://npmjs.com/package/autonomous-agent@3.4.0 (if published)
+- Docker: docker pull user/autonomous-agent:3.4.0 (if published)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 SUGGESTED NEXT ACTIONS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. Monitor release metrics
-> /learn:performance
2. Announce release to team
-> Draft announcement with highlights
3. Create next milestone
-> Plan features for v3.5.2
4. Update project board
-> Close completed issues
Choose option (1-4) or type custom command:
```
## Version Detection Logic
### Major Version (X.0.0)
Triggered by:
- `BREAKING CHANGE:` in commit messages
- `breaking:` commit type
- Major API changes detected
- Interface modifications
- Schema changes
### Minor Version (x.Y.0)
Triggered by:
- `feat:` commits (new features)
- `feature:` commits
- New functionality added
- Non-breaking additions
### Patch Version (x.y.Z)
Triggered by:
- `fix:` commits (bug fixes)
- `perf:` commits (performance improvements)
- `refactor:` commits (code refactoring)
- `docs:` commits (documentation only)
- `style:` commits (formatting)
- `chore:` commits (maintenance)
## Version File Detection
Automatically detects and updates:
- **.claude-plugin/plugin.json** (Claude plugins)
- **package.json** (Node.js/npm)
- **setup.py** (Python)
- **pyproject.toml** (Python Poetry)
- **Cargo.toml** (Rust)
- **composer.json** (PHP)
- **pom.xml** (Maven/Java)
- **\_\_init\_\_.py** (Python packages)
- **version.py** (Python version files)
- **Dockerfile** (Docker version ARG)
## Documentation Sync
Automatically updates:
- **README.md**: Version badges, feature lists, installation instructions
- **CHANGELOG.md**: Categorized change history with links
- **RELEASE_NOTES.md**: Human-readable release summary
- **docs/\*\*/\*.md**: Any documentation with version references
## Validation Checks
### Version Consistency
- All version references match
- No old version numbers remain
- Version format follows semver
### Documentation Consistency
- Feature counts accurate
- Component counts match
- Links valid and working
- Examples up-to-date
### Quality Standards
- Plugin structure valid
- YAML frontmatter correct
- JSON files parseable
- No syntax errors
### Git Readiness
- Working directory clean
- No merge conflicts
- Remote accessible
- Branch up-to-date
## Integration with Learning System
The `/release-dev` command integrates with the autonomous learning system:
**Pattern Storage**:
- Version bump decisions and reasoning
- Documentation update strategies
- Common consistency issues found
- Optimal release timing
- Platform-specific success rates
**Continuous Improvement**:
- Learn best changelog formats
- Optimize documentation sync speed
- Improve version detection accuracy
- Reduce validation time
- Enhance error prevention
## Integration with Other Commands
### Pre-Release Validation
```bash
# Validate before releasing
/validate:fullstack
/analyze:quality
/dev:release
```
### Post-Release Monitoring
```bash
# Monitor after release
/dev:release
/learn:performance
/learn:analytics
```
### Integrated Workflow
```bash
# Complete development cycle
/dev:auto "add new feature"
# ... development happens ...
/analyze:quality
/dev:release
```
## Platform Requirements
The command automatically detects your repository platform and uses the appropriate CLI tool:
### GitHub Repositories
**Required:**
- **GitHub CLI** (`gh` command) - Install: https://cli.github.com/
- **Authentication**: Run `gh auth login` once
- **Permissions**: Push access and release creation permissions
**Setup:**
```bash
gh auth login
gh auth status
```
### GitLab Repositories
**Required:**
- **GitLab CLI** (`glab` command) - Install: https://gitlab.com/gitlab-org/cli
- **Authentication**: Run `glab auth login` once
- **Permissions**: Push access and release creation permissions
**Setup:**
```bash
glab auth login
glab auth status
```
### Bitbucket Repositories
**No additional CLI required** - Uses git tags only
### Generic Git Repositories
**No additional CLI required** - Uses git tags only
## Troubleshooting
### Platform Release Failed
```bash
# For GitHub
gh auth status
gh repo view
/dev:release --retry
# For GitLab
glab auth status
glab repo view
/dev:release --retry
# For any platform
git remote -v # Check remote URL
git tag -l # List existing tags
```
### Quality Check Failed
```bash
# View detailed quality report
/analyze:quality --verbose
# Fix issues and retry
/dev:release --retry
# Skip validation (not recommended)
/dev:release --skip-validation --force
```
### Version Conflict
```bash
# Reset version detection
/dev:release --version 3.4.0 --force
# Manual version update
edit .claude-plugin/plugin.json
/dev:release --skip-version-update
```
### Git Operation Failed
```bash
# Check Git status
git status
git log --oneline -5
# Retry with verbose logging
/dev:release --verbose --retry
```
### Platform Publishing Failed
```bash
# Check authentication
gh auth status # GitHub
glab auth status # GitLab
npm whoami # npm
docker info # Docker
# Retry specific platform
/dev:release --github --retry
```
## Best Practices
### Pre-Release Checklist
- [ ] All changes committed and pushed
- [ ] Tests passing locally
- [ ] Documentation reflects changes
- [ ] No TODOs or FIXMEs in critical code
- [ ] Version bump type is appropriate
- [ ] Release notes are meaningful
### Release Frequency
- **Major**: Every 6-12 months (breaking changes)
- **Minor**: Every 2-4 weeks (new features)
- **Patch**: As needed (bug fixes)
### Communication
- Notify team before major/minor releases
- Share release notes with stakeholders
- Announce on relevant channels
- Update documentation sites
---
**Version**: 1.1.0
**Integration**: Works with version-release-manager agent and git-automation skill
**Platform**: Cross-platform (Windows, Linux, Mac)
**Dependencies**: Git, GitHub CLI (gh) REQUIRED for release creation, GitLab CLI (glab) optional