# WordPress Theme Submission Skill

This skill helps you submit WordPress themes to WordPress.org/themes/upload with automated validation reminders, repo synchronization, and form submission.

## Usage

Run from the root directory of the wpcom-themes repository:

```bash
/new-theme-submission [themeslug]
```

Example:
```bash
/new-theme-submission academica
```



## Prerequisites

Before submitting a theme, ensure:

1. **Theme Review**: Run `/theme-review [themeslug]` to validate the theme
2. **Plugin Validation**: Install the [Theme Check plugin](https://en-gb.wordpress.org/plugins/theme-check/) on your test site and run it
3. **WordPress.org Account**: Have access to the WordPress.org account credentials (available in Secret Store)

## What the Skill Does

1. **Validation Reminders**: Reminds you to complete theme validation steps
2. **Repo Sync**: Ensures your local copy of the themes repo is up to date with trunk
3. **ZIP Creation**: Creates a clean ZIP file, excluding unnecessary files (.git, node_modules, .env, etc.)
4. **File Size Check**: Validates the ZIP is under 10 MB (WordPress.org limit)
5. **Authentication**: Prompts for WordPress.org credentials — password is masked with `*` for security. The Secret Store link is shown at runtime so you can grab the password.
6. **Form Submission**: Uses Puppeteer's bundled Chromium (no separate browser needed) to load the form, then submits via HTTP POST
7. **Trac Ticket**: Displays the trac ticket URL for tracking the theme review

## Testing Without Real Credentials

Use test mode to simulate the full workflow without submitting to WordPress.org:

```bash
TEST_MODE=true /new-theme-submission [themeslug]
```

All steps run normally (reminders, git sync, ZIP creation) except authentication and form submission, which are mocked.

## Manual Submission

If the automated submission fails, you can manually submit at https://wordpress.org/themes/upload/ with:

1. Log in as "automattic"
2. Select the theme ZIP file from `/tmp/[themeslug].zip`
3. Check all three checkboxes:
   - "I have permission to upload this theme..."
   - "The theme complies with all Theme Guidelines"
   - "The theme, and all included assets, are licenced as GPL..."
4. Click "Upload"

## Troubleshooting

### "Theme directory not found"
- Ensure you're running the skill from the root of the wpcom-themes repository
- Verify the theme slug matches the directory name exactly

### "ZIP file too large"
- Remove unnecessary build artifacts or dependencies
- Check for large media files that shouldn't be included

### Credentials not found
- Set `WPORG_USERNAME` and `WPORG_PASSWORD` environment variables, or
- Provide the credentials when prompted (available in Secret Store)

### Browser automation fails
- Ensure Puppeteer dependencies are installed: `npm install`
- On first run, Puppeteer automatically downloads a bundled Chromium (~170MB) — no separate browser installation needed
- You can fall back to manual submission if automated submission fails
