myaidev-method 0.2.12 → 0.2.16
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 +40 -0
- package/CHANGELOG.md +96 -0
- package/CONTENT_CREATION_GUIDE.md +3399 -0
- package/DEVELOPER_USE_CASES.md +2085 -0
- package/README.md +209 -2
- package/VISUAL_GENERATION_FILE_ORGANIZATION.md +105 -0
- package/bin/cli.js +46 -0
- package/package.json +18 -3
- package/src/lib/asset-management.js +532 -0
- package/src/lib/visual-config-utils.js +424 -0
- package/src/lib/visual-generation-utils.js +880 -0
- package/src/scripts/configure-visual-apis.js +413 -0
- package/src/scripts/generate-visual-cli.js +279 -0
- package/src/templates/claude/agents/content-production-coordinator.md +111 -0
- package/src/templates/claude/agents/content-writer.md +209 -4
- package/src/templates/claude/agents/proprietary-content-verifier.md +96 -0
- package/src/templates/claude/agents/visual-content-generator.md +520 -0
- package/src/templates/claude/commands/myai-content-writer.md +33 -8
- package/src/templates/claude/commands/myai-coordinate-content.md +136 -0
- package/src/templates/claude/commands/myai-generate-visual.md +318 -0
- package/src/templates/codex/commands/myai-generate-visual.md +307 -0
- package/src/templates/gemini/commands/myai-generate-visual.md +200 -0
- package/.claude/CLAUDE.md +0 -52
- package/.claude/agents/content-writer.md +0 -155
- package/.claude/agents/wordpress-admin.md +0 -271
- package/.claude/commands/myai-configure.md +0 -44
- package/.claude/commands/myai-content-writer.md +0 -78
- package/.claude/commands/myai-wordpress-publish.md +0 -120
- package/.claude/mcp/gutenberg-converter.js +0 -447
- package/.claude/mcp/mcp-config.json +0 -184
- package/.claude/mcp/wordpress-server-simple.js +0 -182
- package/.claude/settings.local.json +0 -12
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: myai-generate-visual
|
|
3
|
+
description: Generate images or videos for content using AI
|
|
4
|
+
platforms: claude-code
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Generate Visual Content
|
|
8
|
+
|
|
9
|
+
Generate images or videos using AI generation APIs (Google Gemini Flash, Imagen 3, DALL-E 3, Veo 2).
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
/myai-generate-visual "prompt" [options]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Options
|
|
18
|
+
|
|
19
|
+
- `--type <type>` - Content type: hero, illustration, diagram, screenshot, video (default: hero)
|
|
20
|
+
- `--service <service>` - Service: gemini, imagen, dalle, veo (default: auto-select)
|
|
21
|
+
- `--size <size>` - Image size: 1024x1024, 1792x1024, 1024x1792 (default: 1024x1024)
|
|
22
|
+
- `--quality <quality>` - Quality: standard, hd (default: standard)
|
|
23
|
+
- `--description <desc>` - Filename description (default: derived from prompt)
|
|
24
|
+
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
### Generate Hero Image (Auto-Select Service)
|
|
28
|
+
```bash
|
|
29
|
+
/myai-generate-visual "Modern developer workspace with AI coding assistant"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Generate Diagram with Specific Service
|
|
33
|
+
```bash
|
|
34
|
+
/myai-generate-visual "Microservices architecture diagram" --type diagram --service gemini
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Generate High-Quality Illustration
|
|
38
|
+
```bash
|
|
39
|
+
/myai-generate-visual "AI brain network visualization" --type illustration --service dalle --quality hd
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Generate Video
|
|
43
|
+
```bash
|
|
44
|
+
/myai-generate-visual "Product demo: authentication flow" --type video --service veo
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Generate with Custom Description
|
|
48
|
+
```bash
|
|
49
|
+
/myai-generate-visual "Team collaboration workspace" --type hero --description "team-workspace"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Prerequisites
|
|
53
|
+
|
|
54
|
+
Configure at least one API key:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
/myai-configure visual
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Or manually add to `.env`:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Google AI (for Gemini, Imagen, Veo)
|
|
64
|
+
GOOGLE_API_KEY=your_key_here
|
|
65
|
+
|
|
66
|
+
# OpenAI (for DALL-E)
|
|
67
|
+
OPENAI_API_KEY=your_key_here
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Get API keys:
|
|
71
|
+
- **Google AI**: https://ai.google.dev/
|
|
72
|
+
- **OpenAI**: https://platform.openai.com/api-keys
|
|
73
|
+
|
|
74
|
+
## Available Services
|
|
75
|
+
|
|
76
|
+
| Service | Speed | Cost | Quality | Best For |
|
|
77
|
+
|---------|-------|------|---------|----------|
|
|
78
|
+
| Gemini Flash | ⚡⚡⚡ Fast | $0.02 | Good | Quick hero images, high volume |
|
|
79
|
+
| Imagen 3 | ⚡⚡ Medium | $0.03 | Excellent | Premium hero images, photorealistic |
|
|
80
|
+
| DALL-E 3 | ⚡⚡ Medium | $0.04-0.12 | Excellent | Creative illustrations, concept art |
|
|
81
|
+
| Veo 2 | ⚡ Slow | $0.10 (est.) | Good | Product demos, animated diagrams |
|
|
82
|
+
|
|
83
|
+
## How It Works
|
|
84
|
+
|
|
85
|
+
1. **Check Configuration**: Validates API keys are configured
|
|
86
|
+
2. **Gather Requirements**: Analyzes prompt, type, and service preferences
|
|
87
|
+
3. **Estimate Cost**: Shows cost estimate and current budget usage
|
|
88
|
+
4. **Generate**: Calls appropriate AI service to generate content
|
|
89
|
+
5. **Save**: Stores in organized directory (`content-assets/images/YYYY-MM-DD/`)
|
|
90
|
+
6. **Return Markdown**: Provides ready-to-use markdown embed code
|
|
91
|
+
|
|
92
|
+
## Output
|
|
93
|
+
|
|
94
|
+
The command outputs:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
🎨 Generating hero image using gemini...
|
|
98
|
+
✅ Image generated successfully!
|
|
99
|
+
|
|
100
|
+
📸 Details:
|
|
101
|
+
Service: Gemini 2.5 Flash Image
|
|
102
|
+
Type: Hero Image
|
|
103
|
+
Cost: $0.02
|
|
104
|
+
File: ./content-assets/images/2025-11-19/hero-developer-workspace-123456.png
|
|
105
|
+
Size: 342.5 KB
|
|
106
|
+
|
|
107
|
+
💰 Budget Status:
|
|
108
|
+
Today: $0.24 / $5.00 (5%)
|
|
109
|
+
Month: $3.67 / $50.00 (7%)
|
|
110
|
+
|
|
111
|
+
📋 Markdown Reference:
|
|
112
|
+

|
|
113
|
+
|
|
114
|
+
Copy and paste into your content ↑
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## File Organization
|
|
118
|
+
|
|
119
|
+
Generated files are automatically organized by date:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
content-assets/
|
|
123
|
+
├── images/
|
|
124
|
+
│ ├── 2025-11-19/
|
|
125
|
+
│ │ ├── hero-developer-workspace-123456.png
|
|
126
|
+
│ │ ├── illustration-ai-concept-234567.png
|
|
127
|
+
│ │ └── diagram-architecture-345678.png
|
|
128
|
+
│ └── 2025-11-20/
|
|
129
|
+
│ └── ...
|
|
130
|
+
└── videos/
|
|
131
|
+
└── 2025-11-19/
|
|
132
|
+
└── video-product-demo-456789.mp4
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Budget Management
|
|
136
|
+
|
|
137
|
+
Default budget limits (configurable in `.env`):
|
|
138
|
+
|
|
139
|
+
- **Daily Budget**: $5.00 USD
|
|
140
|
+
- **Monthly Budget**: $50.00 USD
|
|
141
|
+
- **Warning Threshold**: 80%
|
|
142
|
+
|
|
143
|
+
The command will:
|
|
144
|
+
- Show cost estimate before generating
|
|
145
|
+
- Display current budget usage
|
|
146
|
+
- Warn when approaching limits
|
|
147
|
+
- Prevent exceeding daily/monthly budgets
|
|
148
|
+
|
|
149
|
+
To adjust limits, add to `.env`:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
VISUAL_DAILY_BUDGET=10.00
|
|
153
|
+
VISUAL_MONTHLY_BUDGET=100.00
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Error Handling
|
|
157
|
+
|
|
158
|
+
### No API Keys Configured
|
|
159
|
+
```
|
|
160
|
+
⚠️ Visual content generation not configured
|
|
161
|
+
|
|
162
|
+
To enable image/video generation:
|
|
163
|
+
1. Run: /myai-configure visual
|
|
164
|
+
2. Or add to .env: GOOGLE_API_KEY=xxx or OPENAI_API_KEY=xxx
|
|
165
|
+
|
|
166
|
+
Get API keys:
|
|
167
|
+
• Google: https://ai.google.dev/
|
|
168
|
+
• OpenAI: https://platform.openai.com/api-keys
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Budget Exceeded
|
|
172
|
+
```
|
|
173
|
+
⚠️ Daily budget limit reached ($5.00)
|
|
174
|
+
|
|
175
|
+
Current usage: $5.02
|
|
176
|
+
Daily limit: $5.00
|
|
177
|
+
|
|
178
|
+
Options:
|
|
179
|
+
1. Increase limit in .env: VISUAL_DAILY_BUDGET=10.00
|
|
180
|
+
2. Wait until tomorrow (resets at midnight)
|
|
181
|
+
3. Continue anyway (requires confirmation)
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Rate Limited
|
|
185
|
+
```
|
|
186
|
+
⚠️ Rate limited by API
|
|
187
|
+
|
|
188
|
+
Options:
|
|
189
|
+
1. Wait 60 seconds and retry automatically
|
|
190
|
+
2. Switch to different service (DALL-E has separate limits)
|
|
191
|
+
3. Cancel operation
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Instructions for Agent
|
|
195
|
+
|
|
196
|
+
When this command is invoked, you should:
|
|
197
|
+
|
|
198
|
+
1. **Load Utilities**
|
|
199
|
+
```javascript
|
|
200
|
+
const { hasAnyAPIKeys, getConfigStatusMessage, validateVisualConfig } =
|
|
201
|
+
require('./src/lib/visual-config-utils.js');
|
|
202
|
+
const { generateImage } = require('./src/lib/visual-generation-utils.js');
|
|
203
|
+
const { saveImage, saveVideo, generateMarkdownReference } =
|
|
204
|
+
require('./src/lib/asset-management.js');
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
2. **Check Configuration**
|
|
208
|
+
```javascript
|
|
209
|
+
if (!hasAnyAPIKeys()) {
|
|
210
|
+
console.log(getConfigStatusMessage());
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
3. **Parse Arguments**
|
|
216
|
+
- Extract prompt from command
|
|
217
|
+
- Parse --type, --service, --size, --quality, --description options
|
|
218
|
+
- Set defaults if not provided
|
|
219
|
+
|
|
220
|
+
4. **Estimate Cost and Check Budget**
|
|
221
|
+
```javascript
|
|
222
|
+
const { estimateCost } = require('./src/lib/visual-generation-utils.js');
|
|
223
|
+
const { checkBudgetLimit } = require('./src/lib/asset-management.js');
|
|
224
|
+
|
|
225
|
+
const cost = estimateCost(service, { quality, size });
|
|
226
|
+
const budget = await checkBudgetLimit(cost);
|
|
227
|
+
|
|
228
|
+
if (!budget.canProceed) {
|
|
229
|
+
// Show budget error and options
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
5. **Generate Visual Content**
|
|
234
|
+
```javascript
|
|
235
|
+
const result = await generateImage(prompt, {
|
|
236
|
+
preferredService: service,
|
|
237
|
+
type: type,
|
|
238
|
+
quality: quality,
|
|
239
|
+
size: size
|
|
240
|
+
});
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
6. **Save to Assets**
|
|
244
|
+
```javascript
|
|
245
|
+
const saved = await saveImage(result.buffer, {
|
|
246
|
+
type: type,
|
|
247
|
+
description: description || 'generated-image',
|
|
248
|
+
service: result.service,
|
|
249
|
+
cost: result.cost,
|
|
250
|
+
prompt: result.prompt
|
|
251
|
+
});
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
7. **Display Results**
|
|
255
|
+
- Show success message
|
|
256
|
+
- Show file details (path, size, cost)
|
|
257
|
+
- Show budget status
|
|
258
|
+
- Display markdown reference for easy copying
|
|
259
|
+
|
|
260
|
+
## Integration with Content Creation
|
|
261
|
+
|
|
262
|
+
This command can be used standalone or integrated with `/myai-content-writer`:
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# Standalone: Generate images separately
|
|
266
|
+
/myai-generate-visual "Article hero image" --type hero
|
|
267
|
+
|
|
268
|
+
# Integrated: Generate article with images
|
|
269
|
+
/myai-content-writer "Article Title" --with-images
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Best Practices
|
|
273
|
+
|
|
274
|
+
### Prompt Quality
|
|
275
|
+
- **Be specific**: "Professional developer workspace with dual monitors, VS Code, and coffee" vs "workspace"
|
|
276
|
+
- **Include style**: "Modern tech aesthetic, clean, high quality"
|
|
277
|
+
- **Specify mood**: "Professional, innovative, welcoming"
|
|
278
|
+
|
|
279
|
+
### Service Selection
|
|
280
|
+
- **Gemini Flash**: Fast iterations, drafts, high volume
|
|
281
|
+
- **Imagen 3**: Final hero images, photorealistic content
|
|
282
|
+
- **DALL-E 3**: Creative illustrations, unique concepts
|
|
283
|
+
- **Veo 2**: Product demos, feature walkthroughs
|
|
284
|
+
|
|
285
|
+
### Cost Optimization
|
|
286
|
+
- Use Gemini Flash for drafts and iterations ($0.02)
|
|
287
|
+
- Use Imagen/DALL-E for final versions ($0.03-0.04)
|
|
288
|
+
- Generate multiple variations with cheap service first
|
|
289
|
+
- Upgrade to premium service for selected images
|
|
290
|
+
|
|
291
|
+
## Related Commands
|
|
292
|
+
|
|
293
|
+
- `/myai-content-writer --with-images` - Generate article with images
|
|
294
|
+
- `/myai-configure visual` - Configure API keys and preferences
|
|
295
|
+
- `/myai-configure` - General configuration wizard
|
|
296
|
+
|
|
297
|
+
## Troubleshooting
|
|
298
|
+
|
|
299
|
+
### Images not generating?
|
|
300
|
+
1. Check API keys: `cat .env | grep API_KEY`
|
|
301
|
+
2. Verify configuration: `/myai-configure visual`
|
|
302
|
+
3. Check budget limits: Look for budget warnings in output
|
|
303
|
+
|
|
304
|
+
### Poor image quality?
|
|
305
|
+
1. Try different service: `--service imagen` or `--service dalle`
|
|
306
|
+
2. Use HD quality: `--quality hd` (DALL-E only)
|
|
307
|
+
3. Improve prompt: Add more specific details and style guidance
|
|
308
|
+
|
|
309
|
+
### Wrong image content?
|
|
310
|
+
1. Refine prompt: Be more specific about desired content
|
|
311
|
+
2. Try different service: Each AI has different strengths
|
|
312
|
+
3. Enhance prompt: Add style, mood, technical requirements
|
|
313
|
+
|
|
314
|
+
## See Also
|
|
315
|
+
|
|
316
|
+
- [VISUAL_CONTENT_GENERATION_GUIDE.md](../../../VISUAL_CONTENT_GENERATION_GUIDE.md) - Complete visual generation guide
|
|
317
|
+
- [CONTENT_CREATION_GUIDE.md](../../../CONTENT_CREATION_GUIDE.md) - Content marketing workflow
|
|
318
|
+
- [USER_GUIDE.md](../../../USER_GUIDE.md) - General usage guide
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: myai-generate-visual
|
|
3
|
+
description: Generate images or videos for content using AI
|
|
4
|
+
platforms: codex-cli
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Generate Visual Content (Codex CLI)
|
|
8
|
+
|
|
9
|
+
Generate images or videos using AI generation APIs via Node.js script execution.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
myai-generate-visual "prompt" [--type=TYPE] [--service=SERVICE] [--size=SIZE] [--quality=QUALITY]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Execute via Node.js
|
|
18
|
+
|
|
19
|
+
For Codex CLI (Cursor), execute the generation script directly:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
node node_modules/myaidev-method/src/scripts/generate-visual-cli.js "Modern developer workspace" --type=hero --service=gemini
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or add to your `package.json` scripts:
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"scripts": {
|
|
30
|
+
"generate-visual": "node node_modules/myaidev-method/src/scripts/generate-visual-cli.js"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Then use:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm run generate-visual "Your prompt here" -- --type=hero --service=gemini
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Options
|
|
42
|
+
|
|
43
|
+
- `--type=<type>` - Content type: hero, illustration, diagram, screenshot, video (default: hero)
|
|
44
|
+
- `--service=<service>` - Service: gemini, imagen, dalle, veo (default: auto-select)
|
|
45
|
+
- `--size=<size>` - Image size: 1024x1024, 1792x1024, 1024x1792 (default: 1024x1024)
|
|
46
|
+
- `--quality=<quality>` - Quality: standard, hd (default: standard)
|
|
47
|
+
- `--description=<desc>` - Filename description (default: derived from prompt)
|
|
48
|
+
|
|
49
|
+
## Prerequisites
|
|
50
|
+
|
|
51
|
+
1. **Install MyAIDev Method**:
|
|
52
|
+
```bash
|
|
53
|
+
npm install myaidev-method
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
2. **Configure API Keys**:
|
|
57
|
+
|
|
58
|
+
Option A: Use configuration script
|
|
59
|
+
```bash
|
|
60
|
+
node node_modules/myaidev-method/src/scripts/configure-visual-apis.js
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Option B: Manual `.env` setup
|
|
64
|
+
```bash
|
|
65
|
+
# Create/edit .env file
|
|
66
|
+
GOOGLE_API_KEY=your_google_api_key_here
|
|
67
|
+
OPENAI_API_KEY=your_openai_api_key_here
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
3. **Get API Keys**:
|
|
71
|
+
- **Google AI**: https://ai.google.dev/
|
|
72
|
+
- **OpenAI**: https://platform.openai.com/api-keys
|
|
73
|
+
|
|
74
|
+
## Examples
|
|
75
|
+
|
|
76
|
+
### Generate Hero Image
|
|
77
|
+
```bash
|
|
78
|
+
npm run generate-visual "Modern AI development workspace" -- --type=hero
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Generate Diagram
|
|
82
|
+
```bash
|
|
83
|
+
npm run generate-visual "System architecture diagram showing microservices" -- --type=diagram --service=gemini
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Generate Creative Illustration with DALL-E
|
|
87
|
+
```bash
|
|
88
|
+
npm run generate-visual "Futuristic AI assistant helping developer code" -- --type=illustration --service=dalle --quality=hd
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Generate Product Demo Video
|
|
92
|
+
```bash
|
|
93
|
+
npm run generate-visual "User authentication flow demonstration" -- --type=video --service=veo
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Available Services
|
|
97
|
+
|
|
98
|
+
| Service | Speed | Cost | Quality | Best For |
|
|
99
|
+
|---------|-------|------|---------|----------|
|
|
100
|
+
| Gemini Flash | ⚡⚡⚡ | $0.02 | Good | Fast iterations, diagrams |
|
|
101
|
+
| Imagen 3 | ⚡⚡ | $0.03 | Excellent | Hero images, photorealistic |
|
|
102
|
+
| DALL-E 3 | ⚡⚡ | $0.04-0.12 | Excellent | Creative concepts, illustrations |
|
|
103
|
+
| Veo 2 | ⚡ | $0.10 (est.) | Good | Product demos, animations |
|
|
104
|
+
|
|
105
|
+
## Output
|
|
106
|
+
|
|
107
|
+
Generated files are saved to:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
content-assets/
|
|
111
|
+
├── images/
|
|
112
|
+
│ └── 2025-11-19/
|
|
113
|
+
│ ├── hero-developer-workspace-123456.png
|
|
114
|
+
│ ├── illustration-ai-assistant-234567.png
|
|
115
|
+
│ └── diagram-architecture-345678.png
|
|
116
|
+
└── videos/
|
|
117
|
+
└── 2025-11-19/
|
|
118
|
+
└── video-auth-demo-456789.mp4
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The script provides markdown reference for embedding:
|
|
122
|
+
|
|
123
|
+
```markdown
|
|
124
|
+

|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Budget Management
|
|
128
|
+
|
|
129
|
+
Set budget limits in `.env`:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
VISUAL_DAILY_BUDGET=5.00 # Max $5 per day
|
|
133
|
+
VISUAL_MONTHLY_BUDGET=50.00 # Max $50 per month
|
|
134
|
+
VISUAL_WARN_THRESHOLD=0.80 # Warn at 80%
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
The script automatically:
|
|
138
|
+
- Estimates costs before generation
|
|
139
|
+
- Tracks daily and monthly spending
|
|
140
|
+
- Warns when approaching limits
|
|
141
|
+
- Prevents budget overruns
|
|
142
|
+
|
|
143
|
+
## Error Handling
|
|
144
|
+
|
|
145
|
+
### Missing Configuration
|
|
146
|
+
```
|
|
147
|
+
⚠️ No API keys configured
|
|
148
|
+
|
|
149
|
+
To enable visual generation:
|
|
150
|
+
1. Add to .env:
|
|
151
|
+
GOOGLE_API_KEY=your_key_here
|
|
152
|
+
OPENAI_API_KEY=your_key_here
|
|
153
|
+
|
|
154
|
+
2. Or run configuration:
|
|
155
|
+
node node_modules/myaidev-method/src/scripts/configure-visual-apis.js
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Budget Exceeded
|
|
159
|
+
```
|
|
160
|
+
⚠️ Daily budget exceeded
|
|
161
|
+
|
|
162
|
+
Current: $5.12
|
|
163
|
+
Limit: $5.00
|
|
164
|
+
|
|
165
|
+
Options:
|
|
166
|
+
1. Increase VISUAL_DAILY_BUDGET in .env
|
|
167
|
+
2. Wait until tomorrow (resets at midnight UTC)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### API Rate Limits
|
|
171
|
+
```
|
|
172
|
+
⚠️ Rate limited by API
|
|
173
|
+
|
|
174
|
+
Retrying in 60 seconds...
|
|
175
|
+
Or switch to different service: --service=dalle
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Integration with Cursor/Codex
|
|
179
|
+
|
|
180
|
+
The visual generation integrates with Cursor by:
|
|
181
|
+
|
|
182
|
+
1. **CLI-Friendly**: Execute via standard npm scripts
|
|
183
|
+
2. **File Organization**: Outputs to standard `content-assets/` directory
|
|
184
|
+
3. **Markdown Output**: Ready-to-paste markdown references
|
|
185
|
+
4. **Budget Control**: Automatic cost tracking and limits
|
|
186
|
+
|
|
187
|
+
## Cursor Rules Integration
|
|
188
|
+
|
|
189
|
+
Add to your `.cursorrules` file:
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
# Visual Content Generation
|
|
193
|
+
|
|
194
|
+
When generating images or videos for documentation or content:
|
|
195
|
+
|
|
196
|
+
1. Use the myaidev-method visual generation:
|
|
197
|
+
npm run generate-visual "description" -- --type=hero --service=gemini
|
|
198
|
+
|
|
199
|
+
2. Available types: hero, illustration, diagram, screenshot, video
|
|
200
|
+
|
|
201
|
+
3. Available services:
|
|
202
|
+
- gemini (fast, $0.02)
|
|
203
|
+
- imagen (quality, $0.03)
|
|
204
|
+
- dalle (creative, $0.04-0.12)
|
|
205
|
+
- veo (video, $0.10)
|
|
206
|
+
|
|
207
|
+
4. Always check budget limits before bulk generation
|
|
208
|
+
|
|
209
|
+
5. Use markdown output in documentation:
|
|
210
|
+

|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Programmatic Usage
|
|
214
|
+
|
|
215
|
+
Use directly in your Node.js scripts:
|
|
216
|
+
|
|
217
|
+
```javascript
|
|
218
|
+
import { generateImage } from 'myaidev-method/src/lib/visual-generation-utils.js';
|
|
219
|
+
import { saveImage } from 'myaidev-method/src/lib/asset-management.js';
|
|
220
|
+
|
|
221
|
+
// Generate and save
|
|
222
|
+
const result = await generateImage("Modern workspace", {
|
|
223
|
+
preferredService: 'gemini',
|
|
224
|
+
type: 'hero'
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
const saved = await saveImage(result.buffer, {
|
|
228
|
+
type: 'hero',
|
|
229
|
+
description: 'workspace',
|
|
230
|
+
service: result.service,
|
|
231
|
+
cost: result.cost,
|
|
232
|
+
prompt: result.prompt
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
console.log(`Saved to: ${saved.relativePath}`);
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Best Practices for Cursor
|
|
239
|
+
|
|
240
|
+
### 1. Add to package.json
|
|
241
|
+
```json
|
|
242
|
+
{
|
|
243
|
+
"scripts": {
|
|
244
|
+
"visual": "node node_modules/myaidev-method/src/scripts/generate-visual-cli.js",
|
|
245
|
+
"visual:hero": "npm run visual -- --type=hero",
|
|
246
|
+
"visual:diagram": "npm run visual -- --type=diagram --service=gemini"
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### 2. Quick Generation
|
|
252
|
+
```bash
|
|
253
|
+
# Hero images (use Imagen for quality)
|
|
254
|
+
npm run visual:hero "Article about AI" -- --service=imagen
|
|
255
|
+
|
|
256
|
+
# Diagrams (use Gemini for speed)
|
|
257
|
+
npm run visual:diagram "System architecture"
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### 3. Batch Generation
|
|
261
|
+
Create a script for multiple images:
|
|
262
|
+
|
|
263
|
+
```javascript
|
|
264
|
+
// scripts/generate-images.js
|
|
265
|
+
const images = [
|
|
266
|
+
{ prompt: "Hero: AI Development", type: "hero" },
|
|
267
|
+
{ prompt: "Diagram: Architecture", type: "diagram" },
|
|
268
|
+
{ prompt: "Illustration: Workflow", type: "illustration" }
|
|
269
|
+
];
|
|
270
|
+
|
|
271
|
+
for (const img of images) {
|
|
272
|
+
await generateAndSave(img.prompt, img.type);
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Troubleshooting
|
|
277
|
+
|
|
278
|
+
### Script not found?
|
|
279
|
+
```bash
|
|
280
|
+
# Verify installation
|
|
281
|
+
npm list myaidev-method
|
|
282
|
+
|
|
283
|
+
# Reinstall if needed
|
|
284
|
+
npm install myaidev-method
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Images not generating?
|
|
288
|
+
```bash
|
|
289
|
+
# Check API keys
|
|
290
|
+
cat .env | grep API_KEY
|
|
291
|
+
|
|
292
|
+
# Verify configuration
|
|
293
|
+
node node_modules/myaidev-method/src/scripts/configure-visual-apis.js
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Wrong file paths?
|
|
297
|
+
Ensure you're using relative paths from project root:
|
|
298
|
+
```markdown
|
|
299
|
+
✅ 
|
|
300
|
+
❌ 
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## See Also
|
|
304
|
+
|
|
305
|
+
- [VISUAL_CONTENT_GENERATION_GUIDE.md](../../../VISUAL_CONTENT_GENERATION_GUIDE.md) - Complete guide
|
|
306
|
+
- [CONTENT_CREATION_GUIDE.md](../../../CONTENT_CREATION_GUIDE.md) - Content workflow
|
|
307
|
+
- [Cursor Documentation](https://cursor.sh/docs) - Cursor-specific features
|