fix: Complete Phase 2 environment-adaptive patterns in reality-audit-comprehensive
Phase 2 Build Validation was still using direct bash commands instead of environment-adaptive patterns, causing approval prompts in Claude Code CLI. ## Changes - Add explicit environment detection initialization for Phase 2 - Replace generic 'execute build command' with environment-aware step-by-step process - Add environment context display showing IDE, language, and tools mode - Use conditional logic for native IDE tools vs CLI batch mode - Provide clear guidance for using Bash tool with descriptions vs traditional CLI ## Expected Result - No more approval prompts during build validation phase - Clear environment context displayed during build validation - Proper tool selection based on IDE environment detection - Consistent behavior with Phase 1 simulation detection patterns
This commit is contained in:
parent
a1152d8f1f
commit
412a968125
|
|
@ -103,27 +103,60 @@ Use the language-specific simulation patterns from `$BMAD_SIMULATION_PATTERNS` a
|
||||||
- TODO_COMMENT_COUNT (TODO, FIXME, etc.)
|
- TODO_COMMENT_COUNT (TODO, FIXME, etc.)
|
||||||
- Calculate TOTAL_SIMULATION_SCORE based on weighted counts
|
- Calculate TOTAL_SIMULATION_SCORE based on weighted counts
|
||||||
|
|
||||||
## Phase 2: Build and Runtime Validation (Environment-Aware)
|
## Phase 2: Environment-Adaptive Build and Runtime Validation
|
||||||
|
|
||||||
**Build Validation Using Auto-Detected Commands:**
|
**Auto-Initialize Environment Detection (if not already done):**
|
||||||
|
```
|
||||||
|
# Ensure environment detection is loaded
|
||||||
|
if [ -z "$BMAD_BUILD_COMMAND" ]; then
|
||||||
|
Read tool: bmad-core/tasks/auto-language-init.md
|
||||||
|
fi
|
||||||
|
|
||||||
Use `$BMAD_BUILD_COMMAND` from auto-detection system and execute based on IDE environment:
|
if [ -z "$USE_IDE_TOOLS" ]; then
|
||||||
|
Read tool: bmad-core/tasks/lightweight-ide-detection.md
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
**If USE_IDE_TOOLS = true (Claude Code CLI):**
|
**Environment-Adaptive Build Validation:**
|
||||||
- Execute build command using Bash tool with clear description
|
|
||||||
- Capture build output for analysis
|
|
||||||
- No approval prompts required in IDE environment
|
|
||||||
|
|
||||||
**If BATCH_COMMANDS = true (CLI mode):**
|
**Step 1: Display Environment Context**
|
||||||
- Batch build validation with error analysis in single command
|
```
|
||||||
- Use command chaining with `&&` for efficiency
|
echo "🔧 Environment-Adaptive Build Validation:"
|
||||||
|
echo "Environment: $DETECTED_IDE | Language: $BMAD_PRIMARY_LANGUAGE"
|
||||||
|
echo "Build Command: $BMAD_BUILD_COMMAND"
|
||||||
|
echo "Tools Mode: $([ "$USE_IDE_TOOLS" = "true" ] && echo "Native IDE integration" || echo "CLI batch mode")"
|
||||||
|
```
|
||||||
|
|
||||||
**Build Analysis Process:**
|
**Step 2: Execute Build Using Environment-Appropriate Method**
|
||||||
1. Execute: `$BMAD_BUILD_COMMAND`
|
```
|
||||||
2. Capture exit code and output
|
if [ "$USE_IDE_TOOLS" = "true" ]; then
|
||||||
3. Use Grep tool to scan build output for error patterns from `$BMAD_ERROR_PATTERNS`
|
echo "Using native IDE integration for build validation"
|
||||||
4. Count warnings using language-specific warning patterns
|
# Use Bash tool with clear description for build command
|
||||||
5. Document results in audit report
|
BUILD_OUTPUT=$($BMAD_BUILD_COMMAND 2>&1)
|
||||||
|
BUILD_EXIT_CODE=$?
|
||||||
|
else
|
||||||
|
echo "Using CLI batch mode for build validation (may require approval)"
|
||||||
|
# Traditional CLI approach
|
||||||
|
BUILD_OUTPUT=$($BMAD_BUILD_COMMAND 2>&1)
|
||||||
|
BUILD_EXIT_CODE=$?
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Build Exit Code: $BUILD_EXIT_CODE"
|
||||||
|
```
|
||||||
|
|
||||||
|
**Step 3: Analyze Build Results Using Native Tools**
|
||||||
|
```
|
||||||
|
# Use Grep tool to analyze build output for errors
|
||||||
|
if [ "$USE_IDE_TOOLS" = "true" ]; then
|
||||||
|
echo "Analyzing build results using native IDE tools"
|
||||||
|
# Would use Grep tool with error patterns from $BMAD_ERROR_PATTERNS
|
||||||
|
# Would use Read tool for detailed error analysis
|
||||||
|
else
|
||||||
|
# Traditional CLI analysis
|
||||||
|
ERROR_COUNT=$(echo "$BUILD_OUTPUT" | grep -c "error" || echo 0)
|
||||||
|
WARNING_COUNT=$(echo "$BUILD_OUTPUT" | grep -c "warning" || echo 0)
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
**Runtime Validation (Simplified):**
|
**Runtime Validation (Simplified):**
|
||||||
- Use `$BMAD_TEST_COMMAND` if available for runtime testing
|
- Use `$BMAD_TEST_COMMAND` if available for runtime testing
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue