myaidev-method 0.0.8 → 0.2.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/.env.example +20 -0
- package/COOLIFY_DEPLOYMENT.md +750 -0
- package/PUBLISHING_GUIDE.md +521 -0
- package/README.md +125 -27
- package/WORDPRESS_ADMIN_SCRIPTS.md +474 -0
- package/package.json +36 -3
- package/src/lib/coolify-utils.js +380 -0
- package/src/lib/payloadcms-utils.js +394 -0
- package/src/lib/report-synthesizer.js +504 -0
- package/src/lib/static-site-utils.js +377 -0
- package/src/lib/wordpress-admin-utils.js +703 -0
- package/src/scripts/astro-publish.js +209 -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/docusaurus-publish.js +209 -0
- package/src/scripts/init-project.js +91 -0
- package/src/scripts/mintlify-publish.js +205 -0
- package/src/scripts/payloadcms-publish.js +202 -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/astro-publish.md +43 -0
- package/src/templates/claude/agents/coolify-deploy.md +563 -0
- package/src/templates/claude/agents/docusaurus-publish.md +42 -0
- package/src/templates/claude/agents/mintlify-publish.md +42 -0
- package/src/templates/claude/agents/payloadcms-publish.md +134 -0
- package/src/templates/claude/commands/myai-astro-publish.md +54 -0
- package/src/templates/claude/commands/myai-coolify-deploy.md +172 -0
- package/src/templates/claude/commands/myai-docusaurus-publish.md +45 -0
- package/src/templates/claude/commands/myai-mintlify-publish.md +45 -0
- package/src/templates/claude/commands/myai-payloadcms-publish.md +45 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Astro Publishing Script
|
|
5
|
+
* Publish markdown content to Astro site
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { StaticSiteUtils } from '../lib/static-site-utils.js';
|
|
9
|
+
|
|
10
|
+
const args = process.argv.slice(2);
|
|
11
|
+
|
|
12
|
+
const options = {
|
|
13
|
+
file: null,
|
|
14
|
+
type: 'content',
|
|
15
|
+
projectPath: null,
|
|
16
|
+
branch: 'main',
|
|
17
|
+
noPush: false,
|
|
18
|
+
commitMessage: null,
|
|
19
|
+
json: args.includes('--json'),
|
|
20
|
+
verbose: args.includes('--verbose') || args.includes('-v'),
|
|
21
|
+
dryRun: args.includes('--dry-run')
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// Parse arguments
|
|
25
|
+
for (let i = 0; i < args.length; i++) {
|
|
26
|
+
switch (args[i]) {
|
|
27
|
+
case '--file':
|
|
28
|
+
case '-f':
|
|
29
|
+
options.file = args[++i];
|
|
30
|
+
break;
|
|
31
|
+
case '--type':
|
|
32
|
+
case '-t':
|
|
33
|
+
options.type = args[++i];
|
|
34
|
+
break;
|
|
35
|
+
case '--project':
|
|
36
|
+
case '-p':
|
|
37
|
+
options.projectPath = args[++i];
|
|
38
|
+
break;
|
|
39
|
+
case '--branch':
|
|
40
|
+
case '-b':
|
|
41
|
+
options.branch = args[++i];
|
|
42
|
+
break;
|
|
43
|
+
case '--no-push':
|
|
44
|
+
options.noPush = true;
|
|
45
|
+
break;
|
|
46
|
+
case '--message':
|
|
47
|
+
case '-m':
|
|
48
|
+
options.commitMessage = args[++i];
|
|
49
|
+
break;
|
|
50
|
+
case '--help':
|
|
51
|
+
case '-h':
|
|
52
|
+
printHelp();
|
|
53
|
+
process.exit(0);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// If no file specified, check positional argument
|
|
58
|
+
if (!options.file && args.length > 0 && !args[0].startsWith('-')) {
|
|
59
|
+
options.file = args[0];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function printHelp() {
|
|
63
|
+
console.log(`
|
|
64
|
+
Astro Publishing Script
|
|
65
|
+
|
|
66
|
+
Usage: astro-publish [file] [options]
|
|
67
|
+
|
|
68
|
+
Arguments:
|
|
69
|
+
file Markdown file to publish (required)
|
|
70
|
+
|
|
71
|
+
Options:
|
|
72
|
+
--type, -t <type> Content type: content|pages (default: content)
|
|
73
|
+
--project, -p <path> Astro project path
|
|
74
|
+
--branch, -b <branch> Git branch to push to (default: main)
|
|
75
|
+
--no-push Commit but don't push to remote
|
|
76
|
+
--message, -m <msg> Custom commit message
|
|
77
|
+
--dry-run Validate without committing
|
|
78
|
+
--verbose, -v Show detailed progress
|
|
79
|
+
--json Output in JSON format
|
|
80
|
+
--help, -h Show this help
|
|
81
|
+
|
|
82
|
+
Examples:
|
|
83
|
+
# Publish to content collection
|
|
84
|
+
astro-publish article.md
|
|
85
|
+
|
|
86
|
+
# Publish to pages
|
|
87
|
+
astro-publish page.md --type pages
|
|
88
|
+
|
|
89
|
+
# Custom project path and branch
|
|
90
|
+
astro-publish article.md --project ./my-astro-site --branch develop
|
|
91
|
+
|
|
92
|
+
# Commit only (no push)
|
|
93
|
+
astro-publish article.md --no-push
|
|
94
|
+
`);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async function publishContent() {
|
|
98
|
+
try {
|
|
99
|
+
// Validate required options
|
|
100
|
+
if (!options.file) {
|
|
101
|
+
console.error('Error: Markdown file is required');
|
|
102
|
+
console.error('Run with --help for usage information');
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (options.verbose) {
|
|
107
|
+
console.error('Initializing Astro publishing...');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const site = new StaticSiteUtils({
|
|
111
|
+
platform: 'astro',
|
|
112
|
+
projectPath: options.projectPath
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
if (options.verbose) {
|
|
116
|
+
console.error('✓ Astro project detected');
|
|
117
|
+
console.error(`Publishing to: ${options.type}`);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Validate project
|
|
121
|
+
site.validateProject();
|
|
122
|
+
|
|
123
|
+
if (options.verbose) {
|
|
124
|
+
console.error('✓ Project structure validated');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Dry run - validate only
|
|
128
|
+
if (options.dryRun) {
|
|
129
|
+
if (options.verbose) {
|
|
130
|
+
console.error('✓ Dry run - validation successful');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const output = {
|
|
134
|
+
success: true,
|
|
135
|
+
dryRun: true,
|
|
136
|
+
file: options.file,
|
|
137
|
+
platform: 'astro',
|
|
138
|
+
type: options.type
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
if (options.json) {
|
|
142
|
+
console.log(JSON.stringify(output, null, 2));
|
|
143
|
+
} else {
|
|
144
|
+
console.log('Dry run successful - ready to publish');
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
process.exit(0);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Publish content
|
|
151
|
+
const result = await site.publishContent(options.file, {
|
|
152
|
+
type: options.type,
|
|
153
|
+
branch: options.branch,
|
|
154
|
+
noPush: options.noPush,
|
|
155
|
+
commitMessage: options.commitMessage
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
if (options.verbose) {
|
|
159
|
+
console.error(`✓ Content published successfully`);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Prepare output
|
|
163
|
+
const output = {
|
|
164
|
+
success: true,
|
|
165
|
+
file: result.file,
|
|
166
|
+
platform: result.platform,
|
|
167
|
+
git: result.git,
|
|
168
|
+
timestamp: new Date().toISOString()
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
if (options.json) {
|
|
172
|
+
console.log(JSON.stringify(output, null, 2));
|
|
173
|
+
} else {
|
|
174
|
+
console.log('\\n' + '='.repeat(60));
|
|
175
|
+
console.log('Astro Publishing Result');
|
|
176
|
+
console.log('='.repeat(60));
|
|
177
|
+
console.log(`Status: ✓ Success`);
|
|
178
|
+
console.log(`File: ${result.file}`);
|
|
179
|
+
console.log(`Committed: ${result.git.committed ? 'Yes' : 'No'}`);
|
|
180
|
+
console.log(`Pushed: ${result.git.pushed ? 'Yes' : 'No'}`);
|
|
181
|
+
if (result.git.branch) {
|
|
182
|
+
console.log(`Branch: ${result.git.branch}`);
|
|
183
|
+
}
|
|
184
|
+
console.log('='.repeat(60));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
process.exit(0);
|
|
188
|
+
} catch (error) {
|
|
189
|
+
if (options.json) {
|
|
190
|
+
console.log(JSON.stringify({
|
|
191
|
+
success: false,
|
|
192
|
+
error: error.message,
|
|
193
|
+
timestamp: new Date().toISOString()
|
|
194
|
+
}, null, 2));
|
|
195
|
+
} else {
|
|
196
|
+
console.error(`\\nError: ${error.message}`);
|
|
197
|
+
if (options.verbose) {
|
|
198
|
+
console.error(`Stack: ${error.stack}`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
process.exit(1);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
206
|
+
publishContent();
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export { publishContent };
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Coolify Application Deployment Script
|
|
5
|
+
* Deploy applications to Coolify with full configuration support
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { CoolifyUtils } from '../lib/coolify-utils.js';
|
|
9
|
+
|
|
10
|
+
const args = process.argv.slice(2);
|
|
11
|
+
|
|
12
|
+
const options = {
|
|
13
|
+
name: null,
|
|
14
|
+
repo: null,
|
|
15
|
+
branch: 'main',
|
|
16
|
+
buildPack: 'nixpacks',
|
|
17
|
+
port: '3000',
|
|
18
|
+
domain: null,
|
|
19
|
+
serverUuid: null,
|
|
20
|
+
projectUuid: null,
|
|
21
|
+
envFile: null,
|
|
22
|
+
instant: false,
|
|
23
|
+
force: false,
|
|
24
|
+
wait: true,
|
|
25
|
+
json: args.includes('--json'),
|
|
26
|
+
verbose: args.includes('--verbose') || args.includes('-v')
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// Parse arguments
|
|
30
|
+
for (let i = 0; i < args.length; i++) {
|
|
31
|
+
switch (args[i]) {
|
|
32
|
+
case '--name':
|
|
33
|
+
options.name = args[++i];
|
|
34
|
+
break;
|
|
35
|
+
case '--repo':
|
|
36
|
+
case '--repository':
|
|
37
|
+
options.repo = args[++i];
|
|
38
|
+
break;
|
|
39
|
+
case '--branch':
|
|
40
|
+
options.branch = args[++i];
|
|
41
|
+
break;
|
|
42
|
+
case '--build-pack':
|
|
43
|
+
options.buildPack = args[++i];
|
|
44
|
+
break;
|
|
45
|
+
case '--port':
|
|
46
|
+
options.port = args[++i];
|
|
47
|
+
break;
|
|
48
|
+
case '--domain':
|
|
49
|
+
options.domain = args[++i];
|
|
50
|
+
break;
|
|
51
|
+
case '--server-uuid':
|
|
52
|
+
options.serverUuid = args[++i];
|
|
53
|
+
break;
|
|
54
|
+
case '--project-uuid':
|
|
55
|
+
options.projectUuid = args[++i];
|
|
56
|
+
break;
|
|
57
|
+
case '--env-file':
|
|
58
|
+
options.envFile = args[++i];
|
|
59
|
+
break;
|
|
60
|
+
case '--instant':
|
|
61
|
+
options.instant = true;
|
|
62
|
+
break;
|
|
63
|
+
case '--force':
|
|
64
|
+
options.force = true;
|
|
65
|
+
break;
|
|
66
|
+
case '--no-wait':
|
|
67
|
+
options.wait = false;
|
|
68
|
+
break;
|
|
69
|
+
case '--help':
|
|
70
|
+
case '-h':
|
|
71
|
+
printHelp();
|
|
72
|
+
process.exit(0);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function printHelp() {
|
|
77
|
+
console.log(`
|
|
78
|
+
Coolify Application Deployment Script
|
|
79
|
+
|
|
80
|
+
Usage: coolify-deploy-app [options]
|
|
81
|
+
|
|
82
|
+
Required Options:
|
|
83
|
+
--name <name> Application name
|
|
84
|
+
--repo <url> Git repository URL
|
|
85
|
+
--project-uuid <uuid> Target project UUID
|
|
86
|
+
--server-uuid <uuid> Target server UUID
|
|
87
|
+
|
|
88
|
+
Optional Options:
|
|
89
|
+
--branch <name> Git branch (default: main)
|
|
90
|
+
--build-pack <type> Build pack: nixpacks, dockerfile, static (default: nixpacks)
|
|
91
|
+
--port <port> Application port (default: 3000)
|
|
92
|
+
--domain <domain> Domain name for the application
|
|
93
|
+
--env-file <path> Environment variables file
|
|
94
|
+
--instant Deploy instantly (skip queue)
|
|
95
|
+
--force Force rebuild
|
|
96
|
+
--no-wait Don't wait for deployment to complete
|
|
97
|
+
--verbose Show detailed progress
|
|
98
|
+
-v Alias for --verbose
|
|
99
|
+
--json Output in JSON format
|
|
100
|
+
--help Show this help
|
|
101
|
+
-h Alias for --help
|
|
102
|
+
|
|
103
|
+
Examples:
|
|
104
|
+
# Basic deployment
|
|
105
|
+
node src/scripts/coolify-deploy-app.js \\
|
|
106
|
+
--name "myapp" \\
|
|
107
|
+
--repo "https://github.com/user/myapp" \\
|
|
108
|
+
--project-uuid "zg44coscocg0sko8k0wgcgkw" \\
|
|
109
|
+
--server-uuid "vcscogc44gko4k880ww880kk"
|
|
110
|
+
|
|
111
|
+
# With custom domain and environment
|
|
112
|
+
node src/scripts/coolify-deploy-app.js \\
|
|
113
|
+
--name "api-prod" \\
|
|
114
|
+
--repo "https://github.com/user/api" \\
|
|
115
|
+
--branch "production" \\
|
|
116
|
+
--domain "api.example.com" \\
|
|
117
|
+
--env-file ".env.production" \\
|
|
118
|
+
--project-uuid "zg44coscocg0sko8k0wgcgkw" \\
|
|
119
|
+
--server-uuid "vcscogc44gko4k880ww880kk"
|
|
120
|
+
|
|
121
|
+
# Dockerfile-based deployment
|
|
122
|
+
node src/scripts/coolify-deploy-app.js \\
|
|
123
|
+
--name "docker-app" \\
|
|
124
|
+
--repo "https://github.com/user/docker-app" \\
|
|
125
|
+
--build-pack "dockerfile" \\
|
|
126
|
+
--port "8080" \\
|
|
127
|
+
--project-uuid "zg44coscocg0sko8k0wgcgkw" \\
|
|
128
|
+
--server-uuid "vcscogc44gko4k880ww880kk"
|
|
129
|
+
`);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async function deployApplication() {
|
|
133
|
+
try {
|
|
134
|
+
// Validate required options
|
|
135
|
+
if (!options.name || !options.repo || !options.projectUuid || !options.serverUuid) {
|
|
136
|
+
console.error('Error: Missing required options');
|
|
137
|
+
console.error('Required: --name, --repo, --project-uuid, --server-uuid');
|
|
138
|
+
console.error('Run with --help for usage information');
|
|
139
|
+
process.exit(1);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (options.verbose) {
|
|
143
|
+
console.error('Initializing Coolify connection...');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const coolify = new CoolifyUtils();
|
|
147
|
+
|
|
148
|
+
// Verify connectivity
|
|
149
|
+
const healthy = await coolify.healthCheck();
|
|
150
|
+
if (!healthy) {
|
|
151
|
+
throw new Error('Coolify is not reachable');
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (options.verbose) {
|
|
155
|
+
console.error('✓ Coolify is reachable');
|
|
156
|
+
console.error(`Deploying application: ${options.name}`);
|
|
157
|
+
console.error(`Repository: ${options.repo}`);
|
|
158
|
+
console.error(`Branch: ${options.branch}`);
|
|
159
|
+
console.error(`Build pack: ${options.buildPack}`);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Build application configuration (Coolify API format)
|
|
163
|
+
const appConfig = {
|
|
164
|
+
project_uuid: options.projectUuid,
|
|
165
|
+
server_uuid: options.serverUuid,
|
|
166
|
+
environment_name: 'production', // Required field
|
|
167
|
+
git_repository: options.repo,
|
|
168
|
+
git_branch: options.branch,
|
|
169
|
+
name: options.name,
|
|
170
|
+
description: `Deployed via myaidev-method on ${new Date().toISOString()}`,
|
|
171
|
+
build_pack: options.buildPack,
|
|
172
|
+
ports_exposes: options.port,
|
|
173
|
+
instant_deploy: options.instant,
|
|
174
|
+
domains: options.domain ? [options.domain] : []
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// Load environment variables if specified
|
|
178
|
+
if (options.envFile) {
|
|
179
|
+
if (options.verbose) {
|
|
180
|
+
console.error(`Loading environment from: ${options.envFile}`);
|
|
181
|
+
}
|
|
182
|
+
// Environment variables would be loaded here
|
|
183
|
+
// For now, we'll skip this as it requires reading the file
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (options.verbose) {
|
|
187
|
+
console.error('Creating application in Coolify...');
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Create application
|
|
191
|
+
const app = await coolify.createApplication(appConfig);
|
|
192
|
+
|
|
193
|
+
if (options.verbose) {
|
|
194
|
+
console.error(`✓ Application created: ${app.uuid}`);
|
|
195
|
+
console.error('Starting deployment...');
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Deploy application
|
|
199
|
+
const deployment = await coolify.deployApplication(app.uuid, {
|
|
200
|
+
force: options.force,
|
|
201
|
+
instant: options.instant
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
if (options.verbose) {
|
|
205
|
+
console.error('✓ Deployment triggered');
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
let result = { success: true, status: 'deployed' };
|
|
209
|
+
|
|
210
|
+
// Wait for deployment to complete
|
|
211
|
+
if (options.wait) {
|
|
212
|
+
if (options.verbose) {
|
|
213
|
+
console.error('Waiting for deployment to complete...');
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
result = await coolify.waitForDeployment(app.uuid, {
|
|
217
|
+
maxAttempts: 120,
|
|
218
|
+
interval: 5000
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
if (options.verbose) {
|
|
222
|
+
if (result.success) {
|
|
223
|
+
console.error(`✓ Deployment completed successfully after ${result.attempts} checks`);
|
|
224
|
+
} else {
|
|
225
|
+
console.error(`✗ Deployment failed with status: ${result.status}`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// Get final application state
|
|
231
|
+
const finalApp = await coolify.getApplication(app.uuid);
|
|
232
|
+
|
|
233
|
+
// Prepare output
|
|
234
|
+
const output = {
|
|
235
|
+
success: result.success,
|
|
236
|
+
application: {
|
|
237
|
+
uuid: finalApp.uuid,
|
|
238
|
+
name: finalApp.name,
|
|
239
|
+
status: finalApp.status || 'unknown',
|
|
240
|
+
url: finalApp.fqdn || 'Not configured',
|
|
241
|
+
repository: options.repo,
|
|
242
|
+
branch: options.branch
|
|
243
|
+
},
|
|
244
|
+
deployment: {
|
|
245
|
+
status: result.status,
|
|
246
|
+
timestamp: new Date().toISOString()
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
if (options.json) {
|
|
251
|
+
console.log(JSON.stringify(output, null, 2));
|
|
252
|
+
} else {
|
|
253
|
+
console.log('\n' + '='.repeat(60));
|
|
254
|
+
console.log('Deployment Result');
|
|
255
|
+
console.log('='.repeat(60));
|
|
256
|
+
console.log(`Status: ${result.success ? '✓ Success' : '✗ Failed'}`);
|
|
257
|
+
console.log(`Application: ${finalApp.name}`);
|
|
258
|
+
console.log(`UUID: ${finalApp.uuid}`);
|
|
259
|
+
console.log(`URL: ${finalApp.fqdn || 'Configure domain in Coolify'}`);
|
|
260
|
+
console.log(`Repository: ${options.repo}`);
|
|
261
|
+
console.log(`Branch: ${options.branch}`);
|
|
262
|
+
console.log('='.repeat(60));
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
process.exit(result.success ? 0 : 1);
|
|
266
|
+
} catch (error) {
|
|
267
|
+
if (options.json) {
|
|
268
|
+
console.log(JSON.stringify({
|
|
269
|
+
success: false,
|
|
270
|
+
error: error.message,
|
|
271
|
+
timestamp: new Date().toISOString()
|
|
272
|
+
}, null, 2));
|
|
273
|
+
} else {
|
|
274
|
+
console.error(`\nError: ${error.message}`);
|
|
275
|
+
if (options.verbose) {
|
|
276
|
+
console.error(`Stack: ${error.stack}`);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
process.exit(1);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
284
|
+
deployApplication();
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export { deployApplication };
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Coolify Resource Listing Script
|
|
5
|
+
* List servers, projects, applications, databases, or services
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { CoolifyUtils } from '../lib/coolify-utils.js';
|
|
9
|
+
|
|
10
|
+
const args = process.argv.slice(2);
|
|
11
|
+
|
|
12
|
+
const options = {
|
|
13
|
+
type: null,
|
|
14
|
+
json: args.includes('--json'),
|
|
15
|
+
detailed: args.includes('--detailed') || args.includes('-d')
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// Parse type argument
|
|
19
|
+
for (let i = 0; i < args.length; i++) {
|
|
20
|
+
if (args[i] === '--type' && args[i + 1]) {
|
|
21
|
+
options.type = args[i + 1];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!options.type || args.includes('--help') || args.includes('-h')) {
|
|
26
|
+
console.log(`
|
|
27
|
+
Usage: coolify-list-resources --type <resource-type> [options]
|
|
28
|
+
|
|
29
|
+
Resource Types:
|
|
30
|
+
servers List all servers
|
|
31
|
+
projects List all projects
|
|
32
|
+
applications List all applications
|
|
33
|
+
databases List all databases
|
|
34
|
+
services List all services
|
|
35
|
+
all List all resources
|
|
36
|
+
|
|
37
|
+
Options:
|
|
38
|
+
--json Output in JSON format
|
|
39
|
+
--detailed Show detailed information
|
|
40
|
+
-d Alias for --detailed
|
|
41
|
+
--help Show this help
|
|
42
|
+
-h Alias for --help
|
|
43
|
+
|
|
44
|
+
Examples:
|
|
45
|
+
node src/scripts/coolify-list-resources.js --type servers
|
|
46
|
+
node src/scripts/coolify-list-resources.js --type applications --detailed
|
|
47
|
+
node src/scripts/coolify-list-resources.js --type all --json
|
|
48
|
+
`);
|
|
49
|
+
process.exit(0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function listResources() {
|
|
53
|
+
try {
|
|
54
|
+
const coolify = new CoolifyUtils();
|
|
55
|
+
let data = {};
|
|
56
|
+
|
|
57
|
+
switch (options.type) {
|
|
58
|
+
case 'servers':
|
|
59
|
+
data.servers = await coolify.listServers();
|
|
60
|
+
break;
|
|
61
|
+
case 'projects':
|
|
62
|
+
data.projects = await coolify.listProjects();
|
|
63
|
+
break;
|
|
64
|
+
case 'applications':
|
|
65
|
+
data.applications = await coolify.listApplications();
|
|
66
|
+
break;
|
|
67
|
+
case 'databases':
|
|
68
|
+
data.databases = await coolify.listDatabases();
|
|
69
|
+
break;
|
|
70
|
+
case 'services':
|
|
71
|
+
data.services = await coolify.listServices();
|
|
72
|
+
break;
|
|
73
|
+
case 'all':
|
|
74
|
+
[data.servers, data.projects, data.applications, data.databases, data.services] = await Promise.all([
|
|
75
|
+
coolify.listServers(),
|
|
76
|
+
coolify.listProjects(),
|
|
77
|
+
coolify.listApplications(),
|
|
78
|
+
coolify.listDatabases(),
|
|
79
|
+
coolify.listServices()
|
|
80
|
+
]);
|
|
81
|
+
break;
|
|
82
|
+
default:
|
|
83
|
+
console.error(`Unknown resource type: ${options.type}`);
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (options.json) {
|
|
88
|
+
console.log(JSON.stringify(data, null, 2));
|
|
89
|
+
process.exit(0);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Format output
|
|
93
|
+
console.log('Coolify Resources');
|
|
94
|
+
console.log('='.repeat(60));
|
|
95
|
+
|
|
96
|
+
if (data.servers) {
|
|
97
|
+
console.log('\nServers:');
|
|
98
|
+
console.log('-'.repeat(60));
|
|
99
|
+
if (data.servers.length === 0) {
|
|
100
|
+
console.log(' No servers found');
|
|
101
|
+
} else {
|
|
102
|
+
coolify.formatServerList(data.servers).forEach(s => {
|
|
103
|
+
console.log(` ${s.name}`);
|
|
104
|
+
if (options.detailed) {
|
|
105
|
+
console.log(` UUID: ${s.uuid}`);
|
|
106
|
+
console.log(` IP: ${s.ip}`);
|
|
107
|
+
console.log(` Status: ${s.status}`);
|
|
108
|
+
console.log(` Usable: ${s.usable}`);
|
|
109
|
+
console.log(` Description: ${s.description}`);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (data.projects) {
|
|
116
|
+
console.log('\nProjects:');
|
|
117
|
+
console.log('-'.repeat(60));
|
|
118
|
+
if (data.projects.length === 0) {
|
|
119
|
+
console.log(' No projects found');
|
|
120
|
+
} else {
|
|
121
|
+
data.projects.forEach(p => {
|
|
122
|
+
console.log(` ${p.name}`);
|
|
123
|
+
if (options.detailed) {
|
|
124
|
+
console.log(` UUID: ${p.uuid}`);
|
|
125
|
+
console.log(` ID: ${p.id}`);
|
|
126
|
+
console.log(` Description: ${p.description || 'No description'}`);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (data.applications) {
|
|
133
|
+
console.log('\nApplications:');
|
|
134
|
+
console.log('-'.repeat(60));
|
|
135
|
+
if (data.applications.length === 0) {
|
|
136
|
+
console.log(' No applications found');
|
|
137
|
+
} else {
|
|
138
|
+
coolify.formatApplicationList(data.applications).forEach(a => {
|
|
139
|
+
console.log(` ${a.name}`);
|
|
140
|
+
if (options.detailed) {
|
|
141
|
+
console.log(` UUID: ${a.uuid}`);
|
|
142
|
+
console.log(` Status: ${a.status}`);
|
|
143
|
+
console.log(` URL: ${a.url}`);
|
|
144
|
+
console.log(` Project: ${a.project}`);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (data.databases) {
|
|
151
|
+
console.log('\nDatabases:');
|
|
152
|
+
console.log('-'.repeat(60));
|
|
153
|
+
if (data.databases.length === 0) {
|
|
154
|
+
console.log(' No databases found');
|
|
155
|
+
} else {
|
|
156
|
+
data.databases.forEach(db => {
|
|
157
|
+
console.log(` ${db.name}`);
|
|
158
|
+
if (options.detailed) {
|
|
159
|
+
console.log(` UUID: ${db.uuid}`);
|
|
160
|
+
console.log(` Type: ${db.type}`);
|
|
161
|
+
console.log(` Status: ${db.status || 'Unknown'}`);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (data.services) {
|
|
168
|
+
console.log('\nServices:');
|
|
169
|
+
console.log('-'.repeat(60));
|
|
170
|
+
if (data.services.length === 0) {
|
|
171
|
+
console.log(' No services found');
|
|
172
|
+
} else {
|
|
173
|
+
data.services.forEach(svc => {
|
|
174
|
+
console.log(` ${svc.name}`);
|
|
175
|
+
if (options.detailed) {
|
|
176
|
+
console.log(` UUID: ${svc.uuid}`);
|
|
177
|
+
console.log(` Status: ${svc.status || 'Unknown'}`);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
console.log('\n' + '='.repeat(60));
|
|
184
|
+
process.exit(0);
|
|
185
|
+
} catch (error) {
|
|
186
|
+
if (options.json) {
|
|
187
|
+
console.log(JSON.stringify({ success: false, error: error.message }, null, 2));
|
|
188
|
+
} else {
|
|
189
|
+
console.error(`Error: ${error.message}`);
|
|
190
|
+
}
|
|
191
|
+
process.exit(1);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
196
|
+
listResources();
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export { listResources };
|