feat: add ai_mcp_servers_js for dynamic MCP server selection #1401
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 🧪 Test Visor CLI | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: # Allow manual triggering | |
| jobs: | |
| test-visor: | |
| name: Test Visor Analysis | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 🛒 Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: 🔧 Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: 📦 Install dependencies | |
| run: npm ci | |
| - name: 🏗️ Build Visor | |
| run: npm run build | |
| - name: 🔗 Ensure main branch exists | |
| run: | | |
| # Fetch main branch to enable diff comparisons | |
| git fetch origin main:main || git branch main || echo "main branch already exists" | |
| - name: 🔍 Test CLI Basic Functionality | |
| run: | | |
| chmod +x ./dist/index.js | |
| echo "Testing Visor CLI help..." | |
| ./dist/index.js --cli --help | |
| echo "Testing Visor CLI version..." | |
| ./dist/index.js --cli --version | |
| - name: 🧪 Create test changes for analysis | |
| run: | | |
| echo "Creating dummy changes for CLI tests..." | |
| echo "test content for CI" > test-file.txt | |
| git add test-file.txt | |
| - name: 🧪 Test JSON Output | |
| run: | | |
| echo "Testing JSON output format..." | |
| ./dist/index.js --cli --check security --output json 2>/dev/null | jq '.summary.overallScore' || { | |
| echo "JSON output test failed" | |
| exit 1 | |
| } | |
| - name: 🧪 Test SARIF Output | |
| run: | | |
| echo "Testing SARIF output format..." | |
| ./dist/index.js --cli --check security --output sarif 2>/dev/null | jq '.version' || { | |
| echo "SARIF output test failed" | |
| exit 1 | |
| } | |
| - name: 🧪 Test Markdown Output | |
| run: | | |
| echo "Testing Markdown output format..." | |
| echo "Running: ./dist/index.js --cli --check performance --output markdown" | |
| # Capture output and exit code (disable exit-on-error temporarily) | |
| set +e | |
| OUTPUT=$(./dist/index.js --cli --check performance --output markdown 2>&1) | |
| EXIT_CODE=$? | |
| set -e | |
| echo "Exit code: $EXIT_CODE" | |
| echo "" | |
| echo "=== Output (first 50 lines) ===" | |
| echo "$OUTPUT" | head -50 | |
| echo "=== End of output ===" | |
| echo "" | |
| # Check for expected pattern | |
| if echo "$OUTPUT" | grep -qi "analysis results"; then | |
| echo "✅ PASS: Found 'analysis results' in markdown output" | |
| else | |
| echo "❌ FAIL: 'analysis results' not found in markdown output" | |
| echo "" | |
| echo "Searching for alternative patterns:" | |
| echo " - Contains 'Visor': $(echo "$OUTPUT" | grep -c 'Visor' || echo 0)" | |
| echo " - Contains 'Summary': $(echo "$OUTPUT" | grep -c 'Summary' || echo 0)" | |
| echo " - Contains '#': $(echo "$OUTPUT" | grep -c '^#' || echo 0)" | |
| echo "" | |
| echo "=== Full output for debugging ===" | |
| echo "$OUTPUT" | |
| exit 1 | |
| fi | |
| - name: 🧪 Test Table Output | |
| run: | | |
| echo "Testing Table output format..." | |
| echo "Running: ./dist/index.js --cli --check architecture --output table" | |
| # Capture output and exit code (disable exit-on-error temporarily) | |
| set +e | |
| OUTPUT=$(./dist/index.js --cli --check architecture --output table 2>&1) | |
| EXIT_CODE=$? | |
| set -e | |
| echo "Exit code: $EXIT_CODE" | |
| echo "" | |
| echo "=== Output (first 50 lines) ===" | |
| echo "$OUTPUT" | head -50 | |
| echo "=== End of output ===" | |
| echo "" | |
| # Check for expected pattern | |
| if echo "$OUTPUT" | grep -q "Analysis Summary"; then | |
| echo "✅ PASS: Found 'Analysis Summary' in table output" | |
| else | |
| echo "❌ FAIL: 'Analysis Summary' not found in table output" | |
| echo "" | |
| echo "Searching for alternative patterns:" | |
| echo " - Contains 'Summary': $(echo "$OUTPUT" | grep -c 'Summary' || echo 0)" | |
| echo " - Contains '─': $(echo "$OUTPUT" | grep -c '─' || echo 0)" | |
| echo " - Contains 'Check': $(echo "$OUTPUT" | grep -c 'Check' || echo 0)" | |
| echo "" | |
| echo "=== Full output for debugging ===" | |
| echo "$OUTPUT" | |
| exit 1 | |
| fi | |
| - name: 📊 Generate Sample Reports | |
| run: | | |
| # Generate reports in all formats for artifact upload (using mock provider) | |
| ./dist/index.js --cli --check all --config .visor.test.yaml --provider mock --output json 2>/dev/null > sample-report.json || echo '{"error": "Mock provider failed"}' > sample-report.json | |
| ./dist/index.js --cli --check all --config .visor.test.yaml --provider mock --output sarif 2>/dev/null > sample-report.sarif || echo '{"error": "Mock provider failed"}' > sample-report.sarif | |
| ./dist/index.js --cli --check all --config .visor.test.yaml --provider mock --output markdown 2>&1 > sample-report.md || echo "Error: Mock provider failed" > sample-report.md | |
| ./dist/index.js --cli --check all --config .visor.test.yaml --provider mock --output table 2>&1 > sample-report.txt || echo "Error: Mock provider failed" > sample-report.txt | |
| - name: 📈 Upload Sample Reports | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: visor-sample-reports | |
| path: | | |
| sample-report.json | |
| sample-report.sarif | |
| sample-report.md | |
| sample-report.txt | |
| retention-days: 7 | |
| - name: 🧹 Clean up test files | |
| run: | | |
| echo "Cleaning up test files..." | |
| git reset HEAD test-file.txt 2>/dev/null || true | |
| rm -f test-file.txt | |
| - name: ✅ Verify Configuration | |
| run: | | |
| echo "Verifying configuration..." | |
| if [ -f ".visor.yaml" ]; then | |
| echo "✅ Custom configuration file found" | |
| # Basic YAML syntax check | |
| python3 -c "import yaml; yaml.safe_load(open('.visor.yaml'))" && echo "✅ YAML syntax valid" | |
| else | |
| echo "✅ Using default configuration from defaults/ folder" | |
| fi |