myaidev-method 0.2.19 → 0.2.23

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 (57) hide show
  1. package/CHANGELOG.md +123 -5
  2. package/README.md +205 -13
  3. package/TECHNICAL_ARCHITECTURE.md +64 -2
  4. package/USER_GUIDE.md +453 -48
  5. package/bin/cli.js +187 -2
  6. package/content-rules.example.md +80 -0
  7. package/dist/mcp/mcp-config.json +138 -1
  8. package/dist/mcp/mcp-launcher.js +237 -0
  9. package/dist/mcp/openstack-server.js +1607 -0
  10. package/dist/server/.tsbuildinfo +1 -1
  11. package/dist/server/auth/layers.d.ts +1 -1
  12. package/dist/server/auth/services/AuthService.d.ts +1 -1
  13. package/dist/server/auth/services/TokenService.js.map +1 -1
  14. package/dist/server/auth/services/example.d.ts +5 -5
  15. package/package.json +17 -17
  16. package/src/config/workflows.js +532 -0
  17. package/src/index.js +21 -8
  18. package/src/lib/payloadcms-utils.js +206 -0
  19. package/src/lib/update-manager.js +2 -1
  20. package/src/lib/visual-config-utils.js +321 -295
  21. package/src/lib/visual-generation-utils.js +1080 -740
  22. package/src/lib/workflow-installer.js +512 -0
  23. package/src/libs/security/authorization-checker.js +606 -0
  24. package/src/mcp/openstack-server.js +1607 -0
  25. package/src/scripts/configure-wordpress-mcp.js +8 -3
  26. package/src/scripts/generate-visual-cli.js +365 -235
  27. package/src/scripts/openstack-setup.sh +110 -0
  28. package/src/scripts/ping.js +250 -0
  29. package/src/scripts/security/environment-detect.js +425 -0
  30. package/src/scripts/wordpress/publish-to-wordpress.js +165 -0
  31. package/src/server/auth/services/TokenService.ts +1 -1
  32. package/src/templates/claude/agents/content-rules-setup.md +657 -0
  33. package/src/templates/claude/agents/content-writer.md +328 -1
  34. package/src/templates/claude/agents/openstack-vm-manager.md +281 -0
  35. package/src/templates/claude/agents/osint-researcher.md +1075 -0
  36. package/src/templates/claude/agents/penetration-tester.md +908 -0
  37. package/src/templates/claude/agents/security-auditor.md +244 -0
  38. package/src/templates/claude/agents/security-setup.md +1094 -0
  39. package/src/templates/claude/agents/visual-content-generator.md +182 -4
  40. package/src/templates/claude/agents/webapp-security-tester.md +581 -0
  41. package/src/templates/claude/commands/myai-configure.md +85 -1
  42. package/src/templates/claude/commands/myai-content-rules-setup.md +204 -0
  43. package/src/templates/claude/commands/myai-openstack.md +229 -0
  44. package/src/templates/claude/commands/sc:security-exploit.md +464 -0
  45. package/src/templates/claude/commands/sc:security-recon.md +281 -0
  46. package/src/templates/claude/commands/sc:security-report.md +756 -0
  47. package/src/templates/claude/commands/sc:security-scan.md +441 -0
  48. package/src/templates/claude/commands/sc:security-setup.md +501 -0
  49. package/src/templates/codex/commands/myai-content-rules-setup.md +85 -0
  50. package/src/templates/gemini/commands/myai-content-rules-setup.toml +57 -0
  51. package/.claude/mcp/sparc-orchestrator-server.js +0 -607
  52. package/.claude/mcp/wordpress-server.js +0 -1277
  53. package/src/agents/content-writer-prompt.md +0 -164
  54. package/src/agents/content-writer.json +0 -70
  55. package/src/templates/claude/mcp_config.json +0 -30
  56. package/src/templates/claude/slash_commands.json +0 -166
  57. package/src/templates/scripts/configure-wordpress-mcp.js +0 -181
@@ -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,250 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { exec } from "child_process";
4
+ import { promisify } from "util";
5
+ import os from "os";
6
+
7
+ const execAsync = promisify(exec);
8
+
9
+ /**
10
+ * Location to IP mapping
11
+ */
12
+ export const LOCATIONS = {
13
+ "ashburn-va": "8.8.8.8", // Google DNS (East Coast reference)
14
+ "los-angeles": "1.1.1.1", // Cloudflare DNS (West Coast reference)
15
+ chicago: "8.8.4.4", // Google DNS secondary
16
+ europe: "1.0.0.1", // Cloudflare secondary
17
+ asia: "208.67.222.222", // OpenDNS
18
+ amsterdam: "213.165.253.121", // aditya's ramnode vm
19
+ };
20
+
21
+ /**
22
+ * Get device's local IP
23
+ */
24
+ function getLocalIP() {
25
+ const interfaces = os.networkInterfaces();
26
+
27
+ for (const name of Object.keys(interfaces)) {
28
+ for (const iface of interfaces[name]) {
29
+ // Skip internal and non-IPv4
30
+ if (iface.family === "IPv4" && !iface.internal) {
31
+ return iface.address;
32
+ }
33
+ }
34
+ }
35
+
36
+ return "127.0.0.1";
37
+ }
38
+
39
+ /**
40
+ * Get public IP and location info
41
+ */
42
+ async function getPublicIPInfo() {
43
+ try {
44
+ // Try ip-api.com first (free, no key needed)
45
+ const response = await fetch("http://ip-api.com/json/");
46
+ const data = await response.json();
47
+
48
+ // Check if we got valid data
49
+ if (data.status === "success" && data.query) {
50
+ return {
51
+ ip: data.query,
52
+ city: data.city || "Unknown City",
53
+ region: data.regionName || data.region,
54
+ country: data.country || "Unknown Country",
55
+ location: `${data.city}, ${data.country}`,
56
+ };
57
+ }
58
+
59
+ // Fallback if API returns error
60
+ throw new Error("Invalid response from IP API");
61
+ } catch (error) {
62
+ // Use local IP as fallback
63
+ const localIP = getLocalIP();
64
+ return {
65
+ ip: localIP,
66
+ location: `Local Network (${localIP})`,
67
+ };
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Simple ping function
73
+ * @param {string} destination - IP address or hostname to ping
74
+ * @param {string} source - Source IP (defaults to device IP)
75
+ * @returns {Promise<object>} Ping results
76
+ */
77
+ export async function ping(destination, source = null) {
78
+ const sourceIP = source || getLocalIP();
79
+
80
+ try {
81
+ const platform = process.platform;
82
+ const countFlag = platform === "win32" ? "-n" : "-c";
83
+ const command = `ping ${countFlag} 4 ${destination}`;
84
+
85
+ const { stdout } = await execAsync(command);
86
+
87
+ // Parse average latency
88
+ let avgLatency = null;
89
+
90
+ if (platform === "win32") {
91
+ const match = stdout.match(/Average = (\d+)ms/);
92
+ if (match) avgLatency = parseFloat(match[1]);
93
+ } else {
94
+ const match = stdout.match(/min\/avg\/max\/[^\s]+ = [\d.]+\/([\d.]+)\//);
95
+ if (match) avgLatency = parseFloat(match[1]);
96
+ }
97
+
98
+ return {
99
+ source: sourceIP,
100
+ destination,
101
+ latency: avgLatency,
102
+ unit: "ms",
103
+ success: true,
104
+ };
105
+ } catch (error) {
106
+ return {
107
+ source: sourceIP,
108
+ destination,
109
+ latency: null,
110
+ error: error.message,
111
+ success: false,
112
+ };
113
+ }
114
+ }
115
+
116
+ /**
117
+ * Ping multiple locations
118
+ * @param {Array<string>} locations - Array of location keys from LOCATIONS
119
+ * @param {string} source - Source IP (optional)
120
+ * @returns {Promise<Array>} Array of ping results
121
+ */
122
+ export async function pingLocations(locations, source = null) {
123
+ const results = [];
124
+
125
+ for (const loc of locations) {
126
+ const ip = LOCATIONS[loc];
127
+ if (!ip) {
128
+ results.push({
129
+ location: loc,
130
+ error: "Unknown location",
131
+ success: false,
132
+ });
133
+ continue;
134
+ }
135
+
136
+ const result = await ping(ip, source);
137
+ results.push({
138
+ location: loc,
139
+ ...result,
140
+ });
141
+ }
142
+
143
+ return results;
144
+ }
145
+
146
+ /**
147
+ * Format ping results as markdown
148
+ * @param {Array} results - Array of ping results from pingLocations
149
+ * @param {object} options - Formatting options
150
+ * @returns {string} Markdown formatted output
151
+ */
152
+ export async function formatAsMarkdown(results, options = {}) {
153
+ const { includeMetadata = true, title = "Network Latency Test Results" } =
154
+ options;
155
+
156
+ let md = `## ${title}\n\n`;
157
+
158
+ if (includeMetadata && results.length > 0) {
159
+ const timestamp = new Date().toISOString();
160
+ const ipInfo = await getPublicIPInfo();
161
+
162
+ md += `**Test Date**: ${timestamp}\n`;
163
+ md += `**Source**: ${ipInfo.location} (${ipInfo.ip})\n\n`;
164
+ }
165
+
166
+ // Build table
167
+ md += "| Location | Destination | Latency | Status |\n";
168
+ md += "|----------|-------------|---------|--------|\n";
169
+
170
+ for (const result of results) {
171
+ const location = result.location || "N/A";
172
+ const destination = result.destination || "N/A";
173
+ const latency = result.success ? `${result.latency}ms` : "-";
174
+ const status = result.success
175
+ ? "✅ Success"
176
+ : `❌ ${result.error || "Failed"}`;
177
+
178
+ md += `| ${location} | ${destination} | ${latency} | ${status} |\n`;
179
+ }
180
+
181
+ // Add summary statistics
182
+ const successful = results.filter((r) => r.success);
183
+ if (successful.length > 0) {
184
+ md += "\n### Summary\n\n";
185
+
186
+ const latencies = successful.map((r) => r.latency);
187
+ const avgLatency = (
188
+ latencies.reduce((a, b) => a + b, 0) / latencies.length
189
+ ).toFixed(2);
190
+ const minLatency = Math.min(...latencies).toFixed(2);
191
+ const maxLatency = Math.max(...latencies).toFixed(2);
192
+
193
+ md += `- **Average Latency**: ${avgLatency}ms\n`;
194
+ md += `- **Best Latency**: ${minLatency}ms\n`;
195
+ md += `- **Worst Latency**: ${maxLatency}ms\n`;
196
+ md += `- **Success Rate**: ${successful.length}/${results.length} (${((successful.length / results.length) * 100).toFixed(0)}%)\n`;
197
+ }
198
+
199
+ return md;
200
+ }
201
+
202
+ // CLI interface
203
+ if (import.meta.url === `file://${process.argv[1]}`) {
204
+ const args = process.argv.slice(2);
205
+
206
+ // Check for --all flag
207
+ if (args.includes("--all")) {
208
+ console.log("Testing all locations...\n");
209
+ const allLocations = Object.keys(LOCATIONS);
210
+ const results = await pingLocations(allLocations);
211
+ const markdown = await formatAsMarkdown(results);
212
+ console.log(markdown);
213
+ process.exit(0);
214
+ }
215
+
216
+ // Check for multiple locations
217
+ if (args.length > 1) {
218
+ console.log(`Testing ${args.length} locations...\n`);
219
+ const results = await pingLocations(args);
220
+ const markdown = await formatAsMarkdown(results);
221
+ console.log(markdown);
222
+ process.exit(0);
223
+ }
224
+
225
+ const destination = args[0];
226
+
227
+ if (!destination) {
228
+ console.log("Usage:");
229
+ console.log(
230
+ " node ping.js <destination> # Single location (markdown output)",
231
+ );
232
+ console.log(
233
+ " node ping.js <loc1> <loc2> <loc3> # Multiple locations (markdown output)",
234
+ );
235
+ console.log(
236
+ " node ping.js --all # Test all locations (markdown output)",
237
+ );
238
+ console.log("\nAvailable locations:");
239
+ Object.keys(LOCATIONS).forEach((loc) => {
240
+ console.log(` ${loc} -> ${LOCATIONS[loc]}`);
241
+ });
242
+ process.exit(1);
243
+ }
244
+
245
+ // Single location - markdown output (consistent with multiple locations)
246
+ console.log(`Testing ${destination}...\n`);
247
+ const results = await pingLocations([destination]);
248
+ const markdown = await formatAsMarkdown(results);
249
+ console.log(markdown);
250
+ }