# Image Generator Tool

Automated screenshot capture & WordPress theme gallery updater for PowerOfDark CMS themes.

```
[Target Themes] -> [Playwright Chromium] -> [Full-page PNGs] -> [WordPress REST API] -> [CMS Theme Gallery]
```

## Stack

- **Runtime**: Node.js >= 20.12.2 (ESM: `"type": "module"`)
- **Browser Automation**: Playwright 1.44.0 (Chromium)
- **CMS API**: `wpapi` 1.2.2 (WordPress REST API)
- **Config**: `dotenv` 16.3.1

## Project Layout

```
.
├── index.js                    # Pipeline orchestrator
├── controllers/
│   ├── image-crawler.js        # Playwright scraper & screenshot engine
│   └── update-wordpress.js     # WordPress media sync & block content builder
├── services/
│   └── wordpress.js            # WP REST API client wrapper & custom routes
├── screenshots/                # Generated local screenshots (<theme>/<theme>-<page>.png)
├── docs/                       # Technical documentation
├── Dockerfile                  # Container definition (Playwright runtime)
├── Readme.md                   # Human onboarding guide
├── AGENT.md                    # LLM operational guide
└── package.json                # Dependencies & scripts
```

## Quick Start

```bash
# 1. Environment config
cp .env.example .env

# 2. Install dependencies
npm install
npx playwright install chromium

# 3. Execute pipeline
npm start
```
