@michelabboud/visual-forge-mcp 0.6.1 โ 0.9.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/CHANGELOG.md +490 -0
- package/README.md +201 -4
- package/config/pricing.json +32 -4
- package/dist/providers/base-provider.d.ts +16 -4
- package/dist/providers/base-provider.d.ts.map +1 -1
- package/dist/providers/base-provider.js +302 -24
- package/dist/providers/base-provider.js.map +1 -1
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +40 -2
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/zai/zai-provider.d.ts +22 -0
- package/dist/providers/zai/zai-provider.d.ts.map +1 -0
- package/dist/providers/zai/zai-provider.js +154 -0
- package/dist/providers/zai/zai-provider.js.map +1 -0
- package/dist/quality/index.d.ts +1 -0
- package/dist/quality/index.d.ts.map +1 -1
- package/dist/quality/index.js +1 -0
- package/dist/quality/index.js.map +1 -1
- package/dist/quality/model-tester.d.ts +87 -0
- package/dist/quality/model-tester.d.ts.map +1 -0
- package/dist/quality/model-tester.js +357 -0
- package/dist/quality/model-tester.js.map +1 -0
- package/dist/server/mcp-server.d.ts +5 -0
- package/dist/server/mcp-server.d.ts.map +1 -1
- package/dist/server/mcp-server.js +374 -5
- package/dist/server/mcp-server.js.map +1 -1
- package/dist/types/generation.d.ts +1 -1
- package/dist/types/generation.d.ts.map +1 -1
- package/dist/types/provider.d.ts +28 -1
- package/dist/types/provider.d.ts.map +1 -1
- package/dist/utils/filename-sanitizer.d.ts +51 -8
- package/dist/utils/filename-sanitizer.d.ts.map +1 -1
- package/dist/utils/filename-sanitizer.js +97 -14
- package/dist/utils/filename-sanitizer.js.map +1 -1
- package/dist/utils/image-metadata-manager.d.ts +151 -0
- package/dist/utils/image-metadata-manager.d.ts.map +1 -0
- package/dist/utils/image-metadata-manager.js +172 -0
- package/dist/utils/image-metadata-manager.js.map +1 -0
- package/dist/utils/index-manager.d.ts +38 -0
- package/dist/utils/index-manager.d.ts.map +1 -0
- package/dist/utils/index-manager.js +110 -0
- package/dist/utils/index-manager.js.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +5 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/multi-format-optimizer.d.ts +96 -0
- package/dist/utils/multi-format-optimizer.d.ts.map +1 -0
- package/dist/utils/multi-format-optimizer.js +423 -0
- package/dist/utils/multi-format-optimizer.js.map +1 -0
- package/dist/utils/prompt-enhancer.d.ts +48 -0
- package/dist/utils/prompt-enhancer.d.ts.map +1 -0
- package/dist/utils/prompt-enhancer.js +169 -0
- package/dist/utils/prompt-enhancer.js.map +1 -0
- package/dist/utils/quality-validator.d.ts +61 -0
- package/dist/utils/quality-validator.d.ts.map +1 -0
- package/dist/utils/quality-validator.js +386 -0
- package/dist/utils/quality-validator.js.map +1 -0
- package/dist/utils/source-metadata.d.ts +56 -0
- package/dist/utils/source-metadata.d.ts.map +1 -0
- package/dist/utils/source-metadata.js +122 -0
- package/dist/utils/source-metadata.js.map +1 -0
- package/dist/utils/user-config-manager.d.ts +68 -0
- package/dist/utils/user-config-manager.d.ts.map +1 -0
- package/dist/utils/user-config-manager.js +131 -0
- package/dist/utils/user-config-manager.js.map +1 -0
- package/dist/workflow/workflow-orchestrator.d.ts.map +1 -1
- package/dist/workflow/workflow-orchestrator.js +23 -0
- package/dist/workflow/workflow-orchestrator.js.map +1 -1
- package/dist/workflow/workflow-tools.d.ts.map +1 -1
- package/dist/workflow/workflow-tools.js +18 -0
- package/dist/workflow/workflow-tools.js.map +1 -1
- package/docs/guides/comprehensive-guide.md +1552 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,496 @@ All notable changes to Visual Forge MCP will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## [0.9.0] - 2026-01-16
|
|
13
|
+
|
|
14
|
+
### Added ๐งช **Model Testing & Comparison System**
|
|
15
|
+
|
|
16
|
+
#### Model Selection Workflow (Phase 1)
|
|
17
|
+
- **Enhanced Provider Configuration**: `configure_provider` now returns available models
|
|
18
|
+
- Shows list of all models offered by the provider
|
|
19
|
+
- Displays model details: name, cost, description, capabilities
|
|
20
|
+
- Indicates which model is currently set as default
|
|
21
|
+
- Guides user to use `set_default_model` for customization
|
|
22
|
+
- **New MCP Tool: `set_default_model`**
|
|
23
|
+
- Choose preferred model for a provider
|
|
24
|
+
- Validates model exists before saving
|
|
25
|
+
- Persists choice in `~/.visual-forge-mcp/user-config.json`
|
|
26
|
+
- Applies to all future generations unless overridden
|
|
27
|
+
- **New MCP Tool: `get_model_info`**
|
|
28
|
+
- Retrieve detailed information about a specific model
|
|
29
|
+
- Shows capabilities, pricing, and description
|
|
30
|
+
- Displays test results if model was previously tested
|
|
31
|
+
- Helps users make informed model selection decisions
|
|
32
|
+
- **User Configuration Manager**: `src/utils/user-config-manager.ts`
|
|
33
|
+
- Persistent storage for user preferences
|
|
34
|
+
- Default model per provider
|
|
35
|
+
- Model test results with quality scores
|
|
36
|
+
- Atomic file writes for crash safety
|
|
37
|
+
|
|
38
|
+
#### Model Testing (Phase 2)
|
|
39
|
+
- **ModelTester Utility**: `src/quality/model-tester.ts`
|
|
40
|
+
- Comprehensive testing framework for AI models
|
|
41
|
+
- Standard automated tests and custom prompt tests
|
|
42
|
+
- Multi-provider comparison with side-by-side results
|
|
43
|
+
- Quality scoring algorithm with weighted metrics
|
|
44
|
+
|
|
45
|
+
- **Quality Scoring Algorithm**:
|
|
46
|
+
- **Sharpness (30%)**: Laplacian variance analysis for edge detection
|
|
47
|
+
- **Brightness (20%)**: Average brightness in optimal range (30-240)
|
|
48
|
+
- **Text Rendering (40%)**: Estimated OCR accuracy and text clarity
|
|
49
|
+
- **Color Accuracy (10%)**: Heuristic-based color validation
|
|
50
|
+
- **Overall Score**: Weighted average, pass threshold 60/100
|
|
51
|
+
- **Auto-Recording**: Test results saved for future reference
|
|
52
|
+
|
|
53
|
+
- **Standard Test Prompt**:
|
|
54
|
+
- Professional quality validation image
|
|
55
|
+
- Multiple text elements (title, subtitle, detailed text)
|
|
56
|
+
- Geometric shapes (red circle, blue square, green triangle)
|
|
57
|
+
- Color gradient background (#1a365d to #0891b2)
|
|
58
|
+
- Technical diagram (simple flowchart)
|
|
59
|
+
- Designed to test sharpness, color accuracy, and text rendering
|
|
60
|
+
|
|
61
|
+
- **New MCP Tool: `test_model`**
|
|
62
|
+
- Two modes:
|
|
63
|
+
- **Standard Test**: Automated quality validation with predefined elements
|
|
64
|
+
- **Custom Prompt**: Test with user's actual use case
|
|
65
|
+
- Cost permission flow (requires confirmation for paid models)
|
|
66
|
+
- Automatic quality scoring and pass/fail determination
|
|
67
|
+
- Test images saved to `generated-images/tests/`
|
|
68
|
+
- Results include quality metrics, generation time, and cost
|
|
69
|
+
|
|
70
|
+
- **New MCP Tool: `compare_models`**
|
|
71
|
+
- Side-by-side comparison of multiple providers/models
|
|
72
|
+
- Same prompt tested across all selected models
|
|
73
|
+
- Automatic ranking by quality score
|
|
74
|
+
- Intelligent recommendation with reasoning
|
|
75
|
+
- Alternative suggestions for budget-conscious users
|
|
76
|
+
- Total cost and time tracking
|
|
77
|
+
- Detailed results per model with success/failure handling
|
|
78
|
+
|
|
79
|
+
- **Permission Flow**:
|
|
80
|
+
- First call shows cost estimate and requires confirmation
|
|
81
|
+
- User confirms by calling again with `skipPermission: true`
|
|
82
|
+
- Prevents accidental spending on paid models
|
|
83
|
+
- Free models (Gemini, HuggingFace) can skip permission
|
|
84
|
+
|
|
85
|
+
#### Files Added
|
|
86
|
+
- `src/quality/model-tester.ts` - Model testing and comparison utility
|
|
87
|
+
- `docs/design/model-selection-workflow.md` - Complete workflow specification
|
|
88
|
+
- `docs/design/IMPLEMENTATION_STATUS.md` - Implementation tracking
|
|
89
|
+
|
|
90
|
+
#### Files Modified
|
|
91
|
+
- `src/server/mcp-server.ts`:
|
|
92
|
+
- Added `userConfigManager` import
|
|
93
|
+
- Added `ModelTester` instance
|
|
94
|
+
- Updated `configure_provider` handler to return models
|
|
95
|
+
- Added `handleSetDefaultModel()` handler
|
|
96
|
+
- Added `handleGetModelInfo()` handler
|
|
97
|
+
- Added `handleTestModel()` handler
|
|
98
|
+
- Added `handleCompareModels()` handler
|
|
99
|
+
- Added routing for 5 new tools
|
|
100
|
+
- Added 'zai' to all provider enums
|
|
101
|
+
- `src/quality/index.ts` - Exported ModelTester
|
|
102
|
+
- `src/utils/index.ts` - Exported UserConfigManager (from 0.8.0)
|
|
103
|
+
|
|
104
|
+
### Benefits
|
|
105
|
+
|
|
106
|
+
#### For Users
|
|
107
|
+
- โ
**Informed Decisions**: Test before committing to a model
|
|
108
|
+
- โ
**Quality Assurance**: Validate model performance on your use case
|
|
109
|
+
- โ
**Cost Awareness**: See estimated costs before generation
|
|
110
|
+
- โ
**Traceability**: Historical test results for comparison
|
|
111
|
+
- โ
**Flexibility**: Different models for different use cases
|
|
112
|
+
- โ
**Side-by-Side Comparison**: Objective ranking with recommendations
|
|
113
|
+
|
|
114
|
+
#### For Workflows
|
|
115
|
+
- โ
**Standard Tests**: Quick automated validation of model quality
|
|
116
|
+
- โ
**Custom Tests**: Real-world testing with actual prompts
|
|
117
|
+
- โ
**Multi-Provider**: Compare 2-8 providers in single call
|
|
118
|
+
- โ
**Automatic Ranking**: Data-driven recommendations
|
|
119
|
+
- โ
**Error Handling**: Graceful failures don't block comparisons
|
|
120
|
+
|
|
121
|
+
### Example Usage
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
// 1. Configure provider and see models
|
|
125
|
+
configure_provider({ provider: "zai", apiKey: "zai-..." })
|
|
126
|
+
// Returns: List of available models with costs
|
|
127
|
+
|
|
128
|
+
// 2. Set preferred model
|
|
129
|
+
set_default_model({ provider: "zai", modelId: "glm-image" })
|
|
130
|
+
|
|
131
|
+
// 3. Test with standard prompt (automated)
|
|
132
|
+
test_model({
|
|
133
|
+
provider: "zai",
|
|
134
|
+
modelId: "glm-image",
|
|
135
|
+
useStandardTest: true
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
// 4. Test with custom prompt (real use case)
|
|
139
|
+
test_model({
|
|
140
|
+
provider: "gemini",
|
|
141
|
+
modelId: "gemini-2.5-flash-image",
|
|
142
|
+
prompt: "AWS VPC architecture diagram with public/private subnets"
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
// 5. Compare multiple models
|
|
146
|
+
compare_models({
|
|
147
|
+
prompt: "Technical diagram showing microservices architecture",
|
|
148
|
+
providers: [
|
|
149
|
+
{ provider: "gemini", model: "gemini-2.5-flash-image" },
|
|
150
|
+
{ provider: "zai", model: "glm-image" },
|
|
151
|
+
{ provider: "huggingface", model: "black-forest-labs/FLUX.1-dev" }
|
|
152
|
+
]
|
|
153
|
+
})
|
|
154
|
+
// Returns: Ranked results with recommendation
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Technical Details
|
|
158
|
+
|
|
159
|
+
- **Test Image Storage**: `generated-images/tests/`
|
|
160
|
+
- **Config Storage**: `~/.visual-forge-mcp/user-config.json`
|
|
161
|
+
- **Quality Metrics**: Sharpness, brightness, text rendering, color accuracy
|
|
162
|
+
- **Pass Threshold**: 60/100 overall score
|
|
163
|
+
- **Concurrent Testing**: Up to 3 parallel model tests in comparison mode
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## [0.8.0] - 2026-01-16
|
|
168
|
+
|
|
169
|
+
### Added ๐ฏ **Multi-Model Architecture & Z.ai Provider**
|
|
170
|
+
|
|
171
|
+
#### Multi-Model Architecture
|
|
172
|
+
- **Provider-Model Separation**: Distinguish between providers (companies) and models (specific AI implementations)
|
|
173
|
+
- One provider can offer multiple models with different capabilities and pricing
|
|
174
|
+
- Example: OpenAI offers `gpt-image-1` (standard, $0.04) and `gpt-image-1-hd` (HD, $0.12)
|
|
175
|
+
- Example: Gemini offers `gemini-2.5-flash-image` (2K) and `gemini-2.5-flash-image-pro` (4K)
|
|
176
|
+
- Example: Replicate offers `flux-schnell` ($0.003), `flux-dev` ($0.025), `flux-pro` ($0.055)
|
|
177
|
+
- **New Type System**:
|
|
178
|
+
- `ProviderModel` interface: Represents individual models with id, name, cost, capabilities
|
|
179
|
+
- `IImageProvider.getModels()`: Returns array of available models
|
|
180
|
+
- `IImageProvider.getDefaultModel()`: Returns provider's default model
|
|
181
|
+
- `IImageProvider.estimateCost(spec, modelId?)`: Model-aware cost estimation
|
|
182
|
+
- **Backward Compatibility**:
|
|
183
|
+
- Optional `models` and `defaultModel` fields in `ProviderConfig`
|
|
184
|
+
- Legacy `model` field still supported for single-model providers
|
|
185
|
+
- Automatic fallback to legacy config if models array not provided
|
|
186
|
+
- **Files Modified**:
|
|
187
|
+
- `src/types/provider.ts` - Added ProviderModel interface, updated IImageProvider
|
|
188
|
+
- `src/providers/base-provider.ts` - Implemented getModels(), getDefaultModel(), updated estimateCost()
|
|
189
|
+
- `src/providers/index.ts` - Updated all provider initializations
|
|
190
|
+
- `config/pricing.json` - Restructured to support models array per provider (v2.1.0)
|
|
191
|
+
- **Benefits**:
|
|
192
|
+
- โ
Future-proof architecture for providers with multiple model offerings
|
|
193
|
+
- โ
Granular cost control per model
|
|
194
|
+
- โ
Better model selection and capabilities reporting
|
|
195
|
+
- โ
Full backward compatibility with existing code
|
|
196
|
+
|
|
197
|
+
#### Z.ai GLM-Image Provider (8th Provider)
|
|
198
|
+
- **New Provider**: Z.ai (Zhipu AI) with GLM-Image model
|
|
199
|
+
- **Model**: GLM-Image - 16B parameter hybrid autoregressive + diffusion model
|
|
200
|
+
- **Specialty**: Excellent for text-heavy diagrams, posters, and knowledge-dense images
|
|
201
|
+
- **Performance**: Beats Google Gemini on CVTG-2k text rendering benchmark (0.9116 vs 0.7788)
|
|
202
|
+
- **Pricing**: $0.015 per image (2nd cheapest paid option after Replicate $0.003)
|
|
203
|
+
- **Rate Limit**: 15 images/minute
|
|
204
|
+
- **Resolution**: Up to 2048x2048
|
|
205
|
+
- **Supported Formats**: PNG
|
|
206
|
+
- **Files Added**:
|
|
207
|
+
- `src/providers/zai/zai-provider.ts` - Complete Z.ai provider implementation
|
|
208
|
+
- `src/types/generation.ts` - Added 'zai' to ProviderType
|
|
209
|
+
- **Configuration**:
|
|
210
|
+
- Environment variable: `ZAI_API_KEY=zai-...`
|
|
211
|
+
- Runtime configuration via `configure_provider` MCP tool
|
|
212
|
+
- **Features**:
|
|
213
|
+
- Custom prompt adaptation for text-heavy content
|
|
214
|
+
- Emphasizes accurate text rendering and clear labels
|
|
215
|
+
- Professional diagram focus
|
|
216
|
+
- Multilingual support
|
|
217
|
+
- **Benefits**:
|
|
218
|
+
- โ
Best-in-class text rendering for technical diagrams
|
|
219
|
+
- โ
Cost-effective at $0.015/image
|
|
220
|
+
- โ
Perfect for documentation with text-heavy visualizations
|
|
221
|
+
|
|
222
|
+
#### Comprehensive Documentation
|
|
223
|
+
- **New Guide**: `docs/guides/comprehensive-guide.md` - Complete user and developer reference
|
|
224
|
+
- **Description**: Overview of Visual Forge MCP features and use cases
|
|
225
|
+
- **Installation**: Step-by-step setup from prerequisites to MCP client configuration
|
|
226
|
+
- **Architecture**: Detailed system components and data flow diagrams
|
|
227
|
+
- **Environment Variables**: Complete reference for all configuration options
|
|
228
|
+
- **Provider & Model System**: Guide to 8 providers, model selection, capabilities
|
|
229
|
+
- **Usage Workflows**: Basic to advanced workflows with code examples
|
|
230
|
+
- **MCP Tools Reference**: All 13+ MCP tools with parameters and response examples
|
|
231
|
+
- **Testing**: Test infrastructure, running tests, writing tests, manual testing
|
|
232
|
+
- **Troubleshooting**: Common issues and debug strategies
|
|
233
|
+
- **Advanced Topics**: Custom providers, pricing config, backups, optimization
|
|
234
|
+
- **Updated**:
|
|
235
|
+
- `README.md` - Added Z.ai provider, multi-model architecture feature, comprehensive guide link
|
|
236
|
+
- Version badge updated to 0.8.0
|
|
237
|
+
- Provider count updated to 8
|
|
238
|
+
- Added `ZAI_API_KEY` to environment variable examples
|
|
239
|
+
|
|
240
|
+
### Changed
|
|
241
|
+
|
|
242
|
+
#### Provider Priority Order
|
|
243
|
+
- **New Default Priority**: Updated to prioritize cost-effectiveness
|
|
244
|
+
1. `replicate` - Cheapest ($0.003)
|
|
245
|
+
2. `zai` - 2nd cheapest ($0.015) โจ NEW
|
|
246
|
+
3. `gemini` - Free tier
|
|
247
|
+
4. `huggingface` - Free tier
|
|
248
|
+
5. Others by cost
|
|
249
|
+
|
|
250
|
+
#### Pricing Configuration
|
|
251
|
+
- **Updated**: `config/pricing.json` version 2.1.0
|
|
252
|
+
- Added Z.ai provider with GLM-Image model
|
|
253
|
+
- Updated cost comparison to highlight Z.ai as 2nd cheapest
|
|
254
|
+
- Added recommended provider section (Z.ai for technical documentation)
|
|
255
|
+
- Complete model specifications for all providers
|
|
256
|
+
|
|
257
|
+
### Fixed
|
|
258
|
+
|
|
259
|
+
#### TypeScript Type Safety
|
|
260
|
+
- **Fixed**: Handling of optional `models` field in ProviderConfig
|
|
261
|
+
- BaseProvider.init() now safely accesses models array
|
|
262
|
+
- BaseProvider.getDefaultModel() handles undefined models array
|
|
263
|
+
- BaseProvider.estimateCost() checks models existence before access
|
|
264
|
+
- ZaiProvider.generateImage() properly extracts prompt text
|
|
265
|
+
- **Fixed**: Removed unused imports (ProviderModel, fs, path, fileURLToPath from ProviderFactory)
|
|
266
|
+
- **Resolved**: All TypeScript compilation errors for multi-model architecture
|
|
267
|
+
|
|
268
|
+
#### Backward Compatibility
|
|
269
|
+
- **Ensured**: Legacy single-model providers continue to work
|
|
270
|
+
- `config.model` field still supported
|
|
271
|
+
- Automatic conversion to ProviderModel format
|
|
272
|
+
- Fallback to legacy cost if models array missing
|
|
273
|
+
|
|
274
|
+
### Testing
|
|
275
|
+
|
|
276
|
+
#### Test Results
|
|
277
|
+
- **All Tests Passed**: 77 tests across 4 test suites
|
|
278
|
+
- ProviderFactory: 21 tests (provider initialization, selection, fallback, priority)
|
|
279
|
+
- All existing tests remain green with multi-model changes
|
|
280
|
+
- Backward compatibility verified
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## [0.7.0] - 2026-01-16
|
|
285
|
+
|
|
286
|
+
### Added ๐จ **Professional Image Generation Pipeline**
|
|
287
|
+
|
|
288
|
+
#### Index-Based Directory Structure
|
|
289
|
+
- **Collision-Free Directories**: Sequential index-based naming prevents filename conflicts
|
|
290
|
+
- Format: `001-filename/`, `002-filename/`, `003-filename/`
|
|
291
|
+
- Automatic index assignment and tracking via `IndexManager`
|
|
292
|
+
- Human-readable directory names with sanitized filenames
|
|
293
|
+
- Guaranteed unique directories even with identical source filenames
|
|
294
|
+
- **Files Added**:
|
|
295
|
+
- `src/utils/index-manager.ts` - Sequential index management with persistence
|
|
296
|
+
- `src/utils/source-metadata.ts` - Per-directory metadata tracking
|
|
297
|
+
- **Benefits**:
|
|
298
|
+
- โ
No more directory collisions (e.g., `lessons/01-lesson.md` vs `docs/01-lesson.md`)
|
|
299
|
+
- โ
Easy navigation with sequential prefixes
|
|
300
|
+
- โ
Automatic cleanup of old indices on reset
|
|
301
|
+
|
|
302
|
+
#### Per-Image Metadata & Logging System
|
|
303
|
+
- **Comprehensive Metadata Tracking**: Each generated image gets complete metadata and logs
|
|
304
|
+
- `img-01.meta.json`: Prompts, generation data, quality scores, costs
|
|
305
|
+
- `img-01.log`: Timestamped generation log with all events
|
|
306
|
+
- Stored in `original/` subdirectory alongside pristine image
|
|
307
|
+
- **Metadata Includes**:
|
|
308
|
+
- Full prompt (original, global context, enhanced final)
|
|
309
|
+
- Generation parameters (provider, model, timing, cost)
|
|
310
|
+
- Quality metrics (sharpness, brightness, dimensions, file size)
|
|
311
|
+
- Optimization results (formats generated, size reductions)
|
|
312
|
+
- Regeneration history (if auto-regenerated)
|
|
313
|
+
- **Files Added**:
|
|
314
|
+
- `src/utils/image-metadata-manager.ts` - Metadata and log management
|
|
315
|
+
- **Benefits**:
|
|
316
|
+
- โ
Complete audit trail for every image
|
|
317
|
+
- โ
Debug generation issues with full context
|
|
318
|
+
- โ
Track costs and quality over time
|
|
319
|
+
- โ
Reproduce exact generation conditions
|
|
320
|
+
|
|
321
|
+
#### Multi-Format Image Optimization with Watermarking
|
|
322
|
+
- **Automatic Format Generation**: Create multiple optimized formats from single source
|
|
323
|
+
- **WebP**: 94% size reduction, modern web use (default for markdown)
|
|
324
|
+
- **JPEG**: 85% size reduction, PDF export compatibility
|
|
325
|
+
- **PNG**: 70% size reduction with lossy palette mode (optional)
|
|
326
|
+
- **Original**: Pristine backup, NO watermark, always preserved
|
|
327
|
+
- **Professional Watermarking**:
|
|
328
|
+
- SVG text overlay using Sharp composite
|
|
329
|
+
- Default: "Generated with Visual Forge MCP ยฉ" at bottom-right
|
|
330
|
+
- Customizable: text, position, opacity, font size, color, font family
|
|
331
|
+
- Applied to web formats only (WebP, JPEG, PNG), never to original
|
|
332
|
+
- **Directory Structure**:
|
|
333
|
+
```
|
|
334
|
+
{provider}/
|
|
335
|
+
โโโ original/
|
|
336
|
+
โ โโโ img-01.png (NO watermark, pristine)
|
|
337
|
+
โ โโโ img-01.meta.json
|
|
338
|
+
โ โโโ img-01.log
|
|
339
|
+
โโโ webp/
|
|
340
|
+
โ โโโ img-01.webp (watermarked, 94% smaller)
|
|
341
|
+
โโโ jpg/
|
|
342
|
+
โ โโโ img-01.jpg (watermarked, 85% smaller)
|
|
343
|
+
โโโ png/
|
|
344
|
+
โโโ img-01.png (watermarked, 70% smaller, optional)
|
|
345
|
+
```
|
|
346
|
+
- **Lossy PNG Optimization**:
|
|
347
|
+
- 8-bit color palette mode (256 colors)
|
|
348
|
+
- Floyd-Steinberg dithering for smooth gradients
|
|
349
|
+
- Near-perfect quality for technical diagrams/screenshots
|
|
350
|
+
- Configurable: quality, palette size, dithering amount
|
|
351
|
+
- **Files Added**:
|
|
352
|
+
- `src/utils/multi-format-optimizer.ts` - Format generation and watermarking
|
|
353
|
+
- **Configuration**:
|
|
354
|
+
```bash
|
|
355
|
+
VF_GENERATE_PNG=true # Enable PNG generation
|
|
356
|
+
VF_PNG_QUALITY=85 # Quality (1-100)
|
|
357
|
+
VF_PNG_PALETTE=true # Lossy mode
|
|
358
|
+
VF_PNG_COLORS=256 # Palette size
|
|
359
|
+
VF_PNG_DITHER=1.0 # Dithering (0-1)
|
|
360
|
+
```
|
|
361
|
+
- **Benefits**:
|
|
362
|
+
- โ
Optimized web delivery (WebP default)
|
|
363
|
+
- โ
PDF compatibility (JPEG)
|
|
364
|
+
- โ
Professional watermarking
|
|
365
|
+
- โ
Pristine originals preserved
|
|
366
|
+
- โ
Massive file size savings (70-94% reduction)
|
|
367
|
+
|
|
368
|
+
#### Quality Validation with OCR & Auto-Regeneration
|
|
369
|
+
- **OCR Text Detection**: Tesseract.js integration for text quality validation
|
|
370
|
+
- Detects gibberish and malformed text in generated images
|
|
371
|
+
- Analyzes OCR confidence scores
|
|
372
|
+
- Identifies common AI text rendering errors
|
|
373
|
+
- Configurable gibberish ratio threshold (default: 30%)
|
|
374
|
+
- **Image Quality Metrics**:
|
|
375
|
+
- **Sharpness**: Laplacian variance edge detection (min: 50)
|
|
376
|
+
- **Brightness**: Average pixel brightness (30-240 range)
|
|
377
|
+
- **Dimensions**: Width/height verification
|
|
378
|
+
- **File Size**: Valid image size check (>10KB, <10MB)
|
|
379
|
+
- **Overall Score**: 0-100 weighted quality score
|
|
380
|
+
- **Automatic Regeneration**:
|
|
381
|
+
- Retry loop with configurable attempts (default: 3)
|
|
382
|
+
- Triggers on quality validation failure
|
|
383
|
+
- Logs each attempt with quality scores
|
|
384
|
+
- Saves regeneration metadata for debugging
|
|
385
|
+
- Configurable via environment variables
|
|
386
|
+
- **Files Added**:
|
|
387
|
+
- `src/utils/quality-validator.ts` - OCR and quality analysis
|
|
388
|
+
- **Configuration**:
|
|
389
|
+
```bash
|
|
390
|
+
VF_AUTO_REGENERATE=true # Enable auto-retry
|
|
391
|
+
VF_MAX_RETRIES=3 # Max attempts
|
|
392
|
+
VF_QUALITY_VALIDATION=true # Enable quality checks
|
|
393
|
+
```
|
|
394
|
+
- **Benefits**:
|
|
395
|
+
- โ
Catches AI text rendering failures
|
|
396
|
+
- โ
Ensures high-quality outputs
|
|
397
|
+
- โ
Automatic retry without user intervention
|
|
398
|
+
- โ
Complete quality audit trail
|
|
399
|
+
|
|
400
|
+
#### Enhanced Prompt Engineering
|
|
401
|
+
- **Type-Specific Enhancement**: Automatic prompt optimization by image type
|
|
402
|
+
- Diagrams: "technical diagram, clean lines, no text or labels"
|
|
403
|
+
- Flowcharts: "professional flowchart, clear arrows, minimal text"
|
|
404
|
+
- Icons: "minimalist design, single object, flat style"
|
|
405
|
+
- Hero images: "high quality, professional, no text overlay"
|
|
406
|
+
- Screenshots: "clean interface, realistic UI, no watermarks"
|
|
407
|
+
- **Text Prevention Instructions**: Minimizes AI text rendering errors
|
|
408
|
+
- Adds explicit "no text", "no labels", "no watermarks" directives
|
|
409
|
+
- Prevents gibberish and malformed text in generated images
|
|
410
|
+
- Type-aware enhancement based on image purpose
|
|
411
|
+
- **Files Added**:
|
|
412
|
+
- `src/utils/prompt-enhancer.ts` - Type-specific prompt optimization
|
|
413
|
+
- **Integration**:
|
|
414
|
+
- Automatic enhancement in `BaseProvider.generate()`
|
|
415
|
+
- Applied before provider-specific adaptations
|
|
416
|
+
- Logged for debugging and reproducibility
|
|
417
|
+
- **Benefits**:
|
|
418
|
+
- โ
Better image quality with minimal text artifacts
|
|
419
|
+
- โ
Type-appropriate styling and composition
|
|
420
|
+
- โ
Reduced need for manual prompt tweaking
|
|
421
|
+
- โ
Consistent enhancement across all providers
|
|
422
|
+
|
|
423
|
+
### Changed
|
|
424
|
+
- **BaseProvider**: Integrated quality validation, auto-regeneration, and multi-format optimization
|
|
425
|
+
- Now orchestrates complete generation pipeline: enhance โ generate โ optimize โ validate โ retry
|
|
426
|
+
- Updated `generate()` method with retry loop
|
|
427
|
+
- Automatic format selection for markdown (WebP default)
|
|
428
|
+
- Comprehensive metadata and logging
|
|
429
|
+
- **Filename Sanitizer**: Made async to support index-based directories
|
|
430
|
+
- `createImagePath()` now returns `Promise<string>`
|
|
431
|
+
- `createImageDirectory()` creates indexed directories
|
|
432
|
+
- All dependent code updated for async paths
|
|
433
|
+
- **MCP Server**: Added `initializePathManager()` call on startup
|
|
434
|
+
- Initializes IndexManager for session persistence
|
|
435
|
+
- Ensures index tracking across server restarts
|
|
436
|
+
|
|
437
|
+
### Dependencies
|
|
438
|
+
- **Optional**: `tesseract.js` for OCR quality validation (install with `npm install tesseract.js`)
|
|
439
|
+
- Graceful degradation if not installed
|
|
440
|
+
- Quality validation continues without OCR
|
|
441
|
+
|
|
442
|
+
### Documentation
|
|
443
|
+
- Updated `src/utils/index.ts` to export all new utilities
|
|
444
|
+
- Comprehensive TSDoc comments in all new modules
|
|
445
|
+
- Environment variable documentation in code comments
|
|
446
|
+
|
|
447
|
+
### Technical Details
|
|
448
|
+
|
|
449
|
+
#### Files Created (5)
|
|
450
|
+
1. `src/utils/index-manager.ts` (188 lines)
|
|
451
|
+
2. `src/utils/source-metadata.ts` (215 lines)
|
|
452
|
+
3. `src/utils/image-metadata-manager.ts` (267 lines)
|
|
453
|
+
4. `src/utils/multi-format-optimizer.ts` (553 lines)
|
|
454
|
+
5. `src/utils/quality-validator.ts` (518 lines)
|
|
455
|
+
6. `src/utils/prompt-enhancer.ts` (176 lines)
|
|
456
|
+
|
|
457
|
+
#### Files Modified (4)
|
|
458
|
+
1. `src/utils/filename-sanitizer.ts` - Async path creation with indexing
|
|
459
|
+
2. `src/providers/base-provider.ts` - Integrated all new features
|
|
460
|
+
3. `src/server/mcp-server.ts` - Initialize IndexManager
|
|
461
|
+
4. `src/utils/index.ts` - Export new utilities
|
|
462
|
+
|
|
463
|
+
#### Test Coverage
|
|
464
|
+
- All 77 existing tests still passing
|
|
465
|
+
- Build successful with strict TypeScript checks
|
|
466
|
+
- No breaking changes to existing workflows
|
|
467
|
+
|
|
468
|
+
### Backward Compatibility
|
|
469
|
+
- โ
Fully backward compatible
|
|
470
|
+
- โ
All new features activated automatically
|
|
471
|
+
- โ
Graceful degradation (OCR optional)
|
|
472
|
+
- โ
Existing workflows unchanged
|
|
473
|
+
- โ
Environment variables optional (sensible defaults)
|
|
474
|
+
|
|
475
|
+
### User Impact โญ
|
|
476
|
+
**Before (v0.6.1)**
|
|
477
|
+
- โ Directory name collisions possible
|
|
478
|
+
- โ No metadata or logs for generated images
|
|
479
|
+
- โ Single PNG format only (large files)
|
|
480
|
+
- โ No watermarking
|
|
481
|
+
- โ No quality validation
|
|
482
|
+
- โ Manual regeneration required
|
|
483
|
+
- โ Basic prompts only
|
|
484
|
+
|
|
485
|
+
**After (v0.7.0)**
|
|
486
|
+
- โ
Collision-free indexed directories
|
|
487
|
+
- โ
Complete metadata and generation logs
|
|
488
|
+
- โ
Multi-format optimization (WebP, JPEG, PNG)
|
|
489
|
+
- โ
Professional watermarking
|
|
490
|
+
- โ
Automatic quality validation
|
|
491
|
+
- โ
Auto-regeneration on quality failure
|
|
492
|
+
- โ
Enhanced prompts with type-specific optimization
|
|
493
|
+
- โ
70-94% file size reduction
|
|
494
|
+
- โ
Pristine originals preserved
|
|
495
|
+
|
|
496
|
+
---
|
|
497
|
+
|
|
8
498
|
## [0.6.1] - 2026-01-15
|
|
9
499
|
|
|
10
500
|
### Fixed
|