myaidev-method 0.0.7 → 0.1.0
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/.claude/CLAUDE.md +52 -0
- package/.claude/agents/content-writer.md +155 -0
- package/.claude/commands/myai-configure.md +44 -0
- package/.claude/commands/myai-content-writer.md +78 -0
- package/.claude/commands/myai-wordpress-publish.md +120 -0
- package/.claude/mcp/gutenberg-converter.js +447 -0
- package/.claude/mcp/mcp-config.json +101 -0
- package/.claude/mcp/wordpress-server-simple.js +182 -0
- package/.claude/mcp/wordpress-server.js +1277 -0
- package/.claude/settings.local.json +12 -0
- package/COOLIFY_DEPLOYMENT.md +750 -0
- package/README.md +6 -6
- package/WORDPRESS_ADMIN_SCRIPTS.md +474 -0
- package/bin/cli.js +17 -22
- package/dist/mcp/gutenberg-converter.js +447 -0
- package/dist/mcp/mcp-config.json +101 -0
- package/dist/mcp/wordpress-server-simple.js +182 -0
- package/dist/mcp/wordpress-server.js +1277 -0
- package/package.json +29 -5
- package/src/lib/coolify-utils.js +380 -0
- package/src/lib/report-synthesizer.js +504 -0
- package/src/lib/wordpress-admin-utils.js +703 -0
- package/src/mcp/health-check.js +190 -0
- package/src/mcp/mcp-launcher.js +237 -0
- package/src/scripts/coolify-deploy-app.js +287 -0
- package/src/scripts/coolify-list-resources.js +199 -0
- package/src/scripts/coolify-status.js +97 -0
- package/src/scripts/test-coolify-deploy.js +47 -0
- package/src/scripts/wordpress-comprehensive-report.js +325 -0
- package/src/scripts/wordpress-health-check.js +175 -0
- package/src/scripts/wordpress-performance-check.js +461 -0
- package/src/scripts/wordpress-security-scan.js +221 -0
- package/src/templates/claude/agents/coolify-deploy.md +563 -0
- package/src/templates/claude/agents/wordpress-admin.md +228 -271
- package/src/templates/claude/commands/myai-configure.md +10 -74
- package/src/templates/claude/commands/myai-coolify-deploy.md +172 -0
- package/src/templates/claude/commands/myai-wordpress-publish.md +16 -8
package/package.json
CHANGED
|
@@ -1,27 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myaidev-method",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "AI CLI tools package with custom subagents and MCP integrations for Claude Code, Gemini CLI, and more",
|
|
5
|
+
"mcpName": "io.github.myaione/myaidev-method",
|
|
5
6
|
"main": "src/index.js",
|
|
6
7
|
"bin": {
|
|
7
|
-
"myaidev-method": "./bin/cli.js"
|
|
8
|
+
"myaidev-method": "./bin/cli.js",
|
|
9
|
+
"myaidev-mcp-server": "./.claude/mcp/wordpress-server.js",
|
|
10
|
+
"myaidev-mcp-launcher": "./src/mcp/mcp-launcher.js"
|
|
8
11
|
},
|
|
9
12
|
"scripts": {
|
|
10
13
|
"test": "node test/run-tests.js",
|
|
11
14
|
"test:gutenberg": "node test/test-gutenberg-converter.js",
|
|
12
15
|
"test:install": "node test/test-installation.js",
|
|
13
|
-
"
|
|
16
|
+
"test:mcp": "node test/test-enhanced-mcp-server.js",
|
|
17
|
+
"test:mcp:simple": "node test/test-simple-mcp.js",
|
|
18
|
+
"mcp:start": "node src/mcp/mcp-launcher.js start",
|
|
19
|
+
"mcp:start:direct": "node .claude/mcp/wordpress-server.js",
|
|
20
|
+
"mcp:start:simple": "node .claude/mcp/wordpress-server-simple.js",
|
|
21
|
+
"mcp:status": "node src/mcp/mcp-launcher.js status",
|
|
22
|
+
"mcp:health": "node src/mcp/mcp-launcher.js health",
|
|
23
|
+
"build:mcp": "mkdir -p dist/mcp && cp .claude/mcp/*.js .claude/mcp/*.json dist/mcp/",
|
|
24
|
+
"prepublishOnly": "npm install && npm test && npm run build:mcp",
|
|
14
25
|
"postinstall": "echo \"MyAIDev Method installed successfully! Run 'npx myaidev-method init --claude' to get started.\"",
|
|
15
|
-
"wordpress:troubleshoot": "node src/templates/docs/wordpress-troubleshoot.js"
|
|
26
|
+
"wordpress:troubleshoot": "node src/templates/docs/wordpress-troubleshoot.js",
|
|
27
|
+
"wordpress:health-check": "node src/scripts/wordpress-health-check.js",
|
|
28
|
+
"wordpress:security-scan": "node src/scripts/wordpress-security-scan.js",
|
|
29
|
+
"wordpress:performance-check": "node src/scripts/wordpress-performance-check.js",
|
|
30
|
+
"wordpress:comprehensive-report": "node src/scripts/wordpress-comprehensive-report.js",
|
|
31
|
+
"coolify:status": "node src/scripts/coolify-status.js",
|
|
32
|
+
"coolify:list": "node src/scripts/coolify-list-resources.js"
|
|
16
33
|
},
|
|
17
34
|
"keywords": [
|
|
18
35
|
"claude-code",
|
|
19
36
|
"ai-cli",
|
|
20
37
|
"mcp",
|
|
21
38
|
"wordpress",
|
|
39
|
+
"coolify",
|
|
22
40
|
"content-writer",
|
|
23
41
|
"ai-agents",
|
|
24
42
|
"automation",
|
|
43
|
+
"deployment",
|
|
44
|
+
"devops",
|
|
25
45
|
"cli-tool",
|
|
26
46
|
"slash-commands",
|
|
27
47
|
"gemini-cli",
|
|
@@ -53,10 +73,14 @@
|
|
|
53
73
|
"files": [
|
|
54
74
|
"bin/",
|
|
55
75
|
"src/",
|
|
76
|
+
".claude/",
|
|
77
|
+
"dist/",
|
|
56
78
|
"README.md",
|
|
57
79
|
"USER_GUIDE.md",
|
|
58
80
|
"LICENSE",
|
|
59
|
-
".env.example"
|
|
81
|
+
".env.example",
|
|
82
|
+
"WORDPRESS_ADMIN_SCRIPTS.md",
|
|
83
|
+
"COOLIFY_DEPLOYMENT.md"
|
|
60
84
|
],
|
|
61
85
|
"engines": {
|
|
62
86
|
"node": ">=18.0.0"
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coolify API Utilities
|
|
3
|
+
* Reusable functions for Coolify deployment and resource management
|
|
4
|
+
* Optimized for Claude Code 2.0 agent integration
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import fetch from 'node-fetch';
|
|
8
|
+
import { readFileSync } from 'fs';
|
|
9
|
+
import { parse } from 'dotenv';
|
|
10
|
+
|
|
11
|
+
export class CoolifyUtils {
|
|
12
|
+
constructor(config = {}) {
|
|
13
|
+
// Load config from .env if not provided
|
|
14
|
+
if (!config.url || !config.apiKey) {
|
|
15
|
+
const envConfig = this.loadEnvConfig();
|
|
16
|
+
config = { ...envConfig, ...config };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
this.url = config.url?.replace(/\/$/, '');
|
|
20
|
+
this.apiKey = config.apiKey;
|
|
21
|
+
this.headers = {
|
|
22
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
23
|
+
'Content-Type': 'application/json',
|
|
24
|
+
'Accept': 'application/json'
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
loadEnvConfig() {
|
|
29
|
+
try {
|
|
30
|
+
const envPath = process.env.ENV_PATH || '.env';
|
|
31
|
+
const envContent = readFileSync(envPath, 'utf8');
|
|
32
|
+
const parsed = parse(envContent);
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
url: parsed.COOLIFY_URL,
|
|
36
|
+
apiKey: parsed.COOLIFY_API_KEY
|
|
37
|
+
};
|
|
38
|
+
} catch (error) {
|
|
39
|
+
throw new Error(`Failed to load Coolify configuration: ${error.message}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Make authenticated Coolify API request
|
|
45
|
+
*/
|
|
46
|
+
async request(endpoint, options = {}) {
|
|
47
|
+
const url = `${this.url}${endpoint}`;
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
const response = await fetch(url, {
|
|
51
|
+
...options,
|
|
52
|
+
headers: { ...this.headers, ...options.headers }
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const data = await response.json().catch(() => ({}));
|
|
56
|
+
|
|
57
|
+
if (!response.ok) {
|
|
58
|
+
throw new Error(`HTTP ${response.status}: ${data.message || response.statusText}`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return data;
|
|
62
|
+
} catch (error) {
|
|
63
|
+
throw new Error(`Coolify API request failed: ${error.message}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Server Management
|
|
69
|
+
*/
|
|
70
|
+
async listServers() {
|
|
71
|
+
return await this.request('/api/v1/servers');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async getServer(uuid) {
|
|
75
|
+
return await this.request(`/api/v1/servers/${uuid}`);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async getServerResources(uuid) {
|
|
79
|
+
return await this.request(`/api/v1/servers/${uuid}/resources`);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Project Management
|
|
84
|
+
*/
|
|
85
|
+
async listProjects() {
|
|
86
|
+
return await this.request('/api/v1/projects');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async getProject(uuid) {
|
|
90
|
+
return await this.request(`/api/v1/projects/${uuid}`);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async createProject(data) {
|
|
94
|
+
return await this.request('/api/v1/projects', {
|
|
95
|
+
method: 'POST',
|
|
96
|
+
body: JSON.stringify(data)
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Application Management
|
|
102
|
+
*/
|
|
103
|
+
async listApplications() {
|
|
104
|
+
return await this.request('/api/v1/applications');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async getApplication(uuid) {
|
|
108
|
+
return await this.request(`/api/v1/applications/${uuid}`);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async createApplication(data) {
|
|
112
|
+
// Coolify API requires /applications/public endpoint
|
|
113
|
+
return await this.request('/api/v1/applications/public', {
|
|
114
|
+
method: 'POST',
|
|
115
|
+
body: JSON.stringify(data)
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async updateApplication(uuid, data) {
|
|
120
|
+
return await this.request(`/api/v1/applications/${uuid}`, {
|
|
121
|
+
method: 'PATCH',
|
|
122
|
+
body: JSON.stringify(data)
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async deleteApplication(uuid) {
|
|
127
|
+
return await this.request(`/api/v1/applications/${uuid}`, {
|
|
128
|
+
method: 'DELETE'
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Deployment Operations
|
|
134
|
+
*/
|
|
135
|
+
async deployApplication(uuid, options = {}) {
|
|
136
|
+
const endpoint = options.tag
|
|
137
|
+
? `/api/v1/deploy?tag=${options.tag}`
|
|
138
|
+
: `/api/v1/deploy?uuid=${uuid}`;
|
|
139
|
+
|
|
140
|
+
return await this.request(endpoint, {
|
|
141
|
+
method: 'POST',
|
|
142
|
+
body: JSON.stringify({
|
|
143
|
+
force: options.force || false,
|
|
144
|
+
instant_deploy: options.instant || false,
|
|
145
|
+
...options.deployConfig
|
|
146
|
+
})
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async getDeploymentLogs(uuid) {
|
|
151
|
+
return await this.request(`/api/v1/applications/${uuid}/logs`);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
async restartApplication(uuid) {
|
|
155
|
+
return await this.request(`/api/v1/applications/${uuid}/restart`, {
|
|
156
|
+
method: 'POST'
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
async stopApplication(uuid) {
|
|
161
|
+
return await this.request(`/api/v1/applications/${uuid}/stop`, {
|
|
162
|
+
method: 'POST'
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Environment Variables
|
|
168
|
+
*/
|
|
169
|
+
async getEnvironmentVariables(uuid) {
|
|
170
|
+
return await this.request(`/api/v1/applications/${uuid}/envs`);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
async updateEnvironmentVariables(uuid, envVars) {
|
|
174
|
+
return await this.request(`/api/v1/applications/${uuid}/envs`, {
|
|
175
|
+
method: 'POST',
|
|
176
|
+
body: JSON.stringify(envVars)
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Database Management
|
|
182
|
+
*/
|
|
183
|
+
async listDatabases() {
|
|
184
|
+
return await this.request('/api/v1/databases');
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
async getDatabase(uuid) {
|
|
188
|
+
return await this.request(`/api/v1/databases/${uuid}`);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
async createDatabase(data) {
|
|
192
|
+
return await this.request('/api/v1/databases', {
|
|
193
|
+
method: 'POST',
|
|
194
|
+
body: JSON.stringify(data)
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Service Management
|
|
200
|
+
*/
|
|
201
|
+
async listServices() {
|
|
202
|
+
return await this.request('/api/v1/services');
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
async getService(uuid) {
|
|
206
|
+
return await this.request(`/api/v1/services/${uuid}`);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Team Management
|
|
211
|
+
*/
|
|
212
|
+
async listTeams() {
|
|
213
|
+
return await this.request('/api/v1/teams');
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
async getCurrentTeam() {
|
|
217
|
+
return await this.request('/api/v1/teams/current');
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Health & Status
|
|
222
|
+
*/
|
|
223
|
+
async healthCheck() {
|
|
224
|
+
try {
|
|
225
|
+
const response = await fetch(`${this.url}/api/health`);
|
|
226
|
+
return response.ok;
|
|
227
|
+
} catch (error) {
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
async getSystemStatus() {
|
|
233
|
+
const [servers, projects, applications] = await Promise.all([
|
|
234
|
+
this.listServers().catch(() => []),
|
|
235
|
+
this.listProjects().catch(() => []),
|
|
236
|
+
this.listApplications().catch(() => [])
|
|
237
|
+
]);
|
|
238
|
+
|
|
239
|
+
return {
|
|
240
|
+
healthy: await this.healthCheck(),
|
|
241
|
+
servers: {
|
|
242
|
+
total: servers.length,
|
|
243
|
+
reachable: servers.filter(s => s.is_reachable).length,
|
|
244
|
+
usable: servers.filter(s => s.is_usable).length
|
|
245
|
+
},
|
|
246
|
+
projects: {
|
|
247
|
+
total: projects.length
|
|
248
|
+
},
|
|
249
|
+
applications: {
|
|
250
|
+
total: applications.length
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Deployment Helpers
|
|
257
|
+
*/
|
|
258
|
+
async findApplicationByName(name) {
|
|
259
|
+
const apps = await this.listApplications();
|
|
260
|
+
return apps.find(app => app.name === name);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
async findServerByName(name) {
|
|
264
|
+
const servers = await this.listServers();
|
|
265
|
+
return servers.find(server => server.name === name);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
async findProjectByName(name) {
|
|
269
|
+
const projects = await this.listProjects();
|
|
270
|
+
return projects.find(project => project.name === name);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
async waitForDeployment(uuid, options = {}) {
|
|
274
|
+
const maxAttempts = options.maxAttempts || 60;
|
|
275
|
+
const interval = options.interval || 5000;
|
|
276
|
+
|
|
277
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
278
|
+
const app = await this.getApplication(uuid);
|
|
279
|
+
|
|
280
|
+
if (app.status === 'running') {
|
|
281
|
+
return { success: true, status: 'running', attempts: i + 1 };
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (app.status === 'error' || app.status === 'failed') {
|
|
285
|
+
return { success: false, status: app.status, attempts: i + 1 };
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
await new Promise(resolve => setTimeout(resolve, interval));
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return { success: false, status: 'timeout', attempts: maxAttempts };
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Deployment Configuration Builders
|
|
296
|
+
*/
|
|
297
|
+
buildApplicationConfig(options) {
|
|
298
|
+
return {
|
|
299
|
+
name: options.name,
|
|
300
|
+
description: options.description || '',
|
|
301
|
+
project_uuid: options.projectUuid,
|
|
302
|
+
server_uuid: options.serverUuid,
|
|
303
|
+
destination_uuid: options.destinationUuid,
|
|
304
|
+
source: {
|
|
305
|
+
type: options.sourceType || 'git',
|
|
306
|
+
repository: options.repository,
|
|
307
|
+
branch: options.branch || 'main',
|
|
308
|
+
commit: options.commit || null
|
|
309
|
+
},
|
|
310
|
+
build_pack: options.buildPack || 'nixpacks',
|
|
311
|
+
ports_exposes: options.ports || '3000',
|
|
312
|
+
domains: options.domains || [],
|
|
313
|
+
environment_variables: options.envVars || {},
|
|
314
|
+
settings: {
|
|
315
|
+
instant_deploy: options.instantDeploy || false,
|
|
316
|
+
auto_deploy: options.autoDeploy || true,
|
|
317
|
+
...options.settings
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
buildDatabaseConfig(options) {
|
|
323
|
+
return {
|
|
324
|
+
name: options.name,
|
|
325
|
+
description: options.description || '',
|
|
326
|
+
project_uuid: options.projectUuid,
|
|
327
|
+
server_uuid: options.serverUuid,
|
|
328
|
+
destination_uuid: options.destinationUuid,
|
|
329
|
+
type: options.type, // postgresql, mysql, mongodb, redis, etc.
|
|
330
|
+
version: options.version || 'latest',
|
|
331
|
+
public_port: options.publicPort || null,
|
|
332
|
+
environment_variables: options.envVars || {}
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Formatted Output Helpers
|
|
338
|
+
*/
|
|
339
|
+
formatServerList(servers) {
|
|
340
|
+
return servers.map(s => ({
|
|
341
|
+
name: s.name,
|
|
342
|
+
uuid: s.uuid,
|
|
343
|
+
ip: s.ip,
|
|
344
|
+
status: s.is_reachable ? '✓ Reachable' : '✗ Unreachable',
|
|
345
|
+
usable: s.is_usable ? '✓ Usable' : '✗ Not Usable',
|
|
346
|
+
description: s.description || 'No description'
|
|
347
|
+
}));
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
formatApplicationList(applications) {
|
|
351
|
+
return applications.map(a => ({
|
|
352
|
+
name: a.name,
|
|
353
|
+
uuid: a.uuid,
|
|
354
|
+
status: a.status,
|
|
355
|
+
url: a.fqdn || 'Not configured',
|
|
356
|
+
project: a.project?.name || 'Unknown'
|
|
357
|
+
}));
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
generateDeploymentReport(deployment, application) {
|
|
361
|
+
return {
|
|
362
|
+
timestamp: new Date().toISOString(),
|
|
363
|
+
application: {
|
|
364
|
+
name: application.name,
|
|
365
|
+
uuid: application.uuid,
|
|
366
|
+
url: application.fqdn
|
|
367
|
+
},
|
|
368
|
+
deployment: {
|
|
369
|
+
status: deployment.status,
|
|
370
|
+
commit: deployment.commit,
|
|
371
|
+
branch: deployment.branch,
|
|
372
|
+
started_at: deployment.started_at,
|
|
373
|
+
finished_at: deployment.finished_at
|
|
374
|
+
},
|
|
375
|
+
success: deployment.status === 'success'
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export default CoolifyUtils;
|