Skip to content

Commit e62d909

Browse files
committed
Refactor Brave tool into Bridge namespace structure
Move Brave search tool from Toolbox/Tool to new Bridge/Brave namespace: - Create Bridge/Brave directory structure with Tests and fixtures - Update namespaces and import statements - Rename fixture file from brave.json to search-results.json - Add GitHub PR template for subtree split repository - Add .gitattributes with export-ignore rules - Add .gitignore for vendor/, composer.lock, and phpunit.xml - Add GitHub Actions workflow to auto-close PRs with redirect message - Add CHANGELOG.md and LICENSE files - Add composer.json with package name symfony/brave-ai-tool - Add phpunit.xml.dist configuration - Fix code style with PHP CS Fixer - Remove old files from Toolbox/Tool location - Update examples to use symfony/brave-ai-tool package - Update link script to scan Bridge packages using braces approach
1 parent cb6ed69 commit e62d909

18 files changed

+193
-19
lines changed

.github/build-packages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Symfony\Component\Finder\Finder;
1010

1111
$finder = (new Finder())
12-
->in([__DIR__.'/../src/*/'])
12+
->in([__DIR__.'/../src/*/', __DIR__.'/../examples/', __DIR__.'/../demo/'])
1313
->depth(0)
1414
->name('composer.json')
1515
;

.github/workflows/code-quality.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,18 @@ jobs:
6060
- name: Build root packages
6161
run: php .github/build-packages.php
6262

63+
- name: Link examples
64+
working-directory: examples
65+
run: ../link
66+
67+
- name: Install examples dependencies
68+
uses: ramsey/composer-install@v3
69+
with:
70+
working-directory: examples
71+
6372
- name: Run PHPStan on examples
64-
run: |
65-
cd examples/ && $COMPOSER_UP && ../link && $PHPSTAN
73+
working-directory: examples
74+
run: $PHPSTAN
6675

6776
- name: Run PHPStan on packages
6877
run: |

.github/workflows/integration-tests.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,17 @@ jobs:
6565
- name: Install root dependencies
6666
uses: ramsey/composer-install@v3
6767

68-
- name: Install examples dependencies
68+
- name: Build root packages
69+
run: php .github/build-packages.php
70+
71+
- name: Install root dependencies
6972
uses: ramsey/composer-install@v3
7073
with:
7174
working-directory: examples
7275

73-
- name: Link examples
74-
working-directory: examples
75-
run: ../link
76-
7776
- name: Run commands examples
78-
run: php examples/commands/stores.php
77+
working-directory: examples
78+
run: php commands/stores.php
7979

8080
demo:
8181
runs-on: ubuntu-latest

examples/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"symfony/ai-agent": "@dev",
2020
"symfony/ai-platform": "@dev",
2121
"symfony/ai-store": "@dev",
22+
"symfony/ai-brave-tool": "@dev",
2223
"symfony/cache": "^7.3|^8.0",
2324
"symfony/console": "^7.3|^8.0",
2425
"symfony/css-selector": "^7.3|^8.0",

examples/toolbox/brave.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
*/
1111

1212
use Symfony\AI\Agent\Agent;
13+
use Symfony\AI\Agent\Bridge\Brave\Brave;
1314
use Symfony\AI\Agent\Toolbox\AgentProcessor;
14-
use Symfony\AI\Agent\Toolbox\Tool\Brave;
1515
use Symfony\AI\Agent\Toolbox\Tool\Crawler;
1616
use Symfony\AI\Agent\Toolbox\Toolbox;
1717
use Symfony\AI\Platform\Bridge\OpenAi\Gpt;

link

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ if (!is_dir("$pathToProject/vendor/symfony")) {
3838
$sfPackages = array();
3939

4040
$filesystem = new Filesystem();
41-
$directories = glob(__DIR__.'/src/*', GLOB_ONLYDIR | GLOB_NOSORT);
41+
$braces = array('*', '*/src/Bridge/*');
42+
$directories = array_merge(...array_values(array_map(function ($part) {
43+
return glob(__DIR__.'/src/'.$part, GLOB_ONLYDIR | GLOB_NOSORT);
44+
}, $braces)));
4245

4346
foreach ($directories as $dir) {
4447
if ($filesystem->exists($composer = "$dir/composer.json")) {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/Tests export-ignore
2+
/phpunit.xml.dist export-ignore
3+
/.git* export-ignore
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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
vendor/
2+
composer.lock
3+
phpunit.xml
4+
.phpunit.result.cache

0 commit comments

Comments
 (0)