myaidev-method 0.3.3 → 0.3.5
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-plugin/plugin.json +0 -1
- package/.env.example +5 -4
- package/CHANGELOG.md +2 -2
- package/CONTENT_CREATION_GUIDE.md +489 -3211
- package/DEVELOPER_USE_CASES.md +1 -1
- package/MODULAR_INSTALLATION.md +2 -2
- package/README.md +39 -33
- package/TECHNICAL_ARCHITECTURE.md +1 -1
- package/USER_GUIDE.md +242 -190
- package/agents/content-editor-agent.md +90 -0
- package/agents/content-planner-agent.md +97 -0
- package/agents/content-research-agent.md +62 -0
- package/agents/content-seo-agent.md +101 -0
- package/agents/content-writer-agent.md +69 -0
- package/agents/infographic-analyzer-agent.md +63 -0
- package/agents/infographic-designer-agent.md +72 -0
- package/bin/cli.js +777 -535
- package/{content-rules.example.md → content-rules-example.md} +2 -2
- package/dist/mcp/health-check.js +82 -68
- package/dist/mcp/mcp-config.json +8 -0
- package/dist/mcp/openstack-server.js +1746 -1262
- package/dist/server/.tsbuildinfo +1 -1
- package/extension.json +21 -4
- package/package.json +181 -184
- package/skills/company-config/SKILL.md +133 -0
- package/skills/configure/SKILL.md +1 -1
- package/skills/myai-configurator/SKILL.md +77 -0
- package/skills/myai-configurator/content-creation-configurator/SKILL.md +516 -0
- package/skills/myai-configurator/content-maintenance-configurator/SKILL.md +397 -0
- package/skills/myai-content-enrichment/SKILL.md +114 -0
- package/skills/myai-content-ideation/SKILL.md +288 -0
- package/skills/myai-content-ideation/evals/evals.json +182 -0
- package/skills/myai-content-production-coordinator/SKILL.md +946 -0
- package/skills/{content-rules-setup → myai-content-rules-setup}/SKILL.md +1 -1
- package/skills/{content-verifier → myai-content-verifier}/SKILL.md +1 -1
- package/skills/myai-content-writer/SKILL.md +333 -0
- package/skills/myai-content-writer/agents/editor-agent.md +138 -0
- package/skills/myai-content-writer/agents/planner-agent.md +121 -0
- package/skills/myai-content-writer/agents/research-agent.md +83 -0
- package/skills/myai-content-writer/agents/seo-agent.md +139 -0
- package/skills/myai-content-writer/agents/visual-planner-agent.md +110 -0
- package/skills/myai-content-writer/agents/writer-agent.md +85 -0
- package/skills/{infographic → myai-infographic}/SKILL.md +1 -1
- package/skills/myai-proprietary-content-verifier/SKILL.md +175 -0
- package/skills/myai-proprietary-content-verifier/evals/evals.json +36 -0
- package/skills/myai-skill-builder/SKILL.md +699 -0
- package/skills/myai-skill-builder/agents/analyzer-agent.md +137 -0
- package/skills/myai-skill-builder/agents/comparator-agent.md +77 -0
- package/skills/myai-skill-builder/agents/grader-agent.md +103 -0
- package/skills/myai-skill-builder/assets/eval_review.html +131 -0
- package/skills/myai-skill-builder/references/schemas.md +211 -0
- package/skills/myai-skill-builder/scripts/aggregate_benchmark.py +190 -0
- package/skills/myai-skill-builder/scripts/generate_review.py +381 -0
- package/skills/myai-skill-builder/scripts/package_skill.py +91 -0
- package/skills/myai-skill-builder/scripts/run_eval.py +105 -0
- package/skills/myai-skill-builder/scripts/run_loop.py +211 -0
- package/skills/myai-skill-builder/scripts/utils.py +123 -0
- package/skills/myai-visual-generator/SKILL.md +125 -0
- package/skills/myai-visual-generator/evals/evals.json +155 -0
- package/skills/myai-visual-generator/references/infographic-pipeline.md +73 -0
- package/skills/myai-visual-generator/references/research-visuals.md +57 -0
- package/skills/myai-visual-generator/references/services.md +89 -0
- package/skills/myai-visual-generator/scripts/visual-generation-utils.js +1272 -0
- package/skills/myaidev-analyze/agents/dependency-mapper-agent.md +236 -0
- package/skills/myaidev-analyze/agents/pattern-detector-agent.md +240 -0
- package/skills/myaidev-analyze/agents/structure-scanner-agent.md +171 -0
- package/skills/myaidev-analyze/agents/tech-profiler-agent.md +291 -0
- package/skills/myaidev-architect/agents/compliance-checker-agent.md +287 -0
- package/skills/myaidev-architect/agents/requirements-analyst-agent.md +194 -0
- package/skills/myaidev-architect/agents/system-designer-agent.md +315 -0
- package/skills/myaidev-coder/agents/implementer-agent.md +185 -0
- package/skills/myaidev-coder/agents/integration-agent.md +168 -0
- package/skills/myaidev-coder/agents/pattern-scanner-agent.md +161 -0
- package/skills/myaidev-coder/agents/self-reviewer-agent.md +168 -0
- package/skills/myaidev-debug/agents/fix-agent-debug.md +317 -0
- package/skills/myaidev-debug/agents/hypothesis-agent.md +226 -0
- package/skills/myaidev-debug/agents/investigator-agent.md +250 -0
- package/skills/myaidev-debug/agents/symptom-collector-agent.md +231 -0
- package/skills/myaidev-documenter/agents/code-reader-agent.md +172 -0
- package/skills/myaidev-documenter/agents/doc-validator-agent.md +174 -0
- package/skills/myaidev-documenter/agents/doc-writer-agent.md +379 -0
- package/skills/myaidev-figma/SKILL.md +212 -0
- package/skills/myaidev-figma/capture.js +133 -0
- package/skills/myaidev-figma/crawl.js +130 -0
- package/skills/myaidev-figma-configure/SKILL.md +130 -0
- package/skills/myaidev-migrate/agents/migration-planner-agent.md +237 -0
- package/skills/myaidev-migrate/agents/migration-writer-agent.md +248 -0
- package/skills/myaidev-migrate/agents/schema-analyzer-agent.md +190 -0
- package/skills/myaidev-performance/agents/benchmark-agent.md +281 -0
- package/skills/myaidev-performance/agents/optimizer-agent.md +277 -0
- package/skills/myaidev-performance/agents/profiler-agent.md +252 -0
- package/skills/myaidev-refactor/agents/refactor-executor-agent.md +221 -0
- package/skills/myaidev-refactor/agents/refactor-planner-agent.md +213 -0
- package/skills/myaidev-refactor/agents/regression-guard-agent.md +242 -0
- package/skills/myaidev-refactor/agents/smell-detector-agent.md +233 -0
- package/skills/myaidev-reviewer/agents/auto-fixer-agent.md +238 -0
- package/skills/myaidev-reviewer/agents/code-analyst-agent.md +220 -0
- package/skills/myaidev-reviewer/agents/security-scanner-agent.md +262 -0
- package/skills/myaidev-tester/agents/coverage-analyst-agent.md +163 -0
- package/skills/myaidev-tester/agents/tdd-driver-agent.md +242 -0
- package/skills/myaidev-tester/agents/test-runner-agent.md +176 -0
- package/skills/myaidev-tester/agents/test-strategist-agent.md +154 -0
- package/skills/myaidev-tester/agents/test-writer-agent.md +242 -0
- package/skills/myaidev-workflow/agents/analyzer-agent.md +317 -0
- package/skills/myaidev-workflow/agents/coordinator-agent.md +253 -0
- package/skills/openstack-manager/SKILL.md +1 -1
- package/skills/payloadcms-publisher/SKILL.md +141 -77
- package/skills/payloadcms-publisher/references/field-mapping.md +142 -0
- package/skills/payloadcms-publisher/references/lexical-format.md +97 -0
- package/skills/security-auditor/SKILL.md +1 -1
- package/src/cli/commands/addon.js +184 -123
- package/src/config/workflows.js +172 -228
- package/src/lib/ascii-banner.js +197 -182
- package/src/lib/{content-coordinator.js → content-production-coordinator.js} +649 -459
- package/src/lib/installation-detector.js +93 -59
- package/src/lib/payloadcms-utils.js +285 -510
- package/src/lib/update-manager.js +120 -61
- package/src/lib/workflow-installer.js +55 -0
- package/src/mcp/health-check.js +82 -68
- package/src/mcp/openstack-server.js +1746 -1262
- package/src/scripts/configure-visual-apis.js +224 -173
- package/src/scripts/configure-wordpress-mcp.js +96 -66
- package/src/scripts/init/install.js +109 -85
- package/src/scripts/init-project.js +138 -67
- package/src/scripts/utils/write-content.js +67 -52
- package/src/scripts/wordpress/publish-to-wordpress.js +128 -128
- package/src/templates/claude/CLAUDE.md +131 -0
- package/hooks/hooks.json +0 -26
- package/skills/content-coordinator/SKILL.md +0 -130
- package/skills/content-enrichment/SKILL.md +0 -80
- package/skills/content-writer/SKILL.md +0 -285
- package/skills/visual-generator/SKILL.md +0 -140
|
@@ -9,18 +9,18 @@
|
|
|
9
9
|
* Usage:
|
|
10
10
|
* node configure-visual-apis.js
|
|
11
11
|
* OR
|
|
12
|
-
* /myai-
|
|
12
|
+
* /myai-configurator visual (from Claude Code)
|
|
13
13
|
*
|
|
14
14
|
* Platform support: Claude Code, Gemini CLI, Codex CLI
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import inquirer from
|
|
18
|
-
import fs from
|
|
19
|
-
import path from
|
|
20
|
-
import dotenv from
|
|
21
|
-
import chalk from
|
|
22
|
-
import ora from
|
|
23
|
-
import { fileURLToPath } from
|
|
17
|
+
import inquirer from "inquirer";
|
|
18
|
+
import fs from "fs-extra";
|
|
19
|
+
import path from "path";
|
|
20
|
+
import dotenv from "dotenv";
|
|
21
|
+
import chalk from "chalk";
|
|
22
|
+
import ora from "ora";
|
|
23
|
+
import { fileURLToPath } from "url";
|
|
24
24
|
|
|
25
25
|
// Load existing environment variables
|
|
26
26
|
dotenv.config();
|
|
@@ -32,51 +32,57 @@ const __dirname = path.dirname(__filename);
|
|
|
32
32
|
* Main configuration function
|
|
33
33
|
*/
|
|
34
34
|
export async function configureVisualAPIs() {
|
|
35
|
-
console.log(chalk.blue(
|
|
36
|
-
console.log(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
console.log(chalk.blue("\n🎨 Visual Content Generation Configuration"));
|
|
36
|
+
console.log(
|
|
37
|
+
chalk.gray(
|
|
38
|
+
"Configure Google AI and OpenAI APIs for image/video generation\n",
|
|
39
|
+
),
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
console.log(chalk.cyan("Supported Platforms:"));
|
|
43
|
+
console.log(chalk.gray("✅ Claude Code"));
|
|
44
|
+
console.log(chalk.gray("✅ Gemini CLI"));
|
|
45
|
+
console.log(chalk.gray("✅ Codex CLI\n"));
|
|
42
46
|
|
|
43
47
|
try {
|
|
44
48
|
// Step 1: Which services to configure
|
|
45
|
-
const { services } = await inquirer.prompt([
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
const { services } = await inquirer.prompt([
|
|
50
|
+
{
|
|
51
|
+
type: "checkbox",
|
|
52
|
+
name: "services",
|
|
53
|
+
message: "Which services do you want to configure?",
|
|
54
|
+
choices: [
|
|
55
|
+
{
|
|
56
|
+
name: "Google AI (Gemini Flash, Imagen 3, Veo 2)",
|
|
57
|
+
value: "google",
|
|
58
|
+
checked: true,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "OpenAI (DALL-E 3)",
|
|
62
|
+
value: "openai",
|
|
63
|
+
checked: true,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
validate: (answer) => {
|
|
67
|
+
if (answer.length < 1) {
|
|
68
|
+
return "You must choose at least one service.";
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
54
71
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
value: 'openai',
|
|
58
|
-
checked: true
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
validate: (answer) => {
|
|
62
|
-
if (answer.length < 1) {
|
|
63
|
-
return 'You must choose at least one service.';
|
|
64
|
-
}
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
}]);
|
|
72
|
+
},
|
|
73
|
+
]);
|
|
68
74
|
|
|
69
75
|
const config = {};
|
|
70
76
|
|
|
71
77
|
// Step 2: Configure Google AI
|
|
72
|
-
if (services.includes(
|
|
73
|
-
console.log(chalk.yellow(
|
|
74
|
-
console.log(chalk.gray(
|
|
75
|
-
console.log(chalk.gray(
|
|
78
|
+
if (services.includes("google")) {
|
|
79
|
+
console.log(chalk.yellow("\n📋 Google AI API Setup:"));
|
|
80
|
+
console.log(chalk.gray("1. Visit: https://ai.google.dev/"));
|
|
81
|
+
console.log(chalk.gray("2. Sign in with your Google account"));
|
|
76
82
|
console.log(chalk.gray('3. Click "Get API key" in Google AI Studio'));
|
|
77
|
-
console.log(chalk.gray(
|
|
83
|
+
console.log(chalk.gray("4. Create or select a project"));
|
|
78
84
|
console.log(chalk.gray('5. Click "Create API key"'));
|
|
79
|
-
console.log(chalk.gray(
|
|
85
|
+
console.log(chalk.gray("6. Copy the API key\n"));
|
|
80
86
|
|
|
81
87
|
const currentGoogleKey = process.env.GOOGLE_API_KEY;
|
|
82
88
|
if (currentGoogleKey) {
|
|
@@ -85,41 +91,45 @@ export async function configureVisualAPIs() {
|
|
|
85
91
|
|
|
86
92
|
const { googleKey, confirmGoogle } = await inquirer.prompt([
|
|
87
93
|
{
|
|
88
|
-
type:
|
|
89
|
-
name:
|
|
90
|
-
message:
|
|
91
|
-
mask:
|
|
94
|
+
type: "password",
|
|
95
|
+
name: "googleKey",
|
|
96
|
+
message: "Enter your Google API Key:",
|
|
97
|
+
mask: "*",
|
|
92
98
|
validate: (input) => {
|
|
93
|
-
if (!input) return
|
|
94
|
-
if (input.length < 20) return
|
|
99
|
+
if (!input) return "API key is required";
|
|
100
|
+
if (input.length < 20) return "API key appears to be too short";
|
|
95
101
|
return true;
|
|
96
|
-
}
|
|
102
|
+
},
|
|
97
103
|
},
|
|
98
104
|
{
|
|
99
|
-
type:
|
|
100
|
-
name:
|
|
101
|
-
message:
|
|
102
|
-
default: true
|
|
103
|
-
}
|
|
105
|
+
type: "confirm",
|
|
106
|
+
name: "confirmGoogle",
|
|
107
|
+
message: "Test API key connectivity?",
|
|
108
|
+
default: true,
|
|
109
|
+
},
|
|
104
110
|
]);
|
|
105
111
|
|
|
106
112
|
config.GOOGLE_API_KEY = googleKey;
|
|
107
113
|
|
|
108
114
|
// Test Google API
|
|
109
115
|
if (confirmGoogle) {
|
|
110
|
-
const spinner = ora(
|
|
116
|
+
const spinner = ora("Testing Google API connection...").start();
|
|
111
117
|
try {
|
|
112
118
|
const testResult = await testGoogleAPI(googleKey);
|
|
113
119
|
if (testResult.success) {
|
|
114
|
-
spinner.succeed(chalk.green(
|
|
120
|
+
spinner.succeed(chalk.green("Google API connection successful!"));
|
|
115
121
|
} else {
|
|
116
|
-
spinner.fail(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
spinner.fail(
|
|
123
|
+
chalk.red(`Google API test failed: ${testResult.error}`),
|
|
124
|
+
);
|
|
125
|
+
const { continueAnyway } = await inquirer.prompt([
|
|
126
|
+
{
|
|
127
|
+
type: "confirm",
|
|
128
|
+
name: "continueAnyway",
|
|
129
|
+
message: "Continue with this API key anyway?",
|
|
130
|
+
default: false,
|
|
131
|
+
},
|
|
132
|
+
]);
|
|
123
133
|
if (!continueAnyway) {
|
|
124
134
|
delete config.GOOGLE_API_KEY;
|
|
125
135
|
}
|
|
@@ -131,13 +141,17 @@ export async function configureVisualAPIs() {
|
|
|
131
141
|
}
|
|
132
142
|
|
|
133
143
|
// Step 3: Configure OpenAI
|
|
134
|
-
if (services.includes(
|
|
135
|
-
console.log(chalk.yellow(
|
|
136
|
-
console.log(chalk.gray(
|
|
137
|
-
console.log(chalk.gray(
|
|
144
|
+
if (services.includes("openai")) {
|
|
145
|
+
console.log(chalk.yellow("\n📋 OpenAI API Setup:"));
|
|
146
|
+
console.log(chalk.gray("1. Visit: https://platform.openai.com/api-keys"));
|
|
147
|
+
console.log(chalk.gray("2. Sign in to your OpenAI account"));
|
|
138
148
|
console.log(chalk.gray('3. Click "Create new secret key"'));
|
|
139
|
-
console.log(
|
|
140
|
-
|
|
149
|
+
console.log(
|
|
150
|
+
chalk.gray('4. Name your key (e.g., "MyAIDev Visual Generation")'),
|
|
151
|
+
);
|
|
152
|
+
console.log(
|
|
153
|
+
chalk.gray("5. Copy the API key (you won't see it again!)\n"),
|
|
154
|
+
);
|
|
141
155
|
|
|
142
156
|
const currentOpenAIKey = process.env.OPENAI_API_KEY;
|
|
143
157
|
if (currentOpenAIKey) {
|
|
@@ -146,42 +160,47 @@ export async function configureVisualAPIs() {
|
|
|
146
160
|
|
|
147
161
|
const { openaiKey, confirmOpenAI } = await inquirer.prompt([
|
|
148
162
|
{
|
|
149
|
-
type:
|
|
150
|
-
name:
|
|
151
|
-
message:
|
|
152
|
-
mask:
|
|
163
|
+
type: "password",
|
|
164
|
+
name: "openaiKey",
|
|
165
|
+
message: "Enter your OpenAI API Key:",
|
|
166
|
+
mask: "*",
|
|
153
167
|
validate: (input) => {
|
|
154
|
-
if (!input) return
|
|
155
|
-
if (input.length < 20) return
|
|
156
|
-
if (!input.startsWith(
|
|
168
|
+
if (!input) return "API key is required";
|
|
169
|
+
if (input.length < 20) return "API key appears to be too short";
|
|
170
|
+
if (!input.startsWith("sk-"))
|
|
171
|
+
return 'OpenAI API keys typically start with "sk-"';
|
|
157
172
|
return true;
|
|
158
|
-
}
|
|
173
|
+
},
|
|
159
174
|
},
|
|
160
175
|
{
|
|
161
|
-
type:
|
|
162
|
-
name:
|
|
163
|
-
message:
|
|
164
|
-
default: true
|
|
165
|
-
}
|
|
176
|
+
type: "confirm",
|
|
177
|
+
name: "confirmOpenAI",
|
|
178
|
+
message: "Test API key connectivity?",
|
|
179
|
+
default: true,
|
|
180
|
+
},
|
|
166
181
|
]);
|
|
167
182
|
|
|
168
183
|
config.OPENAI_API_KEY = openaiKey;
|
|
169
184
|
|
|
170
185
|
// Test OpenAI API
|
|
171
186
|
if (confirmOpenAI) {
|
|
172
|
-
const spinner = ora(
|
|
187
|
+
const spinner = ora("Testing OpenAI API connection...").start();
|
|
173
188
|
try {
|
|
174
189
|
const testResult = await testOpenAIAPI(openaiKey);
|
|
175
190
|
if (testResult.success) {
|
|
176
|
-
spinner.succeed(chalk.green(
|
|
191
|
+
spinner.succeed(chalk.green("OpenAI API connection successful!"));
|
|
177
192
|
} else {
|
|
178
|
-
spinner.fail(
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
193
|
+
spinner.fail(
|
|
194
|
+
chalk.red(`OpenAI API test failed: ${testResult.error}`),
|
|
195
|
+
);
|
|
196
|
+
const { continueAnyway } = await inquirer.prompt([
|
|
197
|
+
{
|
|
198
|
+
type: "confirm",
|
|
199
|
+
name: "continueAnyway",
|
|
200
|
+
message: "Continue with this API key anyway?",
|
|
201
|
+
default: false,
|
|
202
|
+
},
|
|
203
|
+
]);
|
|
185
204
|
if (!continueAnyway) {
|
|
186
205
|
delete config.OPENAI_API_KEY;
|
|
187
206
|
}
|
|
@@ -194,118 +213,150 @@ export async function configureVisualAPIs() {
|
|
|
194
213
|
|
|
195
214
|
// Step 4: Preferences
|
|
196
215
|
if (Object.keys(config).length > 0) {
|
|
197
|
-
console.log(chalk.yellow(
|
|
216
|
+
console.log(chalk.yellow("\n⚙️ Preferences:\n"));
|
|
198
217
|
|
|
199
218
|
const serviceChoices = [];
|
|
200
219
|
if (config.GOOGLE_API_KEY) {
|
|
201
220
|
serviceChoices.push(
|
|
202
|
-
{ name:
|
|
203
|
-
{ name:
|
|
221
|
+
{ name: "Gemini Flash (Fast & Cheap, $0.02)", value: "gemini" },
|
|
222
|
+
{ name: "Imagen 3 (Premium Quality, $0.03)", value: "imagen" },
|
|
204
223
|
);
|
|
205
224
|
}
|
|
206
225
|
if (config.OPENAI_API_KEY) {
|
|
207
|
-
serviceChoices.push(
|
|
208
|
-
|
|
209
|
-
|
|
226
|
+
serviceChoices.push({
|
|
227
|
+
name: "DALL-E 3 (Creative, $0.04-0.12)",
|
|
228
|
+
value: "dalle",
|
|
229
|
+
});
|
|
210
230
|
}
|
|
211
231
|
|
|
212
232
|
const preferences = await inquirer.prompt([
|
|
213
233
|
{
|
|
214
|
-
type:
|
|
215
|
-
name:
|
|
216
|
-
message:
|
|
234
|
+
type: "list",
|
|
235
|
+
name: "defaultService",
|
|
236
|
+
message: "Default image generation service?",
|
|
217
237
|
choices: serviceChoices,
|
|
218
|
-
default:
|
|
238
|
+
default: "gemini",
|
|
219
239
|
},
|
|
220
240
|
{
|
|
221
|
-
type:
|
|
222
|
-
name:
|
|
223
|
-
message:
|
|
241
|
+
type: "list",
|
|
242
|
+
name: "defaultQuality",
|
|
243
|
+
message: "Default quality level?",
|
|
224
244
|
choices: [
|
|
225
|
-
{ name:
|
|
226
|
-
{ name:
|
|
245
|
+
{ name: "Standard (faster, cheaper)", value: "standard" },
|
|
246
|
+
{ name: "HD (higher quality, more expensive)", value: "hd" },
|
|
227
247
|
],
|
|
228
|
-
default:
|
|
248
|
+
default: "standard",
|
|
229
249
|
},
|
|
230
250
|
{
|
|
231
|
-
type:
|
|
232
|
-
name:
|
|
233
|
-
message:
|
|
234
|
-
default: 5.
|
|
251
|
+
type: "number",
|
|
252
|
+
name: "dailyBudget",
|
|
253
|
+
message: "Daily budget limit (USD)?",
|
|
254
|
+
default: 5.0,
|
|
235
255
|
validate: (input) => {
|
|
236
|
-
if (input <= 0) return
|
|
237
|
-
if (input > 1000) return
|
|
256
|
+
if (input <= 0) return "Budget must be greater than 0";
|
|
257
|
+
if (input > 1000) return "Budget seems unusually high (max: $1000)";
|
|
238
258
|
return true;
|
|
239
|
-
}
|
|
259
|
+
},
|
|
240
260
|
},
|
|
241
261
|
{
|
|
242
|
-
type:
|
|
243
|
-
name:
|
|
244
|
-
message:
|
|
245
|
-
default: 50.
|
|
262
|
+
type: "number",
|
|
263
|
+
name: "monthlyBudget",
|
|
264
|
+
message: "Monthly budget limit (USD)?",
|
|
265
|
+
default: 50.0,
|
|
246
266
|
validate: (input) => {
|
|
247
|
-
if (input <= 0) return
|
|
248
|
-
if (input > 10000)
|
|
267
|
+
if (input <= 0) return "Budget must be greater than 0";
|
|
268
|
+
if (input > 10000)
|
|
269
|
+
return "Budget seems unusually high (max: $10,000)";
|
|
249
270
|
return true;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
271
|
+
},
|
|
272
|
+
},
|
|
252
273
|
]);
|
|
253
274
|
|
|
254
275
|
config.VISUAL_DEFAULT_SERVICE = preferences.defaultService;
|
|
255
276
|
config.VISUAL_DEFAULT_QUALITY = preferences.defaultQuality;
|
|
256
277
|
config.VISUAL_DAILY_BUDGET = preferences.dailyBudget;
|
|
257
278
|
config.VISUAL_MONTHLY_BUDGET = preferences.monthlyBudget;
|
|
258
|
-
config.VISUAL_WARN_THRESHOLD = 0.
|
|
259
|
-
config.VISUAL_ASSETS_PATH =
|
|
279
|
+
config.VISUAL_WARN_THRESHOLD = 0.8;
|
|
280
|
+
config.VISUAL_ASSETS_PATH = "./content-assets";
|
|
260
281
|
|
|
261
282
|
// Step 5: Update .env file
|
|
262
|
-
console.log(
|
|
263
|
-
const spinner = ora(
|
|
283
|
+
console.log("");
|
|
284
|
+
const spinner = ora("Updating .env file...").start();
|
|
264
285
|
|
|
265
286
|
try {
|
|
266
287
|
await updateEnvFile(config);
|
|
267
|
-
spinner.succeed(chalk.green(
|
|
288
|
+
spinner.succeed(chalk.green(".env file updated successfully!"));
|
|
268
289
|
} catch (error) {
|
|
269
290
|
spinner.fail(chalk.red(`Failed to update .env: ${error.message}`));
|
|
270
291
|
throw error;
|
|
271
292
|
}
|
|
272
293
|
|
|
273
294
|
// Step 6: Summary
|
|
274
|
-
console.log(chalk.green(
|
|
295
|
+
console.log(chalk.green("\n✅ Configuration Complete!\n"));
|
|
275
296
|
|
|
276
|
-
console.log(chalk.cyan(
|
|
297
|
+
console.log(chalk.cyan("📋 Summary:"));
|
|
277
298
|
if (config.GOOGLE_API_KEY) {
|
|
278
|
-
console.log(
|
|
299
|
+
console.log(
|
|
300
|
+
chalk.gray(` ✅ Google AI configured (Gemini, Imagen, Veo)`),
|
|
301
|
+
);
|
|
279
302
|
}
|
|
280
303
|
if (config.OPENAI_API_KEY) {
|
|
281
304
|
console.log(chalk.gray(` ✅ OpenAI configured (DALL-E 3)`));
|
|
282
305
|
}
|
|
283
|
-
console.log(
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
console.log(
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
console.log(
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
console.log(chalk.
|
|
301
|
-
|
|
306
|
+
console.log(
|
|
307
|
+
chalk.gray(` Default service: ${config.VISUAL_DEFAULT_SERVICE}`),
|
|
308
|
+
);
|
|
309
|
+
console.log(
|
|
310
|
+
chalk.gray(` Default quality: ${config.VISUAL_DEFAULT_QUALITY}`),
|
|
311
|
+
);
|
|
312
|
+
console.log(
|
|
313
|
+
chalk.gray(
|
|
314
|
+
` Daily budget: $${config.VISUAL_DAILY_BUDGET.toFixed(2)}`,
|
|
315
|
+
),
|
|
316
|
+
);
|
|
317
|
+
console.log(
|
|
318
|
+
chalk.gray(
|
|
319
|
+
` Monthly budget: $${config.VISUAL_MONTHLY_BUDGET.toFixed(2)}`,
|
|
320
|
+
),
|
|
321
|
+
);
|
|
322
|
+
|
|
323
|
+
console.log(chalk.yellow("\n💡 Quick Start:\n"));
|
|
324
|
+
console.log(chalk.cyan(" # Generate hero image"));
|
|
325
|
+
console.log(
|
|
326
|
+
chalk.gray(' /myai-visual-generator "Modern developer workspace"\n'),
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
console.log(chalk.cyan(" # Generate with specific service"));
|
|
330
|
+
console.log(
|
|
331
|
+
chalk.gray(
|
|
332
|
+
' /myai-visual-generator "AI concept" --type=illustration --service=dalle\n',
|
|
333
|
+
),
|
|
334
|
+
);
|
|
335
|
+
|
|
336
|
+
console.log(chalk.cyan(" # Generate article with images"));
|
|
337
|
+
console.log(
|
|
338
|
+
chalk.gray(' /content-writer "Article Title" --with-images\n'),
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
console.log(chalk.white("📚 Documentation:"));
|
|
342
|
+
console.log(
|
|
343
|
+
chalk.gray(" VISUAL_CONTENT_GENERATION_GUIDE.md - Complete guide"),
|
|
344
|
+
);
|
|
345
|
+
console.log(
|
|
346
|
+
chalk.gray(" CONTENT_CREATION_GUIDE.md - Content workflow\n"),
|
|
347
|
+
);
|
|
302
348
|
} else {
|
|
303
|
-
console.log(
|
|
349
|
+
console.log(
|
|
350
|
+
chalk.yellow("\n⚠️ No configuration saved (no valid API keys)\n"),
|
|
351
|
+
);
|
|
304
352
|
}
|
|
305
|
-
|
|
306
353
|
} catch (error) {
|
|
307
354
|
if (error.isTtyError) {
|
|
308
|
-
console.error(
|
|
355
|
+
console.error(
|
|
356
|
+
chalk.red(
|
|
357
|
+
"\n❌ Prompt couldn't be rendered in the current environment",
|
|
358
|
+
),
|
|
359
|
+
);
|
|
309
360
|
} else {
|
|
310
361
|
console.error(chalk.red(`\n❌ Configuration error: ${error.message}`));
|
|
311
362
|
}
|
|
@@ -317,17 +368,17 @@ export async function configureVisualAPIs() {
|
|
|
317
368
|
* Update .env file with configuration
|
|
318
369
|
*/
|
|
319
370
|
async function updateEnvFile(config) {
|
|
320
|
-
const envPath = path.join(process.cwd(),
|
|
321
|
-
let envContent =
|
|
371
|
+
const envPath = path.join(process.cwd(), ".env");
|
|
372
|
+
let envContent = "";
|
|
322
373
|
|
|
323
374
|
// Read existing .env if it exists
|
|
324
375
|
if (await fs.pathExists(envPath)) {
|
|
325
|
-
envContent = await fs.readFile(envPath,
|
|
376
|
+
envContent = await fs.readFile(envPath, "utf-8");
|
|
326
377
|
}
|
|
327
378
|
|
|
328
379
|
// Update or add each config value
|
|
329
380
|
for (const [key, value] of Object.entries(config)) {
|
|
330
|
-
const regex = new RegExp(`^${key}=.*$`,
|
|
381
|
+
const regex = new RegExp(`^${key}=.*$`, "m");
|
|
331
382
|
const line = `${key}=${value}`;
|
|
332
383
|
|
|
333
384
|
if (regex.test(envContent)) {
|
|
@@ -335,8 +386,8 @@ async function updateEnvFile(config) {
|
|
|
335
386
|
envContent = envContent.replace(regex, line);
|
|
336
387
|
} else {
|
|
337
388
|
// Add new key
|
|
338
|
-
if (!envContent.endsWith(
|
|
339
|
-
envContent +=
|
|
389
|
+
if (!envContent.endsWith("\n") && envContent.length > 0) {
|
|
390
|
+
envContent += "\n";
|
|
340
391
|
}
|
|
341
392
|
envContent += `${line}\n`;
|
|
342
393
|
}
|
|
@@ -356,7 +407,7 @@ async function testGoogleAPI(apiKey) {
|
|
|
356
407
|
try {
|
|
357
408
|
const response = await fetch(
|
|
358
409
|
`https://generativelanguage.googleapis.com/v1beta/models?key=${apiKey}`,
|
|
359
|
-
{ method:
|
|
410
|
+
{ method: "GET" },
|
|
360
411
|
);
|
|
361
412
|
|
|
362
413
|
if (response.ok) {
|
|
@@ -375,21 +426,21 @@ async function testGoogleAPI(apiKey) {
|
|
|
375
426
|
*/
|
|
376
427
|
async function testOpenAIAPI(apiKey) {
|
|
377
428
|
try {
|
|
378
|
-
const response = await fetch(
|
|
379
|
-
|
|
380
|
-
{
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
);
|
|
429
|
+
const response = await fetch("https://api.openai.com/v1/models", {
|
|
430
|
+
method: "GET",
|
|
431
|
+
headers: {
|
|
432
|
+
Authorization: `Bearer ${apiKey}`,
|
|
433
|
+
},
|
|
434
|
+
});
|
|
387
435
|
|
|
388
436
|
if (response.ok) {
|
|
389
437
|
return { success: true };
|
|
390
438
|
} else {
|
|
391
439
|
const errorData = await response.json();
|
|
392
|
-
return {
|
|
440
|
+
return {
|
|
441
|
+
success: false,
|
|
442
|
+
error: errorData.error?.message || `HTTP ${response.status}`,
|
|
443
|
+
};
|
|
393
444
|
}
|
|
394
445
|
} catch (error) {
|
|
395
446
|
return { success: false, error: error.message };
|
|
@@ -400,13 +451,13 @@ async function testOpenAIAPI(apiKey) {
|
|
|
400
451
|
* Mask API key for display
|
|
401
452
|
*/
|
|
402
453
|
function maskKey(key) {
|
|
403
|
-
if (!key || key.length < 16) return
|
|
404
|
-
return `${key.substring(0, 8)}${
|
|
454
|
+
if (!key || key.length < 16) return "****";
|
|
455
|
+
return `${key.substring(0, 8)}${"*".repeat(Math.max(4, key.length - 12))}${key.substring(key.length - 4)}`;
|
|
405
456
|
}
|
|
406
457
|
|
|
407
458
|
// Run if executed directly
|
|
408
459
|
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
409
|
-
configureVisualAPIs().catch(error => {
|
|
460
|
+
configureVisualAPIs().catch((error) => {
|
|
410
461
|
console.error(chalk.red(`\nFatal error: ${error.message}`));
|
|
411
462
|
process.exit(1);
|
|
412
463
|
});
|