{"_id":"@act-spec/adapter-wordpress","name":"@act-spec/adapter-wordpress","dist-tags":{"rc":"0.2.0-rc.1","latest":"0.2.0-rc.1"},"versions":{"0.2.0-rc.1":{"name":"@act-spec/adapter-wordpress","version":"0.2.0-rc.1","description":"WordPress adapter for ACT (Agent Content Tree). Consumes the WordPress REST API (`wp/v2/{posts,pages,categories,tags,users,media}`) and emits ACT envelopes against the shared adapter framework. Maps posts to leaf nodes, categories and pages to branch node","license":"Apache-2.0","author":{"name":"Jeremy Forsythe","email":"jeremy@act-spec.org"},"homepage":"https://act-spec.org","bugs":{"url":"https://github.com/act-spec/act/issues"},"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/act-spec/act.git","directory":"packages/adapter-wordpress"},"dependencies":{"ajv":"^8.17.1","ajv-formats":"^3.0.1","@act-spec/adapter-framework":"0.2.0-rc.1","@act-spec/core":"0.2.0-rc.1","@act-spec/validator":"0.2.0-rc.1"},"devDependencies":{"@vitest/coverage-v8":"^2.1.9","tsx":"^4.19.2","typescript":"^5.6.3","vitest":"^2.1.4","@act-spec/_test-utils":"0.0.0"},"scripts":{"build":"tsc -p tsconfig.json","test":"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage","lint":"eslint src","typecheck":"tsc -p tsconfig.json --noEmit","conformance":"tsx conformance.ts"},"_id":"@act-spec/adapter-wordpress@0.2.0-rc.1","_integrity":"sha512-S2b+4xsvFaSqnEB/vp+89phOeqlIZk7vxd8KU3m3NX/rbHMnIz2bEk8VUGeJM+M2VNUAwWdxdMzg6QhBdJ+NuA==","_resolved":"/private/var/folders/yp/y7frhcvj70jgr6b8g633lghr0000gn/T/7f029e4d28e206a31d73ee248d6e7237/act-spec-adapter-wordpress-0.2.0-rc.1.tgz","_from":"file:act-spec-adapter-wordpress-0.2.0-rc.1.tgz","_nodeVersion":"22.19.0","_npmVersion":"11.6.0","dist":{"integrity":"sha512-S2b+4xsvFaSqnEB/vp+89phOeqlIZk7vxd8KU3m3NX/rbHMnIz2bEk8VUGeJM+M2VNUAwWdxdMzg6QhBdJ+NuA==","shasum":"a6e002d05273bdcabc30ad2461a24e23271d7882","tarball":"https://registry.npmjs.org/@act-spec/adapter-wordpress/-/adapter-wordpress-0.2.0-rc.1.tgz","fileCount":51,"unpackedSize":249578,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIF+bKFY5Sc/LJDlRCaUia0yQ159PK+i7VSKe9ksrrgcjAiBy1OTc5Qr35N7+NpjxAdi8pzRuEVjKhm7AtP/ZXibLOg=="}]},"_npmUser":{"name":"jdforsythe","email":"jdforsythe@gmail.com"},"directories":{},"maintainers":[{"name":"jdforsythe","email":"jdforsythe@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/adapter-wordpress_0.2.0-rc.1_1777915297031_0.0945480143196582"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-04T17:21:36.808Z","0.2.0-rc.1":"2026-05-04T17:21:37.176Z","modified":"2026-05-04T17:21:37.412Z"},"maintainers":[{"name":"jdforsythe","email":"jdforsythe@gmail.com"}],"description":"WordPress adapter for ACT (Agent Content Tree). Consumes the WordPress REST API (`wp/v2/{posts,pages,categories,tags,users,media}`) and emits ACT envelopes against the shared adapter framework. Maps posts to leaf nodes, categories and pages to branch node","homepage":"https://act-spec.org","repository":{"type":"git","url":"git+https://github.com/act-spec/act.git","directory":"packages/adapter-wordpress"},"author":{"name":"Jeremy Forsythe","email":"jeremy@act-spec.org"},"bugs":{"url":"https://github.com/act-spec/act/issues"},"license":"Apache-2.0","readme":"# @act-spec/adapter-wordpress\n\nWordPress adapter for ACT (Agent Content Tree). Consumes the WordPress\nREST API and emits ACT envelopes against the shared adapter framework\n(`@act-spec/adapter-framework`).\n\n- Maps `wp/v2/posts` to leaf nodes (`type: 'article'`).\n- Maps `wp/v2/pages` to branch nodes (`type: 'section'`), preserving the\n  WordPress `parent` chain.\n- Maps `wp/v2/categories` to branch nodes (`type: 'section'`),\n  preserving the WordPress category-parent chain.\n- Optionally enumerates `wp/v2/tags` and `wp/v2/users`.\n- Detects **Polylang** and **WPML** automatically and surfaces the\n  per-locale translation map under `metadata.translations`.\n- Authentication: anonymous read, JWT bearer string, or WordPress\n  application passwords (Basic Auth). All forms accept\n  `{ from_env: 'NAME' }` for credential hygiene.\n- Conformance target: **standard**.\n\n## Status\n\nPublic release in ACT v0.2. Earlier ACT versions did not ship this\nadapter.\n\n## Install\n\n```bash\nnpm install @act-spec/adapter-wordpress\n```\n\nOr, inside the ACT monorepo:\n\n```jsonc\n// package.json\n{ \"dependencies\": { \"@act-spec/adapter-wordpress\": \"workspace:*\" } }\n```\n\n## Usage\n\n### Public read-only blog\n\n```ts\nimport { createWordPressAdapter } from '@act-spec/adapter-wordpress';\n\nexport default createWordPressAdapter({\n  // No `provider` / `corpus` — the adapter wires the default HTTP\n  // provider against `config.baseUrl`.\n});\n```\n\n`act.config.{js,ts}`:\n\n```js\nexport default {\n  adapters: {\n    '@act-spec/adapter-wordpress': {\n      baseUrl: 'https://blog.example.com',\n      include: { posts: true, pages: true, categories: true },\n      perPage: 100,\n    },\n  },\n};\n```\n\n### Private content via application passwords\n\n```js\nexport default {\n  adapters: {\n    '@act-spec/adapter-wordpress': {\n      baseUrl: 'https://cms.example.com',\n      auth: {\n        user: 'editor',\n        appPassword: { from_env: 'WP_APP_PASSWORD' },\n      },\n    },\n  },\n};\n```\n\nThe user / appPassword pair is sent as HTTP Basic Auth per the\nWordPress 5.6+ application-password recommendation.\n\n### JWT bearer token\n\n```js\nauth: { from_env: 'WP_JWT_TOKEN' }\n```\n\n### Locale fan-out (Polylang or WPML)\n\nBy default the adapter probes the first post for Polylang's `lang` /\n`translations` fields and WPML's `wpml_current_locale` /\n`wpml_translations`. Set `i18n.mode` explicitly to short-circuit the\nprobe:\n\n```js\ni18n: { mode: 'polylang' }   // or 'wpml' or 'none'\n```\n\nEach emitted post node carries `metadata.locale` and (when other\nlocales exist) `metadata.translations: Array<{ locale, id }>`. Node ids\nare suffixed with `@<locale>` for non-default locales.\n\n## Configuration reference\n\n| Option         | Default                         | Notes                                                                |\n| -------------- | ------------------------------- | -------------------------------------------------------------------- |\n| `baseUrl`      | (required)                      | Site URL incl. protocol. REST root = `${baseUrl}/wp-json/wp/v2`.     |\n| `auth`         | `undefined` (anonymous)         | Bearer string, `{ from_env }`, or `{ user, appPassword }`.           |\n| `include`      | posts / pages / categories on   | Toggle each WP collection independently.                             |\n| `perPage`      | `100`                           | REST page size; WordPress's hard cap.                                |\n| `concurrency`  | `4`                             | Parallel transforms.                                                 |\n| `namespace`    | `'wp'`                          | Prefix for emitted node ids.                                         |\n| `i18n.mode`    | `'auto'`                        | `'auto'`, `'polylang'`, `'wpml'`, `'none'`.                          |\n| `typeMap`      | `{}`                            | Override default ACT type per WP collection.                         |\n\n## What's tested\n\n`src/wordpress.test.ts` covers:\n\n- Factory contract (`createWordPressAdapter`, defaults, capabilities).\n- Config schema (positive + negative cases).\n- Auth resolution (string, env var, application password, missing-env\n  errors).\n- HTTP fetch through a mocked `fetch`: pagination, header injection,\n  401/403 → `auth_failed`, 5xx → `http_error`, transport rejections →\n  `transport_error`, end-of-pagination 400 handling.\n- HTML walker: paragraph splits, entity decoding, script / style\n  scrubbing, comment stripping.\n- i18n detection: Polylang via `lang` / `translations`, WPML via\n  `wpml_current_locale` / `wpml_translations`, neither → `'none'`.\n- Mapping: post / page / category / tag / user envelopes, parent\n  chains, namespace + typeMap overrides, translation fan-out,\n  extracted-vs-author summary classification.\n- End-to-end through `runAdapter` + `validateNode` (every emitted\n  envelope is gap-free).\n\nThe conformance gate runs `@act-spec/validator` against the bundled\nfixture corpus and exits non-zero on any gap:\n\n```bash\npnpm -F @act-spec/adapter-wordpress conformance\n```\n\n## Compatibility\n\n- WordPress core: 5.6+ (application passwords) or any version exposing\n  the v2 REST API for read-only public access.\n- Polylang and WPML are detected at run time; either or neither can be\n  installed.\n- No first-party WordPress SDK dependency. The adapter speaks HTTP to\n  `${baseUrl}/wp-json/wp/v2`; pass a custom `fetch` to wire it through\n  a proxy or recorder.\n\n## Links\n\n- Adapter framework: [`@act-spec/adapter-framework`](../adapter-framework)\n- Repository: <https://github.com/act-spec/act>\n","readmeFilename":"README.md","_rev":"1-661bdbea551ea3248e78f1f60cfd1a8f"}