wordpress-agent-kit 0.2.2 → 0.3.2
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/blueprint/SKILL.md +418 -0
- package/.github/skills/wordpress-router/SKILL.md +1 -0
- package/.github/skills/wp-abilities-api/SKILL.md +13 -0
- package/.github/skills/wp-abilities-api/references/delegate-helper-pattern.md +241 -0
- package/.github/skills/wp-abilities-api/references/domain-vs-projection.md +113 -0
- package/.github/skills/wp-abilities-api/references/error-code-vocabulary.md +123 -0
- package/.github/skills/wp-abilities-api/references/grouping-heuristic.md +89 -0
- package/.github/skills/wp-abilities-api/references/input-schema-gotchas.md +265 -0
- package/.github/skills/wp-abilities-api/references/php-registration.md +47 -20
- package/.github/skills/wp-abilities-api/references/plugin-family-patterns.md +233 -0
- package/.github/skills/wp-abilities-api/references/shared-core-service.md +184 -0
- package/.github/skills/wp-abilities-audit/SKILL.md +199 -0
- package/.github/skills/wp-abilities-audit/references/audit-schema.md +300 -0
- package/.github/skills/wp-abilities-audit/references/capability-gate-tracing.md +197 -0
- package/.github/skills/wp-abilities-audit/references/controller-enumeration.md +116 -0
- package/.github/skills/wp-abilities-verify/SKILL.md +215 -0
- package/.github/skills/wp-abilities-verify/references/annotation-correctness.md +154 -0
- package/.github/skills/wp-abilities-verify/references/audit-schema-validation.md +131 -0
- package/.github/skills/wp-abilities-verify/references/permission-roundtrip.md +190 -0
- package/.github/skills/wp-abilities-verify/references/runtime-harness.md +462 -0
- package/.github/skills/wp-abilities-verify/references/schema-lints.md +118 -0
- package/.github/skills/wp-abilities-verify/references/static-enumeration.md +126 -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-plugin-directory-guidelines/SKILL.md +133 -0
- package/.github/skills/wp-plugin-directory-guidelines/references/gpl-compliance.md +217 -0
- package/.github/skills/wp-plugin-directory-guidelines/references/guideline-review-checklist.md +592 -0
- package/.github/skills/wp-plugin-directory-guidelines/references/naming-rules.md +121 -0
- package/.github/skills/wp-project-triage/SKILL.md +1 -0
- package/.github/skills/wp-project-triage/scripts/detect_wp_project.mjs +22 -4
- 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 +226 -124
- package/biome.json +1 -1
- package/dist/commands/install.js +47 -6
- package/dist/commands/upgrade.js +34 -5
- package/dist/lib/api.js +93 -27
- package/dist/lib/installer.js +113 -7
- package/dist/lib/updater.js +260 -0
- package/extensions/wp-agent-kit/index.ts +452 -0
- package/package.json +21 -3
- package/kit-learnings.md +0 -192
package/README.md
CHANGED
|
@@ -2,190 +2,292 @@
|
|
|
2
2
|
|
|
3
3
|
[](LICENSE)
|
|
4
4
|
[](https://www.typescriptlang.org/)
|
|
5
|
-
[](package.json)
|
|
5
|
+
[](package.json)
|
|
7
6
|
[](package.json)
|
|
7
|
+
[](.github/workflows/ci.yml)
|
|
8
8
|
|
|
9
|
-
**WordPress-focused AI agent starter kit** for GitHub Copilot, Cursor, Claude, and
|
|
9
|
+
**WordPress-focused AI agent starter kit** for GitHub Copilot, Cursor, Claude, and Pi Coding Agent. Installs 13 specialized WordPress agent skills, an agent persona, workflow instructions, and AGENTS.md configuration — everything an AI coding agent needs to build WordPress plugins, themes, and blocks correctly.
|
|
10
10
|
|
|
11
11
|
Maintained by [Kyle Brodeur](https://brodeur.me).
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
---
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
## Getting Started
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
# or
|
|
21
|
-
pnpm dlx wp-agent-kit setup
|
|
22
|
-
```
|
|
17
|
+
Choose your scenario:
|
|
18
|
+
|
|
19
|
+
### Scenario 1: Brand New WordPress Project
|
|
23
20
|
|
|
24
|
-
#### Non-Interactive (CI/Agent-Friendly)
|
|
25
21
|
```bash
|
|
26
|
-
#
|
|
27
|
-
|
|
22
|
+
# 1. Install the kit (copies skills, agents, instructions, AGENTS.md template)
|
|
23
|
+
npx wp-agent-kit install /path/to/my-plugin --platform github
|
|
24
|
+
|
|
25
|
+
# 2. Run auto-setup (detects project type and configures AGENTS.md)
|
|
26
|
+
npx wp-agent-kit setup /path/to/my-plugin --auto
|
|
28
27
|
|
|
29
|
-
#
|
|
30
|
-
|
|
28
|
+
# 3. (Optional) Verify the triage report
|
|
29
|
+
node .github/skills/wp-project-triage/scripts/detect_wp_project.mjs
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**What gets installed:**
|
|
33
|
+
```
|
|
34
|
+
my-plugin/
|
|
35
|
+
├── AGENTS.md # Project-specific agent instructions
|
|
36
|
+
├── AGENTS.template.md # Template reference for future updates
|
|
37
|
+
├── .github/
|
|
38
|
+
│ ├── agents/
|
|
39
|
+
│ │ └── wp-architect.agent.md # WordPress Architect agent persona
|
|
40
|
+
│ ├── instructions/
|
|
41
|
+
│ │ └── wordpress-workflow.instructions.md
|
|
42
|
+
│ ├── prompts/
|
|
43
|
+
│ └── skills/ # 17 WordPress skills
|
|
44
|
+
│ ├── wp-project-triage/ # Project detection
|
|
45
|
+
│ ├── wp-plugin-development/ # Plugin architecture
|
|
46
|
+
│ ├── wp-block-development/ # Gutenberg blocks
|
|
47
|
+
│ ├── wp-block-themes/ # Block themes
|
|
48
|
+
│ ├── wp-rest-api/ # REST API
|
|
49
|
+
│ ├── wp-interactivity-api/ # Interactivity API
|
|
50
|
+
│ ├── wp-abilities-api/ # Abilities API
|
|
51
|
+
│ ├── wp-performance/ # Performance profiling
|
|
52
|
+
│ ├── wp-phpstan/ # Static analysis
|
|
53
|
+
│ ├── wp-wpcli-and-ops/ # WP-CLI operations
|
|
54
|
+
│ ├── wp-playground/ # Testing environments
|
|
55
|
+
│ ├── wpds/ # Design system
|
|
56
|
+
│ └── wordpress-router/ # Repo classification
|
|
57
|
+
└── .wp-agent-kit-manifest.github.json # Safe-update tracking
|
|
31
58
|
```
|
|
32
59
|
|
|
33
|
-
|
|
60
|
+
### Scenario 2: Existing WordPress Project
|
|
61
|
+
|
|
34
62
|
```bash
|
|
35
|
-
#
|
|
36
|
-
|
|
63
|
+
# 1. Install kit (preserves your existing AGENTS.md)
|
|
64
|
+
npx wp-agent-kit install /path/to/existing-plugin --platform github
|
|
37
65
|
|
|
38
|
-
#
|
|
39
|
-
|
|
66
|
+
# 2. Run triage to detect your project's type, tech stack, and tooling
|
|
67
|
+
node .github/skills/wp-project-triage/scripts/detect_wp_project.mjs
|
|
40
68
|
|
|
41
|
-
#
|
|
42
|
-
|
|
69
|
+
# 3. Configure based on detection (headless)
|
|
70
|
+
npx wp-agent-kit setup /path/to/existing-plugin --auto
|
|
43
71
|
|
|
44
|
-
#
|
|
45
|
-
|
|
72
|
+
# Or specify explicitly
|
|
73
|
+
npx wp-agent-kit setup /path/to/existing-plugin \
|
|
74
|
+
--project-type plugin \
|
|
75
|
+
--tech-stack gutenberg,rest-api,wpcli,composer,npm \
|
|
76
|
+
--package-manager pnpm \
|
|
77
|
+
--yes
|
|
46
78
|
```
|
|
47
79
|
|
|
48
|
-
|
|
80
|
+
**Key behavior:**
|
|
81
|
+
- Your existing `AGENTS.md` is **never overwritten** — only new sections are added
|
|
82
|
+
- Triage inspects your codebase and returns structured JSON with project kind, signals, and tooling
|
|
83
|
+
- Setup updates only the tooling/configuration sections of AGENTS.md
|
|
49
84
|
|
|
50
|
-
|
|
51
|
-
- `wordpress-agent-kit-github.tar.gz` — GitHub Copilot
|
|
52
|
-
- `wordpress-agent-kit-cursor.tar.gz` — Cursor IDE
|
|
53
|
-
- `wordpress-agent-kit-claude.tar.gz` — Claude
|
|
54
|
-
- `wordpress-agent-kit-agent.tar.gz` — Generic `.agent`
|
|
85
|
+
### Scenario 3: Upgrading an Existing Kit Installation
|
|
55
86
|
|
|
56
87
|
```bash
|
|
57
|
-
|
|
58
|
-
|
|
88
|
+
# Check if an update is available
|
|
89
|
+
npx wp-agent-kit upgrade --check-only
|
|
90
|
+
|
|
91
|
+
# Preview what would change (dry-run)
|
|
92
|
+
npx wp-agent-kit install --dry-run
|
|
93
|
+
|
|
94
|
+
# Apply safe update (preserves your modifications)
|
|
95
|
+
npx wp-agent-kit upgrade --force
|
|
59
96
|
```
|
|
60
97
|
|
|
61
|
-
|
|
98
|
+
**Safe update behavior:**
|
|
99
|
+
- Compares installed files against a manifest of original hashes
|
|
100
|
+
- Files you haven't modified → automatically updated
|
|
101
|
+
- Files you modified → **skipped** (preserved)
|
|
102
|
+
- Use `--force` to overwrite your modifications with upstream changes
|
|
103
|
+
- A backup is created at `.wp-agent-kit-backup-{timestamp}/` before making changes
|
|
62
104
|
|
|
63
|
-
### Structured JSON Output (`--json`)
|
|
64
|
-
All commands output machine-readable JSON for programmatic use:
|
|
65
105
|
```bash
|
|
66
|
-
|
|
67
|
-
|
|
106
|
+
# Emergency: override all safety and replace everything
|
|
107
|
+
npx wp-agent-kit install --no-safe --force
|
|
68
108
|
```
|
|
69
109
|
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
# Auto-detection
|
|
73
|
-
wp-agent-kit setup --auto --json
|
|
110
|
+
---
|
|
74
111
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
112
|
+
## Quick Reference
|
|
113
|
+
|
|
114
|
+
### CLI Commands
|
|
115
|
+
|
|
116
|
+
| Command | Purpose |
|
|
117
|
+
|---------|---------|
|
|
118
|
+
| `install [dir]` | Install kit into a project |
|
|
119
|
+
| `setup [dir]` | Interactive or headless configuration |
|
|
120
|
+
| `sync-skills [ref]` | Pull latest skills from WordPress/agent-skills |
|
|
121
|
+
| `upgrade [dir]` | Check or apply version upgrades |
|
|
122
|
+
| `playground` | Launch local WordPress Playground |
|
|
123
|
+
|
|
124
|
+
### Platform Flags
|
|
125
|
+
|
|
126
|
+
| Platform | Flag | Target Directory |
|
|
127
|
+
|----------|------|-----------------|
|
|
128
|
+
| GitHub Copilot / VS Code | `--platform github` | `.github/` |
|
|
129
|
+
| Cursor IDE | `--platform cursor` | `.cursor/` |
|
|
130
|
+
| Claude Code | `--platform claude` | `.claude/` |
|
|
131
|
+
| Pi Coding Agent | `--platform pi` | `.pi/agent/` |
|
|
132
|
+
| Generic .agent | `--platform agent` | `.agent/` |
|
|
133
|
+
|
|
134
|
+
### Agent-Friendly Flags (All Commands)
|
|
135
|
+
|
|
136
|
+
| Flag | Description |
|
|
137
|
+
|------|-------------|
|
|
138
|
+
| `--json` | Machine-readable JSON output |
|
|
139
|
+
| `--dry-run` | Preview changes without applying |
|
|
140
|
+
| `--ndjson` | Newline-delimited JSON for streaming |
|
|
141
|
+
| `--quiet` | Suppress non-error output |
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Pi Coding Agent Integration
|
|
146
|
+
|
|
147
|
+
This package is also a Pi extension — install it once and all WordPress skills and tools are available to Pi:
|
|
78
148
|
|
|
79
|
-
### Dry-Run Preview (`--dry-run`)
|
|
80
149
|
```bash
|
|
81
|
-
|
|
82
|
-
wp-agent-kit setup --project-type plugin --dry-run --json
|
|
150
|
+
pi install npm:wordpress-agent-kit
|
|
83
151
|
```
|
|
84
152
|
|
|
85
|
-
###
|
|
86
|
-
```bash
|
|
87
|
-
# Check for updates
|
|
88
|
-
wp-agent-kit upgrade --check-only --json
|
|
153
|
+
### Pi Tools (Callable by the Agent)
|
|
89
154
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
155
|
+
| Tool | What it does |
|
|
156
|
+
|------|-------------|
|
|
157
|
+
| `wp_triage` | Detect WordPress project type, signals, and tooling |
|
|
158
|
+
| `wp_install_kit` | Install/update kit into a project (safe by default) |
|
|
159
|
+
| `wp_sync_skills` | Sync skills from WordPress/agent-skills upstream |
|
|
160
|
+
| `wp_upgrade` | Check and apply version upgrades |
|
|
93
161
|
|
|
94
|
-
###
|
|
95
|
-
|
|
96
|
-
|
|
162
|
+
### Pi Commands (Type `/` in Pi TUI)
|
|
163
|
+
|
|
164
|
+
| Command | What it does |
|
|
165
|
+
|---------|-------------|
|
|
166
|
+
| `/wp-triage [dir]` | Run project detection, show in status bar |
|
|
167
|
+
| `/wp-install [dir]` | Install kit into current project |
|
|
168
|
+
| `/wp-sync-skills [ref]` | Sync skills from upstream |
|
|
169
|
+
| `/wp-upgrade` | Show installed vs latest version |
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Programmatic API
|
|
174
|
+
|
|
175
|
+
Import directly into scripts, tests, or other tools:
|
|
97
176
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
177
|
+
```typescript
|
|
178
|
+
import {
|
|
179
|
+
installKitApi, // Install/update kit
|
|
180
|
+
syncSkillsApi, // Sync skills from upstream
|
|
181
|
+
runTriageApi, // Run project detection
|
|
182
|
+
configureAgentsMdApi, // Configure AGENTS.md
|
|
183
|
+
computeChanges, // Preview file changes (dry-run)
|
|
184
|
+
isKitInstalled, // Check if kit is installed
|
|
185
|
+
loadManifest, // Read install manifest
|
|
186
|
+
updateKit, // Raw safe update
|
|
187
|
+
ExitCode, // Semantic exit codes
|
|
188
|
+
} from 'wordpress-agent-kit/api';
|
|
189
|
+
|
|
190
|
+
// Install with safe update
|
|
191
|
+
const result = await installKitApi({
|
|
192
|
+
targetDir: '/path/to/my-plugin',
|
|
193
|
+
platform: 'github',
|
|
194
|
+
safe: true, // Use manifest-based diff
|
|
195
|
+
backup: true, // Create backup before changes
|
|
196
|
+
force: false, // Don't overwrite user mods
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
// Dry-run preview
|
|
200
|
+
const preview = await installKitApi({
|
|
201
|
+
targetDir: '/path/to/my-plugin',
|
|
202
|
+
platform: 'github',
|
|
203
|
+
dryRun: true,
|
|
204
|
+
});
|
|
205
|
+
// preview.data.actions → [{ type: 'create', target: '...', description: '...' }]
|
|
206
|
+
|
|
207
|
+
// Detect project type
|
|
208
|
+
const triage = await runTriageApi({ targetDir: '/path/to/project' });
|
|
209
|
+
console.log(triage.data.project.primary); // "plugin"
|
|
102
210
|
```
|
|
103
211
|
|
|
104
212
|
### Semantic Exit Codes
|
|
213
|
+
|
|
105
214
|
| Code | Meaning |
|
|
106
215
|
|------|---------|
|
|
107
216
|
| 0 | Success |
|
|
108
|
-
| 1 | General error |
|
|
109
217
|
| 2 | Invalid arguments |
|
|
110
|
-
| 3 | Not found
|
|
218
|
+
| 3 | Not found |
|
|
111
219
|
| 4 | Permission denied |
|
|
112
|
-
| 5 | Already exists
|
|
220
|
+
| 5 | Already exists |
|
|
113
221
|
| 6 | Git error |
|
|
114
222
|
| 7 | Network error |
|
|
115
223
|
| 8 | Validation failed |
|
|
116
|
-
| 130 | Cancelled
|
|
224
|
+
| 130 | Cancelled |
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Skills Reference
|
|
229
|
+
|
|
230
|
+
All 13 skills follow the [AgentSkills.io](https://agentskills.io) specification:
|
|
231
|
+
|
|
232
|
+
| Skill | When to Use |
|
|
233
|
+
|-------|------------|
|
|
234
|
+
| `wp-project-triage` | Run deterministic project detection (type, tooling, versions) |
|
|
235
|
+
| `wp-plugin-development` | Develop WordPress plugins (hooks, settings, security, release) |
|
|
236
|
+
| `wp-block-development` | Develop Gutenberg blocks (block.json, attributes, rendering) |
|
|
237
|
+
| `wp-block-themes` | Develop block themes (theme.json, templates, patterns, variations) |
|
|
238
|
+
| `wp-rest-api` | Build, extend, or debug REST API endpoints/routes |
|
|
239
|
+
| `wp-interactivity-api` | Build Interactive blocks with data-wp-* directives |
|
|
240
|
+
| `wp-abilities-api` | Register and consume WordPress Abilities API |
|
|
241
|
+
| `wp-abilities-audit` | Audit a plugin's REST surface for Abilities API opportunities |
|
|
242
|
+
| `wp-abilities-verify` | Verify registered Abilities match their annotations |
|
|
243
|
+
| `wp-performance` | Profile and optimize WordPress performance |
|
|
244
|
+
| `wp-phpstan` | Configure and run PHPStan static analysis |
|
|
245
|
+
| `wp-wpcli-and-ops` | WP-CLI commands, automation, multisite operations |
|
|
246
|
+
| `wp-playground` | Test in disposable WordPress Playground instances |
|
|
247
|
+
| `blueprint` | Write and edit WordPress Playground blueprint JSON |
|
|
248
|
+
| `wpds` | Build UIs with the WordPress Design System |
|
|
249
|
+
| `wp-plugin-directory-guidelines` | GPL compliance, naming, slug rules for WP.org submission |
|
|
250
|
+
|
|
251
|
+
---
|
|
117
252
|
|
|
118
|
-
##
|
|
253
|
+
## Development
|
|
119
254
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
| `github` | `.github/skills/` | ❌ | GitHub Copilot, VS Code |
|
|
124
|
-
| `cursor` | `.cursor/skills/` | ❌ | Cursor IDE |
|
|
125
|
-
| `agent` | `.agent/skills/` | ❌ | Generic `.agent` workflows |
|
|
126
|
-
| `claude` | `.claude/skills/` | ✅ | Claude Code (interactive) |
|
|
255
|
+
```bash
|
|
256
|
+
# Install dependencies
|
|
257
|
+
pnpm install
|
|
127
258
|
|
|
128
|
-
|
|
259
|
+
# Run in dev mode
|
|
260
|
+
pnpm dev
|
|
129
261
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
| `install [dir] --platform <p> [--force] [--dry-run] [--json]` | Install kit to target directory |
|
|
133
|
-
| `setup [dir] [--auto] [--project-type] [--tech-stack] [--yes] [--json]` | Interactive or headless setup |
|
|
134
|
-
| `sync-skills [ref] [--dry-run] [--json]` | Sync skills from WordPress/agent-skills |
|
|
135
|
-
| `playground [--port] [--no-auto-mount] [--json]` | Run local WordPress Playground |
|
|
136
|
-
| `upgrade [dir] [--platform] [--force] [--check-only] [--json]` | Upgrade existing installation |
|
|
262
|
+
# Type-check
|
|
263
|
+
pnpm check
|
|
137
264
|
|
|
138
|
-
|
|
265
|
+
# Lint & format
|
|
266
|
+
pnpm lint:check
|
|
267
|
+
pnpm format
|
|
139
268
|
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
pnpm build
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### Run Tests
|
|
146
|
-
```bash
|
|
269
|
+
# Run tests
|
|
147
270
|
pnpm test:run
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### Lint & Format
|
|
151
|
-
```bash
|
|
152
|
-
pnpm run lint:check # Check only
|
|
153
|
-
pnpm run lint # Auto-fix
|
|
154
|
-
pnpm run format:check # Check formatting
|
|
155
|
-
pnpm run format # Auto-format
|
|
156
|
-
```
|
|
157
271
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
pnpm sync:skills
|
|
161
|
-
pnpm build:bundles
|
|
162
|
-
```
|
|
272
|
+
# Build for distribution
|
|
273
|
+
pnpm build
|
|
163
274
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
pnpm run prepublishOnly
|
|
275
|
+
# Full pre-publish check (build + lint + test)
|
|
276
|
+
pnpm prepublishOnly
|
|
167
277
|
```
|
|
168
278
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
**Quick method:** Run the interactive or headless setup.
|
|
279
|
+
---
|
|
172
280
|
|
|
173
|
-
|
|
174
|
-
1. Edit `AGENTS.md` to match your project's tech stack and conventions.
|
|
175
|
-
2. Run WordPress project triage (via `wp-project-triage` skill) to generate tailored instructions.
|
|
176
|
-
3. Update `.github/instructions/wordpress-workflow.instructions.md` with your workflow.
|
|
177
|
-
4. Keep prompts in `.github/prompts/` accurate for your plugin/theme.
|
|
281
|
+
## Documentation
|
|
178
282
|
|
|
179
|
-
|
|
283
|
+
- **[CLI_REVIEW.md](CLI_REVIEW.md)** — Initial architecture review and design decisions
|
|
284
|
+
- **[CHANGELOG.md](CHANGELOG.md)** — Version history and release notes
|
|
285
|
+
- **[AGENTS.md](AGENTS.md)** — Agent instructions for this repository
|
|
180
286
|
|
|
181
|
-
|
|
182
|
-
# GitHub Actions example
|
|
183
|
-
- name: Install WordPress Agent Kit
|
|
184
|
-
run: pnpm dlx wordpress-agent-kit@latest install --platform github --json
|
|
185
|
-
```
|
|
287
|
+
---
|
|
186
288
|
|
|
187
289
|
## Credits
|
|
188
290
|
|
|
189
|
-
- **[
|
|
190
|
-
- **[
|
|
191
|
-
- **[WordPress/agent-skills](https://github.com/WordPress/agent-skills)**
|
|
291
|
+
- **[AgentSkills.io](https://agentskills.io)** — The agent skills specification
|
|
292
|
+
- **[AGENTS.md](https://agentskills.io)** — The agent configuration standard
|
|
293
|
+
- **[WordPress/agent-skills](https://github.com/WordPress/agent-skills)** — Upstream skills repository
|
package/biome.json
CHANGED
package/dist/commands/install.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
-
import { installKitApi, } from '../lib/api.js';
|
|
3
|
+
import { installKitApi, isKitInstalled, loadManifest, } from '../lib/api.js';
|
|
4
4
|
import { OutputFormatter, createFormatter } from '../utils/output.js';
|
|
5
5
|
function isDryRunResult(result) {
|
|
6
6
|
return result.success && 'wouldExecute' in (result.data || {});
|
|
@@ -12,12 +12,15 @@ function isRegularResult(result) {
|
|
|
12
12
|
* Command to install the WordPress Agent Kit into a target directory.
|
|
13
13
|
* Takes an optional directory argument, defaulting to the current working directory.
|
|
14
14
|
* Supports --json, --quiet, --ndjson, --dry-run global flags.
|
|
15
|
+
* Safe update mode preserves user modifications on re-install.
|
|
15
16
|
*/
|
|
16
17
|
export const installCommand = new Command('install')
|
|
17
18
|
.description('Install the WordPress Agent Kit into a target directory')
|
|
18
19
|
.argument('[dir]', 'Target directory to install into', process.cwd())
|
|
19
20
|
.option('--platform <platform>', 'Target platform (github, cursor, claude, agent, pi)', 'github')
|
|
20
|
-
.option('--force', 'Overwrite
|
|
21
|
+
.option('--force', 'Overwrite user modifications on update', false)
|
|
22
|
+
.option('--no-safe', 'Disable safe update (use full nuke-and-replace)')
|
|
23
|
+
.option('--no-backup', 'Skip creating a backup before overwriting files')
|
|
21
24
|
.action(async (dir, options, command) => {
|
|
22
25
|
const globalOpts = command.parent?.opts() || {};
|
|
23
26
|
const platform = options.platform;
|
|
@@ -32,11 +35,15 @@ export const installCommand = new Command('install')
|
|
|
32
35
|
process.exit(OutputFormatter.getExitCode(result));
|
|
33
36
|
}
|
|
34
37
|
const targetDir = path.resolve(dir);
|
|
38
|
+
const isUpdate = isKitInstalled(targetDir, platform);
|
|
39
|
+
const existingManifest = loadManifest(targetDir, platform);
|
|
35
40
|
const installOptions = {
|
|
36
41
|
targetDir,
|
|
37
42
|
platform: platform,
|
|
38
43
|
force: options.force,
|
|
39
44
|
dryRun: globalOpts.dryRun,
|
|
45
|
+
safe: options.safe !== false, // Default: true (safe)
|
|
46
|
+
backup: options.backup !== false, // Default: true
|
|
40
47
|
};
|
|
41
48
|
const result = await installKitApi(installOptions);
|
|
42
49
|
if (globalOpts.json || globalOpts.ndjson || globalOpts.quiet) {
|
|
@@ -45,13 +52,47 @@ export const installCommand = new Command('install')
|
|
|
45
52
|
// Human-readable output
|
|
46
53
|
if (isRegularResult(result)) {
|
|
47
54
|
const data = result.data;
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
if (isUpdate) {
|
|
56
|
+
console.log(`✓ Updated WordPress Agent Kit (${platform}) in ${targetDir}`);
|
|
57
|
+
if (existingManifest) {
|
|
58
|
+
console.log(` Previous version: ${existingManifest.version}`);
|
|
59
|
+
}
|
|
60
|
+
console.log(` Files: ${data.filesCreated.length} created/updated`);
|
|
61
|
+
if (data.filesSkipped.length > 0) {
|
|
62
|
+
console.log(` Skipped: ${data.filesSkipped.length} files (user-modified, preserved)`);
|
|
63
|
+
}
|
|
64
|
+
if (data.conflicts && data.conflicts.length > 0) {
|
|
65
|
+
console.log(`\n⚠ ${data.conflicts.length} conflict(s) detected:`);
|
|
66
|
+
for (const conflict of data.conflicts) {
|
|
67
|
+
console.log(` - ${conflict}`);
|
|
68
|
+
}
|
|
69
|
+
console.log(' Re-run with --force to overwrite.');
|
|
70
|
+
}
|
|
71
|
+
if (data.backupDir) {
|
|
72
|
+
console.log(` Backup: ${data.backupDir}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
console.log(`✓ Installed WordPress Agent Kit (${platform}) to ${targetDir}`);
|
|
77
|
+
console.log(` Files: ${data.filesCreated.length} created, ${data.filesSkipped.length} skipped`);
|
|
78
|
+
}
|
|
50
79
|
console.log(` Duration: ${data.durationMs}ms`);
|
|
51
80
|
}
|
|
52
81
|
else if (isDryRunResult(result)) {
|
|
53
|
-
|
|
54
|
-
|
|
82
|
+
const summary = result.data.summary;
|
|
83
|
+
if (isUpdate) {
|
|
84
|
+
console.log(`✓ Dry-run update (${platform}) for ${targetDir}:`);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
console.log(`✓ Dry-run install (${platform}) to ${targetDir}:`);
|
|
88
|
+
}
|
|
89
|
+
console.log(` Would create: ${summary.filesCreated.length} files`);
|
|
90
|
+
if (summary.filesSkipped && summary.filesSkipped.length > 0) {
|
|
91
|
+
console.log(` Would skip: ${summary.filesSkipped.length} files (user-modified)`);
|
|
92
|
+
}
|
|
93
|
+
if (summary.conflicts && summary.conflicts.length > 0) {
|
|
94
|
+
console.log(` Conflicts: ${summary.conflicts.length} files (use --force to overwrite)`);
|
|
95
|
+
}
|
|
55
96
|
}
|
|
56
97
|
else {
|
|
57
98
|
console.error(`✗ Installation failed: ${result.error?.message}`);
|
package/dist/commands/upgrade.js
CHANGED
|
@@ -151,24 +151,53 @@ export const upgradeCommand = new Command('upgrade')
|
|
|
151
151
|
platform,
|
|
152
152
|
force: options.force,
|
|
153
153
|
dryRun: globalOpts.dryRun,
|
|
154
|
+
safe: true,
|
|
155
|
+
backup: !options.force, // Skip backup if forcing
|
|
154
156
|
});
|
|
155
157
|
results.push({ platform, ...installResult });
|
|
156
158
|
}
|
|
157
159
|
const successCount = results.filter((r) => r.success).length;
|
|
158
|
-
const
|
|
160
|
+
const totalCreated = results.reduce((sum, r) => {
|
|
159
161
|
if (!r.success)
|
|
160
162
|
return sum;
|
|
161
163
|
if (isRegularResult(r)) {
|
|
162
|
-
return sum + (r.data.filesCreated
|
|
164
|
+
return sum + (r.data.filesCreated?.length || 0);
|
|
163
165
|
}
|
|
164
166
|
if (isDryRunResult(r)) {
|
|
165
|
-
|
|
166
|
-
return sum + (r.data.summary.filesCreated.length || 0);
|
|
167
|
+
return sum + (r.data.summary.filesCreated?.length || 0);
|
|
167
168
|
}
|
|
168
169
|
return sum;
|
|
169
170
|
}, 0);
|
|
171
|
+
const totalSkipped = results.reduce((sum, r) => {
|
|
172
|
+
if (!r.success)
|
|
173
|
+
return sum;
|
|
174
|
+
if (isRegularResult(r)) {
|
|
175
|
+
return sum + (r.data.filesSkipped?.length || 0);
|
|
176
|
+
}
|
|
177
|
+
if (isDryRunResult(r)) {
|
|
178
|
+
return sum + (r.data.summary.filesSkipped?.length || 0);
|
|
179
|
+
}
|
|
180
|
+
return sum;
|
|
181
|
+
}, 0);
|
|
182
|
+
const allConflicts = results.reduce((acc, r) => {
|
|
183
|
+
if (!r.success)
|
|
184
|
+
return acc;
|
|
185
|
+
if (isRegularResult(r) && r.data.conflicts) {
|
|
186
|
+
acc.push(...r.data.conflicts);
|
|
187
|
+
}
|
|
188
|
+
if (isDryRunResult(r) && r.data.summary.conflicts) {
|
|
189
|
+
acc.push(...r.data.summary.conflicts);
|
|
190
|
+
}
|
|
191
|
+
return acc;
|
|
192
|
+
}, []);
|
|
170
193
|
console.log(`\n✓ Upgraded ${successCount}/${results.length} platform(s)`);
|
|
171
|
-
console.log(` Files updated: ${
|
|
194
|
+
console.log(` Files updated: ${totalCreated}`);
|
|
195
|
+
if (totalSkipped > 0) {
|
|
196
|
+
console.log(` Files preserved: ${totalSkipped} (user-modified)`);
|
|
197
|
+
}
|
|
198
|
+
if (allConflicts.length > 0) {
|
|
199
|
+
console.log(` ⚠ Conflicts: ${allConflicts.length} files (re-run with --force to overwrite)`);
|
|
200
|
+
}
|
|
172
201
|
console.log(` Version: ${currentVersion} → ${CURRENT_VERSION}`);
|
|
173
202
|
const failed = results.filter((r) => !r.success);
|
|
174
203
|
if (failed.length > 0) {
|