Initial Auto-Build plugin structure
This commit is contained in:
172
plugin/commands/qa-review.md
Normal file
172
plugin/commands/qa-review.md
Normal file
@@ -0,0 +1,172 @@
|
||||
---
|
||||
description: Run QA validation loop with automatic fixes
|
||||
argument-hint: [feature-name] - Optional, uses current feature if omitted
|
||||
---
|
||||
|
||||
# QA Review and Fix Loop
|
||||
|
||||
Run iterative QA review with automatic fix attempts. The system will review code, identify issues, and attempt fixes up to 50 iterations.
|
||||
|
||||
## Configuration
|
||||
|
||||
- **MAX_ITERATIONS**: 50
|
||||
- **AUTO_FIX**: Ask user before each fix round
|
||||
|
||||
## Input
|
||||
|
||||
- **Feature name**: $ARGUMENTS or infer from current active build
|
||||
|
||||
## Workflow
|
||||
|
||||
### 1. Initialize
|
||||
|
||||
- Determine feature from argument or find active build in status files
|
||||
- Load spec and plan from `.auto-build-data/specs/{feature-name}/`
|
||||
- Create QA iteration directory: `.auto-build-data/cache/qa-iterations/{feature-name}/`
|
||||
- Set iteration counter to 0
|
||||
- Update status to `QA_REVIEW`
|
||||
|
||||
### 2. Review Loop
|
||||
|
||||
```
|
||||
iteration = 0
|
||||
while iteration < MAX_ITERATIONS:
|
||||
|
||||
# 2a. Launch QA Reviewer
|
||||
Launch qa-reviewer agent with:
|
||||
- Spec and plan context
|
||||
- List of modified files (from status.json)
|
||||
- Previous iteration results (if any)
|
||||
|
||||
# 2b. Collect Issues
|
||||
Agent returns issues with severity:
|
||||
- error: Must fix
|
||||
- warning: Should fix
|
||||
- info: Nice to fix
|
||||
|
||||
Save to: .auto-build-data/cache/qa-iterations/{feature-name}/iteration-{n}.json
|
||||
|
||||
# 2c. Check Exit Condition
|
||||
if no errors and no warnings:
|
||||
status = "PASSED"
|
||||
break
|
||||
|
||||
# 2d. Present Issues
|
||||
Display:
|
||||
```
|
||||
QA Review - Iteration {n}
|
||||
|
||||
Found 3 issues:
|
||||
[ERROR] src/api/users.ts:42 - Potential null dereference
|
||||
[WARNING] src/types/user.ts:15 - Missing type annotation
|
||||
[INFO] src/utils/format.ts:8 - Could use const instead of let
|
||||
|
||||
Auto-fix these issues? [Yes] [Select] [Skip] [Abort]
|
||||
```
|
||||
|
||||
# 2e. Fix Issues
|
||||
if user says yes:
|
||||
for each error/warning:
|
||||
Launch qa-fixer agent with issue details
|
||||
Track fix result
|
||||
|
||||
# 2f. Increment
|
||||
iteration++
|
||||
```
|
||||
|
||||
### 3. Exit Conditions
|
||||
|
||||
| Condition | Status | Action |
|
||||
|-----------|--------|--------|
|
||||
| No errors/warnings | `PASSED` | Proceed to completion |
|
||||
| Max iterations | `NEEDS_MANUAL_REVIEW` | Show remaining issues |
|
||||
| User abort | `ABORTED` | Save current state |
|
||||
|
||||
### 4. Final Report
|
||||
|
||||
```
|
||||
======================================
|
||||
QA Review Complete
|
||||
======================================
|
||||
|
||||
Status: PASSED (after 3 iterations)
|
||||
|
||||
Summary:
|
||||
- Total issues found: 8
|
||||
- Issues fixed: 7
|
||||
- Issues skipped: 1 (info level)
|
||||
|
||||
Iterations:
|
||||
1. Found 5 issues, fixed 5
|
||||
2. Found 2 issues, fixed 2
|
||||
3. Found 1 issue (info), skipped
|
||||
|
||||
Files reviewed: 12
|
||||
Files modified during fixes: 6
|
||||
|
||||
Next steps:
|
||||
- Save learnings: /ab:memory-save
|
||||
- If using worktree: /ab:worktree cleanup feature-name
|
||||
```
|
||||
|
||||
## Iteration Record Format
|
||||
|
||||
`.auto-build-data/cache/qa-iterations/{feature-name}/iteration-{n}.json`:
|
||||
```json
|
||||
{
|
||||
"iteration": 1,
|
||||
"timestamp": "2025-01-15T14:30:00Z",
|
||||
"issues_found": [
|
||||
{
|
||||
"severity": "error",
|
||||
"category": "correctness",
|
||||
"file": "src/api/users.ts",
|
||||
"line": 42,
|
||||
"code": "const x = data.value",
|
||||
"description": "Potential null dereference - data could be undefined",
|
||||
"suggestion": "Add null check: const x = data?.value ?? defaultValue"
|
||||
}
|
||||
],
|
||||
"issues_fixed": [
|
||||
{
|
||||
"issue_id": 0,
|
||||
"fix_applied": "Added optional chaining and default value",
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"issues_remaining": 0,
|
||||
"status": "all_fixed"
|
||||
}
|
||||
```
|
||||
|
||||
## QA Categories
|
||||
|
||||
The qa-reviewer checks for:
|
||||
|
||||
1. **Correctness**
|
||||
- Logic errors
|
||||
- Null/undefined handling
|
||||
- Type mismatches
|
||||
|
||||
2. **Patterns**
|
||||
- Following codebase conventions
|
||||
- Consistent error handling
|
||||
|
||||
3. **Security**
|
||||
- Input validation
|
||||
- Injection risks
|
||||
|
||||
4. **Performance**
|
||||
- Unnecessary loops
|
||||
- N+1 queries
|
||||
|
||||
5. **Maintainability**
|
||||
- Code clarity
|
||||
- DRY violations
|
||||
|
||||
## User Controls
|
||||
|
||||
- **Yes**: Fix all errors and warnings automatically
|
||||
- **Select**: Choose which issues to fix
|
||||
- **Skip**: Move to next iteration without fixing
|
||||
- **Abort**: Stop QA review, save current state
|
||||
Reference in New Issue
Block a user