Skip to content

Don't auto-skip plugins/themes in wp_cli#63

Merged
christianc1 merged 2 commits intomainfrom
fix/wpcli-skip-plugins
Apr 30, 2026
Merged

Don't auto-skip plugins/themes in wp_cli#63
christianc1 merged 2 commits intomainfrom
fix/wpcli-skip-plugins

Conversation

@claytoncollie
Copy link
Copy Markdown
Contributor

Summary

runWpCli was always appending --skip-themes --skip-plugins, which made plugin-provided WP-CLI commands (e.g. wp elasticpress stats, wp acf, wp redis) unreachable through the MCP tool — Claude would see "command not found" instead of being able to use the plugin's CLI.

This drops the unconditional flags. Plugins and themes load by default; if a specific plugin/theme fatals, the caller passes --skip-plugins=<slug> (or the bare flag) per command. The tool description now documents this so the agent can self-recover from a plugin fatal without dropping out to a terminal.

  • src/tools/wpcli.ts — remove the auto-injected --skip-themes --skip-plugins; expand the tool description to call out the new default and the per-command escape hatch.
  • tests/tools/__snapshots__/definitions.test.ts.snap — regenerate to match the updated description.

Closes #58

Test plan

  • npm run lint (no new errors; pre-existing warnings only)
  • npx tsc --noEmit
  • npm run test:coverage — 102/102 pass
  • npm run build
  • Against a Local site with ElasticPress: wp_cli with args: "elasticpress stats" returns plugin output instead of "command not found"
  • wp_cli with args: "plugin list --format=json" still works
  • wp_cli with args: "--skip-plugins=problematic-plugin plugin list" — caller-provided skip flag is preserved

Forcing --skip-themes --skip-plugins on every WP-CLI invocation prevented
plugin-provided commands like `wp elasticpress stats`, `wp acf`, and
`wp redis` from being reachable through the MCP tool.

Drop the unconditional flags so plugins and themes load by default. When
a specific plugin or theme is fatally erroring, callers can pass
--skip-plugins=<slug> / --skip-themes=<slug> (or the bare flags) per
command to bypass it. The tool description now documents this so the
agent can self-recover from fatals.

Closes #58
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 29, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 50.19% (🎯 40%) 263 / 524
🔵 Statements 49.9% (🎯 40%) 272 / 545
🔵 Functions 60.24% (🎯 40%) 50 / 83
🔵 Branches 41.35% (🎯 25%) 134 / 324
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/tools/wpcli.ts 44.77% 41.5% 42.85% 42.85% 39-75, 113-157, 172-174, 179-180
Generated in workflow #23 for commit 24771ef by the Vitest Coverage Report Action

Copy link
Copy Markdown
Member

@iandunn iandunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@christianc1 christianc1 merged commit 0e9d444 into main Apr 30, 2026
6 checks passed
@christianc1 christianc1 deleted the fix/wpcli-skip-plugins branch April 30, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skipping plugins for WP-CLI limits usability

3 participants