Imported from shopwareLabs/shopware-catalog-generator (
src/cli/AGENTS.md). Install upstream withnpx skills add shopwareLabs/shopware-catalog-generator --skill cli. Copyright stays with the author.
CLI Reference
Internal documentation for AI agents working on the CLI module, and complete reference for all commands.
Module Overview
The CLI is a thin router in main.ts that parses args and delegates to focused modules:
blueprint.ts—blueprint create,blueprint hydrate,blueprint fix,blueprint inspiregenerate.ts—generate,processimage-fix.ts—image fixshared.ts—CLIError, validation helpers,executePostProcessors
Important: All application logic lives in src/services/, not in the CLI modules. CLI handlers are thin wrappers that call service functions and print their string[] output. This keeps the CLI and MCP tools in sync — both call the same service functions.
| Service File | CLI Module | What It Does |
|---|---|---|
src/services/blueprint-service.ts |
cli/blueprint.ts |
Blueprint create / hydrate / fix / inspire logic |
src/services/generate-service.ts |
cli/generate.ts |
Full generation pipeline + post-processors |
src/services/image-fix-service.ts |
cli/image-fix.ts |
Image regeneration (product/category/cms/theme) |
Separate CLI entry points (not routed through main.ts):
cache-cli.ts—cache:list,cache:clear,cache:trash,cache:restore,cache:empty-trashcleanup-cli.ts—cleanup,cleanup:media,cleanup:propsserver.ts— HTTP server mode
Command Reference
Generate
Full pipeline: create blueprint, hydrate with AI, upload to Shopware.
bun run generate --name=music --description="Musical instruments and accessories"
| Flag | Type | Default | Description |
|---|---|---|---|
--name |
string | (required) | SalesChannel name (becomes subdomain) |
--description |
string | "{name} webshop" |
Context for AI generation |
--products |
number | 90 |
Number of products to generate |
--only |
string | (all) | Post-processors to run (comma-separated) |
--dry-run |
flag | false |
Preview actions without making changes |
--no-template |
flag | false |
Skip checking for pre-generated templates |
Process
Run post-processors on an existing SalesChannel (already uploaded to Shopware).
bun run process --name=music --only=images,manufacturers,customers
| Flag | Type | Default | Description |
|---|---|---|---|
--name |
string | (required) | SalesChannel name |
--only |
string | (all) | Processors to run (comma-separated) |
--dry-run |
flag | false |
Preview actions without making changes |
Blueprint Create
Phase 1: Generate blueprint structure without AI calls (instant).
bun run blueprint create --name=music --description="Musical instruments and accessories"
| Flag | Type | Default | Description |
|---|---|---|---|
--name |
string | (required) | SalesChannel name |
--description |
string | "{name} webshop" |
Context for AI generation |
--products |
number | 90 |
Number of products to generate |
Output: generated/sales-channels/{name}/blueprint.json
Blueprint Hydrate
Phase 2: Fill blueprint with AI-generated content (names, descriptions, properties, images).
bun run blueprint hydrate --name=music
| Flag | Type | Default | Description |
|---|---|---|---|
--name |
string | (required) | SalesChannel name |
--only |
string | (full hydration) | Selective mode: categories, properties, or cms |
--rehydrate |
flag | false |
Force full re-hydration (overwrites existing, changes product names) |
Hydration Modes
| Mode | What It Does |
|---|---|
| (default, new blueprint) | Full hydration: categories, products, properties, images |
--only=categories |
Only update category names/descriptions, preserve product data |
--only=properties |
Only update product properties, preserve names (image-stable) |
--only=cms |
Only hydrate CMS blueprint text (cms-blueprint.json) |
--rehydrate |
Force full re-hydration even if hydrated blueprint exists |
If a hydrated blueprint already exists, --only or --rehydrate is required to prevent accidental name changes.
Output: generated/sales-channels/{name}/hydrated-blueprint.json
Blueprint Fix
Fix incomplete hydration by replacing placeholder names in a hydrated blueprint.
bun run blueprint fix --name=music
| Flag | Type | Default | Description |
|---|---|---|---|
--name |
string | (required) | SalesChannel name |
Blueprint Inspire
Crawl a real store URL to extract categories, example products, brand colors, and description.
Saves inspiration.json so blueprint hydrate can use it to orient AI generation.
bun run blueprint inspire --name=music --url=https://some-music-shop.com
| Flag | Type | Default | Description |
|---|---|---|---|
--name |
string | (required) | SalesChannel name |
--url |
string | (required) | URL of the real store to crawl |
Output: generated/sales-channels/{name}/inspiration.json
No AI calls are made. Uses cheerio (MIT) + sharp to parse static HTML and images:
- JSON-LD
BreadcrumbList→ category names; fallback:<nav>link text - JSON-LD
Product/ItemList→ example products (follows up to 2 category pages) - Brand images → dominant color extraction:
- SVG icons:
fill/strokeattributes parsed directly (e.g. IKEA blue + yellow) - Raster icons (apple-touch-icon, PNG favicons): pixel analysis via
sharp - Fallback:
theme-colormeta / CSS--primary-colorvars (near-white filtered out)
- SVG icons:
og:descriptionor JSON-LDOrganization.description→ brand description
Image Fix
Regenerate images for a specific product, category, or CMS page.
bun run image fix --name=music --target="Acoustic Guitar" --type=product
bun run image fix --name=music --type=theme --target=logo
bun run image fix --name=music --type=theme # regenerates all theme media
| Flag | Type | Default | Description |
|---|---|---|---|
--name |
string | (required) | SalesChannel name |
--target |
string | (required) | Product/category name or ID, CMS page name, or theme media key |
--type |
string | product |
Target type: product, category, cms, or theme |
--dry-run |
flag | false |
Preview without regenerating |
For --type=theme, --target is optional (defaults to "all"). Valid targets: logo, favicon, share, or all.
Cleanup
Remove generated data from Shopware. Local cache is preserved.
bun run cleanup -- --salesChannel="music"
bun run cleanup -- --salesChannel="music" --full --delete
| Flag | Type | Default | Description |
|---|---|---|---|
--salesChannel |
string | (required) | SalesChannel to clean up |
--delete |
flag | false |
Also delete the SalesChannel itself |
--props |
flag | false |
Also delete property groups |
--manufacturers |
flag | false |
Also delete manufacturers |
--processors |
string | (none) | Cleanup specific processor entities (comma-separated, or all) |
--full |
flag | false |
Full cleanup: all processor cleanups, then core cleanup |
--dry-run |
flag | false |
Preview what would be deleted |
Global Cleanup (no SalesChannel required)
bun run cleanup -- --unused-props # Delete property groups with no used options
bun run cleanup -- --unused-options # Delete individual unused property options
bun run cleanup -- --orphaned-media # Delete media not linked to any product
| Flag | Type | Description |
|---|---|---|
--unused-props |
flag | Delete property groups where no options are used by products |
--unused-options |
flag | Delete individual property options not used by any product |
--orphaned-media |
flag | Delete media where the linked product no longer exists |
Shortcut Scripts
bun run cleanup:media # Same as --orphaned-media
bun run cleanup:props # Same as --unused-props
Cache Management
Manage local cached files in generated/. Does not affect Shopware.
bun run cache:list # Show cached SalesChannels with stats
bun run cache:clear # Move all cached data to trash
bun run cache:clear -- music # Move specific SalesChannel to trash
bun run cache:trash # List trash contents
bun run cache:restore -- <item> # Restore specific item from trash
bun run cache:restore -- --all # Restore all items from trash
bun run cache:empty-trash # Permanently delete trash (irreversible)
| Command | Description |
|---|---|
cache:list |
List all cached SalesChannels with product/image counts |
cache:clear |
Move cache to .trash/ (recoverable) |
cache:clear -- <name> |
Move specific SalesChannel cache to trash |
cache:trash |
Show trash contents |
cache:restore -- <item> |
Restore a specific item from trash |
cache:restore -- --all |
Restore everything from trash |
cache:empty-trash |
Permanently delete all trash |
Server Mode
Run as an HTTP service with background processing.
bun run server
| Method | Endpoint | Description |
|---|---|---|
| POST | /generate |
Start background generation (returns process ID) |
| GET | /status/:id |
Poll process status, progress, and logs |
| GET | /health |
Health check and active process count |
Generate Request
Minimal request — name and description are derived from the inspiration URL:
curl -X POST http://localhost:3000/generate \
-H "Content-Type: application/json" \
-d '{
"envPath": "http://localhost:8000",
"shopwareUser": "admin",
"shopwarePassword": "shopware",
"inspirationUrl": "https://some-music-shop.com"
}'
Full request with explicit fields:
curl -X POST http://localhost:3000/generate \
-H "Content-Type: application/json" \
-d '{
"envPath": "http://localhost:8000",
"salesChannel": "music",
"description": "Musical instruments and accessories",
"shopwareUser": "admin",
"shopwarePassword": "shopware"
}'
| Field | Type | Default | Description |
|---|---|---|---|
envPath |
string | (required) | Shopware URL |
salesChannel |
string | derived from inspirationUrl hostname |
SalesChannel name; inferred from URL if omitted |
description |
string | brandDescription from crawl or webshop |
Context for AI generation; falls back to crawled brandDescription |
productCount |
number | 90 |
Number of products |
shopwareUser |
string | - | Shopware admin username |
shopwarePassword |
string | - | Shopware admin password |
skipProcessors |
boolean | false |
Skip post-processors after sync |
skipTemplate |
boolean | false |
Skip checking for pre-generated templates |
inspirationUrl |
string | (none) | Crawl this URL before blueprint creation; derives name + description if omitted |
Poll Status
curl http://localhost:3000/status/proc_xxx
# Returns: { "status": "running", "progress": {...}, "logs": [...] }
Adding a New CLI Command
- Implement the logic in
src/services/<category>-service.ts(returnsstring[]for output) - Create a thin CLI handler in
src/cli/<category>.tsthat calls the service and prints lines - Add routing in
main.tsswitch statement - Add to
showHelp()output - Add a thin MCP tool wrapper in
src/mcp/tools/<category>.tsthat calls the same service and joins lines - Add
package.jsonscript alias if appropriate - Update this reference and
src/mcp/AGENTS.md