AGENTS.md@packages/integration-wordpress · git:20261006.9ddd0d5 · 2026-10-06 · sha256 5c75f775ec4294fd

AGENTS.md@packages/integration-wordpress git:20261006.9ddd0d5A

Immutable. This exact content never changes and is served at /api/v1/blob/5c75f775ec4294fd.

# integration-wordpress

## Purpose

WordPress integration — REST API client for managing WordPress sites, generating structured data (schema.org), and syncing AEO optimization recommendations with WordPress content.

## Key Files

| File | Role |
|------|------|
| `src/wordpress-client.ts` | WordPress REST API client — site management, content sync, schema generation |
| `src/schema-templates.ts` | Schema.org JSON-LD templates for structured data generation |
| `src/types.ts` | Type definitions and `WordpressApiError` custom error class |
| `src/index.ts` | Re-exports public API |

## Patterns

- **REST API auth**: Uses WordPress application passwords or API keys stored in `~/.canonry/config.yaml`.
- **Schema generation**: `schema-templates.ts` owns LocalBusiness, Organization, FAQPage, Service, and WebPage JSON-LD. Pin complete independent template output in its tests; use the real profile deployment and persisted refetch to cover string/object/FAQ parsing.
- **Error handling**: Uses `WordpressApiError` for API-specific errors. Native tests capture one diagnostic from one request and preserve status/code/credential redaction.
- **Native coverage**: Assert complete page/SEO DTOs, exact audit arithmetic and thresholds, independent raw-content hashes, decoded hostile JSON-LD values, and every plugin identity across pagination.

## Common Mistakes

- **Storing WordPress credentials in the database** — credentials belong in `~/.canonry/config.yaml`.
- **Not handling WordPress API pagination** — large sites may require paginated requests.

## See Also

- `docs/wordpress-setup.md` — user-facing setup guide
- `packages/api-routes/src/wordpress.ts` — API routes that use this client