#!/bin/bash
#
# Architectural Test Pipeline CLI
# ================================
# Multi-layer oversight system for continuous validation.
#
# Usage:
#   oversight run              Full pipeline execution
#   oversight run --inject     With injection tests
#   oversight quick            Quick validation
#   oversight validate --phase 5   Validate specific phase
#   oversight report           Generate report
#   oversight matrix           Show phase status matrix
#

set -euo pipefail

OVERSIGHT_DIR="/opt/agent-governance/testing/oversight"

# Show help if no args or --help
if [[ $# -eq 0 ]] || [[ "${1:-}" == "--help" ]] || [[ "${1:-}" == "-h" ]]; then
    cat << 'EOF'
Architectural Test Pipeline
===========================

Multi-layer oversight system for continuous validation across all 12 phases.

Commands:
  run [options]          Run full pipeline
  quick                  Quick validation (phases + anomalies only)
  validate --phase N     Validate specific phase in detail
  report [--inject]      Generate comprehensive report
  matrix                 Show phase status matrix
  status                 Show pipeline status

Options:
  --phase N              Focus on specific phase
  --inject               Run injection tests
  --unsafe               Disable safe mode (caution!)
  --auto-fix             Enable auto-fix for approved changes
  --verbose, -v          Verbose output
  --json                 Output as JSON

Layers:
  1. Bug Window Watcher     Real-time anomaly detection
  2. Suggestion Engine      AI-driven fix recommendations
  3. Council Review         Multi-agent decision making
  4. Phase Validator        Coverage across all phases
  5. Error Injector         Controlled fault injection
  6. Reporter               Comprehensive reporting

Examples:
  oversight run                       # Full pipeline
  oversight run --inject --verbose    # With injection tests
  oversight validate --phase 5        # Focus on Phase 5
  oversight matrix                    # Quick status overview

Documentation: /opt/agent-governance/testing/oversight/README.md
EOF
    exit 0
fi

# Execute pipeline
cd "${OVERSIGHT_DIR}"
exec python3 -m testing.oversight.pipeline "$@"
