Skip to content

Commit 50cde1f

Browse files
committed
Add validation step for required bridge files
This adds a new validation script that ensures all bridges contain required files: LICENSE, composer.json, phpunit.xml.dist, phpstan.dist.neon, CHANGELOG.md, README.md, .gitignore, .gitattributes, and GitHub templates. Also adds missing files to Elasticsearch and OpenMeteo bridges.
1 parent 1edda9e commit 50cde1f

File tree

7 files changed

+135
-0
lines changed

7 files changed

+135
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/bash
2+
#
3+
# Validates that all bridges contain required files.
4+
#
5+
# Usage: validate-bridge-files.sh <bridge_type> [component]
6+
#
7+
# Arguments:
8+
# bridge_type Type of bridge (e.g., "store", "tool") - used in output messages
9+
# component Name of the parent component (e.g., agent, platform, store)
10+
# If not provided, defaults to bridge_type
11+
#
12+
# Example:
13+
# validate-bridge-files.sh store
14+
# validate-bridge-files.sh tool agent
15+
#
16+
# The script builds the bridge path internally as: src/${component}/src/Bridge/*
17+
18+
set -e
19+
20+
BRIDGE_TYPE="${1:?Bridge type is required (e.g., store, tool)}"
21+
COMPONENT="${2:-$BRIDGE_TYPE}"
22+
BRIDGE_PATH="src/${COMPONENT}/src/Bridge/*"
23+
24+
# Required files that must exist in every bridge
25+
REQUIRED_FILES=(
26+
"LICENSE"
27+
"composer.json"
28+
"phpunit.xml.dist"
29+
"phpstan.dist.neon"
30+
"CHANGELOG.md"
31+
"README.md"
32+
".gitignore"
33+
".gitattributes"
34+
".github/close-pull-request.yml"
35+
".github/PULL_REQUEST_TEMPLATE.md"
36+
)
37+
38+
ERRORS=0
39+
40+
echo "Validating ${BRIDGE_TYPE} bridges have required files (${BRIDGE_PATH})..."
41+
echo ""
42+
43+
for bridge_dir in ${BRIDGE_PATH}/; do
44+
if [[ ! -d "$bridge_dir" ]]; then
45+
continue
46+
fi
47+
48+
bridge_name=$(basename "$bridge_dir")
49+
bridge_errors=0
50+
51+
for required_file in "${REQUIRED_FILES[@]}"; do
52+
file_path="${bridge_dir}${required_file}"
53+
if [[ ! -f "$file_path" ]]; then
54+
echo "::error file=${bridge_dir%/}::${BRIDGE_TYPE} bridge '$bridge_name' is missing required file: $required_file"
55+
bridge_errors=$((bridge_errors + 1))
56+
ERRORS=$((ERRORS + 1))
57+
fi
58+
done
59+
60+
if [[ $bridge_errors -eq 0 ]]; then
61+
echo "$bridge_name: all required files present"
62+
fi
63+
done
64+
65+
if [[ $ERRORS -gt 0 ]]; then
66+
echo ""
67+
echo "::error::Found $ERRORS missing required file(s) in ${BRIDGE_TYPE} bridges"
68+
exit 1
69+
fi
70+
71+
echo ""
72+
echo "All ${BRIDGE_TYPE} bridges have required files!"

.github/workflows/validation.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
- '.github/workflows/validation.yaml'
1010
- '.github/scripts/validate-bridge-naming.sh'
1111
- '.github/scripts/validate-bridge-splitsh.sh'
12+
- '.github/scripts/validate-bridge-files.sh'
1213
pull_request:
1314
paths:
1415
- 'src/*/src/Bridge/**/composer.json'
@@ -17,6 +18,7 @@ on:
1718
- '.github/workflows/validation.yaml'
1819
- '.github/scripts/validate-bridge-naming.sh'
1920
- '.github/scripts/validate-bridge-splitsh.sh'
21+
- '.github/scripts/validate-bridge-files.sh'
2022

2123
concurrency:
2224
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -36,6 +38,9 @@ jobs:
3638
- name: Validate store bridges are in splitsh.json
3739
run: .github/scripts/validate-bridge-splitsh.sh store
3840

41+
- name: Validate store bridges have required files
42+
run: .github/scripts/validate-bridge-files.sh store
43+
3944
validate_tools:
4045
name: Tool Bridges
4146
runs-on: ubuntu-latest
@@ -48,3 +53,6 @@ jobs:
4853

4954
- name: Validate tool bridges are in splitsh.json
5055
run: .github/scripts/validate-bridge-splitsh.sh tool agent
56+
57+
- name: Validate tool bridges have required files
58+
run: .github/scripts/validate-bridge-files.sh tool agent
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Please do not submit any Pull Requests here. They will be closed.
2+
---
3+
4+
Please submit your PR here instead:
5+
https://github.com/symfony/ai
6+
7+
This repository is what we call a "subtree split": a read-only subset of that main repository.
8+
We're looking forward to your PR there!
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Please do not submit any Pull Requests here. They will be closed.
2+
---
3+
4+
Please submit your PR here instead:
5+
https://github.com/symfony/ai
6+
7+
This repository is what we call a "subtree split": a read-only subset of that main repository.
8+
We're looking forward to your PR there!
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Close Pull Request
2+
3+
on:
4+
pull_request_target:
5+
types: [opened]
6+
7+
jobs:
8+
run:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: superbrothers/close-pull-request@v3
12+
with:
13+
comment: |
14+
Thanks for your Pull Request! We love contributions.
15+
16+
However, you should instead open your PR on the main repository:
17+
https://github.com/symfony/ai
18+
19+
This repository is what we call a "subtree split": a read-only subset of that main repository.
20+
We're looking forward to your PR there!
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CHANGELOG
2+
=========
3+
4+
0.1
5+
---
6+
7+
* Add the bridge
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Elasticsearch Store
2+
===================
3+
4+
Provides [Elasticsearch](https://www.elastic.co/elasticsearch) vector store integration for Symfony AI Store.
5+
6+
Resources
7+
---------
8+
9+
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
10+
* [Report issues](https://github.com/symfony/ai/issues) and
11+
[send Pull Requests](https://github.com/symfony/ai/pulls)
12+
in the [main Symfony AI repository](https://github.com/symfony/ai)

0 commit comments

Comments
 (0)