myaidev-method 0.2.22 → 0.2.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/USER_GUIDE.md +453 -48
- package/bin/cli.js +18 -0
- package/content-rules.example.md +80 -0
- package/dist/mcp/mcp-launcher.js +237 -0
- package/dist/server/.tsbuildinfo +1 -1
- package/dist/server/auth/layers.d.ts +1 -1
- package/dist/server/auth/services/AuthService.d.ts +1 -1
- package/dist/server/auth/services/TokenService.js.map +1 -1
- package/dist/server/auth/services/example.d.ts +5 -5
- package/package.json +16 -16
- package/src/index.js +21 -8
- package/src/lib/update-manager.js +2 -1
- package/src/lib/visual-config-utils.js +321 -295
- package/src/lib/visual-generation-utils.js +1000 -811
- package/src/scripts/configure-wordpress-mcp.js +8 -3
- package/src/scripts/generate-visual-cli.js +365 -235
- package/src/scripts/ping.js +250 -0
- package/src/scripts/wordpress/publish-to-wordpress.js +165 -0
- package/src/server/auth/services/TokenService.ts +1 -1
- package/src/templates/claude/agents/content-rules-setup.md +657 -0
- package/src/templates/claude/agents/content-writer.md +328 -1
- package/src/templates/claude/agents/visual-content-generator.md +182 -4
- package/src/templates/claude/commands/myai-configure.md +1 -1
- package/src/templates/claude/commands/myai-content-rules-setup.md +204 -0
- package/src/templates/codex/commands/myai-content-rules-setup.md +85 -0
- package/src/templates/gemini/commands/myai-content-rules-setup.toml +57 -0
- package/.claude/mcp/sparc-orchestrator-server.js +0 -607
- package/.claude/mcp/wordpress-server.js +0 -1277
- package/src/agents/content-writer-prompt.md +0 -164
- package/src/agents/content-writer.json +0 -70
- package/src/templates/claude/mcp_config.json +0 -74
- package/src/templates/claude/slash_commands.json +0 -166
- package/src/templates/scripts/configure-wordpress-mcp.js +0 -181
|
@@ -107,6 +107,252 @@ The content-writer agent supports custom content generation rules via a `content
|
|
|
107
107
|
|
|
108
108
|
**Note:** If `content-rules.md` doesn't exist, the agent will use its default professional content creation guidelines.
|
|
109
109
|
|
|
110
|
+
## Content Type Templates
|
|
111
|
+
|
|
112
|
+
The content-writer supports specialized templates for different content types. Specify the type to get optimized structure and formatting:
|
|
113
|
+
|
|
114
|
+
### Available Content Types
|
|
115
|
+
|
|
116
|
+
| Type | Description | Typical Length | Key Elements |
|
|
117
|
+
|------|-------------|----------------|--------------|
|
|
118
|
+
| `blog-post` | Standard SEO-optimized article | 1500-2500 words | Hero image, intro hook, sections, CTA |
|
|
119
|
+
| `technical-tutorial` | Step-by-step implementation guide | 2000-3500 words | Prerequisites, code examples, diagrams |
|
|
120
|
+
| `api-documentation` | API reference documentation | 1000-2000 words | Endpoints, parameters, response examples |
|
|
121
|
+
| `architecture-guide` | System design documentation | 2500-4000 words | Architecture diagrams, component details |
|
|
122
|
+
| `listicle` | List-based article (Top 10, etc.) | 1200-2000 words | Numbered items, supporting graphics |
|
|
123
|
+
| `comparison-guide` | Side-by-side analysis | 1500-2500 words | Comparison tables, infographics |
|
|
124
|
+
| `white-paper` | In-depth technical analysis | 3000-5000 words | Executive summary, data infographics |
|
|
125
|
+
| `how-to-guide` | Practical implementation guide | 1500-2500 words | Step visuals, troubleshooting |
|
|
126
|
+
| `case-study` | Customer success story | 1200-2000 words | Metrics, quotes, before/after |
|
|
127
|
+
|
|
128
|
+
### Template Structures
|
|
129
|
+
|
|
130
|
+
**Blog Post Template:**
|
|
131
|
+
```markdown
|
|
132
|
+
# [Title with Primary Keyword]
|
|
133
|
+
|
|
134
|
+

|
|
135
|
+
|
|
136
|
+
[Hook - 2-3 sentences grabbing attention]
|
|
137
|
+
|
|
138
|
+
## Introduction
|
|
139
|
+
[Problem statement, what reader will learn]
|
|
140
|
+
|
|
141
|
+
## [Main Section 1]
|
|
142
|
+
[Content with examples]
|
|
143
|
+
|
|
144
|
+
## [Main Section 2]
|
|
145
|
+
[Content with visuals if applicable]
|
|
146
|
+
|
|
147
|
+
## [Main Section 3]
|
|
148
|
+
[Content with code/examples]
|
|
149
|
+
|
|
150
|
+
## Conclusion
|
|
151
|
+
[Summary, key takeaways, CTA]
|
|
152
|
+
|
|
153
|
+
## Related Resources
|
|
154
|
+
[Internal links]
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Technical Tutorial Template:**
|
|
158
|
+
```markdown
|
|
159
|
+
# [How to/Build/Implement] [Topic]: [Benefit]
|
|
160
|
+
|
|
161
|
+
![Hero: Tech concept visualization]
|
|
162
|
+
|
|
163
|
+
## What You'll Build/Learn
|
|
164
|
+
[Clear deliverable description]
|
|
165
|
+
|
|
166
|
+
## Prerequisites
|
|
167
|
+
- [Requirement 1]
|
|
168
|
+
- [Requirement 2]
|
|
169
|
+
|
|
170
|
+
## Step 1: [Foundation]
|
|
171
|
+
[Explanation]
|
|
172
|
+
```[language]
|
|
173
|
+
// Code example
|
|
174
|
+
```
|
|
175
|
+
![Diagram: Step 1 visualization]
|
|
176
|
+
|
|
177
|
+
## Step 2: [Implementation]
|
|
178
|
+
[Detailed steps with code]
|
|
179
|
+
|
|
180
|
+
## Step 3: [Advanced/Production]
|
|
181
|
+
[Enhancement and best practices]
|
|
182
|
+
|
|
183
|
+
## Testing & Verification
|
|
184
|
+
[How to verify it works]
|
|
185
|
+
|
|
186
|
+
## Troubleshooting
|
|
187
|
+
| Issue | Solution |
|
|
188
|
+
|-------|----------|
|
|
189
|
+
| ... | ... |
|
|
190
|
+
|
|
191
|
+
## Next Steps
|
|
192
|
+
[Related tutorials, advanced topics]
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**API Documentation Template:**
|
|
196
|
+
```markdown
|
|
197
|
+
# [API Endpoint/Feature] Reference
|
|
198
|
+
|
|
199
|
+
## Overview
|
|
200
|
+
[What this API does, when to use it]
|
|
201
|
+
|
|
202
|
+
## Authentication
|
|
203
|
+
[Required auth method]
|
|
204
|
+
|
|
205
|
+
## Endpoints
|
|
206
|
+
|
|
207
|
+
### [HTTP Method] /endpoint
|
|
208
|
+
[Description]
|
|
209
|
+
|
|
210
|
+
**Request Parameters:**
|
|
211
|
+
| Parameter | Type | Required | Description |
|
|
212
|
+
|-----------|------|----------|-------------|
|
|
213
|
+
| ... | ... | ... | ... |
|
|
214
|
+
|
|
215
|
+
**Request Example:**
|
|
216
|
+
```bash
|
|
217
|
+
curl -X POST https://api.example.com/endpoint \
|
|
218
|
+
-H "Authorization: Bearer TOKEN" \
|
|
219
|
+
-d '{"key": "value"}'
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
**Response:**
|
|
223
|
+
```json
|
|
224
|
+
{
|
|
225
|
+
"status": "success",
|
|
226
|
+
"data": {}
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**Error Codes:**
|
|
231
|
+
| Code | Description |
|
|
232
|
+
|------|-------------|
|
|
233
|
+
| 400 | Bad request |
|
|
234
|
+
| 401 | Unauthorized |
|
|
235
|
+
|
|
236
|
+
## Rate Limits
|
|
237
|
+
[Rate limiting details]
|
|
238
|
+
|
|
239
|
+
## SDKs & Libraries
|
|
240
|
+
[Available SDKs]
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Architecture Guide Template:**
|
|
244
|
+
```markdown
|
|
245
|
+
# [System/Feature] Architecture
|
|
246
|
+
|
|
247
|
+
![Architecture Diagram: System overview]
|
|
248
|
+
|
|
249
|
+
## Executive Summary
|
|
250
|
+
[High-level overview for stakeholders]
|
|
251
|
+
|
|
252
|
+
## System Overview
|
|
253
|
+
[What the system does, key capabilities]
|
|
254
|
+
|
|
255
|
+
## Architecture Diagram
|
|
256
|
+
![architecture-diagram: Component relationships]
|
|
257
|
+
|
|
258
|
+
## Components
|
|
259
|
+
|
|
260
|
+
### [Component 1]
|
|
261
|
+
**Purpose:** [What it does]
|
|
262
|
+
**Technology:** [Tech stack]
|
|
263
|
+
**Interactions:** [How it connects]
|
|
264
|
+
|
|
265
|
+
### [Component 2]
|
|
266
|
+
[Same structure]
|
|
267
|
+
|
|
268
|
+
## Data Flow
|
|
269
|
+
![flowchart: Data flow through system]
|
|
270
|
+
|
|
271
|
+
1. [Step 1]
|
|
272
|
+
2. [Step 2]
|
|
273
|
+
3. [Step 3]
|
|
274
|
+
|
|
275
|
+
## Security Considerations
|
|
276
|
+
[Security architecture]
|
|
277
|
+
|
|
278
|
+
## Scalability
|
|
279
|
+
[How system scales]
|
|
280
|
+
|
|
281
|
+
## Deployment
|
|
282
|
+
[Deployment architecture]
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
**Listicle Template:**
|
|
286
|
+
```markdown
|
|
287
|
+
# [Number] [Topic] [Benefit/Outcome]
|
|
288
|
+
|
|
289
|
+
![Hero: Engaging visual representing the list theme]
|
|
290
|
+
|
|
291
|
+
[Introduction: Why this list matters, what reader will learn]
|
|
292
|
+
|
|
293
|
+
## 1. [First Item]
|
|
294
|
+
![illustration: Item 1 concept]
|
|
295
|
+
[Detailed explanation, 150-250 words]
|
|
296
|
+
**Key Takeaway:** [One-liner]
|
|
297
|
+
|
|
298
|
+
## 2. [Second Item]
|
|
299
|
+
[Same structure]
|
|
300
|
+
|
|
301
|
+
## 3. [Third Item]
|
|
302
|
+
[Same structure]
|
|
303
|
+
|
|
304
|
+
[Continue for all items...]
|
|
305
|
+
|
|
306
|
+
## Summary
|
|
307
|
+
![infographic-data: Quick reference of all items]
|
|
308
|
+
[Recap of all items with key points]
|
|
309
|
+
|
|
310
|
+
## What's Next?
|
|
311
|
+
[CTA, related content]
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**Comparison Guide Template:**
|
|
315
|
+
```markdown
|
|
316
|
+
# [Option A] vs [Option B]: [Decision Framework]
|
|
317
|
+
|
|
318
|
+
![Hero: Visual comparison concept]
|
|
319
|
+
|
|
320
|
+
## Quick Comparison
|
|
321
|
+
![infographic-comparison: Side-by-side summary]
|
|
322
|
+
|
|
323
|
+
| Feature | [Option A] | [Option B] |
|
|
324
|
+
|---------|------------|------------|
|
|
325
|
+
| [Feature 1] | ✅/❌/Value | ✅/❌/Value |
|
|
326
|
+
| [Feature 2] | ... | ... |
|
|
327
|
+
|
|
328
|
+
## Overview
|
|
329
|
+
[When you'd choose each option]
|
|
330
|
+
|
|
331
|
+
## [Option A] Deep Dive
|
|
332
|
+
### Strengths
|
|
333
|
+
### Weaknesses
|
|
334
|
+
### Best For
|
|
335
|
+
|
|
336
|
+
## [Option B] Deep Dive
|
|
337
|
+
### Strengths
|
|
338
|
+
### Weaknesses
|
|
339
|
+
### Best For
|
|
340
|
+
|
|
341
|
+
## Decision Framework
|
|
342
|
+
![flowchart: Decision tree for choosing]
|
|
343
|
+
|
|
344
|
+
Choose [Option A] if:
|
|
345
|
+
- [Criteria 1]
|
|
346
|
+
- [Criteria 2]
|
|
347
|
+
|
|
348
|
+
Choose [Option B] if:
|
|
349
|
+
- [Criteria 1]
|
|
350
|
+
- [Criteria 2]
|
|
351
|
+
|
|
352
|
+
## Conclusion
|
|
353
|
+
[Final recommendation based on use case]
|
|
354
|
+
```
|
|
355
|
+
|
|
110
356
|
## Writing Process
|
|
111
357
|
|
|
112
358
|
### Phase 0: Load Custom Rules (if available)
|
|
@@ -114,9 +360,11 @@ The content-writer agent supports custom content generation rules via a `content
|
|
|
114
360
|
- If found, read and incorporate custom guidelines
|
|
115
361
|
- Merge custom rules with default best practices
|
|
116
362
|
- Continue with standard process if file doesn't exist
|
|
363
|
+
- **Run `/myai-content-rules-setup` if no rules exist and user wants customization**
|
|
117
364
|
|
|
118
365
|
### Phase 1: Understanding
|
|
119
366
|
- Identify the content purpose and goals
|
|
367
|
+
- **Select appropriate content type template**
|
|
120
368
|
- Define the target audience
|
|
121
369
|
- Determine the desired tone and style
|
|
122
370
|
- Clarify key messages and takeaways
|
|
@@ -134,7 +382,86 @@ The content-writer agent supports custom content generation rules via a `content
|
|
|
134
382
|
- Organize information logically
|
|
135
383
|
- Plan keyword placement
|
|
136
384
|
- Identify supporting media needs
|
|
137
|
-
|
|
385
|
+
|
|
386
|
+
### Phase 3.5: Visual Strategy (--with-images or by default for visual content types)
|
|
387
|
+
|
|
388
|
+
Plan visual content to enhance the article:
|
|
389
|
+
|
|
390
|
+
**1. Identify Visual Opportunities:**
|
|
391
|
+
```markdown
|
|
392
|
+
## Visual Content Plan
|
|
393
|
+
|
|
394
|
+
### Hero Image
|
|
395
|
+
- Concept: [Main visual theme]
|
|
396
|
+
- Type: hero
|
|
397
|
+
- Placement: After H1 title
|
|
398
|
+
|
|
399
|
+
### Diagrams (Technical Content)
|
|
400
|
+
- [ ] Architecture diagram: [What it shows]
|
|
401
|
+
- [ ] Flowchart: [Process being illustrated]
|
|
402
|
+
- [ ] Sequence diagram: [Interactions being shown]
|
|
403
|
+
|
|
404
|
+
### Infographics (Data/Process Content)
|
|
405
|
+
- [ ] Data infographic: [Metrics/statistics to visualize]
|
|
406
|
+
- [ ] Process infographic: [Steps to illustrate]
|
|
407
|
+
- [ ] Comparison infographic: [Items being compared]
|
|
408
|
+
- [ ] Timeline infographic: [Events/milestones]
|
|
409
|
+
|
|
410
|
+
### Supporting Visuals
|
|
411
|
+
- [ ] Illustration: [Concept to visualize]
|
|
412
|
+
- [ ] Screenshot: [UI/interface to show]
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
**2. Match Content Type to Visuals:**
|
|
416
|
+
|
|
417
|
+
| Content Type | Recommended Visuals |
|
|
418
|
+
|--------------|---------------------|
|
|
419
|
+
| Blog Post | Hero + 1-2 illustrations |
|
|
420
|
+
| Technical Tutorial | Hero + diagrams + code screenshots |
|
|
421
|
+
| API Documentation | Sequence diagrams + request/response examples |
|
|
422
|
+
| Architecture Guide | Architecture diagrams + flowcharts |
|
|
423
|
+
| Listicle | Hero + item illustrations + summary infographic |
|
|
424
|
+
| Comparison Guide | Comparison infographic + decision flowchart |
|
|
425
|
+
| White Paper | Hero + data infographics + process diagrams |
|
|
426
|
+
|
|
427
|
+
**3. Create Visual Specifications:**
|
|
428
|
+
|
|
429
|
+
For each planned visual, specify:
|
|
430
|
+
```markdown
|
|
431
|
+
### Visual: [Name]
|
|
432
|
+
- **Type**: [hero/diagram/infographic-data/etc.]
|
|
433
|
+
- **Placement**: [After which section/heading]
|
|
434
|
+
- **Concept**: [What it should depict]
|
|
435
|
+
- **Text Elements**: [Any text to include in the image]
|
|
436
|
+
- **Style Notes**: [Technical/friendly/corporate/etc.]
|
|
437
|
+
- **Service**: [Recommended: gemini/gpt-image-1.5/flux2-pro]
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
**4. Infographic Data Specification:**
|
|
441
|
+
|
|
442
|
+
For data-driven infographics, provide structured data:
|
|
443
|
+
```markdown
|
|
444
|
+
### Infographic: [Title]
|
|
445
|
+
- **Type**: infographic-data
|
|
446
|
+
- **Data Points**:
|
|
447
|
+
- Label: "Metric 1", Value: "99.9%"
|
|
448
|
+
- Label: "Metric 2", Value: "< 50ms"
|
|
449
|
+
- Label: "Metric 3", Value: "10M+"
|
|
450
|
+
- **Color Scheme**: [Brand colors or preference]
|
|
451
|
+
- **Style**: Modern flat design with clear typography
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
**5. Diagram Specification:**
|
|
455
|
+
|
|
456
|
+
For technical diagrams:
|
|
457
|
+
```markdown
|
|
458
|
+
### Diagram: [Title]
|
|
459
|
+
- **Type**: architecture-diagram / flowchart / sequence-diagram
|
|
460
|
+
- **Components**: [List of elements to include]
|
|
461
|
+
- **Connections**: [How elements relate]
|
|
462
|
+
- **Labels**: [Key labels to include]
|
|
463
|
+
- **Style**: Isometric / flat / technical illustration
|
|
464
|
+
```
|
|
138
465
|
|
|
139
466
|
### Phase 4: Writing
|
|
140
467
|
- Craft an attention-grabbing headline
|
|
@@ -70,13 +70,30 @@ Collect information from the user:
|
|
|
70
70
|
|
|
71
71
|
**Required Information:**
|
|
72
72
|
- **Prompt/Description**: What should the image/video depict?
|
|
73
|
-
- **Type**:
|
|
73
|
+
- **Type**: See Image Type Reference below
|
|
74
74
|
|
|
75
75
|
**Optional Information:**
|
|
76
|
-
- **Preferred Service**: gemini, imagen,
|
|
77
|
-
- **Quality**:
|
|
76
|
+
- **Preferred Service**: gemini, imagen, gpt-image-1.5, flux2-pro, veo3 (or auto-select)
|
|
77
|
+
- **Quality**: low, medium, high (affects cost and detail)
|
|
78
78
|
- **Size**: 1024x1024, 1792x1024, 1024x1792
|
|
79
79
|
|
|
80
|
+
### Image Type Reference
|
|
81
|
+
|
|
82
|
+
| Type | Description | Best Service | Use Case |
|
|
83
|
+
|------|-------------|--------------|----------|
|
|
84
|
+
| `hero` | Article header, main theme | Gemini/Imagen | Blog posts, landing pages |
|
|
85
|
+
| `illustration` | Abstract concepts, metaphors | FLUX 2 Pro | Explanatory content |
|
|
86
|
+
| `diagram` | Technical workflows, architecture | Gemini | Documentation |
|
|
87
|
+
| `screenshot` | UI mockups, interface designs | GPT Image 1.5 | Tutorials |
|
|
88
|
+
| `infographic-data` | Statistics, metrics, charts | GPT Image 1.5 | Data-driven articles |
|
|
89
|
+
| `infographic-process` | Step flows, workflows | FLUX 2 Pro | How-to guides |
|
|
90
|
+
| `infographic-comparison` | Side-by-side comparisons | GPT Image 1.5 | Comparison articles |
|
|
91
|
+
| `infographic-timeline` | Chronological events | FLUX 2 Pro | History, roadmaps |
|
|
92
|
+
| `architecture-diagram` | System design, tech stacks | Gemini | Technical docs |
|
|
93
|
+
| `flowchart` | Decision trees, processes | Gemini | Process documentation |
|
|
94
|
+
| `sequence-diagram` | API/service interactions | Gemini | API documentation |
|
|
95
|
+
| `video` | Product demos, tutorials | Veo 3 | Marketing, tutorials |
|
|
96
|
+
|
|
80
97
|
**Example Interaction:**
|
|
81
98
|
```
|
|
82
99
|
User: Generate a hero image for an article about AI development
|
|
@@ -407,16 +424,177 @@ Always enhance user prompts for better results:
|
|
|
407
424
|
```javascript
|
|
408
425
|
const enhancePrompt = (userPrompt, type) => {
|
|
409
426
|
const prefixes = {
|
|
427
|
+
// Standard types
|
|
410
428
|
hero: 'Professional hero image, high quality, visually striking:',
|
|
411
429
|
illustration: 'Clean illustration, professional style:',
|
|
412
430
|
diagram: 'Technical diagram, clear labels, easy to understand:',
|
|
413
|
-
screenshot: 'Professional screenshot, clean interface:'
|
|
431
|
+
screenshot: 'Professional screenshot, clean interface:',
|
|
432
|
+
|
|
433
|
+
// Infographic types (use GPT Image 1.5 for best text rendering)
|
|
434
|
+
'infographic-data': 'Clean data visualization infographic with clear typography, color-coded sections, modern flat design. Include title area, data callouts with numbers, and clean layout:',
|
|
435
|
+
'infographic-process': 'Step-by-step process infographic with numbered steps, icons for each step, connecting arrows, clean modern design. Each step clearly labeled:',
|
|
436
|
+
'infographic-comparison': 'Side-by-side comparison infographic with two columns, clear headers, checkmarks and X marks, comparison points aligned, professional business style:',
|
|
437
|
+
'infographic-timeline': 'Horizontal timeline infographic with dated milestones, icons at each point, connecting line, clean modern design, clear labels:',
|
|
438
|
+
|
|
439
|
+
// Technical diagram types
|
|
440
|
+
'architecture-diagram': 'Technical system architecture diagram with labeled boxes, connection arrows, cloud/server/database icons, legend area, isometric or flat technical style:',
|
|
441
|
+
'flowchart': 'Professional flowchart with decision diamonds, process rectangles, start/end ovals, clear yes/no paths, labeled arrows:',
|
|
442
|
+
'sequence-diagram': 'Technical sequence diagram showing component interactions, lifelines, arrows with labels, participant boxes at top:'
|
|
414
443
|
};
|
|
415
444
|
|
|
416
445
|
return `${prefixes[type] || ''} ${userPrompt}`;
|
|
417
446
|
};
|
|
418
447
|
```
|
|
419
448
|
|
|
449
|
+
### Infographic Generation Guidelines
|
|
450
|
+
|
|
451
|
+
When generating infographics, follow these practices:
|
|
452
|
+
|
|
453
|
+
**For Data Infographics (`infographic-data`):**
|
|
454
|
+
```javascript
|
|
455
|
+
// Best service: GPT Image 1.5 (excellent text rendering)
|
|
456
|
+
const prompt = buildDataInfographicPrompt({
|
|
457
|
+
title: "5 Key Authentication Metrics",
|
|
458
|
+
metrics: [
|
|
459
|
+
{ label: "API Latency", value: "< 50ms" },
|
|
460
|
+
{ label: "Uptime", value: "99.99%" },
|
|
461
|
+
{ label: "Daily Requests", value: "10M+" }
|
|
462
|
+
],
|
|
463
|
+
style: "modern flat design, blue and white color scheme"
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
// Example output prompt:
|
|
467
|
+
// "Clean data visualization infographic: Title '5 Key Authentication Metrics'.
|
|
468
|
+
// Show 3 metrics with large numbers: API Latency < 50ms, Uptime 99.99%,
|
|
469
|
+
// Daily Requests 10M+. Modern flat design, blue and white, clear typography."
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
**For Process Infographics (`infographic-process`):**
|
|
473
|
+
```javascript
|
|
474
|
+
// Best service: FLUX 2 Pro (excellent detail)
|
|
475
|
+
const prompt = buildProcessInfographicPrompt({
|
|
476
|
+
title: "JWT Authentication Flow",
|
|
477
|
+
steps: [
|
|
478
|
+
"1. User submits credentials",
|
|
479
|
+
"2. Server validates and generates JWT",
|
|
480
|
+
"3. Client stores token",
|
|
481
|
+
"4. Client sends token with requests",
|
|
482
|
+
"5. Server verifies token"
|
|
483
|
+
],
|
|
484
|
+
style: "numbered steps with icons, arrows connecting each step"
|
|
485
|
+
});
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
**For Comparison Infographics (`infographic-comparison`):**
|
|
489
|
+
```javascript
|
|
490
|
+
// Best service: GPT Image 1.5 (best for text-heavy visuals)
|
|
491
|
+
const prompt = buildComparisonInfographicPrompt({
|
|
492
|
+
title: "JWT vs Session Authentication",
|
|
493
|
+
items: [
|
|
494
|
+
{ category: "Scalability", optionA: "Excellent", optionB: "Good" },
|
|
495
|
+
{ category: "Server Storage", optionA: "None", optionB: "Required" },
|
|
496
|
+
{ category: "Mobile Support", optionA: "Native", optionB: "Complex" }
|
|
497
|
+
],
|
|
498
|
+
style: "two-column layout, checkmarks for advantages"
|
|
499
|
+
});
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
**For Architecture Diagrams (`architecture-diagram`):**
|
|
503
|
+
```javascript
|
|
504
|
+
// Best service: Gemini (fast, good for technical diagrams)
|
|
505
|
+
const prompt = buildArchitectureDiagramPrompt({
|
|
506
|
+
title: "Microservices Architecture",
|
|
507
|
+
components: ["API Gateway", "Auth Service", "User Service", "Database"],
|
|
508
|
+
connections: ["Gateway → Auth", "Gateway → User", "Services → Database"],
|
|
509
|
+
style: "isometric 3D blocks, labeled, connection arrows"
|
|
510
|
+
});
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
### Service Selection by Type
|
|
514
|
+
|
|
515
|
+
Use this guide to auto-select the best service:
|
|
516
|
+
|
|
517
|
+
```javascript
|
|
518
|
+
function getRecommendedService(type) {
|
|
519
|
+
const recommendations = {
|
|
520
|
+
// Text-heavy visuals → GPT Image 1.5 (best text rendering)
|
|
521
|
+
'infographic-data': 'gpt-image-1.5',
|
|
522
|
+
'infographic-comparison': 'gpt-image-1.5',
|
|
523
|
+
'screenshot': 'gpt-image-1.5',
|
|
524
|
+
|
|
525
|
+
// Detailed illustrations → FLUX 2 Pro (best detail)
|
|
526
|
+
'infographic-process': 'flux2-pro',
|
|
527
|
+
'infographic-timeline': 'flux2-pro',
|
|
528
|
+
'illustration': 'flux2-pro',
|
|
529
|
+
'hero': 'flux2-pro',
|
|
530
|
+
|
|
531
|
+
// Technical diagrams → Gemini (fast, cost-effective)
|
|
532
|
+
'diagram': 'gemini',
|
|
533
|
+
'architecture-diagram': 'gemini',
|
|
534
|
+
'flowchart': 'gemini',
|
|
535
|
+
'sequence-diagram': 'gemini',
|
|
536
|
+
|
|
537
|
+
// Video → Veo 3 (only option)
|
|
538
|
+
'video': 'veo3'
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
return recommendations[type] || 'gemini';
|
|
542
|
+
}
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
### Batch Generation for Articles
|
|
546
|
+
|
|
547
|
+
Generate all visuals for an article efficiently:
|
|
548
|
+
|
|
549
|
+
```javascript
|
|
550
|
+
async function generateArticleVisuals(articlePlan) {
|
|
551
|
+
const visuals = [];
|
|
552
|
+
|
|
553
|
+
// Hero image
|
|
554
|
+
if (articlePlan.heroImage) {
|
|
555
|
+
visuals.push({
|
|
556
|
+
type: 'hero',
|
|
557
|
+
prompt: articlePlan.heroImage.concept,
|
|
558
|
+
service: 'flux2-pro'
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
// Diagrams
|
|
563
|
+
for (const diagram of articlePlan.diagrams || []) {
|
|
564
|
+
visuals.push({
|
|
565
|
+
type: diagram.type || 'diagram',
|
|
566
|
+
prompt: diagram.description,
|
|
567
|
+
service: getRecommendedService(diagram.type)
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
// Infographics
|
|
572
|
+
for (const infographic of articlePlan.infographics || []) {
|
|
573
|
+
visuals.push({
|
|
574
|
+
type: infographic.type,
|
|
575
|
+
prompt: buildInfographicPrompt(infographic),
|
|
576
|
+
service: getRecommendedService(infographic.type)
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
// Estimate total cost before generating
|
|
581
|
+
const totalCost = visuals.reduce((sum, v) => sum + estimateCost(v.service), 0);
|
|
582
|
+
console.log(`📊 Generating ${visuals.length} visuals. Estimated cost: $${totalCost.toFixed(2)}`);
|
|
583
|
+
|
|
584
|
+
// Generate all (with budget check)
|
|
585
|
+
const results = [];
|
|
586
|
+
for (const visual of visuals) {
|
|
587
|
+
const result = await generateImage(visual.prompt, {
|
|
588
|
+
preferredService: visual.service,
|
|
589
|
+
type: visual.type
|
|
590
|
+
});
|
|
591
|
+
results.push(result);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
return results;
|
|
595
|
+
}
|
|
596
|
+
```
|
|
597
|
+
|
|
420
598
|
### Quality vs Cost
|
|
421
599
|
|
|
422
600
|
```javascript
|