Add structured verify JSON reports and safe Blueprint materialize export to @wp-playground/cli

未关闭
#4,792 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
javascript, wasm, wordpress

调研方向

Start by reading the @wp-playground/cli implementation and the linked reference patterns wpai verify and wpai export, then review the staged proposal and related PR for the proposed report and state schemas. Agree on the command or Blueprint convention and safety invariants before implementation; done means the upstream interface and minimal PR scope are agreed, with verification and materialization behavior specified.

由索引模型根据 Issue 内容生成。

描述

Problem

@wp-playground/cli already gives agents a one-command, zero-MySQL path to boot Blueprints. Two adjacent contracts are still missing for reliable agent loops:

  1. Structured verify / JSON report — run-blueprint executes steps, but agents lack a first-class, machine-parseable pass/fail report for site options, content presence, REST routes, Abilities, and PHP fatals. Today they scrape logs or invent ad-hoc runPHP probes.
  2. Materialize export — Blueprints often use runPHP / importWxr during ephemeral Playground boots. Replaying raw PHP on production MySQL/MariaDB hosts is unsafe and non-idempotent. Agents need a declarative handoff (WXR + allowlisted state + changed wp-content/) with zero raw runPHP replay.

Proposal

Two thin CLI surfaces (or equivalent Blueprint step + report conventions) in official Playground:

1. Structured verify / JSON report
npx @wp-playground/cli verify \
  --blueprint=./blueprint.json \
  --checks=./verify.json \
  --out=./report.json
# exit 0 iff all checks pass; report.json always written

verify.json would declare expectations only (no agent-supplied executable PHP): site options, published pages/posts by slug/title, CPT counts, terms, theme/plugin presence, REST route presence, Abilities API presence/count, optional live HTTP checks.

report.json should include at least: ok, wordpress_version, php_version, per-check { name, passed, detail }, and php_last_error on failure.

2. Materialize export (WXR + declarative state)
npx @wp-playground/cli materialize \
  --blueprint=./blueprint.json \
  --out=./dist/
# Writes content.wxr + state.json + changed wp-content/; never emits runPHP source

Invariants:

  • Zero raw runPHP replay in the export artifact
  • No secrets (admin accounts, password hashes, salts, SQLite drop-ins)
  • No symlink following under wp-content/
  • Fail safe on host-level untranslatable steps unless an explicit --allow-partial (or equivalent) is set

Non-goal

This is not a proposal to adopt a second official CLI. wpai is a research harness / reference implementation that wraps pinned @wp-playground/cli. After upstream adoption, wpai should call the official commands and shrink.

Reference implementation

Empirical context (honest scope)

Verified in-repo: 63 controlled runs within a single model family; Condition C (verify in the loop) reached 15/15 suitable WordPress selections with live Playground verification and 100% negative-control restraint. Multi-vendor Harbor trials are prepared but not yet run — no cross-vendor claims here.

Ask

  • Schema bikeshed on report + state JSON
  • Willingness to accept a minimal PR after design agreement
  • Preference: new CLI subcommands vs Blueprint step/report conventions
主要语言
JavaScript
星标
2k
派生
504
平均合并
1 天 18 小时
30 天内合并 PR
146

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

WordPress/wordpress-playground 的其他 Issue

查看 WordPress/wordpress-playground 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。