Skip to content

Commit e3ecf01

Browse files
committed
feat: migrate project from pnpm to Bun
- Update package.json to use bun@1.2.22 as packageManager - Replace all pnpm commands with bun equivalents in scripts - Update lefthook.yml to use bun commands in pre-commit hooks - Remove pnpm-lock.yaml and create bun.lock - Rename .github/workflows/node.yml to bun.yml and update to use Bun - Add package manager detection logic to all command documentation - Update AGENT.md to include package manager detection for manual workflows Benefits: - Faster package installation and script execution - Native TypeScript support in Bun runtime - Improved performance for development workflows - Consistent package manager across CI/CD and local development
1 parent 6329324 commit e3ecf01

10 files changed

Lines changed: 339 additions & 430 deletions

File tree

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Node
1+
name: Bun
22
on:
33
push:
44
branches:
@@ -11,27 +11,25 @@ concurrency:
1111
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.sha }}
1212
cancel-in-progress: true
1313
jobs:
14-
node-lint:
14+
bun-lint:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v5
19-
- name: Setup Node.js
20-
uses: actions/setup-node@v4
21-
- name: Install pnpm
22-
uses: pnpm/action-setup@v4
19+
- name: Setup Bun
20+
uses: oven-sh/setup-bun@v2
2321
- name: Install dependencies
24-
run: pnpm install
22+
run: bun install
2523
- name: Check
26-
run: pnpm run check
24+
run: bun run check
2725
- name: Format
28-
run: pnpm run format
26+
run: bun run format
2927
- name: Lint
30-
run: pnpm run lint
31-
node-check:
28+
run: bun run lint
29+
bun-check:
3230
if: always()
3331
needs:
34-
- node-lint
32+
- bun-lint
3533
runs-on: ubuntu-latest
3634
steps:
3735
- name: Alls Green

bun.lock

Lines changed: 98 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

commands/commit-lint.md

Lines changed: 65 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ Install commitlint for commit message validation:
1414

1515
```bash
1616
# Install commitlint CLI and conventional config
17-
pnpm add -D @commitlint/cli @commitlint/config-conventional
17+
bun add -D @commitlint/cli @commitlint/config-conventional
1818

1919
# Install lefthook for pre-commit hooks
20-
pnpm add -D lefthook
20+
bun add -D lefthook
2121

2222
# Initialize lefthook hooks
23-
pnpm run lefthook:install
23+
bun run lefthook:install
2424
```
2525

2626
### Required Dependencies
@@ -41,9 +41,9 @@ The commit linting configuration is defined in `ruler.toml` under the `[commit]`
4141
[commit]
4242
enabled = true
4343
pre_commit_commands = [
44-
"pnpm run format", # Format code with Biome
45-
"pnpm run lint", # Run linting and checks
46-
"pnpm run check" # Run all quality checks
44+
"bun run format", # Format code with Biome
45+
"bun run lint", # Run linting and checks
46+
"bun run check" # Run all quality checks
4747
]
4848
```
4949

@@ -93,17 +93,17 @@ Git hooks are managed through `lefthook.yml` with three main stages:
9393

9494
## Pre-commit Commands
9595

96-
### 1. Code Formatting (`pnpm run format`)
96+
### 1. Code Formatting (`bun run format`)
9797
- Uses Biome to format all code files
9898
- Ensures consistent indentation, spacing, and line breaks
9999
- Applies project-specific formatting rules
100100

101-
### 2. Linting (`pnpm run lint`)
101+
### 2. Linting (`bun run lint`)
102102
- Runs comprehensive linting checks
103103
- Validates code quality and style
104104
- Checks for potential bugs and issues
105105

106-
### 3. Quality Checks (`pnpm run check`)
106+
### 3. Quality Checks (`bun run check`)
107107
- Runs all automated quality verification
108108
- Ensures ruler rules are applied
109109
- Verifies no uncommitted changes remain
@@ -121,11 +121,11 @@ The linting system targets specific file types to optimize performance:
121121

122122
The system includes auto-fix commands that attempt to resolve issues automatically:
123123

124-
- **Biome Format**: `pnpm run biome:format`
124+
- **Biome Format**: `bun run biome:format`
125125
- Automatically formats code
126126
- Fixes spacing and indentation issues
127127

128-
- **Biome Check**: `pnpm run biome:check --write`
128+
- **Biome Check**: `bun run biome:check --write`
129129
- Auto-fixes linting violations where possible
130130
- Applies safe corrections
131131

@@ -141,6 +141,52 @@ When contributing code, AI agents must ensure code quality by:
141141
6. **Solo Authorship**: DO NOT include co-authorship in commit messages - commits should be solo-authored
142142
7. **PR Attribution**: Include AI attribution in PR descriptions, not commit messages
143143

144+
## Package Manager Detection
145+
146+
AI agents must automatically detect which package manager is being used and adapt their behavior accordingly:
147+
148+
### Detection Logic
149+
150+
```bash
151+
# Check for package manager
152+
if [ -f "bun.lockb" ] || [ -f "bun.lock" ]; then
153+
PACKAGE_MANAGER="bun"
154+
elif [ -f "pnpm-lock.yaml" ]; then
155+
PACKAGE_MANAGER="pnpm"
156+
elif [ -f "yarn.lock" ]; then
157+
PACKAGE_MANAGER="yarn"
158+
elif [ -f "package-lock.json" ]; then
159+
PACKAGE_MANAGER="npm"
160+
else
161+
PACKAGE_MANAGER="npm" # fallback to npm
162+
fi
163+
```
164+
165+
#### Fish Detection Logic
166+
167+
```fish
168+
# Check for package manager (Fish)
169+
set PACKAGE_MANAGER npm
170+
if test -f bun.lockb -o -f bun.lock
171+
set PACKAGE_MANAGER bun
172+
else if test -f pnpm-lock.yaml
173+
set PACKAGE_MANAGER pnpm
174+
else if test -f yarn.lock
175+
set PACKAGE_MANAGER yarn
176+
else if test -f package-lock.json
177+
set PACKAGE_MANAGER npm
178+
end
179+
```
180+
181+
### Package Manager Commands
182+
183+
Based on the detected package manager, use these commands:
184+
185+
- **bun**: `bun add`, `bun run`, `bun install`
186+
- **pnpm**: `pnpm add`, `pnpm run`, `pnpm install`
187+
- **yarn**: `yarn add`, `yarn run`, `yarn install`
188+
- **npm**: `npm install`, `npm run`
189+
144190
## Pre-commit Hook Detection
145191

146192
AI agents must automatically detect which pre-commit hook system is being used and adapt their behavior accordingly:
@@ -224,10 +270,10 @@ git commit -m "feat: add new feature"
224270

225271
**Manual workflow:**
226272
```bash
227-
# Run manual checks
228-
pnpm run lint
229-
pnpm run format
230-
pnpm run check
273+
# Run manual checks (adapt commands based on detected package manager)
274+
$PACKAGE_MANAGER run lint
275+
$PACKAGE_MANAGER run format
276+
$PACKAGE_MANAGER run check
231277

232278
# Validate commit message format
233279
echo "feat: add new feature" | npx commitlint
@@ -424,12 +470,12 @@ The system leverages the existing Biome configuration:
424470
### Common Issues
425471
- **Formatting Failures**: Check Biome configuration and file permissions
426472
- **Linting Errors**: Review error messages and fix manually if auto-fix fails
427-
- **Command Not Found**: Ensure pnpm and Biome are properly installed
473+
- **Command Not Found**: Ensure bun and Biome are properly installed
428474

429475
### Troubleshooting Steps
430-
1. Verify Biome installation: `pnpm biome --version`
431-
2. Check configuration: `pnpm run biome:check`
432-
3. Run manual format: `pnpm run biome:format`
476+
1. Verify Biome installation: `bun biome --version`
477+
2. Check configuration: `bun run biome:check`
478+
3. Run manual format: `bun run biome:format`
433479
4. Review git status after fixes
434480

435481
## Quality Standards

commands/commit-push.md

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,61 @@ git push -u origin <branch-name>
2626
git push
2727
```
2828

29+
## Package Manager Detection
30+
31+
Before running any package manager commands, detect which package manager is being used:
32+
33+
```bash
34+
# Check for package manager
35+
if [ -f "bun.lockb" ] || [ -f "bun.lock" ]; then
36+
PACKAGE_MANAGER="bun"
37+
elif [ -f "pnpm-lock.yaml" ]; then
38+
PACKAGE_MANAGER="pnpm"
39+
elif [ -f "yarn.lock" ]; then
40+
PACKAGE_MANAGER="yarn"
41+
elif [ -f "package-lock.json" ]; then
42+
PACKAGE_MANAGER="npm"
43+
else
44+
PACKAGE_MANAGER="npm" # fallback to npm
45+
fi
46+
```
47+
48+
### Fish Detection Logic
49+
50+
```fish
51+
# Check for package manager (Fish)
52+
set PACKAGE_MANAGER npm
53+
if test -f bun.lockb -o -f bun.lock
54+
set PACKAGE_MANAGER bun
55+
else if test -f pnpm-lock.yaml
56+
set PACKAGE_MANAGER pnpm
57+
else if test -f yarn.lock
58+
set PACKAGE_MANAGER yarn
59+
else if test -f package-lock.json
60+
set PACKAGE_MANAGER npm
61+
end
62+
```
63+
2964
## Pre-commit Quality Checks
3065

3166
Before committing, ensure code quality by running:
3267

3368
```bash
34-
# Run formatting with Biome
35-
pnpm run format
69+
# Run formatting with Biome (adapt based on detected package manager)
70+
$PACKAGE_MANAGER run format
3671

3772
# Run linting and checks
38-
pnpm run lint
73+
$PACKAGE_MANAGER run lint
3974

4075
# Run all quality checks
41-
pnpm run check
76+
$PACKAGE_MANAGER run check
4277
```
4378

4479
### Auto-fix Capabilities
45-
The system includes auto-fix commands:
80+
The system includes auto-fix commands (adapt based on detected package manager):
4681

47-
- **Biome Format**: `pnpm run biome:format` - Automatically formats code
48-
- **Biome Check**: `pnpm run biome:check --write` - Auto-fixes linting violations
82+
- **Biome Format**: `$PACKAGE_MANAGER run biome:format` - Automatically formats code
83+
- **Biome Check**: `$PACKAGE_MANAGER run biome:check --write` - Auto-fixes linting violations
4984

5085
### Quality Verification
5186
- **Review auto-fixes** for correctness before committing

commands/pr-create.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,33 @@ gh pr close <number>
186186

187187
### Quality Assurance
188188
- **Ensure all pre-commit hooks pass** before creating PR
189-
- **Run tests** before creating PR (`uv run pytest` for this project)
189+
- **Run tests** before creating PR (adapt commands based on detected package manager)
190190
- **Verify code formatting** (Biome handles this automatically)
191191
- **Check for breaking changes** and document them clearly
192192
- **Test manually** for UI/UX changes
193193

194+
#### Package Manager Detection for Testing
195+
196+
Before running tests, detect which package manager is being used:
197+
198+
```bash
199+
# Check for package manager
200+
if [ -f "bun.lockb" ] || [ -f "bun.lock" ]; then
201+
PACKAGE_MANAGER="bun"
202+
elif [ -f "pnpm-lock.yaml" ]; then
203+
PACKAGE_MANAGER="pnpm"
204+
elif [ -f "yarn.lock" ]; then
205+
PACKAGE_MANAGER="yarn"
206+
elif [ -f "package-lock.json" ]; then
207+
PACKAGE_MANAGER="npm"
208+
else
209+
PACKAGE_MANAGER="npm" # fallback to npm
210+
fi
211+
212+
# Run tests with detected package manager
213+
$PACKAGE_MANAGER run test
214+
```
215+
194216
### CI/CD Integration
195217
- **PRs automatically trigger** CI pipelines
196218
- **Address failing checks** promptly (tests, linting, formatting)

0 commit comments

Comments
 (0)