|
4 | 4 | push: |
5 | 5 | paths: |
6 | 6 | - 'src/store/src/Bridge/**/composer.json' |
| 7 | + - 'src/agent/src/Bridge/**/composer.json' |
7 | 8 | - 'src/ai-bundle/config/options.php' |
8 | 9 | - '.github/workflows/validation.yaml' |
9 | 10 | pull_request: |
10 | 11 | paths: |
11 | 12 | - 'src/store/src/Bridge/**/composer.json' |
| 13 | + - 'src/agent/src/Bridge/**/composer.json' |
12 | 14 | - 'src/ai-bundle/config/options.php' |
13 | 15 | - '.github/workflows/validation.yaml' |
14 | 16 |
|
|
79 | 81 |
|
80 | 82 | echo "" |
81 | 83 | echo "All store bridge naming conventions are valid!" |
| 84 | +
|
| 85 | + validate_tools: |
| 86 | + name: Validate Tool Bridge Naming |
| 87 | + runs-on: ubuntu-latest |
| 88 | + steps: |
| 89 | + - name: Checkout |
| 90 | + uses: actions/checkout@v5 |
| 91 | + |
| 92 | + - name: Validate tool bridge naming conventions |
| 93 | + run: | |
| 94 | + #!/bin/bash |
| 95 | + set -e |
| 96 | +
|
| 97 | + ERRORS=0 |
| 98 | +
|
| 99 | + # Find all tool bridges with composer.json |
| 100 | + for composer_file in src/agent/src/Bridge/*/composer.json; do |
| 101 | + if [[ ! -f "$composer_file" ]]; then |
| 102 | + continue |
| 103 | + fi |
| 104 | +
|
| 105 | + # Get the bridge directory name (e.g., OpenMeteo) |
| 106 | + bridge_dir=$(dirname "$composer_file") |
| 107 | + bridge_name=$(basename "$bridge_dir") |
| 108 | +
|
| 109 | + # Get the package name from composer.json |
| 110 | + package_name=$(jq -r '.name' "$composer_file") |
| 111 | +
|
| 112 | + # Expected package name format: symfony/ai-{lowercase-with-dashes}-tool |
| 113 | + # Convert PascalCase to kebab-case (e.g., OpenMeteo -> open-meteo) |
| 114 | + expected_kebab=$(echo "$bridge_name" | sed 's/\([a-z]\)\([A-Z]\)/\1-\2/g' | tr '[:upper:]' '[:lower:]') |
| 115 | + expected_package="symfony/ai-${expected_kebab}-tool" |
| 116 | +
|
| 117 | + if [[ "$package_name" != "$expected_package" ]]; then |
| 118 | + echo "::error file=$composer_file::Package name '$package_name' does not match expected '$expected_package' for bridge '$bridge_name'" |
| 119 | + ERRORS=$((ERRORS + 1)) |
| 120 | + else |
| 121 | + echo "✓ $bridge_name: package name '$package_name' is correct" |
| 122 | + fi |
| 123 | + done |
| 124 | +
|
| 125 | + if [[ $ERRORS -gt 0 ]]; then |
| 126 | + echo "" |
| 127 | + echo "::error::Found $ERRORS naming convention violation(s)" |
| 128 | + exit 1 |
| 129 | + fi |
| 130 | +
|
| 131 | + echo "" |
| 132 | + echo "All tool bridge naming conventions are valid!" |
0 commit comments