3.2 KiB
3.2 KiB
| name | description | standalone |
|---|---|---|
| validate-workflow | Validate a target file against a checklist | true |
Task: Validate Workflow
Initialization
- Load config from
{project-root}/_bmad/core/config.yaml. - Validate config load before continuing:
- Verify file exists and is readable.
- Parse YAML and fail fast with explicit error if parsing fails.
- Require
user_name; if missing, abort initialization with descriptive error. - Apply explicit defaults when optional keys are absent:
communication_language = "English"document_output_language = "English"
- Log resolved values and config source path.
Purpose
Execute a validation checklist against a target file and report findings clearly and consistently.
Steps
-
Load checklist
- Use the checklist path provided by the calling workflow (e.g., its
validationproperty). - If not provided, ask the user for the checklist path.
- Use the checklist path provided by the calling workflow (e.g., its
-
Load target file
- Infer candidate target path in this order:
- Explicit keys in workflow/checklist inputs:
file,path,target,filePath - Path-like tokens in checklist items
- First matching path from glob patterns supplied by checklist/input
- Explicit keys in workflow/checklist inputs:
- Normalize all candidate paths relative to repo root and resolve
./...
- Infer candidate target path in this order:
- Validate candidate existence and expected file type (
.md,.yaml,.yml,.json, or checklist-defined extension). - If multiple valid candidates remain, prefer explicit key fields over inferred tokens.
- If no valid candidate is found, prompt user with schema example:
Please provide the exact file path (relative to repo root), e.g. ./workflows/ci.yml
- Validate user-supplied path before proceeding.
-
Run the checklist
- Read the checklist fully.
- Apply each item systematically to the target file.
- Record pass/fail and capture specific evidence for any issues.
-
Report findings
- Summarize issues with clear labels (e.g., CRITICAL/HIGH/MEDIUM/LOW when applicable).
- Provide actionable fixes for each issue.
-
Edits (if applicable)
- If checklist requires edits/auto-fixes, follow safe-edit protocol:
- Ask for confirmation before editing.
- Create backup snapshot of target file before changes.
- Use deterministic backup location:
{project-root}/.bmad-tmp/validate-workflow/. - Name backup as
{target-file-name}.{timestamp}.bakand diff as{target-file-name}.{timestamp}.diff. - If temp backup directory cannot be created, fall back to adjacent backup file
{target-file}.bak. - Generate reversible diff preview and show it to user.
- Apply edits only after user approval.
- Run syntax/validation checks against edited file.
- If validation fails or user cancels, rollback from backup and report rollback status.
- Record full backup and diff paths in task output.
- Support
retain_artifactsflag (defaultfalse) to keep backup/diff artifacts when requested.
- If checklist requires edits/auto-fixes, follow safe-edit protocol:
-
Finalize
- Confirm completion and provide the final validation summary.
- If edits succeeded and
retain_artifactsisfalse, delete backup/diff artifacts and report cleanup status. - If edits failed or rollback occurred, preserve backup/diff artifacts and report rollback path explicitly.