Skip to content

Commit 334ae34

Browse files
committed
feat: add composer support
chore: wip chore: wip chore: wip
1 parent 5a291c3 commit 334ae34

18 files changed

+2012
-16
lines changed

.github/workflows/buddy-update.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,39 @@ jobs:
5656
with:
5757
bun-version: latest
5858

59+
- name: Setup PHP and Composer
60+
uses: shivammathur/setup-php@v2
61+
with:
62+
php-version: '8.4'
63+
tools: composer
64+
coverage: none
65+
5966
- name: Install dependencies
6067
run: bun install
6168

69+
- name: Install Composer dependencies
70+
run: composer install --no-dev --prefer-dist --optimize-autoloader
71+
6272
- name: Build buddy-bot
6373
run: bun run build
6474

75+
- name: Verify Composer setup
76+
run: |
77+
echo "🔍 Verifying Composer and PHP setup..."
78+
php --version
79+
composer --version
80+
echo ""
81+
echo "📦 Checking composer.json..."
82+
if [ -f "composer.json" ]; then
83+
echo "✅ composer.json found"
84+
composer validate --no-check-all --strict
85+
echo ""
86+
echo "📋 Composer packages in composer.json:"
87+
cat composer.json | jq -r '.require, ."require-dev" | to_entries[] | "\(.key): \(.value)"' 2>/dev/null || echo "Unable to parse with jq, showing raw content:"
88+
else
89+
echo "❌ composer.json not found"
90+
fi
91+
6592
- name: Display test configuration
6693
run: |
6794
echo "🧪 **Buddy Bot Testing Mode**"

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ A modern, fast alternative to Dependabot and Renovate built for the JavaScript a
1818

1919
- 🚀 **Lightning Fast**: Built with Bun & performance in mind
2020
- 🎯 **Smart Updates**: Configurable update strategies _(major, minor, patch, all)_
21-
- 📦 **Multi-Package Manager**: Supports Bun, npm, yarn, pnpm, pkgx, and Launchpad dependency files
21+
- 📦 **Multi-Package Manager**: Supports Bun, npm, yarn, pnpm, Composer, pkgx, and Launchpad dependency files
2222
-**GitHub Actions**: Automatically updates workflow dependencies (`actions/checkout@v4`, etc.)
2323
- 📊 **Dependency Dashboard**: Single GitHub issue with overview of all dependencies and open PRs
2424
- 🔄 **Rebase Functionality**: Interactive checkbox to update PRs with latest dependency versions
@@ -561,6 +561,8 @@ Buddy automatically detects and updates the following dependency file formats:
561561
562562
#### Package Dependencies
563563
- **package.json** - Traditional npm dependencies
564+
- **composer.json** - PHP dependencies from Packagist
565+
- **composer.lock** - PHP lock file with exact versions
564566
- **deps.yaml** / **deps.yml** - Launchpad/pkgx dependency declarations
565567
- **dependencies.yaml** / **dependencies.yml** - Alternative dependency file format
566568
- **pkgx.yaml** / **pkgx.yml** - pkgx-specific dependency files
@@ -584,15 +586,24 @@ Full table with confidence badges, age, adoption metrics, and weekly download st
584586
| lodash | ^4.17.20 → ^4.17.21 | 📅 | 📈 || 🔒 |
585587
```
586588
587-
#### 2. Launchpad/pkgx Dependencies
589+
#### 2. PHP/Composer Dependencies
590+
Focused table for PHP packages from Packagist:
591+
```
592+
| Package | Change | File | Status |
593+
|---------|--------|------|--------|
594+
| laravel/framework | ^10.0.0 → ^10.16.0 | composer.json | ✅ Available |
595+
| phpunit/phpunit | ^10.0.0 → ^10.3.0 | composer.json | ✅ Available |
596+
```
597+
598+
#### 3. Launchpad/pkgx Dependencies
588599
Simplified table focusing on package updates and file locations:
589600
```
590601
| Package | Change | File | Status |
591602
|---------|--------|------|--------|
592603
| bun.com | ^1.2.16 → ^1.2.19 | deps.yaml | ✅ Available |
593604
```
594605
595-
#### 3. GitHub Actions
606+
#### 4. GitHub Actions
596607
Workflow automation updates with direct links to repositories:
597608
```
598609
| Action | Change | File | Status |
@@ -749,7 +760,7 @@ This PR was generated by [Buddy](https://github.com/stacksjs/buddy-bot).
749760
| Feature | Buddy | Dependabot | Renovate |
750761
|---------|-------|------------|----------|
751762
| **Speed** | ⚡ Bun-native | 🐌 Slower | 🐌 Slower |
752-
| **Package Managers** | Bun, npm, yarn, pnpm, pkgx, Launchpad | Limited | Limited |
763+
| **Package Managers** | Bun, npm, yarn, pnpm, Composer, pkgx, Launchpad | Limited | Limited |
753764
| **Configuration** | TypeScript, YAML, JSON/JS, package.json | YAML | JSON/JS |
754765
| **Grouping** | ✅ Flexible | ✅ Basic | ✅ Advanced |
755766
| **Zero Config** | ✅ Yes | ✅ Yes | ❌ Complex |

bin/cli.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ cli.usage(`[command] [options]
3737
3838
🤖 Buddy Bot - Your companion dependency manager
3939
40+
Supports npm, Bun, yarn, pnpm, Composer, pkgx, Launchpad, and GitHub Actions
41+
4042
DEPENDENCY MANAGEMENT:
4143
setup 🚀 Interactive setup for automated updates (recommended)
4244
scan 🔍 Scan for dependency updates
@@ -61,11 +63,12 @@ CONFIGURATION & SETUP:
6163
6264
Examples:
6365
buddy-bot setup # Interactive setup
64-
buddy-bot scan --verbose # Scan for updates
66+
buddy-bot scan --verbose # Scan for updates (npm + Composer)
6567
buddy-bot dashboard --pin # Create pinned dashboard
6668
buddy-bot rebase 17 # Rebase PR #17
6769
buddy-bot update-check # Auto-rebase checked PRs
68-
buddy-bot info react # Get package info
70+
buddy-bot info laravel/framework # Get Composer package info
71+
buddy-bot info react # Get npm package info
6972
buddy-bot versions react --latest 5 # Show recent versions
7073
buddy-bot search "test framework" # Search packages
7174
buddy-bot open-settings # Open GitHub settings`)
@@ -430,7 +433,7 @@ cli
430433
.option('--ignore <names>', 'Comma-separated list of packages to ignore')
431434
.example('buddy-bot scan')
432435
.example('buddy-bot scan --verbose')
433-
.example('buddy-bot scan --packages "react,typescript"')
436+
.example('buddy-bot scan --packages "react,typescript,laravel/framework"')
434437
.example('buddy-bot scan --pattern "@types/*"')
435438
.example('buddy-bot scan --strategy minor')
436439
.action(async (options: CLIOptions) => {

composer.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"name": "buddy-bot/demo",
3+
"description": "Demo PHP project for testing Buddy Bot Composer support",
4+
"type": "project",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Buddy Bot",
9+
"email": "[email protected]"
10+
}
11+
],
12+
"require": {
13+
"php": "^8.1",
14+
"laravel/framework": "^10.0",
15+
"guzzlehttp/guzzle": "^7.0",
16+
"symfony/console": "^6.0",
17+
"monolog/monolog": "^3.0",
18+
"doctrine/dbal": "^3.0"
19+
},
20+
"require-dev": {
21+
"phpunit/phpunit": "^10.0",
22+
"mockery/mockery": "^1.5",
23+
"fakerphp/faker": "^1.20",
24+
"laravel/pint": "^1.0",
25+
"nunomaduro/collision": "^7.0"
26+
},
27+
"autoload": {
28+
"psr-4": {
29+
"App\\": "src/"
30+
}
31+
},
32+
"autoload-dev": {
33+
"psr-4": {
34+
"Tests\\": "tests/"
35+
}
36+
},
37+
"scripts": {
38+
"test": "phpunit",
39+
"test-coverage": "phpunit --coverage-html coverage",
40+
"pint": "pint",
41+
"pint-test": "pint --test"
42+
},
43+
"config": {
44+
"optimize-autoloader": true,
45+
"preferred-install": "dist",
46+
"sort-packages": true,
47+
"allow-plugins": {
48+
"pestphp/pest-plugin": true
49+
}
50+
},
51+
"minimum-stability": "stable",
52+
"prefer-stable": true
53+
}

docs/config.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,14 +329,19 @@ buddy-bot update
329329

330330
## Supported Dependency Types
331331

332-
Buddy provides comprehensive dependency management across three categories:
332+
Buddy provides comprehensive dependency management across four categories:
333333

334334
### Package Dependencies
335335

336336
#### npm Ecosystem
337337
- **package.json** - Traditional npm, Bun, yarn, pnpm dependencies
338338
- Managed via `bun outdated` for accurate version detection
339339

340+
#### PHP/Composer Ecosystem
341+
- **composer.json** - PHP dependencies from Packagist
342+
- **composer.lock** - Lock file with exact versions
343+
- Managed via `composer outdated` and Packagist API integration
344+
340345
#### pkgx/Launchpad Ecosystem
341346
- **deps.yaml** / **deps.yml** - Launchpad/pkgx dependency declarations
342347
- **dependencies.yaml** / **dependencies.yml** - Alternative format
@@ -370,11 +375,20 @@ steps:
370375

371376
### Configuration Examples
372377

373-
#### Ignore Specific Actions
378+
#### Ignore Specific Packages
374379
```typescript
375380
const config: BuddyBotConfig = {
376381
packages: {
377382
ignore: [
383+
// npm packages
384+
'react', // Keep React version stable
385+
'@types/node', // Manual Node.js type updates
386+
387+
// Composer packages
388+
'laravel/framework', // Skip Laravel updates
389+
'php', // Platform requirement (auto-skipped)
390+
391+
// GitHub Actions
378392
'actions/checkout', // Skip action updates
379393
'oven-sh/setup-bun', // Keep specific version
380394
],

docs/features/package-management.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Buddy works with multiple package managers and dependency file formats:
1414
- **npm** - Full compatibility with npm ecosystem
1515
- **yarn** - Classic and Berry versions
1616
- **pnpm** - Efficient disk usage and fast installs
17+
- **Composer** - PHP dependency manager with Packagist registry
1718
- **pkgx** - Cross-platform package manager with YAML dependency files
1819
- **Launchpad** - Fast package manager using pkgx registry format
1920
- **GitHub Actions** - Workflow dependency automation
@@ -23,6 +24,40 @@ Buddy works with multiple package managers and dependency file formats:
2324
Buddy automatically detects and updates various dependency file formats:
2425

2526
#### Package Dependencies
27+
28+
##### npm Ecosystem
29+
```json
30+
# package.json - Traditional npm, Bun, yarn, pnpm dependencies
31+
{
32+
"dependencies": {
33+
"react": "^18.0.0",
34+
"typescript": "^5.0.0"
35+
},
36+
"devDependencies": {
37+
"eslint": "^8.0.0",
38+
"@types/node": "^20.0.0"
39+
}
40+
}
41+
```
42+
43+
##### PHP/Composer Ecosystem
44+
```json
45+
# composer.json - PHP dependencies from Packagist
46+
{
47+
"name": "vendor/project",
48+
"require": {
49+
"php": "^8.1",
50+
"laravel/framework": "^10.0",
51+
"guzzlehttp/guzzle": "^7.0"
52+
},
53+
"require-dev": {
54+
"phpunit/phpunit": "^10.0",
55+
"mockery/mockery": "^1.5"
56+
}
57+
}
58+
```
59+
60+
##### pkgx/Launchpad Ecosystem
2661
```yaml
2762
# deps.yaml / deps.yml - pkgx and Launchpad
2863
dependencies:
@@ -162,6 +197,97 @@ const registryIntegration = {
162197
}
163198
```
164199

200+
## PHP/Composer Support
201+
202+
Buddy provides comprehensive support for PHP projects using Composer, integrating with Packagist to manage PHP dependencies.
203+
204+
### Automatic Detection
205+
206+
Buddy automatically detects Composer projects by scanning for:
207+
208+
- **composer.json** - Main dependency configuration
209+
- **composer.lock** - Lock file with exact versions
210+
211+
```bash
212+
# Buddy automatically scans for PHP dependencies
213+
my-project/
214+
├── composer.json # ✅ PHP dependencies
215+
├── composer.lock # ✅ Lock file versions
216+
├── vendor/ # Generated by Composer
217+
├── app/
218+
│ └── composer.json # ✅ Sub-project dependencies
219+
└── packages/
220+
├── core/
221+
│ └── composer.json # ✅ Package dependencies
222+
└── api/
223+
└── composer.json # ✅ API dependencies
224+
```
225+
226+
### Packagist Integration
227+
228+
All Composer packages are resolved through Packagist, providing access to:
229+
230+
- **PHP packages** - Framework, libraries, and tools
231+
- **Version management** - Semantic versioning with constraint resolution
232+
- **Package metadata** - Descriptions, licenses, and repository links
233+
- **Release information** - Changelogs and release notes from GitHub
234+
235+
### Composer Commands
236+
237+
Buddy uses native Composer commands for maximum compatibility:
238+
239+
```bash
240+
# Check for outdated packages
241+
composer outdated --format=json --direct
242+
243+
# Validate package existence
244+
composer info laravel/framework
245+
246+
# Update constraints (handled by Buddy)
247+
composer require laravel/framework:^10.16
248+
```
249+
250+
### Version Constraints
251+
252+
Buddy preserves and respects Composer version constraints:
253+
254+
```json
255+
{
256+
"require": {
257+
"laravel/framework": "^10.0", // Caret constraint
258+
"symfony/console": "~6.0", // Tilde constraint
259+
"doctrine/orm": "2.*", // Wildcard constraint
260+
"monolog/monolog": ">=2.0,<3.0" // Range constraint
261+
}
262+
}
263+
```
264+
265+
When updating packages, Buddy maintains the original constraint format while updating to the latest compatible version.
266+
267+
### Dependency Types
268+
269+
Buddy handles all Composer dependency types:
270+
271+
- **require** - Production dependencies
272+
- **require-dev** - Development dependencies
273+
- **suggest** - Suggested packages (informational only)
274+
- **conflict** - Conflicting packages (validation)
275+
- **replace** - Replaced packages (validation)
276+
277+
### PHP Platform Requirements
278+
279+
Platform requirements are automatically excluded from updates:
280+
281+
```json
282+
{
283+
"require": {
284+
"php": "^8.1", // ❌ Skipped (platform)
285+
"ext-json": "*", // ❌ Skipped (extension)
286+
"laravel/framework": "^10.0" // ✅ Updated
287+
}
288+
}
289+
```
290+
165291
## Package Filtering
166292

167293
Control which packages are managed by buddy.

docs/usage.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,12 @@ buddy-bot --version
106106

107107
## Supported File Types
108108

109-
Buddy automatically detects and updates dependencies across three categories:
109+
Buddy automatically detects and updates dependencies across four categories:
110110

111111
### Package Dependencies
112112
- **package.json** - npm, Bun, yarn, pnpm dependencies
113+
- **composer.json** - PHP dependencies from Packagist
114+
- **composer.lock** - PHP lock file with exact versions
113115
- **deps.yaml** / **deps.yml** - Launchpad/pkgx dependency declarations
114116
- **dependencies.yaml** / **dependencies.yml** - Alternative dependency format
115117
- **pkgx.yaml** / **pkgx.yml** - pkgx-specific dependency files
@@ -131,6 +133,7 @@ steps:
131133
132134
### Update Sources
133135
- **npm packages**: Uses `bun outdated` for accurate detection
136+
- **Composer packages**: Uses `composer outdated` and Packagist API
134137
- **pkgx/Launchpad packages**: Uses `ts-pkgx` library integration
135138
- **GitHub Actions**: Fetches latest releases via GitHub API
136139

0 commit comments

Comments
 (0)