wordpress-agent-kit 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/agents/wp-architect.agent.md +1 -0
- package/.github/skills/wordpress-router/SKILL.md +1 -0
- package/.github/skills/wp-abilities-api/SKILL.md +1 -0
- package/.github/skills/wp-block-development/SKILL.md +1 -0
- package/.github/skills/wp-block-themes/SKILL.md +1 -0
- package/.github/skills/wp-interactivity-api/SKILL.md +1 -0
- package/.github/skills/wp-performance/SKILL.md +1 -0
- package/.github/skills/wp-phpstan/SKILL.md +1 -0
- package/.github/skills/wp-playground/SKILL.md +1 -0
- package/.github/skills/wp-plugin-development/SKILL.md +1 -0
- package/.github/skills/wp-project-triage/SKILL.md +1 -0
- package/.github/skills/wp-rest-api/SKILL.md +1 -0
- package/.github/skills/wp-wpcli-and-ops/SKILL.md +1 -0
- package/.github/skills/wpds/SKILL.md +1 -0
- package/AGENTS.md +33 -10
- package/AGENTS.template.md +63 -18
- package/README.md +220 -121
- package/biome.json +1 -1
- package/dist/commands/install.js +47 -6
- package/dist/commands/upgrade.js +34 -5
- package/dist/lib/api.js +63 -8
- package/dist/lib/installer.js +114 -6
- package/dist/lib/updater.js +260 -0
- package/extensions/wp-agent-kit/index.ts +630 -0
- package/package.json +21 -3
- package/kit-learnings.md +0 -192
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wordpress-router
|
|
3
3
|
description: "Use when the user asks about WordPress codebases (plugins, themes, block themes, Gutenberg blocks, WP core checkouts) and you need to quickly classify the repo and route to the correct workflow/skill (blocks, theme.json, REST API, WP-CLI, performance, security, testing, release packaging)."
|
|
4
|
+
license: GPL-2.0-or-later
|
|
4
5
|
compatibility: "Targets WordPress 6.9+ (PHP 7.2.24+). Filesystem-based agent with bash + node. Some workflows require WP-CLI."
|
|
5
6
|
---
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wp-abilities-api
|
|
3
3
|
description: "Use when working with the WordPress Abilities API (wp_register_ability, wp_register_ability_category, /wp-json/wp-abilities/v1/*, @wordpress/abilities) including defining abilities, categories, meta, REST exposure, and permissions checks for clients."
|
|
4
|
+
license: GPL-2.0-or-later
|
|
4
5
|
compatibility: "Targets WordPress 6.9+ (PHP 7.2.24+). Filesystem-based agent with bash + node. Some workflows require WP-CLI."
|
|
5
6
|
---
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wp-block-development
|
|
3
3
|
description: "Use when developing WordPress (Gutenberg) blocks: block.json metadata, register_block_type(_from_metadata), attributes/serialization, supports, dynamic rendering (render.php/render_callback), deprecations/migrations, viewScript vs viewScriptModule, and @wordpress/scripts/@wordpress/create-block build and test workflows."
|
|
4
|
+
license: GPL-2.0-or-later
|
|
4
5
|
compatibility: "Targets WordPress 6.9+ (PHP 7.2.24+). Filesystem-based agent with bash + node. Some workflows require WP-CLI."
|
|
5
6
|
---
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wp-block-themes
|
|
3
3
|
description: "Use when developing WordPress block themes: theme.json (global settings/styles), templates and template parts, patterns, style variations, and Site Editor troubleshooting (style hierarchy, overrides, caching)."
|
|
4
|
+
license: GPL-2.0-or-later
|
|
4
5
|
compatibility: "Targets WordPress 6.9+ (PHP 7.2.24+). Filesystem-based agent with bash + node. Some workflows require WP-CLI."
|
|
5
6
|
---
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wp-interactivity-api
|
|
3
3
|
description: "Use when building or debugging WordPress Interactivity API features (data-wp-* directives, @wordpress/interactivity store/state/actions, block viewScriptModule integration, wp_interactivity_*()) including performance, hydration, and directive behavior."
|
|
4
|
+
license: GPL-2.0-or-later
|
|
4
5
|
compatibility: "Targets WordPress 6.9+ (PHP 7.2.24+). Filesystem-based agent with bash + node. Some workflows require WP-CLI."
|
|
5
6
|
---
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wp-performance
|
|
3
3
|
description: "Use when investigating or improving WordPress performance (backend-only agent): profiling and measurement (WP-CLI profile/doctor, Server-Timing, Query Monitor via REST headers), database/query optimization, autoloaded options, object caching, cron, HTTP API calls, and safe verification."
|
|
4
|
+
license: GPL-2.0-or-later
|
|
4
5
|
compatibility: "Targets WordPress 6.9+ (PHP 7.2.24+). Backend-only agent; prefers WP-CLI (doctor/profile) when available."
|
|
5
6
|
---
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wp-phpstan
|
|
3
3
|
description: "Use when configuring, running, or fixing PHPStan static analysis in WordPress projects (plugins/themes/sites): phpstan.neon setup, baselines, WordPress-specific typing, and handling third-party plugin classes."
|
|
4
|
+
license: GPL-2.0-or-later
|
|
4
5
|
compatibility: "Targets WordPress 6.9+ (PHP 7.2.24+). Requires Composer-based PHPStan."
|
|
5
6
|
---
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wp-playground
|
|
3
3
|
description: "Use for WordPress Playground workflows: fast disposable WP instances in the browser or locally via @wp-playground/cli (server, run-blueprint, build-snapshot), auto-mounting plugins/themes, switching WP/PHP versions, blueprints, and debugging (Xdebug)."
|
|
4
|
+
license: GPL-2.0-or-later
|
|
4
5
|
compatibility: "Targets WordPress 6.9+ (PHP 7.2.24+). Playground CLI requires Node.js 20.18+; runs WP in WebAssembly with SQLite."
|
|
5
6
|
---
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wp-plugin-development
|
|
3
3
|
description: "Use when developing WordPress plugins: architecture and hooks, activation/deactivation/uninstall, admin UI and Settings API, data storage, cron/tasks, security (nonces/capabilities/sanitization/escaping), and release packaging."
|
|
4
|
+
license: GPL-2.0-or-later
|
|
4
5
|
compatibility: "Targets WordPress 6.9+ (PHP 7.2.24+). Filesystem-based agent with bash + node. Some workflows require WP-CLI."
|
|
5
6
|
---
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wp-project-triage
|
|
3
3
|
description: "Use when you need a deterministic inspection of a WordPress repository (plugin/theme/block theme/WP core/Gutenberg/full site) including tooling/tests/version hints, and a structured JSON report to guide workflows and guardrails."
|
|
4
|
+
license: GPL-2.0-or-later
|
|
4
5
|
compatibility: "Targets WordPress 6.9+ (PHP 7.2.24+). Filesystem-based agent with bash + node. Some workflows require WP-CLI."
|
|
5
6
|
---
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wp-rest-api
|
|
3
3
|
description: "Use when building, extending, or debugging WordPress REST API endpoints/routes: register_rest_route, WP_REST_Controller/controller classes, schema/argument validation, permission_callback/authentication, response shaping, register_rest_field/register_meta, or exposing CPTs/taxonomies via show_in_rest."
|
|
4
|
+
license: GPL-2.0-or-later
|
|
4
5
|
compatibility: "Targets WordPress 6.9+ (PHP 7.2.24+). Filesystem-based agent with bash + node. Some workflows require WP-CLI."
|
|
5
6
|
---
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wp-wpcli-and-ops
|
|
3
3
|
description: "Use when working with WP-CLI (wp) for WordPress operations: safe search-replace, db export/import, plugin/theme/user/content management, cron, cache flushing, multisite, and scripting/automation with wp-cli.yml."
|
|
4
|
+
license: GPL-2.0-or-later
|
|
4
5
|
compatibility: "Targets WordPress 6.9+ (PHP 7.2.24+). Requires WP-CLI in the execution environment."
|
|
5
6
|
---
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wpds
|
|
3
3
|
description: "Use when building UIs leveraging the WordPress Design System (WPDS) and its components, tokens, patterns, etc."
|
|
4
|
+
license: GPL-2.0-or-later
|
|
4
5
|
compatibility: "Requires WPDS MCP server configured and running. Targets WordPress 6.9+ (PHP 7.2.24+)."
|
|
5
6
|
---
|
|
6
7
|
|
package/AGENTS.md
CHANGED
|
@@ -8,32 +8,55 @@ This is a Node.js CLI tool (`wp-agent-kit`) designed to scaffold AI agent config
|
|
|
8
8
|
- **Prompting**: `@clack/prompts`
|
|
9
9
|
- **Build**: `tsc` (TypeScript Compiler)
|
|
10
10
|
- **Test**: `vitest`
|
|
11
|
+
- **Lint/Format**: Biome + ESLint
|
|
11
12
|
|
|
12
13
|
## Architecture
|
|
13
14
|
- **Entry Point**: `src/cli.ts`
|
|
14
|
-
- **Commands**: `src/commands/*.ts` (e.g., `install`, `setup`, `sync-skills`, `playground`)
|
|
15
|
-
- **Core Logic**: `src/lib/*.ts` (e.g., `installer.ts` for file copying, `triage-mapper.ts` for project detection)
|
|
16
|
-
- **Utilities**: `src/utils/*.ts` (e.g., `paths.ts`, `run.ts`)
|
|
15
|
+
- **Commands**: `src/commands/*.ts` (e.g., `install`, `setup`, `sync-skills`, `playground`, `upgrade`)
|
|
16
|
+
- **Core Logic**: `src/lib/*.ts` (e.g., `installer.ts` for file copying, `triage-mapper.ts` for project detection, `api.ts` for programmatic API)
|
|
17
|
+
- **Utilities**: `src/utils/*.ts` (e.g., `paths.ts`, `run.ts`, `output.ts`, `exit-codes.ts`)
|
|
17
18
|
- **Assets**:
|
|
18
19
|
- `AGENTS.template.md`: The template file copied to user projects.
|
|
19
|
-
- `.github/`: The source of skills
|
|
20
|
+
- `.github/`: The source of skills (14 WordPress skills), instructions, agents, and prompts copied to user projects.
|
|
20
21
|
- `vendor/wp-agent-skills/`: Submodule containing upstream skills.
|
|
21
22
|
|
|
23
|
+
## Package Exports
|
|
24
|
+
- `wordpress-agent-kit` → CLI entry (`dist/cli.js`)
|
|
25
|
+
- `wordpress-agent-kit/api` → Programmatic API (`dist/lib/api.js`)
|
|
26
|
+
|
|
22
27
|
## Development Workflow
|
|
23
28
|
- **Run locally**: `npm run dev` (uses `tsx src/cli.ts`)
|
|
24
29
|
- **Build**: `npm run build` (outputs to `dist/`)
|
|
30
|
+
- **TypeCheck**: `npm run check` (no-emit type checking)
|
|
25
31
|
- **Test**: `npm test` (runs Vitest)
|
|
26
|
-
- **Lint**: `npm run lint`
|
|
32
|
+
- **Lint**: `npm run lint:check` (ESLint + Biome)
|
|
33
|
+
- **Format**: `npm run format` (Prettier + Biome)
|
|
34
|
+
- **Pre-commit**: Husky runs lint:check + test:run
|
|
27
35
|
|
|
28
36
|
## Key Commands
|
|
29
|
-
- `install`: Copies `.github` and `AGENTS.md` template to a target directory.
|
|
30
|
-
- `setup`: Interactive wizard that detects project type and configures the kit.
|
|
31
|
-
- `sync-skills`: Pulls skills from `WordPress/agent-skills` into `.github/skills`.
|
|
37
|
+
- `install`: Copies `.github` and `AGENTS.md` template to a target directory. Supports `--json`, `--dry-run`, `--ndjson`.
|
|
38
|
+
- `setup`: Interactive wizard that detects project type and configures the kit. Supports `--auto`, `--project-type`, `--tech-stack`, `--yes`.
|
|
39
|
+
- `sync-skills`: Pulls skills from `WordPress/agent-skills` into `.github/skills`. Supports `--json`, `--dry-run`.
|
|
32
40
|
- `playground`: Launches a local WordPress Playground instance using a blueprint.
|
|
33
|
-
- `
|
|
41
|
+
- `upgrade`: Checks for and applies newer versions. Supports `--check-only`, `--force`, `--json`.
|
|
42
|
+
|
|
43
|
+
## Agent-Friendly Features (v0.3.0+)
|
|
44
|
+
- `--json`: Structured JSON output with success/data/error/time fields
|
|
45
|
+
- `--dry-run`: Preview mode showing what would happen without making changes
|
|
46
|
+
- `--ndjson`: Newline-delimited JSON for streaming long operations
|
|
47
|
+
- `--quiet`: Suppress non-essential output
|
|
48
|
+
- **Semantic exit codes**: 0=OK, 2=Invalid Args, 3=Not Found, 4=Permission Denied, 5=Already Exists, 6=Git Error, 7=Network Error, 8=Validation Error, 130=Cancelled
|
|
49
|
+
- **Programmatic API**: `import { installKitApi, syncSkillsApi, runTriageApi, configureAgentsMdApi } from 'wordpress-agent-kit/api'`
|
|
34
50
|
|
|
35
51
|
## Notes for Agents
|
|
36
52
|
- When modifying commands, ensure you update the corresponding JSDoc comments.
|
|
37
53
|
- The `src/lib/installer.ts` file is critical as it handles the file copying logic.
|
|
38
54
|
- The `src/lib/triage-mapper.ts` file contains logic for mapping project detection results to configuration options.
|
|
39
|
-
- The `
|
|
55
|
+
- The `src/lib/api.ts` file exposes the programmatic API — all changes to command logic should flow through to the API.
|
|
56
|
+
- The `vendor` directory is gitignored and populated via submodule or script.
|
|
57
|
+
- The `.github/skills/` directory contains 14 WordPress skills following the AgentSkills.io spec.
|
|
58
|
+
- CI runs on every push: lint, typecheck, test, build. No publish workflow (manual npm publish only).
|
|
59
|
+
|
|
60
|
+
## Pi Extension (Package)
|
|
61
|
+
- `pi.extensions`: `./extensions/wp-agent-kit` — registers WordPress agent tools
|
|
62
|
+
- `pi.skills`: `./.github/skills` — 14 WordPress skills discoverable by Pi
|
package/AGENTS.template.md
CHANGED
|
@@ -1,31 +1,76 @@
|
|
|
1
1
|
# Project: WordPress Codebase
|
|
2
2
|
|
|
3
|
-
This repository is WordPress-centric (plugin, theme, or site). Agents should prioritize local skills and official WordPress standards.
|
|
3
|
+
This repository is WordPress-centric (plugin, theme, block theme, or site). Agents should prioritize local skills and official WordPress standards.
|
|
4
4
|
|
|
5
5
|
## Onboarding
|
|
6
6
|
|
|
7
|
-
- Core
|
|
8
|
-
- Workflow
|
|
9
|
-
- Skills
|
|
7
|
+
- **Core Agent**: `.github/agents/wp-architect.agent.md` — the primary agent persona
|
|
8
|
+
- **Workflow Instructions**: `.github/instructions/wordpress-workflow.instructions.md` — project-specific conventions
|
|
9
|
+
- **Skills**: `.github/skills/` — specialized agent skills for WordPress development
|
|
10
10
|
|
|
11
|
-
## Project Discovery (
|
|
11
|
+
## Project Discovery (Required Before Changes)
|
|
12
12
|
|
|
13
|
-
1. Run project triage:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
-
|
|
13
|
+
1. **Run project triage** to classify the codebase:
|
|
14
|
+
```bash
|
|
15
|
+
node .github/skills/wp-project-triage/scripts/detect_wp_project.mjs
|
|
16
|
+
```
|
|
17
|
+
This outputs a JSON report with project kind, signals, and tooling.
|
|
18
|
+
|
|
19
|
+
2. **Route to the right skill**:
|
|
20
|
+
- If routing is unclear, consult `.github/skills/wordpress-router/references/decision-tree.md`
|
|
21
|
+
- For plugins: `wp-plugin-development`
|
|
22
|
+
- For block themes: `wp-block-themes`
|
|
23
|
+
- For Gutenberg blocks: `wp-block-development`
|
|
24
|
+
- For REST API work: `wp-rest-api`
|
|
25
|
+
- For WP-CLI operations: `wp-wpcli-and-ops`
|
|
26
|
+
|
|
27
|
+
3. **Update repo-specific guidance** based on triage results:
|
|
28
|
+
- Confirm the project prefix (functions, classes, constants)
|
|
29
|
+
- Confirm the folder structure (single-file plugin, `includes/`, blocks, theme, full site)
|
|
30
|
+
- Confirm target WordPress and PHP versions
|
|
31
|
+
|
|
32
|
+
## Architecture
|
|
33
|
+
|
|
34
|
+
<!-- Populated by project triage — do not remove -->
|
|
35
|
+
|
|
36
|
+
- **Project Type**: <!-- plugin | theme | block-theme | site | gutenberg -->
|
|
37
|
+
- **PHP Version**: <!-- minimum PHP version -->
|
|
38
|
+
- **WP Version**: <!-- minimum WordPress version -->
|
|
39
|
+
- **Build Tool**: <!-- webpack | @wordpress/scripts | vite | none -->
|
|
40
|
+
- **Test Framework**: <!-- PHPUnit | Jest | Cypress | none -->
|
|
41
|
+
|
|
42
|
+
## Commands
|
|
43
|
+
|
|
44
|
+
<!-- Populated by project triage — do not remove -->
|
|
45
|
+
|
|
46
|
+
| Purpose | Command |
|
|
47
|
+
|---------|---------|
|
|
48
|
+
| Build | <!-- e.g., npm run build --> |
|
|
49
|
+
| Lint (PHP) | <!-- e.g., composer lint --> |
|
|
50
|
+
| Lint (JS/CSS) | <!-- e.g., npm run lint --> |
|
|
51
|
+
| Test | <!-- e.g., npm test, composer test --> |
|
|
52
|
+
| Dev server | <!-- e.g., npm start --> |
|
|
53
|
+
|
|
54
|
+
## Code Conventions
|
|
55
|
+
|
|
56
|
+
<!-- Populated by project triage — do not remove -->
|
|
57
|
+
|
|
58
|
+
- **Prefix**: <!-- e.g., myplugin_ for functions, MyPlugin\ for namespaces -->
|
|
59
|
+
- **Indentation**: Tabs for PHP, <!-- 2 spaces for JS -->
|
|
60
|
+
- **PHP Standards**: [WordPress PHP Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/)
|
|
61
|
+
- **JS Standards**: <!-- WordPress JS standards -->
|
|
21
62
|
|
|
22
63
|
## Security Baseline
|
|
23
64
|
|
|
24
|
-
- Sanitize input
|
|
25
|
-
-
|
|
26
|
-
-
|
|
65
|
+
- **Sanitize Early**: Validate and sanitize all user input (`sanitize_text_field`, `sanitize_email`, etc.)
|
|
66
|
+
- **Escape Late**: Escape all output (`esc_html`, `esc_attr`, `esc_url`, `wp_kses`)
|
|
67
|
+
- **Use Nonces**: All state-changing requests must include nonce verification (`wp_nonce_field`, `check_admin_referer`)
|
|
68
|
+
- **Check Capabilities**: Privileged actions require capability checks (`current_user_can`)
|
|
69
|
+
- **Validate AJAX/REST**: Use `permission_callback` for REST endpoints and capability checks for AJAX handlers
|
|
27
70
|
|
|
28
71
|
## Output Requirements
|
|
29
72
|
|
|
30
|
-
- Prefer minimal, standards-compliant changes
|
|
31
|
-
- Follow existing conventions in the codebase
|
|
73
|
+
- Prefer minimal, standards-compliant changes over large rewrites
|
|
74
|
+
- Follow existing conventions in the codebase (naming, patterns, architecture)
|
|
75
|
+
- Cite which skill or handbook informed the solution
|
|
76
|
+
- Cross-check against this file (`AGENTS.md`) before finalizing output
|