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,97 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Coolify Status Check Script
|
|
5
|
+
* Verify Coolify API connectivity and system status
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { CoolifyUtils } from '../lib/coolify-utils.js';
|
|
9
|
+
|
|
10
|
+
const args = process.argv.slice(2);
|
|
11
|
+
const options = {
|
|
12
|
+
comprehensive: args.includes('--comprehensive') || args.includes('-c'),
|
|
13
|
+
json: args.includes('--json'),
|
|
14
|
+
verbose: args.includes('--verbose') || args.includes('-v')
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
async function checkStatus() {
|
|
18
|
+
try {
|
|
19
|
+
if (options.verbose) {
|
|
20
|
+
console.error('Connecting to Coolify...');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const coolify = new CoolifyUtils();
|
|
24
|
+
const status = await coolify.getSystemStatus();
|
|
25
|
+
|
|
26
|
+
if (options.json) {
|
|
27
|
+
console.log(JSON.stringify(status, null, 2));
|
|
28
|
+
process.exit(0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
console.log('Coolify Status Report');
|
|
32
|
+
console.log('='.repeat(60));
|
|
33
|
+
console.log(`Health: ${status.healthy ? '✓ Healthy' : '✗ Unhealthy'}`);
|
|
34
|
+
console.log('');
|
|
35
|
+
console.log('Servers:');
|
|
36
|
+
console.log(` Total: ${status.servers.total}`);
|
|
37
|
+
console.log(` Reachable: ${status.servers.reachable}`);
|
|
38
|
+
console.log(` Usable: ${status.servers.usable}`);
|
|
39
|
+
console.log('');
|
|
40
|
+
console.log(`Projects: ${status.projects.total}`);
|
|
41
|
+
console.log(`Applications: ${status.applications.total}`);
|
|
42
|
+
console.log('');
|
|
43
|
+
|
|
44
|
+
if (options.comprehensive) {
|
|
45
|
+
const [servers, projects, apps] = await Promise.all([
|
|
46
|
+
coolify.listServers(),
|
|
47
|
+
coolify.listProjects(),
|
|
48
|
+
coolify.listApplications()
|
|
49
|
+
]);
|
|
50
|
+
|
|
51
|
+
console.log('Detailed Server Information:');
|
|
52
|
+
console.log('-'.repeat(60));
|
|
53
|
+
servers.forEach(server => {
|
|
54
|
+
console.log(` ${server.name} (${server.ip})`);
|
|
55
|
+
console.log(` UUID: ${server.uuid}`);
|
|
56
|
+
console.log(` Status: ${server.is_reachable ? '✓' : '✗'} Reachable, ${server.is_usable ? '✓' : '✗'} Usable`);
|
|
57
|
+
});
|
|
58
|
+
console.log('');
|
|
59
|
+
|
|
60
|
+
if (projects.length > 0) {
|
|
61
|
+
console.log('Projects:');
|
|
62
|
+
console.log('-'.repeat(60));
|
|
63
|
+
projects.forEach(project => {
|
|
64
|
+
console.log(` ${project.name} (${project.uuid})`);
|
|
65
|
+
});
|
|
66
|
+
console.log('');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (apps.length > 0) {
|
|
70
|
+
console.log('Applications:');
|
|
71
|
+
console.log('-'.repeat(60));
|
|
72
|
+
apps.forEach(app => {
|
|
73
|
+
console.log(` ${app.name}`);
|
|
74
|
+
console.log(` UUID: ${app.uuid}`);
|
|
75
|
+
console.log(` Status: ${app.status || 'Unknown'}`);
|
|
76
|
+
console.log(` URL: ${app.fqdn || 'Not configured'}`);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
console.log('='.repeat(60));
|
|
82
|
+
process.exit(status.healthy ? 0 : 1);
|
|
83
|
+
} catch (error) {
|
|
84
|
+
if (options.json) {
|
|
85
|
+
console.log(JSON.stringify({ success: false, error: error.message }, null, 2));
|
|
86
|
+
} else {
|
|
87
|
+
console.error(`Error: ${error.message}`);
|
|
88
|
+
}
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
94
|
+
checkStatus();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export { checkStatus };
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Docusaurus Publishing Script
|
|
5
|
+
* Publish markdown content to Docusaurus site
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { StaticSiteUtils, detectPlatform } from '../lib/static-site-utils.js';
|
|
9
|
+
|
|
10
|
+
const args = process.argv.slice(2);
|
|
11
|
+
|
|
12
|
+
const options = {
|
|
13
|
+
file: null,
|
|
14
|
+
type: 'docs',
|
|
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
|
+
Docusaurus Publishing Script
|
|
65
|
+
|
|
66
|
+
Usage: docusaurus-publish [file] [options]
|
|
67
|
+
|
|
68
|
+
Arguments:
|
|
69
|
+
file Markdown file to publish (required)
|
|
70
|
+
|
|
71
|
+
Options:
|
|
72
|
+
--type, -t <type> Content type: docs|blog|pages (default: docs)
|
|
73
|
+
--project, -p <path> Docusaurus 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 docs
|
|
84
|
+
docusaurus-publish article.md
|
|
85
|
+
|
|
86
|
+
# Publish to blog
|
|
87
|
+
docusaurus-publish post.md --type blog
|
|
88
|
+
|
|
89
|
+
# Custom project path and branch
|
|
90
|
+
docusaurus-publish article.md --project ./my-docs --branch develop
|
|
91
|
+
|
|
92
|
+
# Commit only (no push)
|
|
93
|
+
docusaurus-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 Docusaurus publishing...');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const site = new StaticSiteUtils({
|
|
111
|
+
platform: 'docusaurus',
|
|
112
|
+
projectPath: options.projectPath
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
if (options.verbose) {
|
|
116
|
+
console.error('✓ Docusaurus 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: 'docusaurus',
|
|
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('Docusaurus 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,91 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* MyAIDev Method - Project Initialization Script
|
|
5
|
+
* Enhanced welcome and quick start guide
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
|
|
10
|
+
function printWelcome() {
|
|
11
|
+
console.log('');
|
|
12
|
+
console.log(chalk.cyan.bold('🚀 Welcome to MyAIDev Method!'));
|
|
13
|
+
console.log('');
|
|
14
|
+
console.log(chalk.gray('A comprehensive AI-powered content creation and publishing toolkit'));
|
|
15
|
+
console.log(chalk.gray('for Claude Code, optimized for modern development workflows'));
|
|
16
|
+
console.log('');
|
|
17
|
+
|
|
18
|
+
console.log(chalk.yellow.bold('📝 CONTENT CREATION'));
|
|
19
|
+
console.log(chalk.white(' • AI-powered content writing agent'));
|
|
20
|
+
console.log(chalk.white(' • SEO-optimized article generation'));
|
|
21
|
+
console.log(chalk.white(' • Multiple tone and style options'));
|
|
22
|
+
console.log(chalk.cyan(' Command: ') + chalk.green('/myai-content-writer'));
|
|
23
|
+
console.log('');
|
|
24
|
+
|
|
25
|
+
console.log(chalk.yellow.bold('📤 PUBLISHING PLATFORMS'));
|
|
26
|
+
console.log(chalk.white(' • ') + chalk.bold('WordPress') + chalk.gray(' - REST API publishing with Gutenberg blocks'));
|
|
27
|
+
console.log(chalk.white(' • ') + chalk.bold('PayloadCMS') + chalk.gray(' - Headless CMS publishing with Lexical editor'));
|
|
28
|
+
console.log(chalk.white(' • ') + chalk.bold('Docusaurus') + chalk.gray(' - Documentation site publishing'));
|
|
29
|
+
console.log(chalk.white(' • ') + chalk.bold('Mintlify') + chalk.gray(' - API documentation publishing'));
|
|
30
|
+
console.log(chalk.white(' • ') + chalk.bold('Astro') + chalk.gray(' - Static site publishing'));
|
|
31
|
+
console.log('');
|
|
32
|
+
console.log(chalk.cyan(' Configure: ') + chalk.green('/myai-configure'));
|
|
33
|
+
console.log(chalk.cyan(' Publish: ') + chalk.green('/myai-[platform]-publish "content.md"'));
|
|
34
|
+
console.log('');
|
|
35
|
+
|
|
36
|
+
console.log(chalk.yellow.bold('🚀 DEPLOYMENT'));
|
|
37
|
+
console.log(chalk.white(' • ') + chalk.bold('Coolify') + chalk.gray(' - Self-hosted PaaS deployment'));
|
|
38
|
+
console.log(chalk.white(' • Automated app deployment and management'));
|
|
39
|
+
console.log(chalk.white(' • Health monitoring and status checks'));
|
|
40
|
+
console.log(chalk.cyan(' Command: ') + chalk.green('/myai-coolify-deploy'));
|
|
41
|
+
console.log('');
|
|
42
|
+
|
|
43
|
+
console.log(chalk.yellow.bold('⚙️ WORDPRESS ADMIN'));
|
|
44
|
+
console.log(chalk.white(' • Health checks and security scanning'));
|
|
45
|
+
console.log(chalk.white(' • Performance monitoring'));
|
|
46
|
+
console.log(chalk.white(' • Comprehensive reporting'));
|
|
47
|
+
console.log(chalk.cyan(' Scripts: ') + chalk.green('npm run wordpress:health-check'));
|
|
48
|
+
console.log('');
|
|
49
|
+
|
|
50
|
+
console.log(chalk.yellow.bold('📚 QUICK START'));
|
|
51
|
+
console.log(chalk.white(' 1. Configure your platform:'));
|
|
52
|
+
console.log(chalk.gray(' ') + chalk.green('/myai-configure'));
|
|
53
|
+
console.log('');
|
|
54
|
+
console.log(chalk.white(' 2. Create content:'));
|
|
55
|
+
console.log(chalk.gray(' ') + chalk.green('/myai-content-writer "your topic"'));
|
|
56
|
+
console.log('');
|
|
57
|
+
console.log(chalk.white(' 3. Publish to your platform:'));
|
|
58
|
+
console.log(chalk.gray(' ') + chalk.green('/myai-wordpress-publish "content.md"'));
|
|
59
|
+
console.log(chalk.gray(' ') + chalk.green('/myai-payloadcms-publish "content.md" --status published'));
|
|
60
|
+
console.log(chalk.gray(' ') + chalk.green('/myai-docusaurus-publish "content.md" --type blog'));
|
|
61
|
+
console.log('');
|
|
62
|
+
console.log(chalk.white(' 4. Deploy your application:'));
|
|
63
|
+
console.log(chalk.gray(' ') + chalk.green('/myai-coolify-deploy'));
|
|
64
|
+
console.log('');
|
|
65
|
+
|
|
66
|
+
console.log(chalk.yellow.bold('📖 DOCUMENTATION'));
|
|
67
|
+
console.log(chalk.white(' • Publishing Guide: ') + chalk.cyan('PUBLISHING_GUIDE.md'));
|
|
68
|
+
console.log(chalk.white(' • WordPress Admin: ') + chalk.cyan('WORDPRESS_ADMIN_SCRIPTS.md'));
|
|
69
|
+
console.log(chalk.white(' • PayloadCMS: ') + chalk.cyan('PAYLOADCMS_PUBLISHING.md'));
|
|
70
|
+
console.log(chalk.white(' • Static Sites: ') + chalk.cyan('STATIC_SITE_PUBLISHING.md'));
|
|
71
|
+
console.log(chalk.white(' • Coolify Deployment: ') + chalk.cyan('COOLIFY_DEPLOYMENT.md'));
|
|
72
|
+
console.log(chalk.white(' • User Guide: ') + chalk.cyan('USER_GUIDE.md'));
|
|
73
|
+
console.log('');
|
|
74
|
+
|
|
75
|
+
console.log(chalk.yellow.bold('🔗 LINKS'));
|
|
76
|
+
console.log(chalk.white(' • GitHub: ') + chalk.cyan('https://github.com/myaione/myaidev-method'));
|
|
77
|
+
console.log(chalk.white(' • NPM Package: ') + chalk.cyan('https://www.npmjs.com/package/myaidev-method'));
|
|
78
|
+
console.log(chalk.white(' • Issues: ') + chalk.cyan('https://github.com/myaione/myaidev-method/issues'));
|
|
79
|
+
console.log('');
|
|
80
|
+
|
|
81
|
+
console.log(chalk.gray('─'.repeat(70)));
|
|
82
|
+
console.log(chalk.green('✨ Ready to create and publish amazing content!'));
|
|
83
|
+
console.log(chalk.gray('─'.repeat(70)));
|
|
84
|
+
console.log('');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
88
|
+
printWelcome();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export { printWelcome };
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Mintlify Publishing Script
|
|
5
|
+
* Publish markdown content to Mintlify documentation
|
|
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
|
+
projectPath: null,
|
|
15
|
+
navSection: 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 '--nav-section':
|
|
32
|
+
case '-n':
|
|
33
|
+
options.navSection = 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
|
+
Mintlify Publishing Script
|
|
65
|
+
|
|
66
|
+
Usage: mintlify-publish [file] [options]
|
|
67
|
+
|
|
68
|
+
Arguments:
|
|
69
|
+
file Markdown/MDX file to publish (required)
|
|
70
|
+
|
|
71
|
+
Options:
|
|
72
|
+
--nav-section, -n <name> Add to navigation section in mint.json
|
|
73
|
+
--project, -p <path> Mintlify 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 documentation
|
|
84
|
+
mintlify-publish guide.mdx
|
|
85
|
+
|
|
86
|
+
# Add to specific navigation section
|
|
87
|
+
mintlify-publish api-reference.mdx --nav-section "API Reference"
|
|
88
|
+
|
|
89
|
+
# Custom project path
|
|
90
|
+
mintlify-publish article.mdx --project ./docs --branch develop
|
|
91
|
+
`);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async function publishContent() {
|
|
95
|
+
try {
|
|
96
|
+
// Validate required options
|
|
97
|
+
if (!options.file) {
|
|
98
|
+
console.error('Error: Markdown file is required');
|
|
99
|
+
console.error('Run with --help for usage information');
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (options.verbose) {
|
|
104
|
+
console.error('Initializing Mintlify publishing...');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const site = new StaticSiteUtils({
|
|
108
|
+
platform: 'mintlify',
|
|
109
|
+
projectPath: options.projectPath
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
if (options.verbose) {
|
|
113
|
+
console.error('✓ Mintlify project detected');
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Validate project
|
|
117
|
+
site.validateProject();
|
|
118
|
+
|
|
119
|
+
if (options.verbose) {
|
|
120
|
+
console.error('✓ Project structure validated');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Dry run - validate only
|
|
124
|
+
if (options.dryRun) {
|
|
125
|
+
if (options.verbose) {
|
|
126
|
+
console.error('✓ Dry run - validation successful');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const output = {
|
|
130
|
+
success: true,
|
|
131
|
+
dryRun: true,
|
|
132
|
+
file: options.file,
|
|
133
|
+
platform: 'mintlify',
|
|
134
|
+
navSection: options.navSection
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
if (options.json) {
|
|
138
|
+
console.log(JSON.stringify(output, null, 2));
|
|
139
|
+
} else {
|
|
140
|
+
console.log('Dry run successful - ready to publish');
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
process.exit(0);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Publish content
|
|
147
|
+
const result = await site.publishContent(options.file, {
|
|
148
|
+
navSection: options.navSection,
|
|
149
|
+
branch: options.branch,
|
|
150
|
+
noPush: options.noPush,
|
|
151
|
+
commitMessage: options.commitMessage
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
if (options.verbose) {
|
|
155
|
+
console.error(`✓ Content published successfully`);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Prepare output
|
|
159
|
+
const output = {
|
|
160
|
+
success: true,
|
|
161
|
+
file: result.file,
|
|
162
|
+
platform: result.platform,
|
|
163
|
+
git: result.git,
|
|
164
|
+
timestamp: new Date().toISOString()
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
if (options.json) {
|
|
168
|
+
console.log(JSON.stringify(output, null, 2));
|
|
169
|
+
} else {
|
|
170
|
+
console.log('\\n' + '='.repeat(60));
|
|
171
|
+
console.log('Mintlify Publishing Result');
|
|
172
|
+
console.log('='.repeat(60));
|
|
173
|
+
console.log(`Status: ✓ Success`);
|
|
174
|
+
console.log(`File: ${result.file}`);
|
|
175
|
+
console.log(`Committed: ${result.git.committed ? 'Yes' : 'No'}`);
|
|
176
|
+
console.log(`Pushed: ${result.git.pushed ? 'Yes' : 'No'}`);
|
|
177
|
+
if (result.git.branch) {
|
|
178
|
+
console.log(`Branch: ${result.git.branch}`);
|
|
179
|
+
}
|
|
180
|
+
console.log('='.repeat(60));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
process.exit(0);
|
|
184
|
+
} catch (error) {
|
|
185
|
+
if (options.json) {
|
|
186
|
+
console.log(JSON.stringify({
|
|
187
|
+
success: false,
|
|
188
|
+
error: error.message,
|
|
189
|
+
timestamp: new Date().toISOString()
|
|
190
|
+
}, null, 2));
|
|
191
|
+
} else {
|
|
192
|
+
console.error(`\\nError: ${error.message}`);
|
|
193
|
+
if (options.verbose) {
|
|
194
|
+
console.error(`Stack: ${error.stack}`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
process.exit(1);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
202
|
+
publishContent();
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export { publishContent };
|