@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,337 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Build, test, and deploy with platform-agnostic CI/CD pipelines using configuration-driven deployment
|
|
3
|
+
tags: [cicd, deployment, automation, pipeline, security, testing, configuration]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Implement enterprise-grade CI/CD pipelines with configuration-driven deployment that works across platforms based on $ARGUMENTS.
|
|
7
|
+
|
|
8
|
+
First, examine the project structure and current pipeline setup:
|
|
9
|
+
!ls -la | grep -E "(.github|.gitlab-ci.yml|Jenkinsfile|azure-pipelines.yml|buildspec.yml)"
|
|
10
|
+
!find . -name "*.yml" -o -name "*.yaml" | grep -E "(workflow|pipeline|ci|cd)" | head -10
|
|
11
|
+
!find . -name "*.json" | grep -E "(package|requirements|pom|Cargo)" | head -5
|
|
12
|
+
|
|
13
|
+
Analyze current pipeline maturity and best practices compliance:
|
|
14
|
+
- Trunk-based development workflow
|
|
15
|
+
- Fast feedback loops (< 30 minutes)
|
|
16
|
+
- Comprehensive security scanning
|
|
17
|
+
- Configuration-driven deployment automation
|
|
18
|
+
- Platform-agnostic rollback capabilities
|
|
19
|
+
|
|
20
|
+
Based on $ARGUMENTS, perform the appropriate CI/CD operation:
|
|
21
|
+
|
|
22
|
+
## 1. Pipeline Initialization (Platform-Agnostic)
|
|
23
|
+
|
|
24
|
+
If initializing GitHub Actions (--init github):
|
|
25
|
+
!mkdir -p .github/workflows
|
|
26
|
+
!mkdir -p config/environments
|
|
27
|
+
Create GitHub Actions workflow with configuration-driven stages:
|
|
28
|
+
- **Source Stage**: Checkout with secure authentication
|
|
29
|
+
- **Pre-commit Validation**: Fast feedback (< 5 minutes)
|
|
30
|
+
- **Build Stage**: Compile, unit tests, security scans, artifact generation
|
|
31
|
+
- **Test Stage**: Integration tests in isolated environment (< 30 minutes)
|
|
32
|
+
- **Security Stage**: SAST, secrets detection, dependency scanning
|
|
33
|
+
- **Deploy Stage**: Configuration-driven deployment to any environment
|
|
34
|
+
|
|
35
|
+
If initializing GitLab CI (--init gitlab):
|
|
36
|
+
!mkdir -p config/environments
|
|
37
|
+
Create .gitlab-ci.yml with configuration-driven deployment:
|
|
38
|
+
- source, build, test, security, deploy stages
|
|
39
|
+
- Environment-specific configuration files
|
|
40
|
+
- Parallel execution where possible for fast feedback
|
|
41
|
+
|
|
42
|
+
If initializing platform-agnostic pipeline (--init generic):
|
|
43
|
+
!mkdir -p config/environments
|
|
44
|
+
!mkdir -p scripts/ci
|
|
45
|
+
Create configuration templates that work with any CI/CD platform:
|
|
46
|
+
- Environment configuration files (staging.json, production.json)
|
|
47
|
+
- Unified deployment script with environment parameter
|
|
48
|
+
- Security scanning configuration
|
|
49
|
+
- Testing configuration
|
|
50
|
+
|
|
51
|
+
## 2. Pipeline Configuration and Validation
|
|
52
|
+
|
|
53
|
+
If validating pipeline (--validate):
|
|
54
|
+
!yamllint .github/workflows/*.yml 2>/dev/null || echo "No GitHub workflows found"
|
|
55
|
+
!yamllint .gitlab-ci.yml 2>/dev/null || echo "No GitLab CI config found"
|
|
56
|
+
!find config/environments -name "*.json" -exec jq . {} \; 2>/dev/null || echo "No environment configs found"
|
|
57
|
+
|
|
58
|
+
Validate pipeline best practices compliance:
|
|
59
|
+
- **YAML/JSON syntax and structure**
|
|
60
|
+
- **Required stages present**: source, build, test, security, deploy
|
|
61
|
+
- **Fast feedback**: Build + test stages complete within 30 minutes
|
|
62
|
+
- **Security controls**: Secrets detection, SAST, dependency scanning
|
|
63
|
+
- **Configuration-driven deployment**: Environment configs present and valid
|
|
64
|
+
- **Trunk-based development**: Main branch protection and merge requirements
|
|
65
|
+
- **Secret management**: No hardcoded secrets, proper environment variables
|
|
66
|
+
- **Rollback capabilities**: Configuration-driven rollback mechanisms
|
|
67
|
+
- **Key metrics tracking**: Lead time, deploy frequency, MTBF, MTTR
|
|
68
|
+
|
|
69
|
+
Create environment configuration template if missing:
|
|
70
|
+
!cat > config/environments/template.json << 'EOF'
|
|
71
|
+
{
|
|
72
|
+
"environment": "template",
|
|
73
|
+
"deploy": {
|
|
74
|
+
"target": "platform-specific-target",
|
|
75
|
+
"strategy": "rolling|blue-green|canary",
|
|
76
|
+
"health_check_url": "/health",
|
|
77
|
+
"timeout_minutes": 10,
|
|
78
|
+
"rollback": {
|
|
79
|
+
"auto_rollback": true,
|
|
80
|
+
"failure_threshold": 0.1
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"secrets": {
|
|
84
|
+
"required": ["API_KEY", "DATABASE_URL"],
|
|
85
|
+
"optional": ["MONITORING_TOKEN"]
|
|
86
|
+
},
|
|
87
|
+
"resources": {
|
|
88
|
+
"cpu": "1000m",
|
|
89
|
+
"memory": "512Mi",
|
|
90
|
+
"replicas": 2
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
EOF
|
|
94
|
+
|
|
95
|
+
## 3. Build and Test Operations
|
|
96
|
+
|
|
97
|
+
If running build (--build):
|
|
98
|
+
@package.json
|
|
99
|
+
Execute build stage with artifact generation:
|
|
100
|
+
!echo "=== Build Stage (Target: < 15 minutes) ==="
|
|
101
|
+
!time (npm ci && npm run build) 2>/dev/null || time (python -m pip install -r requirements.txt && python -m build) 2>/dev/null || echo "No standard build found"
|
|
102
|
+
|
|
103
|
+
Generate Software Bill of Materials (SBOM):
|
|
104
|
+
!npm sbom 2>/dev/null || cyclonedx-bom -o sbom.json 2>/dev/null || echo "SBOM generation not available"
|
|
105
|
+
|
|
106
|
+
Package build artifacts:
|
|
107
|
+
!mkdir -p artifacts
|
|
108
|
+
!tar -czf artifacts/build-$(date +%Y%m%d-%H%M%S).tar.gz dist/ build/ 2>/dev/null || echo "No build artifacts to package"
|
|
109
|
+
|
|
110
|
+
If running tests (--test):
|
|
111
|
+
!echo "=== Test Stage (Target: < 30 minutes total) ==="
|
|
112
|
+
!time npm test 2>/dev/null || time python -m pytest --cov --junitxml=test-results.xml 2>/dev/null || echo "No tests found"
|
|
113
|
+
|
|
114
|
+
Run integration tests:
|
|
115
|
+
!npm run test:integration 2>/dev/null || python -m pytest tests/integration/ 2>/dev/null || echo "No integration tests configured"
|
|
116
|
+
|
|
117
|
+
Performance and load testing:
|
|
118
|
+
!npm run test:performance 2>/dev/null || echo "No performance tests configured"
|
|
119
|
+
|
|
120
|
+
Generate test reports:
|
|
121
|
+
!mkdir -p reports
|
|
122
|
+
!cp test-results.xml reports/ 2>/dev/null || echo "No test results to copy"
|
|
123
|
+
|
|
124
|
+
## 4. Configuration-Driven Deployment Operations
|
|
125
|
+
|
|
126
|
+
If deploying to environment (--deploy [environment]):
|
|
127
|
+
Create unified deployment script if missing:
|
|
128
|
+
!cat > scripts/deploy.sh << 'EOF'
|
|
129
|
+
#!/bin/bash
|
|
130
|
+
set -euo pipefail
|
|
131
|
+
|
|
132
|
+
ENVIRONMENT=${1:-staging}
|
|
133
|
+
CONFIG_FILE="config/environments/${ENVIRONMENT}.json"
|
|
134
|
+
|
|
135
|
+
if [[ ! -f "$CONFIG_FILE" ]]; then
|
|
136
|
+
echo "Error: Environment config not found: $CONFIG_FILE"
|
|
137
|
+
exit 1
|
|
138
|
+
fi
|
|
139
|
+
|
|
140
|
+
# Load configuration
|
|
141
|
+
DEPLOY_TARGET=$(jq -r '.deploy.target' "$CONFIG_FILE")
|
|
142
|
+
DEPLOY_STRATEGY=$(jq -r '.deploy.strategy' "$CONFIG_FILE")
|
|
143
|
+
HEALTH_CHECK_URL=$(jq -r '.deploy.health_check_url' "$CONFIG_FILE")
|
|
144
|
+
TIMEOUT=$(jq -r '.deploy.timeout_minutes' "$CONFIG_FILE")
|
|
145
|
+
|
|
146
|
+
echo "=== Deploying to $ENVIRONMENT ==="
|
|
147
|
+
echo "Target: $DEPLOY_TARGET"
|
|
148
|
+
echo "Strategy: $DEPLOY_STRATEGY"
|
|
149
|
+
|
|
150
|
+
# Platform-agnostic deployment logic
|
|
151
|
+
case "$DEPLOY_STRATEGY" in
|
|
152
|
+
"rolling")
|
|
153
|
+
echo "Executing rolling deployment..."
|
|
154
|
+
;;
|
|
155
|
+
"blue-green")
|
|
156
|
+
echo "Executing blue/green deployment..."
|
|
157
|
+
;;
|
|
158
|
+
"canary")
|
|
159
|
+
echo "Executing canary deployment..."
|
|
160
|
+
;;
|
|
161
|
+
esac
|
|
162
|
+
|
|
163
|
+
# Health check validation
|
|
164
|
+
if [[ "$HEALTH_CHECK_URL" != "null" ]]; then
|
|
165
|
+
echo "Running health checks on $HEALTH_CHECK_URL"
|
|
166
|
+
fi
|
|
167
|
+
|
|
168
|
+
echo "✅ Deployment to $ENVIRONMENT completed"
|
|
169
|
+
EOF
|
|
170
|
+
|
|
171
|
+
!chmod +x scripts/deploy.sh
|
|
172
|
+
|
|
173
|
+
Check deployment prerequisites:
|
|
174
|
+
- **All tests passing** (unit, integration, performance)
|
|
175
|
+
- **Security scans clean** (SAST, secrets, dependencies)
|
|
176
|
+
- **Artifacts generated** and validated
|
|
177
|
+
- **Environment configuration** exists and valid
|
|
178
|
+
- **Rollback plan** prepared and tested
|
|
179
|
+
|
|
180
|
+
Execute configuration-driven deployment:
|
|
181
|
+
!scripts/deploy.sh ${TARGET_ENV:-staging}
|
|
182
|
+
|
|
183
|
+
Deployment safety mechanisms:
|
|
184
|
+
- **Configuration validation** before deployment
|
|
185
|
+
- **Health check verification** using environment config
|
|
186
|
+
- **Automated rollback** based on failure thresholds
|
|
187
|
+
- **Real-time monitoring** during deployment
|
|
188
|
+
- **Environment-specific** rollback procedures
|
|
189
|
+
|
|
190
|
+
## 5. Status and Monitoring
|
|
191
|
+
|
|
192
|
+
If checking status (--status):
|
|
193
|
+
!git log --oneline -5
|
|
194
|
+
!git status
|
|
195
|
+
|
|
196
|
+
Show:
|
|
197
|
+
- Current branch
|
|
198
|
+
- Last commit
|
|
199
|
+
- Pipeline status
|
|
200
|
+
- Test results
|
|
201
|
+
- Deployment status
|
|
202
|
+
|
|
203
|
+
Think step by step about CI/CD best practices and provide recommendations for:
|
|
204
|
+
- Pipeline optimization
|
|
205
|
+
- Security improvements
|
|
206
|
+
- Testing strategies
|
|
207
|
+
- Deployment safety
|
|
208
|
+
|
|
209
|
+
If no specific operation is provided, analyze current CI/CD setup and suggest improvements.
|
|
210
|
+
|
|
211
|
+
## 6. Pipeline Optimization
|
|
212
|
+
|
|
213
|
+
If optimizing pipeline (--optimize):
|
|
214
|
+
Analyze current pipeline performance:
|
|
215
|
+
!du -sh node_modules/ 2>/dev/null || echo "No node_modules found"
|
|
216
|
+
!find . -name "*.log" -size +1M 2>/dev/null | head -5
|
|
217
|
+
|
|
218
|
+
Identify bottlenecks:
|
|
219
|
+
- Long-running test suites
|
|
220
|
+
- Large dependency installations
|
|
221
|
+
- Inefficient Docker builds
|
|
222
|
+
- Missing caching strategies
|
|
223
|
+
|
|
224
|
+
Provide specific optimization recommendations.
|
|
225
|
+
|
|
226
|
+
## 7. Security and Compliance Scanning
|
|
227
|
+
|
|
228
|
+
If running security checks (--security):
|
|
229
|
+
!echo "=== Security Stage ==="
|
|
230
|
+
|
|
231
|
+
**Secrets Detection:**
|
|
232
|
+
!git secrets --scan 2>/dev/null || trufflehog . --json 2>/dev/null || echo "Install git-secrets or trufflehog for secrets scanning"
|
|
233
|
+
|
|
234
|
+
**Software Composition Analysis:**
|
|
235
|
+
!npm audit --audit-level high 2>/dev/null || pip-audit 2>/dev/null || echo "No dependency vulnerability scanning available"
|
|
236
|
+
|
|
237
|
+
**Static Application Security Testing (SAST):**
|
|
238
|
+
!semgrep --config=auto . 2>/dev/null || bandit -r . 2>/dev/null || echo "Install semgrep or bandit for SAST"
|
|
239
|
+
|
|
240
|
+
**Infrastructure as Code Security:**
|
|
241
|
+
!checkov -d . 2>/dev/null || echo "Install checkov for IaC security scanning"
|
|
242
|
+
|
|
243
|
+
**Configuration Security Validation:**
|
|
244
|
+
!find config/environments -name "*.json" -exec grep -l "password\|secret\|key" {} \; | head -5
|
|
245
|
+
!echo "Checking for hardcoded secrets in configuration files..."
|
|
246
|
+
|
|
247
|
+
**Software Bill of Materials (SBOM) Validation:**
|
|
248
|
+
!cyclonedx validate --input-file sbom.json 2>/dev/null || echo "SBOM validation not available"
|
|
249
|
+
|
|
250
|
+
Security compliance checks:
|
|
251
|
+
- **Hardcoded secrets and credentials**
|
|
252
|
+
- **Vulnerable dependencies and libraries**
|
|
253
|
+
- **Insecure configurations and permissions**
|
|
254
|
+
- **Missing security headers and controls**
|
|
255
|
+
- **Container and infrastructure vulnerabilities**
|
|
256
|
+
- **Configuration file security validation**
|
|
257
|
+
- **Supply chain security validation**
|
|
258
|
+
|
|
259
|
+
## 8. Pipeline Monitoring and Key Metrics
|
|
260
|
+
|
|
261
|
+
If monitoring pipeline (--monitor):
|
|
262
|
+
!echo "=== Pipeline Key Metrics ==="
|
|
263
|
+
|
|
264
|
+
**Lead Time Measurement:**
|
|
265
|
+
!git log --since="30 days ago" --pretty=format:"%h %ad %s" --date=iso | head -20
|
|
266
|
+
|
|
267
|
+
**Deployment Frequency:**
|
|
268
|
+
!git log --since="7 days ago" --pretty=format:"%h %s" | wc -l
|
|
269
|
+
!git log --since="7 days ago" --grep="deploy" --pretty=format:"%h %ad %s" --date=short
|
|
270
|
+
|
|
271
|
+
**Mean Time Between Failures (MTBF):**
|
|
272
|
+
!git log --since="30 days ago" --grep="fix\|bug\|hotfix" --pretty=format:"%h %ad %s" --date=short
|
|
273
|
+
|
|
274
|
+
**Mean Time to Recovery (MTTR):**
|
|
275
|
+
!git log --since="7 days ago" --grep="rollback\|revert" --pretty=format:"%h %ad %s" --date=short
|
|
276
|
+
|
|
277
|
+
**Build and Pipeline Health:**
|
|
278
|
+
- Build success rate (target: > 95%)
|
|
279
|
+
- Average build time (target: < 30 minutes)
|
|
280
|
+
- Failed build patterns and root causes
|
|
281
|
+
- Security scan pass rate
|
|
282
|
+
- Test coverage trends
|
|
283
|
+
- Configuration drift detection
|
|
284
|
+
|
|
285
|
+
**Configuration Health:**
|
|
286
|
+
!find config/environments -name "*.json" -exec echo "Validating: {}" \; -exec jq . {} \; 2>/dev/null || echo "No environment configs to validate"
|
|
287
|
+
|
|
288
|
+
For rollback operations (--rollback [environment]):
|
|
289
|
+
!git log --oneline -10
|
|
290
|
+
Create configuration-driven rollback script:
|
|
291
|
+
!cat > scripts/rollback.sh << 'EOF'
|
|
292
|
+
#!/bin/bash
|
|
293
|
+
set -euo pipefail
|
|
294
|
+
|
|
295
|
+
ENVIRONMENT=${1:-staging}
|
|
296
|
+
CONFIG_FILE="config/environments/${ENVIRONMENT}.json"
|
|
297
|
+
|
|
298
|
+
if [[ ! -f "$CONFIG_FILE" ]]; then
|
|
299
|
+
echo "Error: Environment config not found: $CONFIG_FILE"
|
|
300
|
+
exit 1
|
|
301
|
+
fi
|
|
302
|
+
|
|
303
|
+
# Load rollback configuration
|
|
304
|
+
AUTO_ROLLBACK=$(jq -r '.deploy.rollback.auto_rollback' "$CONFIG_FILE")
|
|
305
|
+
FAILURE_THRESHOLD=$(jq -r '.deploy.rollback.failure_threshold' "$CONFIG_FILE")
|
|
306
|
+
|
|
307
|
+
echo "=== Rolling back $ENVIRONMENT ==="
|
|
308
|
+
echo "Auto-rollback enabled: $AUTO_ROLLBACK"
|
|
309
|
+
echo "Failure threshold: $FAILURE_THRESHOLD"
|
|
310
|
+
|
|
311
|
+
# Execute rollback based on deployment strategy
|
|
312
|
+
DEPLOY_STRATEGY=$(jq -r '.deploy.strategy' "$CONFIG_FILE")
|
|
313
|
+
case "$DEPLOY_STRATEGY" in
|
|
314
|
+
"blue-green")
|
|
315
|
+
echo "Executing blue/green rollback..."
|
|
316
|
+
;;
|
|
317
|
+
"rolling")
|
|
318
|
+
echo "Executing rolling rollback..."
|
|
319
|
+
;;
|
|
320
|
+
"canary")
|
|
321
|
+
echo "Executing canary rollback..."
|
|
322
|
+
;;
|
|
323
|
+
esac
|
|
324
|
+
|
|
325
|
+
echo "✅ Rollback to $ENVIRONMENT completed"
|
|
326
|
+
EOF
|
|
327
|
+
|
|
328
|
+
!chmod +x scripts/rollback.sh
|
|
329
|
+
|
|
330
|
+
Execute configuration-driven rollback procedures:
|
|
331
|
+
- **Automated rollback triggers** based on health checks and configuration
|
|
332
|
+
- **Environment-specific rollback** using deployment strategy from config
|
|
333
|
+
- **Health check validation** during rollback process
|
|
334
|
+
- **Post-rollback validation** and monitoring
|
|
335
|
+
- **Incident documentation** and lessons learned
|
|
336
|
+
|
|
337
|
+
Report comprehensive pipeline health metrics and suggest data-driven improvements for reliability, security, and performance.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Create commits linked to specifications with full traceability and coverage metrics
|
|
3
|
+
tags: [git, commit, traceability, tdd, specifications]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Create specification-driven commits with traceability based on the arguments provided in $ARGUMENTS.
|
|
7
|
+
|
|
8
|
+
First, check the current git status and recent commits:
|
|
9
|
+
!git status --porcelain
|
|
10
|
+
!git log --oneline -5
|
|
11
|
+
!git branch --show-current
|
|
12
|
+
|
|
13
|
+
Based on $ARGUMENTS, perform the appropriate commit operation:
|
|
14
|
+
|
|
15
|
+
## 1. TDD Cycle Commits
|
|
16
|
+
|
|
17
|
+
If committing TDD cycle (--tdd):
|
|
18
|
+
Analyze staged changes to determine if this follows TDD pattern:
|
|
19
|
+
!git diff --cached --name-only
|
|
20
|
+
!git diff --cached --stat
|
|
21
|
+
|
|
22
|
+
Check for test files and implementation files:
|
|
23
|
+
!git diff --cached | grep -E "(test_|_test\.py|\.test\.js|spec\.js)"
|
|
24
|
+
|
|
25
|
+
Generate commit message following TDD pattern:
|
|
26
|
+
- Red: Add failing test
|
|
27
|
+
- Green: Make test pass
|
|
28
|
+
- Refactor: Improve code
|
|
29
|
+
|
|
30
|
+
## 2. Message Generation
|
|
31
|
+
|
|
32
|
+
If generating commit message (--message):
|
|
33
|
+
Analyze the changes to determine commit type:
|
|
34
|
+
!git diff --cached --name-only | head -10
|
|
35
|
+
!git diff --cached --numstat
|
|
36
|
+
|
|
37
|
+
Determine commit type based on files changed:
|
|
38
|
+
- src/ changes → feat/fix
|
|
39
|
+
- test/ changes → test
|
|
40
|
+
- docs/ changes → docs
|
|
41
|
+
- config files → chore
|
|
42
|
+
|
|
43
|
+
## 3. Traceability Information
|
|
44
|
+
|
|
45
|
+
If including traceability (--trace):
|
|
46
|
+
Look for specification references in the project:
|
|
47
|
+
@specs/ 2>/dev/null || echo "No specs directory found"
|
|
48
|
+
!find . -name "*.md" | grep -i spec | head -5
|
|
49
|
+
|
|
50
|
+
Include in commit:
|
|
51
|
+
- Specification ID reference
|
|
52
|
+
- Files modified
|
|
53
|
+
- Test coverage impact
|
|
54
|
+
- Related issues or tickets
|
|
55
|
+
|
|
56
|
+
## 4. Coverage Integration
|
|
57
|
+
|
|
58
|
+
If including coverage (--coverage):
|
|
59
|
+
!python -m pytest --cov=. --cov-report=term-missing 2>/dev/null || npm test -- --coverage 2>/dev/null || echo "No coverage tools found"
|
|
60
|
+
|
|
61
|
+
Calculate coverage metrics:
|
|
62
|
+
- Code coverage percentage
|
|
63
|
+
- Test coverage for specifications
|
|
64
|
+
- Lines added/modified
|
|
65
|
+
|
|
66
|
+
## 5. Authority and Compliance
|
|
67
|
+
|
|
68
|
+
If including authority (--authority):
|
|
69
|
+
Check specification authority level:
|
|
70
|
+
- system: Core system requirements
|
|
71
|
+
- platform: Platform-specific requirements
|
|
72
|
+
- developer: Implementation details
|
|
73
|
+
|
|
74
|
+
Think step by step about the commit content and generate an appropriate commit message that includes:
|
|
75
|
+
- Conventional commit format (type: description)
|
|
76
|
+
- Specification reference if provided
|
|
77
|
+
- Coverage metrics if requested
|
|
78
|
+
- Authority level if specified
|
|
79
|
+
- Traceability information if requested
|
|
80
|
+
|
|
81
|
+
Execute the commit with the generated message:
|
|
82
|
+
!git add -A
|
|
83
|
+
!git commit -m "Generated commit message with traceability"
|
|
84
|
+
|
|
85
|
+
Provide a summary of what was committed and any recommendations for future commits.
|
|
86
|
+
|
|
87
|
+
## 6. Advanced Commit Features
|
|
88
|
+
|
|
89
|
+
For breaking changes detection:
|
|
90
|
+
!git diff --cached | grep -E "(BREAKING CHANGE|breaking change)" || echo "No breaking changes detected"
|
|
91
|
+
|
|
92
|
+
For co-author support:
|
|
93
|
+
If multiple contributors are detected, include co-author lines:
|
|
94
|
+
```
|
|
95
|
+
Co-authored-by: Name <email@example.com>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
For dependency tracking:
|
|
99
|
+
!git diff --cached package.json requirements.txt 2>/dev/null | grep -E "(\+.*"|"-.*")"
|
|
100
|
+
|
|
101
|
+
## 7. Quality Gates
|
|
102
|
+
|
|
103
|
+
Before committing, verify quality gates:
|
|
104
|
+
!python -m pytest --tb=short 2>/dev/null || npm test 2>/dev/null || echo "No tests to run"
|
|
105
|
+
!python -m mypy . 2>/dev/null || npm run lint 2>/dev/null || echo "No linting configured"
|
|
106
|
+
|
|
107
|
+
Ensure commit meets quality standards:
|
|
108
|
+
- All tests pass
|
|
109
|
+
- Code coverage maintained or improved
|
|
110
|
+
- Linting passes
|
|
111
|
+
- No security vulnerabilities introduced
|
|
112
|
+
|
|
113
|
+
## 8. Specification Validation
|
|
114
|
+
|
|
115
|
+
If specification ID is provided, validate it exists:
|
|
116
|
+
!find . -name "*.md" -exec grep -l "$spec_id" {} \; 2>/dev/null
|
|
117
|
+
|
|
118
|
+
Verify specification authority and coverage requirements are met.
|
|
119
|
+
|
|
120
|
+
Generate final commit message with all requested components and execute the commit.
|
|
121
|
+
|
|
122
|
+
Report commit success and provide next steps or recommendations for the development workflow.
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Check project compliance with standards and generate audit documentation
|
|
3
|
+
tags: [compliance, audit, security, regulatory, governance]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Perform compliance checks and management based on the arguments provided in $ARGUMENTS.
|
|
7
|
+
|
|
8
|
+
First, examine the project structure for compliance-related files:
|
|
9
|
+
!ls -la | grep -E "(compliance|audit|security|policy)"
|
|
10
|
+
!find . -name "*.md" -o -name "*.yml" -o -name "*.json" | grep -E "(compliance|policy|security)" | head -10
|
|
11
|
+
|
|
12
|
+
Based on $ARGUMENTS, perform the appropriate compliance operation:
|
|
13
|
+
|
|
14
|
+
## 1. Standards Compliance Checking
|
|
15
|
+
|
|
16
|
+
If checking SOC 2 compliance (--soc2):
|
|
17
|
+
!grep -r "audit" . --include="*.md" --include="*.yml" | head -5
|
|
18
|
+
!find . -name "*.log" | grep -E "(access|security|change)" | head -5
|
|
19
|
+
|
|
20
|
+
Check SOC 2 requirements:
|
|
21
|
+
- Security controls implementation
|
|
22
|
+
- Availability monitoring
|
|
23
|
+
- Processing integrity
|
|
24
|
+
- Confidentiality measures
|
|
25
|
+
- Privacy protection
|
|
26
|
+
|
|
27
|
+
If checking ISO 27001 (--iso27001):
|
|
28
|
+
!find . -name "*security*" -o -name "*isms*" | head -10
|
|
29
|
+
|
|
30
|
+
Validate:
|
|
31
|
+
- Information security management system
|
|
32
|
+
- Risk assessment documentation
|
|
33
|
+
- Security policy implementation
|
|
34
|
+
- Incident response procedures
|
|
35
|
+
|
|
36
|
+
If checking GDPR compliance (--gdpr):
|
|
37
|
+
!grep -r -i "personal.*data\|privacy\|consent" . --include="*.py" --include="*.js" | head -10
|
|
38
|
+
|
|
39
|
+
Check for:
|
|
40
|
+
- Data processing lawfulness
|
|
41
|
+
- Consent mechanisms
|
|
42
|
+
- Data subject rights
|
|
43
|
+
- Privacy by design
|
|
44
|
+
- Data breach procedures
|
|
45
|
+
|
|
46
|
+
## 2. Audit Trail Generation
|
|
47
|
+
|
|
48
|
+
If generating audit trail (--audit-trail):
|
|
49
|
+
!git log --since="30 days ago" --pretty=format:"%h %an %ad %s" --date=short
|
|
50
|
+
!find . -name "*.log" -newer $(date -d "30 days ago" +%Y-%m-%d) 2>/dev/null | head -10
|
|
51
|
+
|
|
52
|
+
Collect:
|
|
53
|
+
- Code changes with timestamps
|
|
54
|
+
- Access logs
|
|
55
|
+
- Configuration changes
|
|
56
|
+
- Deployment records
|
|
57
|
+
- Security events
|
|
58
|
+
|
|
59
|
+
## 3. Gap Analysis
|
|
60
|
+
|
|
61
|
+
If running gap analysis (--gap-analysis):
|
|
62
|
+
@package.json
|
|
63
|
+
!pip list | grep -E "(security|audit|compliance)" 2>/dev/null || npm list | grep -E "(security|audit|compliance)" 2>/dev/null
|
|
64
|
+
|
|
65
|
+
Identify missing:
|
|
66
|
+
- Security controls
|
|
67
|
+
- Documentation
|
|
68
|
+
- Monitoring capabilities
|
|
69
|
+
- Access controls
|
|
70
|
+
- Compliance policies
|
|
71
|
+
|
|
72
|
+
## 4. Evidence Collection
|
|
73
|
+
|
|
74
|
+
If collecting evidence (--evidence):
|
|
75
|
+
!ls -la logs/ 2>/dev/null || echo "No logs directory found"
|
|
76
|
+
!find . -name "*.cert" -o -name "*.pem" | head -5
|
|
77
|
+
!docker images 2>/dev/null | grep -E "(security|scan)" || echo "No security scanning images"
|
|
78
|
+
|
|
79
|
+
Gather evidence for:
|
|
80
|
+
- Security configurations
|
|
81
|
+
- Access controls
|
|
82
|
+
- Monitoring systems
|
|
83
|
+
- Backup procedures
|
|
84
|
+
- Incident responses
|
|
85
|
+
|
|
86
|
+
## 5. Assessment and Reporting
|
|
87
|
+
|
|
88
|
+
If running assessment (--assessment):
|
|
89
|
+
!find . -name "Dockerfile" -exec grep -l "USER" {} \; 2>/dev/null
|
|
90
|
+
!grep -r "password" . --include="*.py" --include="*.js" | grep -v "test" | head -5
|
|
91
|
+
!find . -name "*.yml" -exec grep -l "secrets" {} \; 2>/dev/null
|
|
92
|
+
|
|
93
|
+
Assess:
|
|
94
|
+
- Container security
|
|
95
|
+
- Secret management
|
|
96
|
+
- Network security
|
|
97
|
+
- Data encryption
|
|
98
|
+
- Access management
|
|
99
|
+
|
|
100
|
+
Think step by step about compliance requirements and provide:
|
|
101
|
+
- Current compliance status
|
|
102
|
+
- Identified gaps and risks
|
|
103
|
+
- Remediation recommendations
|
|
104
|
+
- Implementation timeline
|
|
105
|
+
- Resource requirements
|
|
106
|
+
|
|
107
|
+
Generate compliance report with findings and recommendations.
|
|
108
|
+
|
|
109
|
+
## 6. Policy Management
|
|
110
|
+
|
|
111
|
+
If checking policies (--policies, --policy-check):
|
|
112
|
+
!find . -name "*policy*" -o -name "*procedure*" | head -10
|
|
113
|
+
!grep -r "policy" . --include="*.md" | head -5
|
|
114
|
+
|
|
115
|
+
Validate:
|
|
116
|
+
- Policy documentation exists
|
|
117
|
+
- Policies are current and approved
|
|
118
|
+
- Implementation evidence
|
|
119
|
+
- Training records
|
|
120
|
+
- Exception handling
|
|
121
|
+
|
|
122
|
+
## 7. Control Testing
|
|
123
|
+
|
|
124
|
+
If testing controls (--test-controls):
|
|
125
|
+
!netstat -tuln 2>/dev/null | grep ":22\|:443\|:80" || echo "Network scan not available"
|
|
126
|
+
!ps aux | grep -E "(firewall|antivirus|monitoring)" | head -5
|
|
127
|
+
|
|
128
|
+
Test:
|
|
129
|
+
- Access controls
|
|
130
|
+
- Network security
|
|
131
|
+
- Data encryption
|
|
132
|
+
- Monitoring systems
|
|
133
|
+
- Backup procedures
|
|
134
|
+
|
|
135
|
+
## 8. Compliance Monitoring
|
|
136
|
+
|
|
137
|
+
If generating dashboard (--dashboard, --metrics):
|
|
138
|
+
!uptime
|
|
139
|
+
!df -h | head -5
|
|
140
|
+
!free -h 2>/dev/null || echo "Memory info not available"
|
|
141
|
+
|
|
142
|
+
Track:
|
|
143
|
+
- System availability
|
|
144
|
+
- Security incident count
|
|
145
|
+
- Policy compliance rate
|
|
146
|
+
- Control effectiveness
|
|
147
|
+
- Audit findings
|
|
148
|
+
|
|
149
|
+
For continuous monitoring (--alerts):
|
|
150
|
+
Set up compliance alerts for:
|
|
151
|
+
- Policy violations
|
|
152
|
+
- Security incidents
|
|
153
|
+
- System failures
|
|
154
|
+
- Unauthorized access
|
|
155
|
+
- Configuration changes
|
|
156
|
+
|
|
157
|
+
Provide compliance scorecard with recommendations for improvement.
|
|
158
|
+
|
|
159
|
+
## 9. Remediation Planning
|
|
160
|
+
|
|
161
|
+
If requesting remediation (--remediation):
|
|
162
|
+
Based on identified gaps, provide:
|
|
163
|
+
- Prioritized action items
|
|
164
|
+
- Implementation timeline
|
|
165
|
+
- Resource requirements
|
|
166
|
+
- Risk mitigation strategies
|
|
167
|
+
- Success metrics
|
|
168
|
+
|
|
169
|
+
## 10. Audit Readiness
|
|
170
|
+
|
|
171
|
+
If checking readiness (--readiness):
|
|
172
|
+
!find . -name "*.backup" -o -name "*.bak" | head -5
|
|
173
|
+
!crontab -l 2>/dev/null | grep -E "(backup|security|audit)" || echo "No scheduled compliance tasks"
|
|
174
|
+
|
|
175
|
+
Verify readiness for:
|
|
176
|
+
- External audits
|
|
177
|
+
- Regulatory reviews
|
|
178
|
+
- Security assessments
|
|
179
|
+
- Compliance certifications
|
|
180
|
+
|
|
181
|
+
Provide audit preparation checklist and recommendations for successful compliance outcomes.
|
|
182
|
+
|