@paulduvall/claude-dev-toolkit 0.0.1-alpha.1 → 0.0.1-alpha.10
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/README.md +75 -17
- package/bin/claude-commands +250 -64
- package/commands/active/xarchitecture.md +393 -0
- package/commands/active/xconfig.md +127 -0
- package/commands/active/xdebug.md +130 -0
- package/commands/active/xdocs.md +178 -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/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/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 +898 -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/README.md +231 -0
- package/hooks/file-logger.sh +98 -0
- package/hooks/lib/argument-parser.sh +422 -0
- package/hooks/lib/config-constants.sh +230 -0
- package/hooks/lib/context-manager.sh +549 -0
- package/hooks/lib/error-handler.sh +412 -0
- package/hooks/lib/execution-engine.sh +627 -0
- package/hooks/lib/file-utils.sh +375 -0
- package/hooks/lib/subagent-discovery.sh +465 -0
- package/hooks/lib/subagent-validator.sh +597 -0
- package/hooks/on-error-debug.sh +221 -0
- package/hooks/pre-commit-quality.sh +204 -0
- package/hooks/pre-write-security.sh +107 -0
- package/hooks/prevent-credential-exposure.sh +265 -0
- package/hooks/subagent-trigger-simple.sh +193 -0
- package/hooks/subagent-trigger.sh +253 -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 +228 -3
- 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-backup.js +579 -0
- package/lib/installation-instruction-generator.js +213 -495
- package/lib/installer.js +134 -56
- package/lib/oidc-command.js +354 -0
- package/lib/result.js +138 -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 +309 -0
- package/lib/subagent-formatter.js +278 -0
- package/lib/subagents-core.js +237 -0
- package/lib/subagents.js +508 -0
- package/lib/types.d.ts +183 -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 +17 -4
- package/scripts/postinstall.js +28 -10
- package/subagents/api-guardian.md +29 -0
- package/subagents/audit-trail-verifier.md +24 -0
- package/subagents/change-scoper.md +23 -0
- package/subagents/ci-pipeline-curator.md +24 -0
- package/subagents/code-review-assistant.md +258 -0
- package/subagents/continuous-release-orchestrator.md +29 -0
- package/subagents/contract-tester.md +24 -0
- package/subagents/data-steward.md +29 -0
- package/subagents/debug-context.md +197 -0
- package/subagents/debug-specialist.md +138 -0
- package/subagents/dependency-steward.md +24 -0
- package/subagents/deployment-strategist.md +29 -0
- package/subagents/documentation-curator.md +29 -0
- package/subagents/environment-guardian.md +29 -0
- package/subagents/license-compliance-guardian.md +29 -0
- package/subagents/observability-engineer.md +25 -0
- package/subagents/performance-guardian.md +29 -0
- package/subagents/product-owner-proxy.md +28 -0
- package/subagents/requirements-reviewer.md +26 -0
- package/subagents/rollback-first-responder.md +24 -0
- package/subagents/sbom-provenance.md +25 -0
- package/subagents/security-auditor.md +29 -0
- package/subagents/style-enforcer.md +23 -0
- package/subagents/test-writer.md +24 -0
- package/subagents/trunk-guardian.md +29 -0
- package/subagents/workflow-coordinator.md +26 -0
- package/templates/README.md +100 -0
- package/templates/basic-settings.json +30 -0
- package/templates/comprehensive-settings.json +206 -0
- package/templates/hybrid-hook-config.yaml +133 -0
- package/templates/security-focused-settings.json +62 -0
- package/templates/subagent-hooks.yaml +188 -0
- package/tsconfig.json +37 -0
|
@@ -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.
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Machine-readable specifications with unique identifiers and authority levels for precise AI code generation
|
|
3
|
+
tags: [specifications, traceability, ai-generation, coverage, requirements, authority]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Manage SpecDriven AI specifications based on the arguments provided in $ARGUMENTS.
|
|
7
|
+
|
|
8
|
+
## Usage Examples
|
|
9
|
+
|
|
10
|
+
**Basic specification analysis:**
|
|
11
|
+
```
|
|
12
|
+
/xspec
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Read specifications:**
|
|
16
|
+
```
|
|
17
|
+
/xspec --read
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Create new specification:**
|
|
21
|
+
```
|
|
22
|
+
/xspec --new "Add contact form"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Help and options:**
|
|
26
|
+
```
|
|
27
|
+
/xspec --help
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Implementation
|
|
31
|
+
|
|
32
|
+
If $ARGUMENTS contains "help" or "--help":
|
|
33
|
+
Display this usage information and exit.
|
|
34
|
+
|
|
35
|
+
First, verify SpecDriven AI project structure:
|
|
36
|
+
!ls -la specs/ 2>/dev/null || echo "No specs directory found"
|
|
37
|
+
!find specs/specifications/ -name "*.md" 2>/dev/null | head -5 || echo "No specifications found"
|
|
38
|
+
!find specs/tests/ -name "*.py" 2>/dev/null | head -5 || echo "No tests found"
|
|
39
|
+
|
|
40
|
+
Based on $ARGUMENTS, perform the appropriate specification operation:
|
|
41
|
+
|
|
42
|
+
## 1. Specification Reading and Discovery
|
|
43
|
+
|
|
44
|
+
If reading specifications (--read, --find):
|
|
45
|
+
!grep -r "#{#" specs/specifications/ | head -10 2>/dev/null || echo "No specification IDs found"
|
|
46
|
+
!find specs/specifications/ -name "*.md" -exec grep -l "authority=" {} \; 2>/dev/null | head -5
|
|
47
|
+
|
|
48
|
+
Read and analyze specifications:
|
|
49
|
+
- Parse specification IDs and authority levels
|
|
50
|
+
- Extract requirement descriptions and criteria
|
|
51
|
+
- Identify implementation dependencies
|
|
52
|
+
- Display specification content and metadata
|
|
53
|
+
- Cross-reference related specifications
|
|
54
|
+
|
|
55
|
+
## 2. Traceability Analysis
|
|
56
|
+
|
|
57
|
+
If tracing specifications (--trace):
|
|
58
|
+
!grep -r "$spec_id" specs/tests/ 2>/dev/null || echo "No tests found for specification"
|
|
59
|
+
!grep -r "$spec_id" . --exclude-dir=specs --exclude-dir=.git 2>/dev/null | head -5
|
|
60
|
+
|
|
61
|
+
Analyze specification traceability:
|
|
62
|
+
- Find tests implementing the specification
|
|
63
|
+
- Locate code referencing specification ID
|
|
64
|
+
- Map requirement-to-implementation relationships
|
|
65
|
+
- Validate traceability completeness
|
|
66
|
+
- Generate traceability reports
|
|
67
|
+
|
|
68
|
+
## 3. Specification Validation
|
|
69
|
+
|
|
70
|
+
If validating specifications (--validate, --machine-readable):
|
|
71
|
+
!grep -r "#{#[a-z]{3}[0-9][a-z] authority=" specs/specifications/ 2>/dev/null || echo "Invalid specification format"
|
|
72
|
+
!find specs/specifications/ -name "*.md" -exec grep -E "authority=(system|platform|developer)" {} \; | wc -l
|
|
73
|
+
|
|
74
|
+
Validate specification compliance:
|
|
75
|
+
- Check ID format (3 letters + 1 digit + 1 letter)
|
|
76
|
+
- Verify authority levels (system/platform/developer)
|
|
77
|
+
- Validate specification structure
|
|
78
|
+
- Ensure machine-readable format compliance
|
|
79
|
+
- Report format violations
|
|
80
|
+
|
|
81
|
+
## 4. Specification Creation
|
|
82
|
+
|
|
83
|
+
If creating new specifications (--new):
|
|
84
|
+
!find specs/specifications/ -name "*.md" -exec grep -o "#{#[a-z]*[0-9][a-z]" {} \; | sort | tail -5
|
|
85
|
+
!mkdir -p specs/specifications specs/tests
|
|
86
|
+
|
|
87
|
+
Create new specification with proper format:
|
|
88
|
+
- Generate unique specification ID
|
|
89
|
+
- Apply appropriate authority level
|
|
90
|
+
- Create specification template
|
|
91
|
+
- Include acceptance criteria
|
|
92
|
+
- Add traceability placeholders
|
|
93
|
+
|
|
94
|
+
## 5. Coverage Analysis
|
|
95
|
+
|
|
96
|
+
If analyzing coverage (--coverage, --dual-coverage):
|
|
97
|
+
!grep -r "#{#" specs/specifications/ | wc -l
|
|
98
|
+
!grep -r "#{#" specs/tests/ | wc -l
|
|
99
|
+
!python -m pytest --cov=. --cov-report=term-missing specs/tests/ 2>/dev/null || echo "Code coverage not available"
|
|
100
|
+
|
|
101
|
+
Analyze dual coverage metrics:
|
|
102
|
+
- Specification coverage (tests exist for requirements)
|
|
103
|
+
- Code coverage (tests execute relevant code)
|
|
104
|
+
- Traceability coverage (links maintained)
|
|
105
|
+
- Gap analysis and recommendations
|
|
106
|
+
- Coverage trend reporting
|
|
107
|
+
|
|
108
|
+
## 6. AI Code Generation
|
|
109
|
+
|
|
110
|
+
If generating from specifications (--generate-test, --ai-implement):
|
|
111
|
+
@specs/specifications/$spec_file 2>/dev/null || echo "Specification file not found"
|
|
112
|
+
!find specs/tests/ -name "*test*" | grep "$component" | head -3
|
|
113
|
+
|
|
114
|
+
Generate AI implementation:
|
|
115
|
+
- Extract requirements from specification
|
|
116
|
+
- Generate test cases covering all criteria
|
|
117
|
+
- Create minimal implementation code
|
|
118
|
+
- Ensure specification traceability
|
|
119
|
+
- Validate generated code compliance
|
|
120
|
+
|
|
121
|
+
## 7. Authority Management
|
|
122
|
+
|
|
123
|
+
If filtering by authority (--authority):
|
|
124
|
+
!grep -r "authority=$authority_level" specs/specifications/ 2>/dev/null || echo "No specifications with authority level found"
|
|
125
|
+
|
|
126
|
+
Manage specification authority:
|
|
127
|
+
- system: Critical system requirements (highest priority)
|
|
128
|
+
- platform: Infrastructure/framework requirements
|
|
129
|
+
- developer: Application/feature requirements (lowest priority)
|
|
130
|
+
- Authority-based filtering and prioritization
|
|
131
|
+
- Compliance validation by authority level
|
|
132
|
+
|
|
133
|
+
## 8. Gap Analysis
|
|
134
|
+
|
|
135
|
+
If identifying gaps (--gaps):
|
|
136
|
+
!find specs/specifications/ -name "*.md" -exec grep -o "#{#[a-z]{3}[0-9][a-z]" {} \; | sort | uniq > /tmp/spec_ids
|
|
137
|
+
!find specs/tests/ -name "*.py" -exec grep -o "#{#[a-z]{3}[0-9][a-z]" {} \; | sort | uniq > /tmp/test_ids || touch /tmp/test_ids
|
|
138
|
+
|
|
139
|
+
Identify specification gaps:
|
|
140
|
+
- Specifications without corresponding tests
|
|
141
|
+
- Tests without specification references
|
|
142
|
+
- Missing implementation coverage
|
|
143
|
+
- Broken traceability links
|
|
144
|
+
- Prioritized gap remediation
|
|
145
|
+
|
|
146
|
+
Think step by step about specification management and provide:
|
|
147
|
+
|
|
148
|
+
1. **Specification Analysis**:
|
|
149
|
+
- Current specification inventory
|
|
150
|
+
- Authority level distribution
|
|
151
|
+
- Format compliance status
|
|
152
|
+
- Coverage metrics and gaps
|
|
153
|
+
|
|
154
|
+
2. **Traceability Assessment**:
|
|
155
|
+
- Requirement-to-test mapping completeness
|
|
156
|
+
- Implementation traceability status
|
|
157
|
+
- Broken or missing links
|
|
158
|
+
- Cross-reference validation
|
|
159
|
+
|
|
160
|
+
3. **Quality Metrics**:
|
|
161
|
+
- Specification coverage percentage
|
|
162
|
+
- Code coverage achieved by tests
|
|
163
|
+
- Authority level compliance
|
|
164
|
+
- Format standardization status
|
|
165
|
+
|
|
166
|
+
4. **Improvement Recommendations**:
|
|
167
|
+
- Missing specifications to create
|
|
168
|
+
- Tests requiring implementation
|
|
169
|
+
- Traceability links to establish
|
|
170
|
+
- Coverage improvement opportunities
|
|
171
|
+
|
|
172
|
+
Generate comprehensive specification management report with dual coverage analysis, traceability validation, and actionable recommendations for improving SpecDriven AI development practices.
|
|
173
|
+
|
|
174
|
+
If no specific operation is provided, analyze current specification state and suggest priorities for improvement.
|