@paulduvall/claude-dev-toolkit 0.0.1-alpha.2 → 0.0.1-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +88 -37
- package/bin/claude-commands +307 -65
- package/commands/active/xarchitecture.md +393 -0
- package/commands/active/xconfig.md +127 -0
- package/commands/active/xcontinue.md +92 -0
- package/commands/active/xdebug.md +130 -0
- package/commands/active/xdocs.md +178 -0
- package/commands/active/xexplore.md +94 -0
- package/commands/active/xgit.md +149 -0
- package/commands/active/xpipeline.md +152 -0
- package/commands/active/xquality.md +96 -0
- package/commands/active/xrefactor.md +198 -0
- package/commands/active/xrelease.md +142 -0
- package/commands/active/xsecurity.md +92 -0
- package/commands/active/xspec.md +174 -0
- package/commands/active/xtdd.md +151 -0
- package/commands/active/xtest.md +89 -0
- package/commands/active/xverify.md +80 -0
- package/commands/experiments/xact.md +742 -0
- package/commands/experiments/xanalytics.md +113 -0
- package/commands/experiments/xanalyze.md +70 -0
- package/commands/experiments/xapi.md +161 -0
- package/commands/experiments/xatomic.md +112 -0
- package/commands/experiments/xaws.md +85 -0
- package/commands/experiments/xcicd.md +337 -0
- package/commands/experiments/xcommit.md +122 -0
- package/commands/experiments/xcompliance.md +182 -0
- package/commands/experiments/xconstraints.md +89 -0
- package/commands/experiments/xcoverage.md +90 -0
- package/commands/experiments/xdb.md +102 -0
- package/commands/experiments/xdesign.md +121 -0
- package/commands/experiments/xdevcontainer.md +238 -0
- package/commands/experiments/xevaluate.md +111 -0
- package/commands/experiments/xfootnote.md +12 -0
- package/commands/experiments/xgenerate.md +117 -0
- package/commands/experiments/xgovernance.md +149 -0
- package/commands/experiments/xgreen.md +66 -0
- package/commands/experiments/xiac.md +118 -0
- package/commands/experiments/xincident.md +137 -0
- package/commands/experiments/xinfra.md +115 -0
- package/commands/experiments/xknowledge.md +115 -0
- package/commands/experiments/xmaturity.md +120 -0
- package/commands/experiments/xmetrics.md +118 -0
- package/commands/experiments/xmonitoring.md +128 -0
- package/commands/experiments/xnew.md +903 -0
- package/commands/experiments/xobservable.md +114 -0
- package/commands/experiments/xoidc.md +165 -0
- package/commands/experiments/xoptimize.md +115 -0
- package/commands/experiments/xperformance.md +112 -0
- package/commands/experiments/xplanning.md +131 -0
- package/commands/experiments/xpolicy.md +115 -0
- package/commands/experiments/xproduct.md +98 -0
- package/commands/experiments/xreadiness.md +75 -0
- package/commands/experiments/xred.md +55 -0
- package/commands/experiments/xrisk.md +128 -0
- package/commands/experiments/xrules.md +124 -0
- package/commands/experiments/xsandbox.md +120 -0
- package/commands/experiments/xscan.md +102 -0
- package/commands/experiments/xsetup.md +123 -0
- package/commands/experiments/xtemplate.md +116 -0
- package/commands/experiments/xtrace.md +212 -0
- package/commands/experiments/xux.md +171 -0
- package/commands/experiments/xvalidate.md +104 -0
- package/commands/experiments/xworkflow.md +113 -0
- package/hooks/.smellrc.example.json +19 -0
- package/hooks/README.md +263 -0
- package/hooks/check-commit-signing.py +127 -0
- package/hooks/check-complexity.py +38 -0
- package/hooks/check-security.py +37 -0
- package/hooks/claude-wrapper.sh +29 -0
- package/hooks/config.py +110 -0
- package/hooks/file-logger.sh +100 -0
- package/hooks/lib/argument-parser.sh +427 -0
- package/hooks/lib/config-constants.sh +230 -0
- package/hooks/lib/context-manager.sh +560 -0
- package/hooks/lib/error-handler.sh +423 -0
- package/hooks/lib/execution-engine.sh +444 -0
- package/hooks/lib/execution-results.sh +113 -0
- package/hooks/lib/execution-simulation.sh +114 -0
- package/hooks/lib/field-validators.sh +104 -0
- package/hooks/lib/file-utils.sh +398 -0
- package/hooks/lib/subagent-discovery.sh +468 -0
- package/hooks/lib/subagent-validator.sh +407 -0
- package/hooks/lib/validation-reporter.sh +134 -0
- package/hooks/on-error-debug.sh +226 -0
- package/hooks/pre-commit-quality.sh +204 -0
- package/hooks/pre-commit-test-runner.sh +132 -0
- package/hooks/pre-write-security.sh +115 -0
- package/hooks/prevent-credential-exposure.sh +279 -0
- package/hooks/security_bandit.py +177 -0
- package/hooks/security_checks.py +97 -0
- package/hooks/security_secrets.py +81 -0
- package/hooks/security_trojan.py +61 -0
- package/hooks/settings.example.json +52 -0
- package/hooks/smell_checks.py +238 -0
- package/hooks/smell_javascript.py +231 -0
- package/hooks/smell_python.py +110 -0
- package/hooks/smell_ruff.py +70 -0
- package/hooks/smell_types.py +72 -0
- package/hooks/subagent-trigger-simple.sh +202 -0
- package/hooks/subagent-trigger.sh +253 -0
- package/hooks/suppression.py +82 -0
- package/hooks/tab-color.sh +70 -0
- package/hooks/verify-before-edit.sh +135 -0
- package/lib/backup-restore-command.js +140 -0
- package/lib/base/base-command.js +252 -0
- package/lib/base/command-result.js +184 -0
- package/lib/config/constants.js +255 -0
- package/lib/config.js +48 -6
- package/lib/configure-command.js +428 -0
- package/lib/dependency-validator.js +64 -5
- package/lib/hook-installer-core.js +2 -2
- package/lib/installation-instruction-generator.js +213 -495
- package/lib/installer.js +134 -56
- package/lib/oidc-command.js +740 -0
- package/lib/services/backup-list-service.js +226 -0
- package/lib/services/backup-service.js +230 -0
- package/lib/services/command-installer-service.js +217 -0
- package/lib/services/logger-service.js +201 -0
- package/lib/services/package-manager-service.js +319 -0
- package/lib/services/platform-instruction-service.js +294 -0
- package/lib/services/recovery-instruction-service.js +348 -0
- package/lib/services/restore-service.js +221 -0
- package/lib/setup-command.js +359 -0
- package/lib/setup-wizard.js +155 -262
- package/lib/uninstall-command.js +100 -0
- package/lib/utils/claude-path-config.js +184 -0
- package/lib/utils/file-system-utils.js +152 -0
- package/lib/utils.js +8 -4
- package/lib/verify-command.js +430 -0
- package/package.json +7 -3
- package/scripts/postinstall.js +172 -157
- package/subagents/debug-specialist.md +7 -0
- package/templates/README.md +115 -0
- package/templates/basic-settings.json +30 -0
- package/templates/comprehensive-settings.json +57 -0
- package/templates/global-claude.md +344 -0
- package/templates/hybrid-hook-config.yaml +132 -0
- package/templates/security-focused-settings.json +62 -0
- package/templates/subagent-hooks.yaml +188 -0
- package/lib/package-manager-service.js +0 -270
- package/subagents/debug-context.md +0 -197
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run code quality checks and fixes (defaults to all checks)
|
|
3
|
+
tags: [quality, formatting, linting, type-checking]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Quality Analysis
|
|
7
|
+
|
|
8
|
+
Run comprehensive code quality analysis with smart defaults. No parameters needed for basic usage.
|
|
9
|
+
|
|
10
|
+
## Usage Examples
|
|
11
|
+
|
|
12
|
+
**Basic usage (runs all checks):**
|
|
13
|
+
```
|
|
14
|
+
/xquality
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Quick fix common issues:**
|
|
18
|
+
```
|
|
19
|
+
/xquality fix
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Generate detailed report:**
|
|
23
|
+
```
|
|
24
|
+
/xquality report
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Help and options:**
|
|
28
|
+
```
|
|
29
|
+
/xquality help
|
|
30
|
+
/xquality --help
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Implementation
|
|
34
|
+
|
|
35
|
+
If $ARGUMENTS contains "help" or "--help":
|
|
36
|
+
Display this usage information and exit.
|
|
37
|
+
|
|
38
|
+
First, examine the project structure and available tools:
|
|
39
|
+
!ls -la | grep -E "(pyproject.toml|setup.py|requirements.txt|package.json|composer.json|go.mod)"
|
|
40
|
+
!python -c "import ruff" 2>/dev/null && echo "✓ Ruff available" || echo "⚠ Ruff not available"
|
|
41
|
+
!python -c "import mypy" 2>/dev/null && echo "✓ MyPy available" || echo "⚠ MyPy not available"
|
|
42
|
+
|
|
43
|
+
Determine what to do based on $ARGUMENTS (default to comprehensive analysis if no arguments):
|
|
44
|
+
|
|
45
|
+
**Mode 1: Default Analysis (no arguments or "check")**
|
|
46
|
+
If $ARGUMENTS is empty or contains "check":
|
|
47
|
+
!find . -name "*.py" -o -name "*.js" -o -name "*.ts" | head -10
|
|
48
|
+
|
|
49
|
+
Run comprehensive quality analysis:
|
|
50
|
+
1. **Format Check**: Verify code formatting consistency
|
|
51
|
+
2. **Lint Analysis**: Check for bugs, style issues, and best practices
|
|
52
|
+
3. **Type Safety**: Validate type annotations and consistency
|
|
53
|
+
4. **Code Metrics**: Calculate complexity and maintainability scores
|
|
54
|
+
|
|
55
|
+
!ruff check . --statistics 2>/dev/null || echo "Ruff not available - install with: pip install ruff"
|
|
56
|
+
!ruff format . --check 2>/dev/null || echo "Formatting check skipped"
|
|
57
|
+
!python -c "import mypy" && mypy . --ignore-missing-imports 2>/dev/null || echo "MyPy not available - install with: pip install mypy"
|
|
58
|
+
|
|
59
|
+
**Mode 2: Quick Fix (argument: "fix")**
|
|
60
|
+
If $ARGUMENTS contains "fix":
|
|
61
|
+
!ruff check . --fix-only 2>/dev/null && echo "✓ Auto-fixed linting issues" || echo "No auto-fixable issues found"
|
|
62
|
+
!ruff format . 2>/dev/null && echo "✓ Applied code formatting" || echo "No formatting changes needed"
|
|
63
|
+
|
|
64
|
+
Apply automated improvements:
|
|
65
|
+
- Fix common linting violations automatically
|
|
66
|
+
- Apply consistent code formatting
|
|
67
|
+
- Organize imports and remove unused ones
|
|
68
|
+
- Report what was changed
|
|
69
|
+
|
|
70
|
+
**Mode 3: Detailed Report (argument: "report")**
|
|
71
|
+
If $ARGUMENTS contains "report":
|
|
72
|
+
!find . -name "*.py" | wc -l
|
|
73
|
+
!grep -r "TODO\|FIXME\|XXX" . --include="*.py" --include="*.js" --include="*.ts" | wc -l 2>/dev/null || echo "0"
|
|
74
|
+
|
|
75
|
+
Generate comprehensive metrics:
|
|
76
|
+
- Total lines of code and file counts
|
|
77
|
+
- Technical debt indicators (TODOs, FIXMEs)
|
|
78
|
+
- Quality score and recommendations
|
|
79
|
+
- Comparison to industry standards
|
|
80
|
+
|
|
81
|
+
## Analysis and Reporting
|
|
82
|
+
|
|
83
|
+
Think step by step about the code quality findings and provide:
|
|
84
|
+
|
|
85
|
+
1. **Quality Summary**: Overall assessment with clear pass/fail status
|
|
86
|
+
2. **Critical Issues**: Problems that need immediate attention
|
|
87
|
+
3. **Quick Wins**: Easy fixes that provide high impact
|
|
88
|
+
4. **Next Steps**: Prioritized action items for improvement
|
|
89
|
+
|
|
90
|
+
Generate a clear, actionable quality report showing:
|
|
91
|
+
- ✅ What's working well
|
|
92
|
+
- ⚠️ What needs attention
|
|
93
|
+
- 🔧 What can be auto-fixed
|
|
94
|
+
- 📈 Improvement recommendations
|
|
95
|
+
|
|
96
|
+
Keep the output focused and actionable, avoiding overwhelming technical details unless specifically requested with "report" argument.
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Interactive refactoring assistant based on Martin Fowler's catalog and project-specific rules for code smell detection
|
|
3
|
+
tags: [refactoring, code-smells, quality, patterns, analysis]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Analyze code for refactoring opportunities based on the arguments provided in $ARGUMENTS.
|
|
7
|
+
|
|
8
|
+
## Usage Examples
|
|
9
|
+
|
|
10
|
+
**Basic refactoring analysis:**
|
|
11
|
+
```
|
|
12
|
+
/xrefactor
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Detect code smells:**
|
|
16
|
+
```
|
|
17
|
+
/xrefactor --smell
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Find duplicate code:**
|
|
21
|
+
```
|
|
22
|
+
/xrefactor --duplicates
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Help and options:**
|
|
26
|
+
```
|
|
27
|
+
/xrefactor --help
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Implementation
|
|
31
|
+
|
|
32
|
+
If $ARGUMENTS contains "help" or "--help":
|
|
33
|
+
Display this usage information and exit.
|
|
34
|
+
|
|
35
|
+
First, examine the project structure for Python files to analyze:
|
|
36
|
+
!find . -name "*.py" -type f | grep -v __pycache__ | head -20
|
|
37
|
+
!ls -la src/ app/ lib/ 2>/dev/null || echo "No standard Python directories found"
|
|
38
|
+
!python --version 2>/dev/null || echo "Python not available"
|
|
39
|
+
|
|
40
|
+
Based on $ARGUMENTS, perform the appropriate refactoring analysis:
|
|
41
|
+
|
|
42
|
+
## 1. Code Smell Detection
|
|
43
|
+
|
|
44
|
+
If analyzing code smells (--smell, --analyze, --detect):
|
|
45
|
+
!find . -name "*.py" | xargs wc -l | sort -nr | head -10
|
|
46
|
+
!python -c "import ast; print('AST analysis available')" 2>/dev/null || echo "Python AST not available"
|
|
47
|
+
!grep -r "def " . --include="*.py" | wc -l
|
|
48
|
+
!grep -r "class " . --include="*.py" | wc -l
|
|
49
|
+
|
|
50
|
+
Detect common code smells:
|
|
51
|
+
- Long methods and large classes
|
|
52
|
+
- Duplicate code patterns
|
|
53
|
+
- Complex conditional logic
|
|
54
|
+
- Missing error handling
|
|
55
|
+
- Hardcoded configuration values
|
|
56
|
+
|
|
57
|
+
## 2. Bloater Detection
|
|
58
|
+
|
|
59
|
+
If detecting bloaters (--bloaters, --long-methods, --large-classes):
|
|
60
|
+
!python -c "
|
|
61
|
+
import ast
|
|
62
|
+
import os
|
|
63
|
+
for root, dirs, files in os.walk('.'):
|
|
64
|
+
for file in files:
|
|
65
|
+
if file.endswith('.py'):
|
|
66
|
+
filepath = os.path.join(root, file)
|
|
67
|
+
try:
|
|
68
|
+
with open(filepath, 'r') as f:
|
|
69
|
+
tree = ast.parse(f.read())
|
|
70
|
+
for node in ast.walk(tree):
|
|
71
|
+
if isinstance(node, ast.FunctionDef):
|
|
72
|
+
if hasattr(node, 'end_lineno') and node.end_lineno - node.lineno > 20:
|
|
73
|
+
print(f'Long method: {node.name} in {filepath} ({node.end_lineno - node.lineno} lines)')
|
|
74
|
+
except: pass
|
|
75
|
+
" 2>/dev/null || echo "Python AST analysis not available"
|
|
76
|
+
|
|
77
|
+
Analyze bloater patterns:
|
|
78
|
+
- Methods longer than 20-30 lines
|
|
79
|
+
- Classes with more than 200 lines
|
|
80
|
+
- Parameter lists with more than 3-4 parameters
|
|
81
|
+
- Data classes with too many fields
|
|
82
|
+
- Large conditional expressions
|
|
83
|
+
|
|
84
|
+
## 3. Change Preventer Detection
|
|
85
|
+
|
|
86
|
+
If detecting change preventers (--change-preventers, --coupling):
|
|
87
|
+
!grep -r "import " . --include="*.py" | wc -l
|
|
88
|
+
!python -c "
|
|
89
|
+
import ast
|
|
90
|
+
import os
|
|
91
|
+
for root, dirs, files in os.walk('.'):
|
|
92
|
+
for file in files:
|
|
93
|
+
if file.endswith('.py'):
|
|
94
|
+
filepath = os.path.join(root, file)
|
|
95
|
+
try:
|
|
96
|
+
with open(filepath, 'r') as f:
|
|
97
|
+
content = f.read()
|
|
98
|
+
if content.count('if ') > 10:
|
|
99
|
+
print(f'High conditional complexity in {filepath}')
|
|
100
|
+
except: pass
|
|
101
|
+
" 2>/dev/null
|
|
102
|
+
|
|
103
|
+
Identify change preventers:
|
|
104
|
+
- Divergent change patterns
|
|
105
|
+
- Shotgun surgery indicators
|
|
106
|
+
- Parallel inheritance hierarchies
|
|
107
|
+
- Refused bequest patterns
|
|
108
|
+
- Alternative classes with different interfaces
|
|
109
|
+
|
|
110
|
+
## 4. Dispensable Code Detection
|
|
111
|
+
|
|
112
|
+
If detecting dispensables (--dispensables, --dead-code, --duplicates):
|
|
113
|
+
!grep -r "TODO\|FIXME\|XXX" . --include="*.py" | wc -l
|
|
114
|
+
!find . -name "*.py" -exec grep -l "^#.*unused\|^#.*deprecated" {} \; | wc -l
|
|
115
|
+
!python -c "
|
|
116
|
+
import ast
|
|
117
|
+
import os
|
|
118
|
+
from collections import defaultdict
|
|
119
|
+
|
|
120
|
+
class_methods = defaultdict(list)
|
|
121
|
+
for root, dirs, files in os.walk('.'):
|
|
122
|
+
for file in files:
|
|
123
|
+
if file.endswith('.py'):
|
|
124
|
+
filepath = os.path.join(root, file)
|
|
125
|
+
try:
|
|
126
|
+
with open(filepath, 'r') as f:
|
|
127
|
+
tree = ast.parse(f.read())
|
|
128
|
+
for node in ast.walk(tree):
|
|
129
|
+
if isinstance(node, ast.ClassDef):
|
|
130
|
+
methods = [n.name for n in node.body if isinstance(n, ast.FunctionDef)]
|
|
131
|
+
if len(methods) < 2:
|
|
132
|
+
print(f'Potential lazy class: {node.name} in {filepath}')
|
|
133
|
+
except: pass
|
|
134
|
+
" 2>/dev/null
|
|
135
|
+
|
|
136
|
+
Find dispensable code:
|
|
137
|
+
- Dead code and unused variables
|
|
138
|
+
- Duplicate code blocks
|
|
139
|
+
- Lazy classes with minimal functionality
|
|
140
|
+
- Data classes without behavior
|
|
141
|
+
- Comments and temporary fields
|
|
142
|
+
|
|
143
|
+
## 5. Coupler Detection
|
|
144
|
+
|
|
145
|
+
If detecting couplers (--couplers, --dependencies):
|
|
146
|
+
!find . -name "*.py" | xargs grep -l "\.[a-zA-Z_][a-zA-Z0-9_]*\.[a-zA-Z_]" | head -10
|
|
147
|
+
!python -c "
|
|
148
|
+
import ast
|
|
149
|
+
import os
|
|
150
|
+
for root, dirs, files in os.walk('.'):
|
|
151
|
+
for file in files:
|
|
152
|
+
if file.endswith('.py'):
|
|
153
|
+
filepath = os.path.join(root, file)
|
|
154
|
+
try:
|
|
155
|
+
with open(filepath, 'r') as f:
|
|
156
|
+
content = f.read()
|
|
157
|
+
# Look for feature envy patterns (lots of method calls on other objects)
|
|
158
|
+
if content.count('.') > len(content.split('\n')) * 0.3:
|
|
159
|
+
print(f'Potential feature envy in {filepath}')
|
|
160
|
+
except: pass
|
|
161
|
+
" 2>/dev/null
|
|
162
|
+
|
|
163
|
+
Detect coupling issues:
|
|
164
|
+
- Feature envy patterns
|
|
165
|
+
- Inappropriate intimacy between classes
|
|
166
|
+
- Message chains and law of Demeter violations
|
|
167
|
+
- Middle man classes
|
|
168
|
+
- Temporary field usage
|
|
169
|
+
|
|
170
|
+
Think step by step about refactoring opportunities and provide:
|
|
171
|
+
|
|
172
|
+
1. **Code Smell Analysis**:
|
|
173
|
+
- Identified code smells and their severity
|
|
174
|
+
- Location and context of problematic code
|
|
175
|
+
- Impact assessment on maintainability
|
|
176
|
+
- Priority ranking for refactoring
|
|
177
|
+
|
|
178
|
+
2. **Refactoring Strategy**:
|
|
179
|
+
- Recommended refactoring techniques
|
|
180
|
+
- Step-by-step refactoring approach
|
|
181
|
+
- Risk assessment and mitigation
|
|
182
|
+
- Testing strategy during refactoring
|
|
183
|
+
|
|
184
|
+
3. **Implementation Plan**:
|
|
185
|
+
- Prioritized refactoring tasks
|
|
186
|
+
- Dependencies between refactoring steps
|
|
187
|
+
- Timeline and effort estimation
|
|
188
|
+
- Team coordination requirements
|
|
189
|
+
|
|
190
|
+
4. **Quality Improvements**:
|
|
191
|
+
- Expected code quality improvements
|
|
192
|
+
- Maintainability and readability gains
|
|
193
|
+
- Performance impact assessment
|
|
194
|
+
- Long-term technical debt reduction
|
|
195
|
+
|
|
196
|
+
Generate comprehensive refactoring analysis with smell detection, improvement recommendations, implementation guidance, and quality metrics.
|
|
197
|
+
|
|
198
|
+
If no specific operation is provided, perform comprehensive code smell detection and recommend refactoring priorities based on Martin Fowler's refactoring catalog and current code analysis.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Comprehensive release management with planning, coordination, deployment automation, and monitoring
|
|
3
|
+
tags: [release, deployment, planning, coordination, automation, monitoring, rollback]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Manage comprehensive release operations based on the arguments provided in $ARGUMENTS.
|
|
7
|
+
|
|
8
|
+
## Usage Examples
|
|
9
|
+
|
|
10
|
+
**Basic release analysis:**
|
|
11
|
+
```
|
|
12
|
+
/xrelease
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Plan release:**
|
|
16
|
+
```
|
|
17
|
+
/xrelease --plan
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Deploy release:**
|
|
21
|
+
```
|
|
22
|
+
/xrelease --deploy
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Help and options:**
|
|
26
|
+
```
|
|
27
|
+
/xrelease --help
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Implementation
|
|
31
|
+
|
|
32
|
+
If $ARGUMENTS contains "help" or "--help":
|
|
33
|
+
Display this usage information and exit.
|
|
34
|
+
|
|
35
|
+
First, examine the project release environment and status:
|
|
36
|
+
!git tag --sort=-version:refname | head -10 2>/dev/null || echo "No git tags found"
|
|
37
|
+
!git log --oneline -10 2>/dev/null || echo "No git repository found"
|
|
38
|
+
!find . -name "CHANGELOG*" -o -name "RELEASE*" | head -3
|
|
39
|
+
!ls -la package.json setup.py pyproject.toml 2>/dev/null || echo "No version files found"
|
|
40
|
+
|
|
41
|
+
Based on $ARGUMENTS, perform the appropriate release operation:
|
|
42
|
+
|
|
43
|
+
## 1. Release Planning and Preparation
|
|
44
|
+
|
|
45
|
+
If planning release (--plan):
|
|
46
|
+
!git log --since="$(git describe --tags --abbrev=0 2>/dev/null)..HEAD" --oneline | wc -l 2>/dev/null || echo "No previous releases"
|
|
47
|
+
!find . -name "*.md" | xargs grep -l "BREAKING" | head -3 2>/dev/null || echo "No breaking changes documented"
|
|
48
|
+
!git diff --name-only HEAD~10..HEAD | head -10 2>/dev/null
|
|
49
|
+
|
|
50
|
+
Create comprehensive release plan:
|
|
51
|
+
- Analyze changes since last release
|
|
52
|
+
- Identify breaking changes and dependencies
|
|
53
|
+
- Assess release readiness criteria
|
|
54
|
+
- Generate release timeline and milestones
|
|
55
|
+
- Coordinate stakeholder approvals
|
|
56
|
+
|
|
57
|
+
## 2. Release Notes and Documentation
|
|
58
|
+
|
|
59
|
+
If generating release notes (--notes):
|
|
60
|
+
!git log --since="$(git describe --tags --abbrev=0 2>/dev/null)" --pretty=format:"%h %s" 2>/dev/null | head -20
|
|
61
|
+
!find . -name "CHANGELOG*" | head -1
|
|
62
|
+
!git log --grep="feat\|fix\|BREAKING" --oneline --since="$(git describe --tags --abbrev=0 2>/dev/null)" 2>/dev/null | head -10
|
|
63
|
+
|
|
64
|
+
Generate release documentation:
|
|
65
|
+
- Extract commit messages and categorize changes
|
|
66
|
+
- Identify features, fixes, and breaking changes
|
|
67
|
+
- Create formatted changelog entries
|
|
68
|
+
- Generate migration guides for breaking changes
|
|
69
|
+
- Prepare stakeholder communications
|
|
70
|
+
|
|
71
|
+
## 3. Deployment and Delivery
|
|
72
|
+
|
|
73
|
+
If deploying release (--deploy):
|
|
74
|
+
!docker --version 2>/dev/null || echo "Docker not available"
|
|
75
|
+
!kubectl version --client 2>/dev/null || echo "Kubernetes not available"
|
|
76
|
+
!find . -name "Dockerfile" -o -name "docker-compose.yml" | head -3
|
|
77
|
+
|
|
78
|
+
Execute release deployment:
|
|
79
|
+
- Validate deployment environment
|
|
80
|
+
- Execute deployment strategy (blue-green, canary, rolling)
|
|
81
|
+
- Monitor deployment progress and health
|
|
82
|
+
- Coordinate feature flag rollouts
|
|
83
|
+
- Validate deployment success criteria
|
|
84
|
+
|
|
85
|
+
## 4. Rollback and Recovery
|
|
86
|
+
|
|
87
|
+
If executing rollback (--rollback):
|
|
88
|
+
!git tag --sort=-version:refname | head -5
|
|
89
|
+
!docker images --format "table {{.Repository}}:{{.Tag}}" 2>/dev/null | head -5
|
|
90
|
+
!kubectl get deployments 2>/dev/null || echo "No Kubernetes deployments"
|
|
91
|
+
|
|
92
|
+
Execute rollback procedures:
|
|
93
|
+
- Identify target rollback version
|
|
94
|
+
- Validate rollback compatibility
|
|
95
|
+
- Execute rollback deployment
|
|
96
|
+
- Verify system stability post-rollback
|
|
97
|
+
- Document rollback reasons and lessons
|
|
98
|
+
|
|
99
|
+
## 5. Quality Gates and Validation
|
|
100
|
+
|
|
101
|
+
If validating release (--validate, --gate):
|
|
102
|
+
!python -m pytest --tb=short 2>/dev/null || npm test 2>/dev/null || echo "No tests configured"
|
|
103
|
+
!find . -name "*security*" -o -name "*audit*" | head -3
|
|
104
|
+
!git log --grep="security\|vulnerability" --oneline | head -5
|
|
105
|
+
|
|
106
|
+
Validate release quality:
|
|
107
|
+
- Execute comprehensive test suites
|
|
108
|
+
- Run security scans and audits
|
|
109
|
+
- Check compliance requirements
|
|
110
|
+
- Validate performance benchmarks
|
|
111
|
+
- Ensure documentation completeness
|
|
112
|
+
|
|
113
|
+
Think step by step about release management requirements and provide:
|
|
114
|
+
|
|
115
|
+
1. **Release Planning Assessment**:
|
|
116
|
+
- Current release readiness status
|
|
117
|
+
- Change analysis and impact assessment
|
|
118
|
+
- Dependency validation and coordination
|
|
119
|
+
- Risk evaluation and mitigation strategies
|
|
120
|
+
|
|
121
|
+
2. **Documentation and Communication**:
|
|
122
|
+
- Release notes generation from commits
|
|
123
|
+
- Breaking change identification and documentation
|
|
124
|
+
- Stakeholder communication planning
|
|
125
|
+
- Migration guide preparation
|
|
126
|
+
|
|
127
|
+
3. **Deployment Strategy**:
|
|
128
|
+
- Deployment method selection and validation
|
|
129
|
+
- Environment readiness verification
|
|
130
|
+
- Rollback plan preparation
|
|
131
|
+
- Monitoring and health check configuration
|
|
132
|
+
|
|
133
|
+
4. **Quality Assurance**:
|
|
134
|
+
- Quality gate validation
|
|
135
|
+
- Security and compliance verification
|
|
136
|
+
- Performance benchmark validation
|
|
137
|
+
- Post-release monitoring setup
|
|
138
|
+
|
|
139
|
+
Generate comprehensive release management with automated planning, coordinated deployment, quality validation, and monitoring integration.
|
|
140
|
+
|
|
141
|
+
If no specific operation is provided, analyze current release status and recommend next steps based on project state and release readiness criteria.
|
|
142
|
+
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run security scans with smart defaults (scans all areas if no arguments)
|
|
3
|
+
tags: [security, vulnerabilities, scanning]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Security Analysis
|
|
7
|
+
|
|
8
|
+
Perform comprehensive security scanning with intelligent defaults. No parameters needed for basic usage.
|
|
9
|
+
|
|
10
|
+
## Usage Examples
|
|
11
|
+
|
|
12
|
+
**Basic usage (runs all security checks):**
|
|
13
|
+
```
|
|
14
|
+
/xsecurity
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Quick secret scan:**
|
|
18
|
+
```
|
|
19
|
+
/xsecurity secrets
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Dependency vulnerability check:**
|
|
23
|
+
```
|
|
24
|
+
/xsecurity deps
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Help and options:**
|
|
28
|
+
```
|
|
29
|
+
/xsecurity help
|
|
30
|
+
/xsecurity --help
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Implementation
|
|
34
|
+
|
|
35
|
+
If $ARGUMENTS contains "help" or "--help":
|
|
36
|
+
Display this usage information and exit.
|
|
37
|
+
|
|
38
|
+
Start by detecting project type and available security tools:
|
|
39
|
+
!ls -la | grep -E "(package.json|requirements.txt|go.mod|Gemfile|pom.xml|composer.json)"
|
|
40
|
+
|
|
41
|
+
Determine scan scope based on $ARGUMENTS (default to comprehensive scan):
|
|
42
|
+
|
|
43
|
+
**Mode 1: Comprehensive Scan (no arguments or "all")**
|
|
44
|
+
If $ARGUMENTS is empty or contains "all":
|
|
45
|
+
|
|
46
|
+
Run complete security analysis:
|
|
47
|
+
1. **Secret Detection**: Scan for exposed credentials and API keys
|
|
48
|
+
2. **Dependency Check**: Check for known vulnerable dependencies
|
|
49
|
+
3. **Code Analysis**: Look for common security anti-patterns
|
|
50
|
+
4. **Configuration Review**: Check for insecure settings
|
|
51
|
+
|
|
52
|
+
!git grep -i -E "(api[_-]?key|secret|password|token)" --no-index 2>/dev/null | grep -v -E "(test|spec|mock|example)" | head -10 || echo "✓ No secrets found in code"
|
|
53
|
+
!pip-audit 2>/dev/null || npm audit --audit-level=high 2>/dev/null || echo "Dependency scan: install pip-audit or npm for dependency checks"
|
|
54
|
+
!grep -r -E "(eval\(|exec\(|system\()" . --include="*.py" --include="*.js" 2>/dev/null | head -5 || echo "✓ No dangerous code patterns found"
|
|
55
|
+
|
|
56
|
+
**Mode 2: Secret Scan Only (argument: "secrets")**
|
|
57
|
+
If $ARGUMENTS contains "secrets":
|
|
58
|
+
!git grep -i -E "(api[_-]?key|secret|password|token|credential)" --no-index 2>/dev/null | grep -v -E "(test|spec|mock|example)" | head -15
|
|
59
|
+
!git log -p --all -S"api_key" --pickaxe-all 2>/dev/null | grep -E "^\+.*api_key" | head -5 || echo "✓ No secrets in git history"
|
|
60
|
+
|
|
61
|
+
Focus on credential exposure:
|
|
62
|
+
- Scan current files for hardcoded secrets
|
|
63
|
+
- Check git history for accidentally committed credentials
|
|
64
|
+
- Identify potential credential leaks
|
|
65
|
+
- Provide immediate remediation steps
|
|
66
|
+
|
|
67
|
+
**Mode 3: Dependency Check (argument: "deps")**
|
|
68
|
+
If $ARGUMENTS contains "deps":
|
|
69
|
+
!pip-audit --format=json 2>/dev/null || npm audit --json 2>/dev/null || echo "Checking dependencies..."
|
|
70
|
+
|
|
71
|
+
Analyze dependency vulnerabilities:
|
|
72
|
+
- Check for known security issues in dependencies
|
|
73
|
+
- Identify outdated packages with vulnerabilities
|
|
74
|
+
- Suggest version updates and fixes
|
|
75
|
+
- Report critical vs non-critical issues
|
|
76
|
+
|
|
77
|
+
## Security Analysis Results
|
|
78
|
+
|
|
79
|
+
Think step by step about the security findings and provide:
|
|
80
|
+
|
|
81
|
+
1. **Security Status**: Overall security posture assessment
|
|
82
|
+
2. **Critical Issues**: Problems requiring immediate attention
|
|
83
|
+
3. **Recommended Actions**: Priority-ordered fix list
|
|
84
|
+
4. **Prevention Tips**: How to avoid similar issues
|
|
85
|
+
|
|
86
|
+
Generate a clear security report showing:
|
|
87
|
+
- 🔴 Critical vulnerabilities (fix immediately)
|
|
88
|
+
- 🟡 Important issues (fix soon)
|
|
89
|
+
- ✅ Areas that look secure
|
|
90
|
+
- 🛡️ Recommended security improvements
|
|
91
|
+
|
|
92
|
+
Keep output focused on actionable findings rather than overwhelming technical details. Provide specific file locations and concrete remediation steps for any issues found.
|