Skip to content

Add studio ai CLI command with interactive AI agent#2632

Draft
youknowriad wants to merge 12 commits intotrunkfrom
add-studio-ai-command
Draft

Add studio ai CLI command with interactive AI agent#2632
youknowriad wants to merge 12 commits intotrunkfrom
add-studio-ai-command

Conversation

@youknowriad
Copy link
Contributor

@youknowriad youknowriad commented Feb 20, 2026

Related issues

  • Related to AI assistant exploration for Studio CLI

Proposed Changes

Add a new studio ai command — an interactive AI-powered WordPress assistant running in the terminal. Uses the Claude Agent SDK with a pi-tui chat interface. The agent can manage sites, run WP-CLI, create blocks/themes, validate block markup, and take screenshots.

Testing Instructions

  1. npm install && npm run cli:build
  2. node apps/cli/dist/cli/main.js ai
  3. Enter your Anthropic API key when prompted (saved for future use)
  4. Try prompts like:
    • "List all my WordPress sites"
    • "Create a custom block plugin called testimonial-card"
    • "Take a screenshot of [site-url]"
  5. Press Escape to interrupt, Ctrl+C to exit

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@youknowriad
Copy link
Contributor Author

This is not just a Proof of concept in my mind but yeah still early :P

@wojtekn
Copy link
Contributor

wojtekn commented Feb 25, 2026

This is not just a Proof of concept in my mind but yeah still early :P

I used 'Proof of Concept' to signal that we haven't settled on the exact approach yet, not to say the ideas aren't valuable - they are! We're actually about to start a project to integrate Studio with ACP, and what you've built here will definitely help shape that work. Since we don't know the final architecture yet, I'd rather not merge something we might need to rewrite later - but I'd love to keep this PR as a reference as we figure out the direction. Would that work for you?

@youknowriad
Copy link
Contributor Author

Let's discuss a bit after but IMO, We should ship something if it's valuable. I agree with not merging the PR before it's ready though if that's what you meant but if you see this PR as just a "vision PR", this is not my intent, my ultimate intent is to ship the PR.

@youknowriad
Copy link
Contributor Author

This PR is starting to generate really cool sites (great designs, all blocks valid...). I think it's time to start getting some feedback for the generated sites.

Next, I'm going to focus on the UI of the command and to make the PR shippable.

youknowriad and others added 12 commits February 27, 2026 13:57
Introduces an AI-powered WordPress assistant accessible via `studio ai`.
Uses the Claude Agent SDK with a TUI (pi-tui) for interactive conversations.

Features:
- REPL chat interface with markdown rendering and bordered editor
- MCP tools for site management (list, info, start, stop, WP-CLI)
- WordPress development skills via SDK plugins (blocks, themes, patterns)
- BYOK authentication with saved API key
- Session resume across conversation turns
- Escape to interrupt, Ctrl+C to exit
- Human-readable tool status in spinner
- Tool result output display

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Switch to Sonnet model with bypassPermissions mode to prevent tool hanging
- Replace old skills (creating-themes, editing-blocks, editing-themes, generating-patterns)
  with new ones (frontend-design, wordpress-block-theming, wp-interactivity-api)
- Forward Logger progress messages to TUI spinner instead of fighting with ora
- Add directive workflow in system prompt to ensure site creation vs reuse
- Add block markup rules: no HTML blocks, no decorative comments, no emojis
- Fix stale PM2 bus cache causing "SUB connection already being closed" errors
  after site creation by clearing pm2Bus on disconnect

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…m prompt

Remove the SDK plugin/skills system and move block content rules directly
into the system prompt. Switch to Sonnet 4.6, add PM2 keepAlive to prevent
stale bus connections, fix WP-CLI quoted argument parsing, and fix lint issues.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ributes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Validates WordPress block content against registered save() functions
using @wordpress/blocks + @wordpress/block-library with jsdom as DOM
polyfill. The agent must now validate every file with block content and
loop until 0 invalid blocks remain.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Suppress console.error during block validation to eliminate verbose
  block type object dumps from WordPress's validation logging
- Auto-validate post content in wp_cli post create/update commands,
  rejecting invalid blocks before execution
- Add progress messages to validate_blocks showing file and result status
- Track last tool name in UI for context-aware result display
- Increase validation result truncation limit to 2000 chars
- Increase default max turns from 10 to 30
- Make --experimental-wasm-jspi conditional on Node 22+ to fix site
  startup on Node 20
- Add emitProgress helper to logger
- Update system prompt: restructure validation steps, add block content
  checklist, note wp_cli content validation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds a Playwright-based screenshot tool that captures full-page PNG
screenshots of URLs with desktop (1040x1248) and mobile (390x844)
viewport support. The browser instance is lazily initialized and
reused across calls. Returns images in MCP ImageContent format for
the agent to analyze visually.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…reenshots

Restructure system prompt: add design guidelines section with typography,
color, motion, and layout direction. Refine block content rules with
explicit core/html allowlist. Screenshot tool now waits for all images
to load before capturing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a branded welcome header with Wapuu ASCII art in a cyan bordered box,
showing version, model, and working directory. Restyle the prompt editor
to match Claude Code's layout (top/bottom borders, > prefix, placeholder
text). Improve spacing with embedded newlines, add inverse background for
user messages, and support max-turns continuation flow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove the conditional Node version check for --experimental-wasm-jspi
(trunk requires Node 22+). Add a step to check for HTML block abuse
before taking screenshots.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@youknowriad youknowriad force-pushed the add-studio-ai-command branch from 9a0b92d to af42f5c Compare February 27, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants