myaidev-method 0.2.19 → 0.2.22

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.
Files changed (31) hide show
  1. package/.claude/mcp/sparc-orchestrator-server.js +0 -0
  2. package/.claude/mcp/wordpress-server.js +0 -0
  3. package/CHANGELOG.md +123 -5
  4. package/README.md +205 -13
  5. package/TECHNICAL_ARCHITECTURE.md +64 -2
  6. package/bin/cli.js +169 -2
  7. package/dist/mcp/mcp-config.json +138 -1
  8. package/dist/mcp/openstack-server.js +1607 -0
  9. package/package.json +2 -2
  10. package/src/config/workflows.js +532 -0
  11. package/src/lib/payloadcms-utils.js +206 -0
  12. package/src/lib/visual-generation-utils.js +445 -294
  13. package/src/lib/workflow-installer.js +512 -0
  14. package/src/libs/security/authorization-checker.js +606 -0
  15. package/src/mcp/openstack-server.js +1607 -0
  16. package/src/scripts/openstack-setup.sh +110 -0
  17. package/src/scripts/security/environment-detect.js +425 -0
  18. package/src/templates/claude/agents/openstack-vm-manager.md +281 -0
  19. package/src/templates/claude/agents/osint-researcher.md +1075 -0
  20. package/src/templates/claude/agents/penetration-tester.md +908 -0
  21. package/src/templates/claude/agents/security-auditor.md +244 -0
  22. package/src/templates/claude/agents/security-setup.md +1094 -0
  23. package/src/templates/claude/agents/webapp-security-tester.md +581 -0
  24. package/src/templates/claude/commands/myai-configure.md +84 -0
  25. package/src/templates/claude/commands/myai-openstack.md +229 -0
  26. package/src/templates/claude/commands/sc:security-exploit.md +464 -0
  27. package/src/templates/claude/commands/sc:security-recon.md +281 -0
  28. package/src/templates/claude/commands/sc:security-report.md +756 -0
  29. package/src/templates/claude/commands/sc:security-scan.md +441 -0
  30. package/src/templates/claude/commands/sc:security-setup.md +501 -0
  31. package/src/templates/claude/mcp_config.json +44 -0
@@ -0,0 +1,110 @@
1
+ #!/bin/bash
2
+ # OpenStack Setup Helper Script
3
+ # This script helps configure OpenStack credentials for the MyAIDev Method
4
+
5
+ set -e
6
+
7
+ echo "================================"
8
+ echo "OpenStack Configuration Helper"
9
+ echo "================================"
10
+ echo ""
11
+
12
+ # Check if OpenStack CLI is installed
13
+ if ! command -v openstack &> /dev/null; then
14
+ echo "OpenStack CLI is not installed."
15
+ echo ""
16
+ echo "To install on Ubuntu/Debian:"
17
+ echo " sudo apt update"
18
+ echo " sudo apt install python3-openstackclient"
19
+ echo ""
20
+ echo "To install with pip:"
21
+ echo " pip install python-openstackclient"
22
+ echo ""
23
+ echo "After installation, re-run this script."
24
+ exit 1
25
+ fi
26
+
27
+ echo "OpenStack CLI found: $(which openstack)"
28
+ echo "Version: $(openstack --version 2>&1)"
29
+ echo ""
30
+
31
+ # Check for openrc file
32
+ OPENRC_FILE="${1:-openrc}"
33
+
34
+ if [ -f "$OPENRC_FILE" ]; then
35
+ echo "Found openrc file: $OPENRC_FILE"
36
+ echo ""
37
+ echo "Parsing environment variables..."
38
+
39
+ # Parse the openrc file (without executing it for security)
40
+ OS_AUTH_URL=$(grep -E "^export OS_AUTH_URL=" "$OPENRC_FILE" | cut -d'=' -f2- | tr -d '"' | tr -d "'")
41
+ OS_USERNAME=$(grep -E "^export OS_USERNAME=" "$OPENRC_FILE" | cut -d'=' -f2- | tr -d '"' | tr -d "'")
42
+ OS_PROJECT_ID=$(grep -E "^export OS_PROJECT_ID=" "$OPENRC_FILE" | cut -d'=' -f2- | tr -d '"' | tr -d "'")
43
+ OS_USER_DOMAIN_ID=$(grep -E "^export OS_USER_DOMAIN_ID=" "$OPENRC_FILE" | cut -d'=' -f2- | tr -d '"' | tr -d "'" || echo "default")
44
+ OS_PROJECT_DOMAIN_ID=$(grep -E "^export OS_PROJECT_DOMAIN_ID=" "$OPENRC_FILE" | cut -d'=' -f2- | tr -d '"' | tr -d "'" || echo "default")
45
+ OS_REGION_NAME=$(grep -E "^export OS_REGION_NAME=" "$OPENRC_FILE" | cut -d'=' -f2- | tr -d '"' | tr -d "'")
46
+
47
+ echo "Detected configuration:"
48
+ echo " Auth URL: $OS_AUTH_URL"
49
+ echo " Username: $OS_USERNAME"
50
+ echo " Project ID: $OS_PROJECT_ID"
51
+ echo " User Domain: ${OS_USER_DOMAIN_ID:-default}"
52
+ echo " Project Domain: ${OS_PROJECT_DOMAIN_ID:-default}"
53
+ echo " Region: $OS_REGION_NAME"
54
+ echo ""
55
+
56
+ # Check if .env exists
57
+ ENV_FILE=".env"
58
+ if [ -f "$ENV_FILE" ]; then
59
+ echo "Existing .env file found. Will append OpenStack variables."
60
+ fi
61
+
62
+ echo "Enter your OpenStack password:"
63
+ read -sr OS_PASSWORD
64
+ echo ""
65
+
66
+ # Write to .env file
67
+ {
68
+ echo ""
69
+ echo "# OpenStack Configuration"
70
+ echo "OS_AUTH_URL=$OS_AUTH_URL"
71
+ echo "OS_USERNAME=$OS_USERNAME"
72
+ echo "OS_PASSWORD=$OS_PASSWORD"
73
+ echo "OS_PROJECT_ID=$OS_PROJECT_ID"
74
+ echo "OS_USER_DOMAIN_ID=${OS_USER_DOMAIN_ID:-default}"
75
+ echo "OS_PROJECT_DOMAIN_ID=${OS_PROJECT_DOMAIN_ID:-default}"
76
+ echo "OS_REGION_NAME=$OS_REGION_NAME"
77
+ echo "OS_IDENTITY_API_VERSION=3"
78
+ } >> "$ENV_FILE"
79
+
80
+ echo "Configuration written to $ENV_FILE"
81
+ echo ""
82
+
83
+ # Test the connection
84
+ echo "Testing OpenStack connection..."
85
+ source "$OPENRC_FILE"
86
+ export OS_PASSWORD
87
+
88
+ if openstack token issue &> /dev/null; then
89
+ echo "Connection successful!"
90
+ else
91
+ echo "Connection failed. Please verify your credentials."
92
+ exit 1
93
+ fi
94
+
95
+ else
96
+ echo "No openrc file found at: $OPENRC_FILE"
97
+ echo ""
98
+ echo "Usage: $0 [path/to/openrc]"
99
+ echo ""
100
+ echo "You can download your openrc file from your OpenStack dashboard:"
101
+ echo " 1. Log in to your OpenStack dashboard"
102
+ echo " 2. Go to Project > API Access"
103
+ echo " 3. Click 'Download OpenStack RC File'"
104
+ echo ""
105
+ fi
106
+
107
+ echo ""
108
+ echo "================================"
109
+ echo "Setup Complete"
110
+ echo "================================"
@@ -0,0 +1,425 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * MyAIDev Method - Security Environment Detection
5
+ *
6
+ * Detects execution environment and recommends setup approach
7
+ * @module security/environment-detect
8
+ */
9
+
10
+ import { execSync } from 'child_process';
11
+ import fs from 'fs';
12
+
13
+ /**
14
+ * Environment types
15
+ */
16
+ const EnvType = {
17
+ KALI_NATIVE: 'kali_native',
18
+ KALI_DOCKER: 'kali_docker',
19
+ UBUNTU_NATIVE: 'ubuntu_native',
20
+ DEBIAN_NATIVE: 'debian_native',
21
+ FEDORA_NATIVE: 'fedora_native',
22
+ DOCKER_CONTAINER: 'docker_container',
23
+ UNKNOWN: 'unknown'
24
+ };
25
+
26
+ /**
27
+ * Environment detection class
28
+ */
29
+ class EnvironmentDetector {
30
+ constructor() {
31
+ this.osInfo = {};
32
+ this.containerInfo = {};
33
+ this.toolsInfo = {};
34
+ }
35
+
36
+ /**
37
+ * Detect execution environment
38
+ */
39
+ async detect() {
40
+ console.log('🔍 Detecting security testing environment...\n');
41
+
42
+ // Detect OS
43
+ this.detectOS();
44
+
45
+ // Detect container environment
46
+ this.detectContainer();
47
+
48
+ // Check Docker availability
49
+ this.detectDocker();
50
+
51
+ // Check existing tools
52
+ this.detectTools();
53
+
54
+ // Generate recommendation
55
+ const recommendation = this.generateRecommendation();
56
+
57
+ // Display results
58
+ this.displayResults(recommendation);
59
+
60
+ return {
61
+ os: this.osInfo,
62
+ container: this.containerInfo,
63
+ tools: this.toolsInfo,
64
+ recommendation
65
+ };
66
+ }
67
+
68
+ /**
69
+ * Detect operating system
70
+ */
71
+ detectOS() {
72
+ try {
73
+ // Check if /etc/os-release exists
74
+ if (fs.existsSync('/etc/os-release')) {
75
+ const osRelease = fs.readFileSync('/etc/os-release', 'utf8');
76
+
77
+ // Parse OS release file
78
+ const lines = osRelease.split('\n');
79
+ for (const line of lines) {
80
+ const [key, value] = line.split('=');
81
+ if (value) {
82
+ this.osInfo[key] = value.replace(/"/g, '');
83
+ }
84
+ }
85
+
86
+ // Determine OS type
87
+ const id = this.osInfo.ID || '';
88
+ if (id.includes('kali')) {
89
+ this.osInfo.type = EnvType.KALI_NATIVE;
90
+ } else if (id.includes('ubuntu')) {
91
+ this.osInfo.type = EnvType.UBUNTU_NATIVE;
92
+ } else if (id.includes('debian')) {
93
+ this.osInfo.type = EnvType.DEBIAN_NATIVE;
94
+ } else if (id.includes('fedora') || id.includes('rhel') || id.includes('centos')) {
95
+ this.osInfo.type = EnvType.FEDORA_NATIVE;
96
+ } else {
97
+ this.osInfo.type = EnvType.UNKNOWN;
98
+ }
99
+ }
100
+
101
+ // Get kernel version
102
+ try {
103
+ this.osInfo.kernel = execSync('uname -r', { encoding: 'utf8' }).trim();
104
+ } catch (err) {
105
+ this.osInfo.kernel = 'unknown';
106
+ }
107
+
108
+ // Detect package manager
109
+ if (this.commandExists('apt')) {
110
+ this.osInfo.packageManager = 'apt';
111
+ } else if (this.commandExists('dnf')) {
112
+ this.osInfo.packageManager = 'dnf';
113
+ } else if (this.commandExists('yum')) {
114
+ this.osInfo.packageManager = 'yum';
115
+ } else if (this.commandExists('pacman')) {
116
+ this.osInfo.packageManager = 'pacman';
117
+ } else {
118
+ this.osInfo.packageManager = 'unknown';
119
+ }
120
+
121
+ } catch (err) {
122
+ console.error('Error detecting OS:', err.message);
123
+ this.osInfo.type = EnvType.UNKNOWN;
124
+ }
125
+ }
126
+
127
+ /**
128
+ * Detect container environment
129
+ */
130
+ detectContainer() {
131
+ try {
132
+ // Check for /.dockerenv
133
+ if (fs.existsSync('/.dockerenv')) {
134
+ this.containerInfo.isContainer = true;
135
+ this.containerInfo.type = 'docker';
136
+ return;
137
+ }
138
+
139
+ // Check cgroup for docker/container
140
+ if (fs.existsSync('/proc/1/cgroup')) {
141
+ const cgroup = fs.readFileSync('/proc/1/cgroup', 'utf8');
142
+ if (cgroup.includes('docker')) {
143
+ this.containerInfo.isContainer = true;
144
+ this.containerInfo.type = 'docker';
145
+ return;
146
+ }
147
+ if (cgroup.includes('kubepods')) {
148
+ this.containerInfo.isContainer = true;
149
+ this.containerInfo.type = 'kubernetes';
150
+ return;
151
+ }
152
+ }
153
+
154
+ this.containerInfo.isContainer = false;
155
+ } catch (err) {
156
+ this.containerInfo.isContainer = false;
157
+ }
158
+ }
159
+
160
+ /**
161
+ * Detect Docker availability
162
+ */
163
+ detectDocker() {
164
+ try {
165
+ if (this.commandExists('docker')) {
166
+ const version = execSync('docker --version', { encoding: 'utf8' }).trim();
167
+ this.containerInfo.dockerAvailable = true;
168
+ this.containerInfo.dockerVersion = version;
169
+
170
+ // Check if Docker daemon is running
171
+ try {
172
+ execSync('docker ps', { encoding: 'utf8', stdio: 'ignore' });
173
+ this.containerInfo.dockerRunning = true;
174
+ } catch (err) {
175
+ this.containerInfo.dockerRunning = false;
176
+ }
177
+ } else {
178
+ this.containerInfo.dockerAvailable = false;
179
+ }
180
+ } catch (err) {
181
+ this.containerInfo.dockerAvailable = false;
182
+ }
183
+ }
184
+
185
+ /**
186
+ * Detect existing security tools
187
+ */
188
+ detectTools() {
189
+ const essentialTools = [
190
+ 'nmap',
191
+ 'masscan',
192
+ 'sqlmap',
193
+ 'nikto',
194
+ 'hydra',
195
+ 'john',
196
+ 'hashcat',
197
+ 'metasploit-framework',
198
+ 'burpsuite',
199
+ 'zaproxy'
200
+ ];
201
+
202
+ const commandMap = {
203
+ 'metasploit-framework': 'msfconsole',
204
+ 'burpsuite': 'burpsuite',
205
+ 'zaproxy': 'zaproxy'
206
+ };
207
+
208
+ const installed = [];
209
+ const missing = [];
210
+
211
+ for (const tool of essentialTools) {
212
+ const command = commandMap[tool] || tool;
213
+ if (this.commandExists(command)) {
214
+ installed.push(tool);
215
+ } else {
216
+ missing.push(tool);
217
+ }
218
+ }
219
+
220
+ this.toolsInfo.installed = installed;
221
+ this.toolsInfo.missing = missing;
222
+ this.toolsInfo.installCount = installed.length;
223
+ this.toolsInfo.totalCount = essentialTools.length;
224
+ this.toolsInfo.percentInstalled = Math.round((installed.length / essentialTools.length) * 100);
225
+ }
226
+
227
+ /**
228
+ * Check if command exists
229
+ */
230
+ commandExists(command) {
231
+ try {
232
+ execSync(`which ${command}`, { stdio: 'ignore' });
233
+ return true;
234
+ } catch (err) {
235
+ return false;
236
+ }
237
+ }
238
+
239
+ /**
240
+ * Generate setup recommendation
241
+ */
242
+ generateRecommendation() {
243
+ const rec = {
244
+ approach: '',
245
+ reason: '',
246
+ steps: [],
247
+ estimatedTime: '',
248
+ diskSpace: ''
249
+ };
250
+
251
+ // If already Kali Linux
252
+ if (this.osInfo.type === EnvType.KALI_NATIVE) {
253
+ rec.approach = 'verify_tools';
254
+ rec.reason = 'Kali Linux detected - most tools pre-installed';
255
+ rec.steps = [
256
+ 'Update package lists: sudo apt update',
257
+ 'Upgrade packages: sudo apt upgrade',
258
+ 'Verify tool installations',
259
+ 'Install any missing tools'
260
+ ];
261
+ rec.estimatedTime = '10-15 minutes';
262
+ rec.diskSpace = '~500MB';
263
+ return rec;
264
+ }
265
+
266
+ // If Kali Docker available
267
+ if (this.containerInfo.dockerAvailable && this.containerInfo.dockerRunning) {
268
+ rec.approach = 'kali_docker';
269
+ rec.reason = 'Docker available - isolated environment recommended';
270
+ rec.steps = [
271
+ 'Pull Kali Linux Docker image',
272
+ 'Create persistent volume',
273
+ 'Start Kali container with capabilities',
274
+ 'Install kali-linux-default package',
275
+ 'Verify tool installations'
276
+ ];
277
+ rec.estimatedTime = '20-30 minutes';
278
+ rec.diskSpace = '~3GB';
279
+ return rec;
280
+ }
281
+
282
+ // If Docker available but not running
283
+ if (this.containerInfo.dockerAvailable && !this.containerInfo.dockerRunning) {
284
+ rec.approach = 'kali_docker';
285
+ rec.reason = 'Docker installed but not running';
286
+ rec.steps = [
287
+ 'Start Docker service: sudo systemctl start docker',
288
+ 'Pull Kali Linux Docker image',
289
+ 'Create persistent volume',
290
+ 'Start Kali container',
291
+ 'Install security tools'
292
+ ];
293
+ rec.estimatedTime = '25-35 minutes';
294
+ rec.diskSpace = '~3GB';
295
+ return rec;
296
+ }
297
+
298
+ // Native installation (no Docker)
299
+ if (this.osInfo.type === EnvType.UBUNTU_NATIVE ||
300
+ this.osInfo.type === EnvType.DEBIAN_NATIVE) {
301
+ rec.approach = 'native_install';
302
+ rec.reason = 'Native Linux installation - direct tool installation';
303
+ rec.steps = [
304
+ 'Update package lists',
305
+ 'Install network scanning tools (nmap, masscan)',
306
+ 'Install web testing tools (sqlmap, nikto)',
307
+ 'Install exploitation tools (metasploit)',
308
+ 'Install password tools (john, hashcat, hydra)',
309
+ 'Verify installations'
310
+ ];
311
+ rec.estimatedTime = '45-60 minutes';
312
+ rec.diskSpace = '~2GB';
313
+ return rec;
314
+ }
315
+
316
+ // Fedora/RHEL/CentOS
317
+ if (this.osInfo.type === EnvType.FEDORA_NATIVE) {
318
+ rec.approach = 'native_install';
319
+ rec.reason = 'Fedora/RHEL system - native installation with DNF';
320
+ rec.steps = [
321
+ 'Enable EPEL repository',
322
+ 'Update system: sudo dnf update',
323
+ 'Install security tools via DNF',
324
+ 'Install remaining tools from source',
325
+ 'Verify installations'
326
+ ];
327
+ rec.estimatedTime = '45-60 minutes';
328
+ rec.diskSpace = '~2GB';
329
+ return rec;
330
+ }
331
+
332
+ // Fallback - recommend Docker
333
+ rec.approach = 'install_docker_first';
334
+ rec.reason = 'Unknown environment - Docker installation recommended';
335
+ rec.steps = [
336
+ 'Install Docker: curl -fsSL https://get.docker.com | sh',
337
+ 'Start Docker service',
338
+ 'Follow Kali Docker setup',
339
+ 'Install security tools in container'
340
+ ];
341
+ rec.estimatedTime = '30-45 minutes';
342
+ rec.diskSpace = '~3.5GB';
343
+ return rec;
344
+ }
345
+
346
+ /**
347
+ * Display detection results
348
+ */
349
+ displayResults(recommendation) {
350
+ console.log('═══════════════════════════════════════════════════════');
351
+ console.log('🔍 Environment Detection Results');
352
+ console.log('═══════════════════════════════════════════════════════\n');
353
+
354
+ // OS Information
355
+ console.log('📋 Operating System:');
356
+ console.log(` Name: ${this.osInfo.NAME || 'Unknown'}`);
357
+ console.log(` Version: ${this.osInfo.VERSION || 'Unknown'}`);
358
+ console.log(` ID: ${this.osInfo.ID || 'Unknown'}`);
359
+ console.log(` Kernel: ${this.osInfo.kernel || 'Unknown'}`);
360
+ console.log(` Package Manager: ${this.osInfo.packageManager || 'Unknown'}\n`);
361
+
362
+ // Container Information
363
+ console.log('🐳 Container Environment:');
364
+ console.log(` Running in Container: ${this.containerInfo.isContainer ? 'Yes' : 'No'}`);
365
+ if (this.containerInfo.isContainer) {
366
+ console.log(` Container Type: ${this.containerInfo.type}`);
367
+ }
368
+ console.log(` Docker Available: ${this.containerInfo.dockerAvailable ? 'Yes' : 'No'}`);
369
+ if (this.containerInfo.dockerAvailable) {
370
+ console.log(` Docker Version: ${this.containerInfo.dockerVersion}`);
371
+ console.log(` Docker Running: ${this.containerInfo.dockerRunning ? 'Yes' : 'No'}`);
372
+ }
373
+ console.log();
374
+
375
+ // Security Tools
376
+ console.log('🛠️ Security Tools:');
377
+ console.log(` Installed: ${this.toolsInfo.installCount}/${this.toolsInfo.totalCount} (${this.toolsInfo.percentInstalled}%)`);
378
+ if (this.toolsInfo.installed.length > 0) {
379
+ console.log(` Found: ${this.toolsInfo.installed.slice(0, 5).join(', ')}${this.toolsInfo.installed.length > 5 ? '...' : ''}`);
380
+ }
381
+ console.log();
382
+
383
+ // Recommendation
384
+ console.log('═══════════════════════════════════════════════════════');
385
+ console.log('📋 Recommended Setup Approach');
386
+ console.log('═══════════════════════════════════════════════════════\n');
387
+ console.log(`✨ Approach: ${recommendation.approach.toUpperCase().replace(/_/g, ' ')}`);
388
+ console.log(`📝 Reason: ${recommendation.reason}`);
389
+ console.log(`⏱️ Estimated Time: ${recommendation.estimatedTime}`);
390
+ console.log(`💾 Disk Space: ${recommendation.diskSpace}\n`);
391
+
392
+ console.log('📝 Setup Steps:');
393
+ recommendation.steps.forEach((step, index) => {
394
+ console.log(` ${index + 1}. ${step}`);
395
+ });
396
+ console.log();
397
+
398
+ console.log('═══════════════════════════════════════════════════════\n');
399
+ }
400
+ }
401
+
402
+ /**
403
+ * Main execution
404
+ */
405
+ async function main() {
406
+ const detector = new EnvironmentDetector();
407
+ const result = await detector.detect();
408
+
409
+ // Save results to JSON for programmatic use
410
+ const outputPath = '/tmp/security-env-detect.json';
411
+ fs.writeFileSync(outputPath, JSON.stringify(result, null, 2));
412
+ console.log(`📄 Results saved to: ${outputPath}\n`);
413
+
414
+ process.exit(0);
415
+ }
416
+
417
+ // Run if executed directly
418
+ if (import.meta.url === `file://${process.argv[1]}`) {
419
+ main().catch(err => {
420
+ console.error('❌ Error:', err.message);
421
+ process.exit(1);
422
+ });
423
+ }
424
+
425
+ export { EnvironmentDetector, EnvType };