wcf-validate
目的: 画面HTMLの妥当性を検証し、修正指示を返す。
Required Input
html: stringprefix: string
Validation Priority
- MCP
validate_markup npm run validate:wc- CEM手動突合(最小)
Output Contract
出力は必ず以下の2部構成にする:
- 人間向けの短いMarkdown説明(問題要約)
- 機械可読JSONブロック
{
"passed": false,
"diagnostics": [
{
"level": "error",
"code": "unknownElement",
"message": "<myui-unknown> is not registered"
}
],
"fixSuggestions": [
"replace myui-unknown with myui-card",
"ensure wcf vendor add --component card was executed"
],
"rerunCommands": [
"npm run validate:wc",
"npm run agents:pre-pr"
]
}
Error Contract
VALIDATE_MCP_UNAVAILABLEVALIDATE_REGISTRY_UNAVAILABLEVALIDATE_PREFIX_MISMATCHVALIDATE_INSUFFICIENT_INPUT
Fallback Contract
MCPが使えない場合は npm run validate:wc を主経路とし、失敗時は CEM参照で最小修正案を返す。
Procedure
- 入力HTMLを受け取り検証実行する。
diagnosticsをerror/warning/infoで正規化する。- 各 error に対して1件以上の
fixSuggestionsを付ける。 - 再実行コマンドを
rerunCommandsに返す。 passedを最終判定として返す。
Success Example
- 概要: 問題なし
{
"passed": true,
"diagnostics": [],
"fixSuggestions": [],
"rerunCommands": [
"npm run validate:wc",
"npm run agents:pre-pr"
]
}
Failure Example
- 概要: 入力HTML空
{
"error": {
"code": "VALIDATE_INSUFFICIENT_INPUT",
"message": "html が空です。"
},
"passed": false,
"diagnostics": [],
"fixSuggestions": ["html を渡して再実行"],
"rerunCommands": []
}
Do / Don't
Do
- Run validation before PR — Always execute
validate_markupon changed HTML before submitting a pull request. - Use MCP
validate_markupas primary validator — It checks against CEM schema for accurate component validation. - Check CEM registration for unknown elements —
unknownElementwarnings indicate missing component definitions. - Include
rerunCommandsin diagnostics — Provide actionable re-run commands for reproducible validation.
Don't
- Skip validation for "small" changes — Even minor HTML edits can introduce invalid attribute usage.
- Ignore
unknownElementwarnings — These indicate tag names not registered in CEM, which may be typos or missing imports. - Suppress validation errors silently — All diagnostics should be surfaced to the user for informed decisions.
- Assume tag names are correct without CEM check — Always verify against the custom-elements.json manifest.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.