# Development Tools

> Utility scripts in the theme tools/ directory for builds, pattern audits, migrations, and WPAudit tests. See also tools/README.md in the repository.

## Repository policy

| Location | In the source repository | In theme zip |
| --- | --- | --- |
| `tools/` maintained scripts | Yes | No |
| `tools/wpaudit/` source (`src/`, `tests/`, `composer.json`/`lock`, configs) | Yes | No |
| `tools/scratch/` | No (gitignored) | No |
| `tools/wpaudit/vendor/`, `.phpunit.cache/`, `coverage/` | No (gitignored) | No |

## Build and translate

```
npm run build       # webpack + generate-blocks-manifest.phpnpm run clean       # clean-build.jsnpm run translate   # prepare-translate.js + wp i18n make-pot + finish-translate.js
```

On WordPress Studio sites, use `npm run translate:studio` instead of `npm run translate`. The prepare step copies Icon library PHP/JS, Marquee editor JS, Newsletter PHP/JS, Accordion PHP, SVG editor JS/PHP, Visibility editor JS, and Query Loop PHP/JS into `build/` so those vendor strings are included even though `vendor/` is excluded from the scan. Bundled `editor.js` is not copied; SVG inspector strings come from `svg-editor.js`. Run `npm run build` first if you changed theme block TypeScript (`*.tsx` / `*.ts`); WP-CLI scans the compiled JavaScript.

Aegis Dash strings are **not** in this catalog. Generate `wp-content/plugins/aegis-dash/languages/aegis.pot` from the plugin (`npm run translate` or `npm run translate:studio` in `wp-content/plugins/aegis-dash`). Pro uses `wp-content/plugins/aegis-pro/languages/aegis-pro.pot`.

## audit-patterns.php

Validates pattern slugs, block references, and template cross-links across the theme, Aegis Dash, and Pro pattern trees.

```
npm run audit-patterns# WordPress Studio:npm run audit-patterns:studio
```

**Scanned directories:**

- `wp-content/themes/aegis/patterns/`
- `wp-content/plugins/aegis-dash/patterns/`
- `wp-content/plugins/aegis-pro/patterns/`

**Checks:** duplicate slugs, missing pattern references in templates, unregistered blocks, `theme.json` custom template file existence.

**Expected baseline (without WooCommerce active):** WooCommerce block warnings marked optional; Pro blocks error when Pro is inactive. Re-run after doc or pattern changes.

## migrate-icons (WP-CLI)

Converts leftover **Image Icon** blocks (`core/image` + `is-style-icon`) and legacy `aegis/{set}/{name}` Icon IDs to the WordPress **Icon** block (`core/icon`).

```
wp aegis migrate-icons# WordPress Studio:studio wp aegis migrate-iconsstudio wp aegis migrate-icons --dry-run
```

See [Updating](https://www.atmostfear-entertainment.com/docs/aegis/themes/theme/updating/#image-icon--coreicon) and [SVG Icons](https://www.atmostfear-entertainment.com/docs/aegis/themes/theme/svg-icons/).

## WPAudit (`tools/wpaudit/`)

PHPUnit suite for theme quality checks. CI runs `composer test:wpaudit` after `composer install` in `tools/wpaudit/`.

## Scratch scripts

One-off Site Editor probes and local diagnostics belong in `tools/scratch/` (gitignored). Do not document scratch scripts in this page unless they are promoted to the maintained list above.

## Next Steps

- [Testing](https://www.atmostfear-entertainment.com/docs/aegis/themes/theme/testing/) — PHPUnit, performance, accessibility
- [Building Assets](https://www.atmostfear-entertainment.com/docs/aegis/themes/theme/building-assets/) — Block build workflow
- [File Structure](https://www.atmostfear-entertainment.com/docs/aegis/themes/theme/file-structure/) — Repository layout

---

Source: https://www.atmostfear-entertainment.com/docs/aegis/themes/theme/tools/ · Updated 2026-11-24
