wordpress-agent-kit 0.3.2 → 0.5.1
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/.agents/skills/blueprint/SKILL.md +418 -0
- package/.agents/skills/wordpress-router/SKILL.md +52 -0
- package/.agents/skills/wordpress-router/references/decision-tree.md +55 -0
- package/.agents/skills/wp-abilities-api/SKILL.md +108 -0
- package/.agents/skills/wp-abilities-api/references/delegate-helper-pattern.md +241 -0
- package/.agents/skills/wp-abilities-api/references/domain-vs-projection.md +113 -0
- package/.agents/skills/wp-abilities-api/references/error-code-vocabulary.md +123 -0
- package/.agents/skills/wp-abilities-api/references/grouping-heuristic.md +89 -0
- package/.agents/skills/wp-abilities-api/references/input-schema-gotchas.md +265 -0
- package/.agents/skills/wp-abilities-api/references/php-registration.md +94 -0
- package/.agents/skills/wp-abilities-api/references/plugin-family-patterns.md +233 -0
- package/.agents/skills/wp-abilities-api/references/rest-api.md +13 -0
- package/.agents/skills/wp-abilities-api/references/shared-core-service.md +184 -0
- package/.agents/skills/wp-abilities-audit/SKILL.md +199 -0
- package/.agents/skills/wp-abilities-audit/references/audit-schema.md +300 -0
- package/.agents/skills/wp-abilities-audit/references/capability-gate-tracing.md +197 -0
- package/.agents/skills/wp-abilities-audit/references/controller-enumeration.md +116 -0
- package/.agents/skills/wp-abilities-verify/SKILL.md +215 -0
- package/.agents/skills/wp-abilities-verify/references/annotation-correctness.md +154 -0
- package/.agents/skills/wp-abilities-verify/references/audit-schema-validation.md +131 -0
- package/.agents/skills/wp-abilities-verify/references/permission-roundtrip.md +190 -0
- package/.agents/skills/wp-abilities-verify/references/runtime-harness.md +462 -0
- package/.agents/skills/wp-abilities-verify/references/schema-lints.md +118 -0
- package/.agents/skills/wp-abilities-verify/references/static-enumeration.md +126 -0
- package/.agents/skills/wp-block-development/SKILL.md +175 -0
- package/.agents/skills/wp-block-development/references/attributes-and-serialization.md +22 -0
- package/.agents/skills/wp-block-development/references/block-json.md +49 -0
- package/.agents/skills/wp-block-development/references/creating-new-blocks.md +46 -0
- package/.agents/skills/wp-block-development/references/debugging.md +36 -0
- package/.agents/skills/wp-block-development/references/deprecations.md +24 -0
- package/.agents/skills/wp-block-development/references/dynamic-rendering.md +23 -0
- package/.agents/skills/wp-block-development/references/inner-blocks.md +25 -0
- package/.agents/skills/wp-block-development/references/registration.md +30 -0
- package/.agents/skills/wp-block-development/references/supports-and-wrappers.md +18 -0
- package/.agents/skills/wp-block-development/references/tooling-and-testing.md +21 -0
- package/.agents/skills/wp-block-development/scripts/list_blocks.mjs +121 -0
- package/.agents/skills/wp-block-themes/SKILL.md +117 -0
- package/.agents/skills/wp-block-themes/references/creating-new-block-theme.md +37 -0
- package/.agents/skills/wp-block-themes/references/debugging.md +24 -0
- package/.agents/skills/wp-block-themes/references/patterns.md +18 -0
- package/.agents/skills/wp-block-themes/references/style-variations.md +14 -0
- package/.agents/skills/wp-block-themes/references/templates-and-parts.md +16 -0
- package/.agents/skills/wp-block-themes/references/theme-json.md +59 -0
- package/.agents/skills/wp-block-themes/scripts/detect_block_themes.mjs +117 -0
- package/.agents/skills/wp-interactivity-api/SKILL.md +180 -0
- package/.agents/skills/wp-interactivity-api/references/debugging.md +29 -0
- package/.agents/skills/wp-interactivity-api/references/directives-quickref.md +30 -0
- package/.agents/skills/wp-interactivity-api/references/server-side-rendering.md +310 -0
- package/.agents/skills/wp-performance/SKILL.md +147 -0
- package/.agents/skills/wp-performance/references/autoload-options.md +24 -0
- package/.agents/skills/wp-performance/references/cron.md +20 -0
- package/.agents/skills/wp-performance/references/database.md +20 -0
- package/.agents/skills/wp-performance/references/http-api.md +15 -0
- package/.agents/skills/wp-performance/references/measurement.md +21 -0
- package/.agents/skills/wp-performance/references/object-cache.md +24 -0
- package/.agents/skills/wp-performance/references/query-monitor-headless.md +38 -0
- package/.agents/skills/wp-performance/references/server-timing.md +22 -0
- package/.agents/skills/wp-performance/references/wp-cli-doctor.md +24 -0
- package/.agents/skills/wp-performance/references/wp-cli-profile.md +32 -0
- package/.agents/skills/wp-performance/scripts/perf_inspect.mjs +128 -0
- package/.agents/skills/wp-phpstan/SKILL.md +98 -0
- package/.agents/skills/wp-phpstan/references/configuration.md +52 -0
- package/.agents/skills/wp-phpstan/references/third-party-classes.md +76 -0
- package/.agents/skills/wp-phpstan/references/wordpress-annotations.md +124 -0
- package/.agents/skills/wp-phpstan/scripts/phpstan_inspect.mjs +263 -0
- package/.agents/skills/wp-playground/SKILL.md +233 -0
- package/.agents/skills/wp-playground/references/blueprints.md +36 -0
- package/.agents/skills/wp-playground/references/cli-commands.md +39 -0
- package/.agents/skills/wp-playground/references/debugging.md +16 -0
- package/.agents/skills/wp-playground/references/e2e-playwright.md +115 -0
- package/.agents/skills/wp-plugin-development/SKILL.md +113 -0
- package/.agents/skills/wp-plugin-development/references/data-and-cron.md +19 -0
- package/.agents/skills/wp-plugin-development/references/debugging.md +19 -0
- package/.agents/skills/wp-plugin-development/references/lifecycle.md +33 -0
- package/.agents/skills/wp-plugin-development/references/security.md +29 -0
- package/.agents/skills/wp-plugin-development/references/settings-api.md +22 -0
- package/.agents/skills/wp-plugin-development/references/structure.md +16 -0
- package/.agents/skills/wp-plugin-development/scripts/detect_plugins.mjs +122 -0
- package/.agents/skills/wp-plugin-directory-guidelines/SKILL.md +133 -0
- package/.agents/skills/wp-plugin-directory-guidelines/references/gpl-compliance.md +217 -0
- package/.agents/skills/wp-plugin-directory-guidelines/references/guideline-review-checklist.md +592 -0
- package/.agents/skills/wp-plugin-directory-guidelines/references/naming-rules.md +121 -0
- package/.agents/skills/wp-project-triage/SKILL.md +39 -0
- package/.agents/skills/wp-project-triage/references/triage.schema.json +143 -0
- package/.agents/skills/wp-project-triage/scripts/detect_wp_project.mjs +610 -0
- package/.agents/skills/wp-rest-api/SKILL.md +115 -0
- package/.agents/skills/wp-rest-api/references/authentication.md +18 -0
- package/.agents/skills/wp-rest-api/references/custom-content-types.md +20 -0
- package/.agents/skills/wp-rest-api/references/discovery-and-params.md +20 -0
- package/.agents/skills/wp-rest-api/references/responses-and-fields.md +30 -0
- package/.agents/skills/wp-rest-api/references/routes-and-endpoints.md +36 -0
- package/.agents/skills/wp-rest-api/references/schema.md +22 -0
- package/.agents/skills/wp-wpcli-and-ops/SKILL.md +126 -0
- package/.agents/skills/wp-wpcli-and-ops/references/automation.md +30 -0
- package/.agents/skills/wp-wpcli-and-ops/references/cron-and-cache.md +23 -0
- package/.agents/skills/wp-wpcli-and-ops/references/debugging.md +17 -0
- package/.agents/skills/wp-wpcli-and-ops/references/multisite.md +22 -0
- package/.agents/skills/wp-wpcli-and-ops/references/packages-and-updates.md +22 -0
- package/.agents/skills/wp-wpcli-and-ops/references/safety.md +30 -0
- package/.agents/skills/wp-wpcli-and-ops/references/search-replace.md +40 -0
- package/.agents/skills/wp-wpcli-and-ops/scripts/wpcli_inspect.mjs +90 -0
- package/.agents/skills/wp-wpengine/SKILL.md +398 -0
- package/.agents/skills/wp-wpengine/references/ci-gate.md +469 -0
- package/.agents/skills/wp-wpengine/references/github-actions-deploy.md +736 -0
- package/.agents/skills/wp-wpengine/scripts/ci-gate.sh +118 -0
- package/.agents/skills/wp-wpengine/scripts/wpe-check.sh +89 -0
- package/.agents/skills/wp-wpengine/scripts/wpe-preflight.sh +104 -0
- package/.agents/skills/wpds/SKILL.md +59 -0
- package/.github/agents/wp-architect.agent.md +1 -2
- package/.github/copilot-instructions.md +1 -1
- package/.github/instructions/wordpress-workflow.instructions.md +3 -3
- package/.github/skills/wp-playground/SKILL.md +132 -1
- package/.github/skills/wp-playground/references/e2e-playwright.md +115 -0
- package/.github/skills/wp-wpengine/SKILL.md +127 -0
- package/AGENTS.md +22 -10
- package/AGENTS.template.md +20 -10
- package/README.md +93 -86
- package/dist/cli.js +5 -1
- package/dist/commands/clean-skills.js +64 -0
- package/dist/commands/setup.js +6 -2
- package/dist/commands/sync-skills.js +3 -0
- package/dist/lib/api.js +176 -4
- package/dist/lib/installer.js +166 -2
- package/extensions/wp-agent-kit/index.ts +185 -10
- package/package.json +10 -14
- package/skills-custom/wp-wpengine/SKILL.md +398 -0
- package/skills-custom/wp-wpengine/references/ci-gate.md +469 -0
- package/skills-custom/wp-wpengine/references/github-actions-deploy.md +736 -0
- package/skills-custom/wp-wpengine/scripts/ci-gate.sh +118 -0
- package/skills-custom/wp-wpengine/scripts/wpe-check.sh +89 -0
- package/skills-custom/wp-wpengine/scripts/wpe-preflight.sh +104 -0
- package/.github/workflows/ci.yml +0 -44
- package/.husky/pre-commit +0 -7
- package/CLI_REVIEW.md +0 -250
- package/biome.json +0 -39
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wp-wpengine
|
|
3
|
+
description: "Optional: Use for WP Engine hosting workflows — SSH-based git push to WP Engine environments, managing installs/domains/cache/backups via the wpe-labs Claude Code skills, and WP Engine API access. Requires WPE_USERNAME and WPE_PASSWORD env vars."
|
|
4
|
+
license: GPL-2.0-or-later
|
|
5
|
+
optional: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# WP Engine
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
|
|
12
|
+
- Deploy WordPress code to a WP Engine environment via `git push`.
|
|
13
|
+
- Manage WP Engine installs, domains, cache, backups, or users through natural language.
|
|
14
|
+
- Generate monthly usage/bandwidth reports across WP Engine accounts.
|
|
15
|
+
- Manage LargeFS media offload configuration.
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
- SSH key for WP Engine git push stored in 1Password (`Employee` vault, item `wpengine_ed25519`).
|
|
20
|
+
- WP Engine API credentials in 1Password (`Employee` vault, item `WP Engine API`).
|
|
21
|
+
- `op` CLI authenticated (`op whoami` works).
|
|
22
|
+
- The `wpe-labs` Claude Code skills installed (`~/.claude/skills/wpe-labs:*`).
|
|
23
|
+
|
|
24
|
+
## Procedure
|
|
25
|
+
|
|
26
|
+
### 1) First-time SSH setup on a new machine
|
|
27
|
+
|
|
28
|
+
Pull the private key from 1Password and configure SSH:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
op read "op://Employee/wpengine_ed25519/private key" > ~/.ssh/wpengine_ed25519
|
|
32
|
+
chmod 600 ~/.ssh/wpengine_ed25519
|
|
33
|
+
ssh-keyscan git.wpengine.com >> ~/.ssh/known_hosts
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Add to `~/.ssh/config` (before any `Host *` block):
|
|
37
|
+
```
|
|
38
|
+
Host git.wpengine.com
|
|
39
|
+
User git
|
|
40
|
+
IdentityFile ~/.ssh/wpengine_ed25519
|
|
41
|
+
IdentitiesOnly yes
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Verify:
|
|
45
|
+
```bash
|
|
46
|
+
ssh git@git.wpengine.com info
|
|
47
|
+
# Expected: hello <username> / R W <install-name>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The public key is already registered on WP Engine — no portal action needed on new machines.
|
|
51
|
+
|
|
52
|
+
### 2) Add a WP Engine git remote
|
|
53
|
+
|
|
54
|
+
Find the remote URL on the WP Engine portal: `https://my.wpengine.com/installs/<ENV>/git_push`
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
git remote add wpengine git@git.wpengine.com:<install-name>.git
|
|
58
|
+
# Example for staging:
|
|
59
|
+
git remote add wpengine-staging git@git.wpengine.com:<install-name>stg.git
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 3) Deploy via git push
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
git push wpengine main
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- WP Engine deploys the pushed branch automatically.
|
|
69
|
+
- Only the WordPress files are pushed (not `node_modules`, build artifacts, etc.).
|
|
70
|
+
- After push, WP Engine may take 1–2 min to propagate the deploy.
|
|
71
|
+
|
|
72
|
+
### 4) wpe-labs skills (natural language management)
|
|
73
|
+
|
|
74
|
+
Load API credentials, then use any `/wpe-labs:*` skill:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Load credentials from 1Password for the session
|
|
78
|
+
eval $(op run --env-file ~/.config/op-ssh/.env.1pass -- env | grep ^WPE | sed 's/^/export /')
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Available skills:
|
|
82
|
+
|
|
83
|
+
| Skill | What it does | Risk |
|
|
84
|
+
|---|---|---|
|
|
85
|
+
| `/wpe-labs:account-usage` | Bandwidth, visits, storage across accounts | 🟢 Read-only |
|
|
86
|
+
| `/wpe-labs:monthly-report` | Client-ready monthly usage report | 🟢 Read-only |
|
|
87
|
+
| `/wpe-labs:backups` | On-demand backups + progress monitoring | 🟡 Write |
|
|
88
|
+
| `/wpe-labs:cache` | Purge object/page/CDN cache | 🟡 Write |
|
|
89
|
+
| `/wpe-labs:users` | List, invite, update roles, remove users | 🟡/🔴 |
|
|
90
|
+
| `/wpe-labs:domains` | Manage domains, DNS, SSL | 🟡/🔴 |
|
|
91
|
+
| `/wpe-labs:installs` | List, create, copy WordPress installs | 🟡/🔴 |
|
|
92
|
+
| `/wpe-labs:offload` | LargeFS media offload config | 🟡 Write |
|
|
93
|
+
|
|
94
|
+
Example prompts:
|
|
95
|
+
```
|
|
96
|
+
/wpe-labs:account-usage which accounts are closest to their bandwidth limit?
|
|
97
|
+
/wpe-labs:cache purge all cache for uofdev production
|
|
98
|
+
/wpe-labs:backups back up uofdev production before deployment
|
|
99
|
+
/wpe-labs:installs copy uofdev production to staging
|
|
100
|
+
/wpe-labs:monthly-report last month
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 5) Re-installing wpe-labs skills
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
curl -fsSL https://raw.githubusercontent.com/wpengine/wpe-labs-platform-skills/main/install.sh | bash
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Verification
|
|
110
|
+
|
|
111
|
+
- SSH: `ssh git@git.wpengine.com info` — should return `hello <username> / R W <install>`
|
|
112
|
+
- API: `op run --env-file ~/.config/op-ssh/.env.1pass -- bash -c 'curl -s -u "$WPE_USERNAME:$WPE_PASSWORD" https://api.wpengineapi.com/v1/user | jq .email'`
|
|
113
|
+
|
|
114
|
+
## Failure modes
|
|
115
|
+
|
|
116
|
+
- **SSH: Host key verification failed** — re-run `ssh-keyscan git.wpengine.com >> ~/.ssh/known_hosts`
|
|
117
|
+
- **SSH: Permission denied** — confirm the key is at `~/.ssh/wpengine_ed25519` with `chmod 600`
|
|
118
|
+
- **git push rejected** — verify the remote URL matches the install name exactly
|
|
119
|
+
- **wpe-labs: 401 Unauthorized** — regenerate API credentials at `https://my.wpengine.com/api_access` and update the `WP Engine API` item in 1Password
|
|
120
|
+
- **wpe-labs: storage shows zero** — ask Claude to "refresh storage" (async recalculation, ~30–60s)
|
|
121
|
+
|
|
122
|
+
## References
|
|
123
|
+
|
|
124
|
+
- WP Engine git push portal: `https://my.wpengine.com/installs/<ENV>/git_push`
|
|
125
|
+
- WP Engine API access: `https://my.wpengine.com/api_access`
|
|
126
|
+
- wpe-labs skills source: `https://github.com/wpengine/wpe-labs-platform-skills`
|
|
127
|
+
- SSH setup log (first machine): gist `602d6a16ddfea438c0611a8e5cc31d5e`
|
package/AGENTS.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# Project: WordPress Agent Kit (CLI)
|
|
2
2
|
|
|
3
|
-
This is a Node.js CLI tool (`wp-agent-kit`) designed to scaffold AI agent configuration for WordPress projects. It helps developers quickly set up `AGENTS.md` and `.
|
|
3
|
+
This is a Node.js CLI tool (`wp-agent-kit`) designed to scaffold AI agent configuration for WordPress projects. It helps developers quickly set up `AGENTS.md` and `.agents/skills/` in their repositories.
|
|
4
4
|
|
|
5
5
|
## Tech Stack
|
|
6
|
+
|
|
6
7
|
- **Language**: TypeScript (Node.js)
|
|
7
8
|
- **Framework**: Commander.js
|
|
8
9
|
- **Prompting**: `@clack/prompts`
|
|
@@ -11,20 +12,24 @@ This is a Node.js CLI tool (`wp-agent-kit`) designed to scaffold AI agent config
|
|
|
11
12
|
- **Lint/Format**: Biome + ESLint
|
|
12
13
|
|
|
13
14
|
## Architecture
|
|
15
|
+
|
|
14
16
|
- **Entry Point**: `src/cli.ts`
|
|
15
17
|
- **Commands**: `src/commands/*.ts` (e.g., `install`, `setup`, `sync-skills`, `playground`, `upgrade`)
|
|
16
18
|
- **Core Logic**: `src/lib/*.ts` (e.g., `installer.ts` for file copying, `triage-mapper.ts` for project detection, `api.ts` for programmatic API)
|
|
17
19
|
- **Utilities**: `src/utils/*.ts` (e.g., `paths.ts`, `run.ts`, `output.ts`, `exit-codes.ts`)
|
|
18
|
-
- **Assets**:
|
|
20
|
+
- **Assets**:
|
|
19
21
|
- `AGENTS.template.md`: The template file copied to user projects.
|
|
20
|
-
- `.github/`:
|
|
21
|
-
-
|
|
22
|
+
- `.github/`: Platform-specific agents, instructions, and prompts (copied to target platform dir).
|
|
23
|
+
- `.agents/skills/`: Universal skills directory (AgentSkills.io convention), copied to target `.agents/skills/`.
|
|
24
|
+
- `skills-custom/`: Custom skills that survive upstream syncs, merged into `.agents/skills/` on install.
|
|
22
25
|
|
|
23
26
|
## Package Exports
|
|
27
|
+
|
|
24
28
|
- `wordpress-agent-kit` → CLI entry (`dist/cli.js`)
|
|
25
29
|
- `wordpress-agent-kit/api` → Programmatic API (`dist/lib/api.js`)
|
|
26
30
|
|
|
27
31
|
## Development Workflow
|
|
32
|
+
|
|
28
33
|
- **Run locally**: `npm run dev` (uses `tsx src/cli.ts`)
|
|
29
34
|
- **Build**: `npm run build` (outputs to `dist/`)
|
|
30
35
|
- **TypeCheck**: `npm run check` (no-emit type checking)
|
|
@@ -34,29 +39,36 @@ This is a Node.js CLI tool (`wp-agent-kit`) designed to scaffold AI agent config
|
|
|
34
39
|
- **Pre-commit**: Husky runs lint:check + test:run
|
|
35
40
|
|
|
36
41
|
## Key Commands
|
|
37
|
-
|
|
42
|
+
|
|
43
|
+
- `install`: Copies `.agents/skills/` (universal convention), platform agents/instructions, and `AGENTS.md` template to a target directory. Supports `--json`, `--dry-run`, `--ndjson`. Merges custom skills from `skills-custom/`.
|
|
38
44
|
- `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 `.
|
|
45
|
+
- `sync-skills`: Pulls skills from `WordPress/agent-skills` into `.agents/skills/` (canonical, AgentSkills.io convention), merging custom skills from `skills-custom/`. Supports `--json`, `--dry-run`.
|
|
46
|
+
- `clean-skills`: Detects and removes orphaned skills that are no longer part of the kit. Supports `--dry-run`, `--remove`, `--json`.
|
|
40
47
|
- `playground`: Launches a local WordPress Playground instance using a blueprint.
|
|
41
48
|
- `upgrade`: Checks for and applies newer versions. Supports `--check-only`, `--force`, `--json`.
|
|
42
49
|
|
|
43
50
|
## Agent-Friendly Features (v0.3.0+)
|
|
51
|
+
|
|
44
52
|
- `--json`: Structured JSON output with success/data/error/time fields
|
|
45
53
|
- `--dry-run`: Preview mode showing what would happen without making changes
|
|
46
54
|
- `--ndjson`: Newline-delimited JSON for streaming long operations
|
|
47
55
|
- `--quiet`: Suppress non-essential output
|
|
48
56
|
- **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'`
|
|
57
|
+
- **Programmatic API**: `import { installKitApi, syncSkillsApi, runTriageApi, configureAgentsMdApi, cleanSkillsApi } from 'wordpress-agent-kit/api'`
|
|
50
58
|
|
|
51
59
|
## Notes for Agents
|
|
60
|
+
|
|
52
61
|
- When modifying commands, ensure you update the corresponding JSDoc comments.
|
|
53
62
|
- The `src/lib/installer.ts` file is critical as it handles the file copying logic.
|
|
54
63
|
- The `src/lib/triage-mapper.ts` file contains logic for mapping project detection results to configuration options.
|
|
55
64
|
- 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 `.
|
|
65
|
+
- The `vendor` directory is gitignored and populated via submodule or script. Upstream skills sync to `.github/skills/` (sync buffer) then copy to `.agents/skills/` (canonical).
|
|
66
|
+
- The `.agents/skills/` directory contains 18 WordPress skills (17 upstream + 1 custom `wp-wpengine`) following the AgentSkills.io spec. Skills are installed to `.agents/skills/` (universal convention) instead of platform-specific directories.
|
|
58
67
|
- CI runs on every push: lint, typecheck, test, build. No publish workflow (manual npm publish only).
|
|
59
68
|
|
|
60
69
|
## Pi Extension (Package)
|
|
70
|
+
|
|
61
71
|
- `pi.extensions`: `./extensions/wp-agent-kit` — registers WordPress agent tools
|
|
62
|
-
- `pi.skills`: `./.
|
|
72
|
+
- `pi.skills`: `./.agents/skills` — 18 WordPress skills discoverable by Pi (17 upstream + `wp-wpengine` custom from `skills-custom/`). Uses AgentSkills.io convention.
|
|
73
|
+
- Tools: `wp_triage`, `wp_install_kit`, `wp_sync_skills`, `wp_upgrade`, `wp_clean_skills`
|
|
74
|
+
- Commands: `/wp-triage`, `/wp-install`, `/wp-sync-skills`, `/wp-upgrade`, `/wp-clean-skills`
|
package/AGENTS.template.md
CHANGED
|
@@ -6,23 +6,33 @@ This repository is WordPress-centric (plugin, theme, block theme, or site). Agen
|
|
|
6
6
|
|
|
7
7
|
- **Core Agent**: `.github/agents/wp-architect.agent.md` — the primary agent persona
|
|
8
8
|
- **Workflow Instructions**: `.github/instructions/wordpress-workflow.instructions.md` — project-specific conventions
|
|
9
|
-
- **Skills**: `.
|
|
9
|
+
- **Skills**: `.agents/skills/` — specialized agent skills for WordPress development
|
|
10
10
|
|
|
11
11
|
## Project Discovery (Required Before Changes)
|
|
12
12
|
|
|
13
13
|
1. **Run project triage** to classify the codebase:
|
|
14
|
+
|
|
14
15
|
```bash
|
|
15
|
-
node .
|
|
16
|
+
node .agents/skills/wp-project-triage/scripts/detect_wp_project.mjs
|
|
16
17
|
```
|
|
18
|
+
|
|
17
19
|
This outputs a JSON report with project kind, signals, and tooling.
|
|
18
20
|
|
|
19
21
|
2. **Route to the right skill**:
|
|
20
|
-
- If routing is unclear, consult `.
|
|
22
|
+
- If routing is unclear, consult `.agents/skills/wordpress-router/references/decision-tree.md`
|
|
21
23
|
- For plugins: `wp-plugin-development`
|
|
22
24
|
- For block themes: `wp-block-themes`
|
|
23
25
|
- For Gutenberg blocks: `wp-block-development`
|
|
24
26
|
- For REST API work: `wp-rest-api`
|
|
27
|
+
- For Interactivity API: `wp-interactivity-api`
|
|
28
|
+
- For Abilities API: `wp-abilities-api` / `wp-abilities-audit` / `wp-abilities-verify`
|
|
25
29
|
- For WP-CLI operations: `wp-wpcli-and-ops`
|
|
30
|
+
- For Playground testing (PHPUnit, E2E, CI): `wp-playground`
|
|
31
|
+
- For Performance profiling: `wp-performance`
|
|
32
|
+
- For PHPStan static analysis: `wp-phpstan`
|
|
33
|
+
- For WP Engine hosting: `wp-wpengine` (optional, requires env vars)
|
|
34
|
+
- For Design System components: `wpds`
|
|
35
|
+
- For plugin directory submission: `wp-plugin-directory-guidelines`
|
|
26
36
|
|
|
27
37
|
3. **Update repo-specific guidance** based on triage results:
|
|
28
38
|
- Confirm the project prefix (functions, classes, constants)
|
|
@@ -43,13 +53,13 @@ This repository is WordPress-centric (plugin, theme, block theme, or site). Agen
|
|
|
43
53
|
|
|
44
54
|
<!-- Populated by project triage — do not remove -->
|
|
45
55
|
|
|
46
|
-
| Purpose
|
|
47
|
-
|
|
48
|
-
| Build
|
|
49
|
-
| Lint (PHP)
|
|
50
|
-
| Lint (JS/CSS) | <!-- e.g., npm run lint -->
|
|
51
|
-
| Test
|
|
52
|
-
| Dev server
|
|
56
|
+
| Purpose | Command |
|
|
57
|
+
| ------------- | -------------------------------------- |
|
|
58
|
+
| Build | <!-- e.g., npm run build --> |
|
|
59
|
+
| Lint (PHP) | <!-- e.g., composer lint --> |
|
|
60
|
+
| Lint (JS/CSS) | <!-- e.g., npm run lint --> |
|
|
61
|
+
| Test | <!-- e.g., npm test, composer test --> |
|
|
62
|
+
| Dev server | <!-- e.g., npm start --> |
|
|
53
63
|
|
|
54
64
|
## Code Conventions
|
|
55
65
|
|
package/README.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
[](LICENSE)
|
|
4
4
|
[](https://www.typescriptlang.org/)
|
|
5
|
-
[](package.json)
|
|
6
6
|
[](package.json)
|
|
7
7
|
[](.github/workflows/ci.yml)
|
|
8
8
|
|
|
9
|
-
**WordPress-focused AI agent starter kit** for GitHub Copilot, Cursor, Claude, and Pi Coding Agent. Installs
|
|
9
|
+
**WordPress-focused AI agent starter kit** for GitHub Copilot, Cursor, Claude, and Pi Coding Agent. Installs 17 specialized WordPress agent skills (plus an optional WP Engine skill), 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
|
|
|
@@ -26,21 +26,17 @@ npx wp-agent-kit install /path/to/my-plugin --platform github
|
|
|
26
26
|
npx wp-agent-kit setup /path/to/my-plugin --auto
|
|
27
27
|
|
|
28
28
|
# 3. (Optional) Verify the triage report
|
|
29
|
-
node .
|
|
29
|
+
node .agents/skills/wp-project-triage/scripts/detect_wp_project.mjs
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
**What gets installed:**
|
|
33
|
+
|
|
33
34
|
```
|
|
34
35
|
my-plugin/
|
|
35
36
|
├── AGENTS.md # Project-specific agent instructions
|
|
36
37
|
├── AGENTS.template.md # Template reference for future updates
|
|
37
|
-
├── .
|
|
38
|
-
│
|
|
39
|
-
│ │ └── wp-architect.agent.md # WordPress Architect agent persona
|
|
40
|
-
│ ├── instructions/
|
|
41
|
-
│ │ └── wordpress-workflow.instructions.md
|
|
42
|
-
│ ├── prompts/
|
|
43
|
-
│ └── skills/ # 17 WordPress skills
|
|
38
|
+
├── .agents/
|
|
39
|
+
│ └── skills/ # 18 WordPress skills (AgentSkills.io convention)
|
|
44
40
|
│ ├── wp-project-triage/ # Project detection
|
|
45
41
|
│ ├── wp-plugin-development/ # Plugin architecture
|
|
46
42
|
│ ├── wp-block-development/ # Gutenberg blocks
|
|
@@ -51,9 +47,16 @@ my-plugin/
|
|
|
51
47
|
│ ├── wp-performance/ # Performance profiling
|
|
52
48
|
│ ├── wp-phpstan/ # Static analysis
|
|
53
49
|
│ ├── wp-wpcli-and-ops/ # WP-CLI operations
|
|
54
|
-
│ ├── wp-playground/ # Testing environments
|
|
50
|
+
│ ├── wp-playground/ # Testing environments (PHPUnit, Playwright, CI)
|
|
55
51
|
│ ├── wpds/ # Design system
|
|
56
|
-
│
|
|
52
|
+
│ ├── wordpress-router/ # Repo classification
|
|
53
|
+
│ └── wp-wpengine/ # (optional) WP Engine hosting + git push
|
|
54
|
+
├── .github/
|
|
55
|
+
│ ├── agents/
|
|
56
|
+
│ │ └── wp-architect.agent.md # WordPress Architect agent persona
|
|
57
|
+
│ ├── instructions/
|
|
58
|
+
│ │ └── wordpress-workflow.instructions.md
|
|
59
|
+
│ └── prompts/
|
|
57
60
|
└── .wp-agent-kit-manifest.github.json # Safe-update tracking
|
|
58
61
|
```
|
|
59
62
|
|
|
@@ -64,7 +67,7 @@ my-plugin/
|
|
|
64
67
|
npx wp-agent-kit install /path/to/existing-plugin --platform github
|
|
65
68
|
|
|
66
69
|
# 2. Run triage to detect your project's type, tech stack, and tooling
|
|
67
|
-
node .
|
|
70
|
+
node .agents/skills/wp-project-triage/scripts/detect_wp_project.mjs
|
|
68
71
|
|
|
69
72
|
# 3. Configure based on detection (headless)
|
|
70
73
|
npx wp-agent-kit setup /path/to/existing-plugin --auto
|
|
@@ -78,6 +81,7 @@ npx wp-agent-kit setup /path/to/existing-plugin \
|
|
|
78
81
|
```
|
|
79
82
|
|
|
80
83
|
**Key behavior:**
|
|
84
|
+
|
|
81
85
|
- Your existing `AGENTS.md` is **never overwritten** — only new sections are added
|
|
82
86
|
- Triage inspects your codebase and returns structured JSON with project kind, signals, and tooling
|
|
83
87
|
- Setup updates only the tooling/configuration sections of AGENTS.md
|
|
@@ -96,6 +100,7 @@ npx wp-agent-kit upgrade --force
|
|
|
96
100
|
```
|
|
97
101
|
|
|
98
102
|
**Safe update behavior:**
|
|
103
|
+
|
|
99
104
|
- Compares installed files against a manifest of original hashes
|
|
100
105
|
- Files you haven't modified → automatically updated
|
|
101
106
|
- Files you modified → **skipped** (preserved)
|
|
@@ -113,32 +118,32 @@ npx wp-agent-kit install --no-safe --force
|
|
|
113
118
|
|
|
114
119
|
### CLI Commands
|
|
115
120
|
|
|
116
|
-
| Command
|
|
117
|
-
|
|
118
|
-
| `install [dir]`
|
|
119
|
-
| `setup [dir]`
|
|
121
|
+
| Command | Purpose |
|
|
122
|
+
| ------------------- | ---------------------------------------------- |
|
|
123
|
+
| `install [dir]` | Install kit into a project |
|
|
124
|
+
| `setup [dir]` | Interactive or headless configuration |
|
|
120
125
|
| `sync-skills [ref]` | Pull latest skills from WordPress/agent-skills |
|
|
121
|
-
| `upgrade [dir]`
|
|
122
|
-
| `playground`
|
|
126
|
+
| `upgrade [dir]` | Check or apply version upgrades |
|
|
127
|
+
| `playground` | Launch local WordPress Playground |
|
|
123
128
|
|
|
124
129
|
### Platform Flags
|
|
125
130
|
|
|
126
|
-
| Platform
|
|
127
|
-
|
|
128
|
-
| GitHub Copilot / VS Code | `--platform github` | `.github/`
|
|
129
|
-
| Cursor IDE
|
|
130
|
-
| Claude Code
|
|
131
|
-
| Pi Coding Agent
|
|
132
|
-
| Generic .agent
|
|
131
|
+
| Platform | Flag | Target Directory |
|
|
132
|
+
| ------------------------ | ------------------- | ---------------- |
|
|
133
|
+
| GitHub Copilot / VS Code | `--platform github` | `.github/` |
|
|
134
|
+
| Cursor IDE | `--platform cursor` | `.cursor/` |
|
|
135
|
+
| Claude Code | `--platform claude` | `.claude/` |
|
|
136
|
+
| Pi Coding Agent | `--platform pi` | `.pi/agent/` |
|
|
137
|
+
| Generic .agent | `--platform agent` | `.agent/` |
|
|
133
138
|
|
|
134
139
|
### Agent-Friendly Flags (All Commands)
|
|
135
140
|
|
|
136
|
-
| Flag
|
|
137
|
-
|
|
138
|
-
| `--json`
|
|
139
|
-
| `--dry-run` | Preview changes without applying
|
|
140
|
-
| `--ndjson`
|
|
141
|
-
| `--quiet`
|
|
141
|
+
| Flag | Description |
|
|
142
|
+
| ----------- | ------------------------------------ |
|
|
143
|
+
| `--json` | Machine-readable JSON output |
|
|
144
|
+
| `--dry-run` | Preview changes without applying |
|
|
145
|
+
| `--ndjson` | Newline-delimited JSON for streaming |
|
|
146
|
+
| `--quiet` | Suppress non-error output |
|
|
142
147
|
|
|
143
148
|
---
|
|
144
149
|
|
|
@@ -152,21 +157,21 @@ pi install npm:wordpress-agent-kit
|
|
|
152
157
|
|
|
153
158
|
### Pi Tools (Callable by the Agent)
|
|
154
159
|
|
|
155
|
-
| Tool
|
|
156
|
-
|
|
157
|
-
| `wp_triage`
|
|
160
|
+
| Tool | What it does |
|
|
161
|
+
| ---------------- | --------------------------------------------------- |
|
|
162
|
+
| `wp_triage` | Detect WordPress project type, signals, and tooling |
|
|
158
163
|
| `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`
|
|
164
|
+
| `wp_sync_skills` | Sync skills from WordPress/agent-skills upstream |
|
|
165
|
+
| `wp_upgrade` | Check and apply version upgrades |
|
|
161
166
|
|
|
162
167
|
### Pi Commands (Type `/` in Pi TUI)
|
|
163
168
|
|
|
164
|
-
| Command
|
|
165
|
-
|
|
166
|
-
| `/wp-triage [dir]`
|
|
167
|
-
| `/wp-install [dir]`
|
|
168
|
-
| `/wp-sync-skills [ref]` | Sync skills from upstream
|
|
169
|
-
| `/wp-upgrade`
|
|
169
|
+
| Command | What it does |
|
|
170
|
+
| ----------------------- | ----------------------------------------- |
|
|
171
|
+
| `/wp-triage [dir]` | Run project detection, show in status bar |
|
|
172
|
+
| `/wp-install [dir]` | Install kit into current project |
|
|
173
|
+
| `/wp-sync-skills [ref]` | Sync skills from upstream |
|
|
174
|
+
| `/wp-upgrade` | Show installed vs latest version |
|
|
170
175
|
|
|
171
176
|
---
|
|
172
177
|
|
|
@@ -176,24 +181,24 @@ Import directly into scripts, tests, or other tools:
|
|
|
176
181
|
|
|
177
182
|
```typescript
|
|
178
183
|
import {
|
|
179
|
-
installKitApi,
|
|
180
|
-
syncSkillsApi,
|
|
181
|
-
runTriageApi,
|
|
182
|
-
configureAgentsMdApi,
|
|
183
|
-
computeChanges,
|
|
184
|
-
isKitInstalled,
|
|
185
|
-
loadManifest,
|
|
186
|
-
updateKit,
|
|
187
|
-
ExitCode,
|
|
184
|
+
installKitApi, // Install/update kit
|
|
185
|
+
syncSkillsApi, // Sync skills from upstream
|
|
186
|
+
runTriageApi, // Run project detection
|
|
187
|
+
configureAgentsMdApi, // Configure AGENTS.md
|
|
188
|
+
computeChanges, // Preview file changes (dry-run)
|
|
189
|
+
isKitInstalled, // Check if kit is installed
|
|
190
|
+
loadManifest, // Read install manifest
|
|
191
|
+
updateKit, // Raw safe update
|
|
192
|
+
ExitCode, // Semantic exit codes
|
|
188
193
|
} from 'wordpress-agent-kit/api';
|
|
189
194
|
|
|
190
195
|
// Install with safe update
|
|
191
196
|
const result = await installKitApi({
|
|
192
197
|
targetDir: '/path/to/my-plugin',
|
|
193
198
|
platform: 'github',
|
|
194
|
-
safe: true,
|
|
195
|
-
backup: true,
|
|
196
|
-
force: false,
|
|
199
|
+
safe: true, // Use manifest-based diff
|
|
200
|
+
backup: true, // Create backup before changes
|
|
201
|
+
force: false, // Don't overwrite user mods
|
|
197
202
|
});
|
|
198
203
|
|
|
199
204
|
// Dry-run preview
|
|
@@ -211,42 +216,44 @@ console.log(triage.data.project.primary); // "plugin"
|
|
|
211
216
|
|
|
212
217
|
### Semantic Exit Codes
|
|
213
218
|
|
|
214
|
-
| Code | Meaning
|
|
215
|
-
|
|
216
|
-
| 0
|
|
217
|
-
| 2
|
|
218
|
-
| 3
|
|
219
|
-
| 4
|
|
220
|
-
| 5
|
|
221
|
-
| 6
|
|
222
|
-
| 7
|
|
223
|
-
| 8
|
|
224
|
-
| 130
|
|
219
|
+
| Code | Meaning |
|
|
220
|
+
| ---- | ----------------- |
|
|
221
|
+
| 0 | Success |
|
|
222
|
+
| 2 | Invalid arguments |
|
|
223
|
+
| 3 | Not found |
|
|
224
|
+
| 4 | Permission denied |
|
|
225
|
+
| 5 | Already exists |
|
|
226
|
+
| 6 | Git error |
|
|
227
|
+
| 7 | Network error |
|
|
228
|
+
| 8 | Validation failed |
|
|
229
|
+
| 130 | Cancelled |
|
|
225
230
|
|
|
226
231
|
---
|
|
227
232
|
|
|
228
233
|
## Skills Reference
|
|
229
234
|
|
|
230
|
-
All
|
|
231
|
-
|
|
232
|
-
| Skill
|
|
233
|
-
|
|
234
|
-
| `wp-project-triage`
|
|
235
|
-
| `wp-plugin-development`
|
|
236
|
-
| `wp-block-development`
|
|
237
|
-
| `wp-block-themes`
|
|
238
|
-
| `wp-rest-api`
|
|
239
|
-
| `wp-interactivity-api`
|
|
240
|
-
| `wp-abilities-api`
|
|
241
|
-
| `wp-abilities-audit`
|
|
242
|
-
| `wp-abilities-verify`
|
|
243
|
-
| `wp-performance`
|
|
244
|
-
| `wp-phpstan`
|
|
245
|
-
| `wp-wpcli-and-ops`
|
|
246
|
-
| `wp-playground`
|
|
247
|
-
| `blueprint`
|
|
248
|
-
| `wpds`
|
|
249
|
-
| `wp-plugin-directory-guidelines`
|
|
235
|
+
All 18 skills follow the [AgentSkills.io](https://agentskills.io) specification. Skills in `skills-custom/` are project-specific (not from upstream) and survive `sync-skills`:
|
|
236
|
+
|
|
237
|
+
| Skill | When to Use |
|
|
238
|
+
| -------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
239
|
+
| `wp-project-triage` | Run deterministic project detection (type, tooling, versions) |
|
|
240
|
+
| `wp-plugin-development` | Develop WordPress plugins (hooks, settings, security, release) |
|
|
241
|
+
| `wp-block-development` | Develop Gutenberg blocks (block.json, attributes, rendering) |
|
|
242
|
+
| `wp-block-themes` | Develop block themes (theme.json, templates, patterns, variations) |
|
|
243
|
+
| `wp-rest-api` | Build, extend, or debug REST API endpoints/routes |
|
|
244
|
+
| `wp-interactivity-api` | Build Interactive blocks with data-wp-\* directives |
|
|
245
|
+
| `wp-abilities-api` | Register and consume WordPress Abilities API |
|
|
246
|
+
| `wp-abilities-audit` | Audit a plugin's REST surface for Abilities API opportunities |
|
|
247
|
+
| `wp-abilities-verify` | Verify registered Abilities match their annotations |
|
|
248
|
+
| `wp-performance` | Profile and optimize WordPress performance |
|
|
249
|
+
| `wp-phpstan` | Configure and run PHPStan static analysis |
|
|
250
|
+
| `wp-wpcli-and-ops` | WP-CLI commands, automation, multisite operations |
|
|
251
|
+
| `wp-playground` | Test with disposable Playground instances; PHPUnit, Playwright E2E, CI |
|
|
252
|
+
| `blueprint` | Write and edit WordPress Playground blueprint JSON |
|
|
253
|
+
| `wpds` | Build UIs with the WordPress Design System |
|
|
254
|
+
| `wp-plugin-directory-guidelines` | GPL compliance, naming, slug rules for WP.org submission |
|
|
255
|
+
| `wordpress-router` | Route/classify repository type and select appropriate skills |
|
|
256
|
+
| **`wp-wpengine`** _(optional, custom)_ | **WP Engine git push, install/domain/cache/backup management via wpe-labs skills** |
|
|
250
257
|
|
|
251
258
|
---
|
|
252
259
|
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { Command } from 'commander';
|
|
4
|
+
import { cleanSkillsCommand } from './commands/clean-skills.js';
|
|
4
5
|
import { installCommand } from './commands/install.js';
|
|
5
6
|
import { runPlaygroundCommand } from './commands/run-playground.js';
|
|
6
7
|
import { setupCommand } from './commands/setup.js';
|
|
@@ -25,6 +26,7 @@ program
|
|
|
25
26
|
sortSubcommands: true,
|
|
26
27
|
});
|
|
27
28
|
// Add commands
|
|
29
|
+
program.addCommand(cleanSkillsCommand);
|
|
28
30
|
program.addCommand(installCommand);
|
|
29
31
|
program.addCommand(setupCommand);
|
|
30
32
|
program.addCommand(syncSkillsCommand);
|
|
@@ -52,9 +54,11 @@ Examples:
|
|
|
52
54
|
$ wp-agent-kit install --platform github
|
|
53
55
|
$ wp-agent-kit setup --auto --json
|
|
54
56
|
$ wp-agent-kit sync-skills --ref trunk --ndjson
|
|
55
|
-
$ wp-agent-kit
|
|
57
|
+
$ wp-agent-kit clean-skills --dry-run --json
|
|
58
|
+
$ wp-agent-kit clean-skills --remove --platform github
|
|
56
59
|
$ wp-agent-kit upgrade --check-only --json
|
|
57
60
|
|
|
61
|
+
|
|
58
62
|
Programmatic API:
|
|
59
63
|
import { installKit, syncSkills, runTriage } from 'wordpress-agent-kit/api';
|
|
60
64
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { cleanSkillsApi } from '../lib/api.js';
|
|
3
|
+
import { OutputFormatter } from '../utils/output.js';
|
|
4
|
+
function isDryRunResult(result) {
|
|
5
|
+
return result.success && 'wouldExecute' in (result.data || {});
|
|
6
|
+
}
|
|
7
|
+
function isRegularResult(result) {
|
|
8
|
+
return result.success && !('wouldExecute' in (result.data || {}));
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Command to detect and remove orphaned skills from an installation.
|
|
12
|
+
* Compares installed skills against the canonical set (upstream + custom).
|
|
13
|
+
*/
|
|
14
|
+
export const cleanSkillsCommand = new Command('clean-skills')
|
|
15
|
+
.description('Detect and remove orphaned skills from a WordPress Agent Kit installation')
|
|
16
|
+
.argument('[dir]', 'Target directory', process.cwd())
|
|
17
|
+
.option('--platform <platform>', 'Platform to clean (github, cursor, claude, agent, pi)', 'pi')
|
|
18
|
+
.option('--dry-run', 'Preview changes without applying (default: true)', true)
|
|
19
|
+
.option('--remove', 'Actually remove orphaned skills (default: false — report only)', false)
|
|
20
|
+
.option('--json', 'Output as JSON')
|
|
21
|
+
.option('--quiet', 'Suppress non-essential output')
|
|
22
|
+
.action(async (dir, options) => {
|
|
23
|
+
const targetDir = dir || process.cwd();
|
|
24
|
+
const platform = options.platform || 'pi';
|
|
25
|
+
const result = await cleanSkillsApi({
|
|
26
|
+
targetDir,
|
|
27
|
+
platform,
|
|
28
|
+
dryRun: !options.remove, // dry-run unless --remove is specified
|
|
29
|
+
remove: options.remove,
|
|
30
|
+
});
|
|
31
|
+
if (options.json || options.quiet) {
|
|
32
|
+
process.exit(OutputFormatter.getExitCode(result));
|
|
33
|
+
}
|
|
34
|
+
if (isRegularResult(result)) {
|
|
35
|
+
const data = result.data;
|
|
36
|
+
if (data.orphanedSkills.length === 0) {
|
|
37
|
+
console.log('✓ No orphaned skills found. All skills match the canonical set.');
|
|
38
|
+
}
|
|
39
|
+
else if (data.dryRun) {
|
|
40
|
+
console.log(`Found ${data.orphanedSkills.length} orphaned skill(s):`);
|
|
41
|
+
for (const skill of data.orphanedSkills) {
|
|
42
|
+
console.log(` - ${skill}`);
|
|
43
|
+
}
|
|
44
|
+
console.log('\nRun with --remove to remove them.');
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
console.log(`✓ Removed ${data.removedSkills.length} orphaned skill(s):`);
|
|
48
|
+
for (const skill of data.removedSkills) {
|
|
49
|
+
console.log(` - ${skill}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else if (isDryRunResult(result)) {
|
|
54
|
+
const data = result.data;
|
|
55
|
+
console.log(`Dry-run: ${data.summary.orphanedSkills.length} orphaned skill(s) would be removed:`);
|
|
56
|
+
for (const skill of data.summary.orphanedSkills) {
|
|
57
|
+
console.log(` - ${skill}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
console.error(`✗ Clean failed: ${result.error?.message}`);
|
|
62
|
+
}
|
|
63
|
+
process.exit(result.success ? 0 : 1);
|
|
64
|
+
});
|