Skip to content

Commit eec5881

Browse files
committed
docs(agents): document upstream PR workflow to prevent beads metadata leaks
Add critical instructions for creating upstream PRs: - MUST branch from upstream/main (not origin/main) to avoid beads files - Use --no-verify flag to skip beads hooks on upstream branches - Verify PR contains only intended files before submission This prevents beads metadata from appearing in PRs to projectbluefin/documentation. Context: PR projectbluefin#621 accidentally included .beads/ files because it branched from origin/main. PR projectbluefin#622 is clean because it branched from upstream/main. Assisted-by: Claude Sonnet 4.5 via GitHub Copilot
1 parent bd524c2 commit eec5881

File tree

1 file changed

+80
-16
lines changed

1 file changed

+80
-16
lines changed

AGENTS.md

Lines changed: 80 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -743,33 +743,75 @@ bd list --status=in_progress # Should be empty or updated
743743
- New features that benefit all users
744744
- Build system improvements
745745

746+
**CRITICAL: Always branch from upstream/main for upstream PRs**
747+
748+
To ensure PRs contain NO fork-specific files (beads metadata, etc.), ALWAYS create feature branches from `upstream/main`:
749+
750+
```bash
751+
# Fetch latest upstream
752+
git fetch upstream main
753+
754+
# Create branch from upstream (NOT origin/main)
755+
git checkout -b feature/branch-name upstream/main
756+
757+
# Make your changes
758+
# Edit files...
759+
760+
# Commit (use --no-verify to skip beads hook if needed)
761+
git add <files>
762+
git commit --no-verify -m "type: description"
763+
764+
# Push to your fork
765+
git push origin feature/branch-name
766+
767+
# Create PR to upstream
768+
gh pr create --repo projectbluefin/documentation --head castrojo:feature/branch-name --title "Title" --body "Description"
769+
```
770+
771+
**Why this matters:**
772+
773+
- Branching from `origin/main` (your fork) includes beads metadata committed to your fork
774+
- Branching from `upstream/main` starts clean - no fork-specific files
775+
- The `--no-verify` flag skips beads git hooks (which expect .beads/ directory)
776+
746777
**Before submitting:**
747778

748-
1. Verify .beads/ directory is NOT in your changes (should be gitignored on feature branches)
749-
2. Ensure no beads-specific content in commit
779+
1. **Verify clean diff**: `git diff --name-only upstream/main` should show ONLY your intended changes
780+
2. **No beads files**: Ensure no `.beads/` files, `AGENTS.md` beads sections, or internal docs
750781
3. Run validation: `npm run typecheck && npm run build`
751782
4. Test locally: `npm run start`
752783

753784
**Submission process:**
754785

755-
1. **Push to your fork**:
786+
1. **Verify branch base**:
787+
788+
```bash
789+
# Check that branch is based on upstream/main
790+
git log --oneline --graph --decorate -5
791+
# Should show upstream/main as base
792+
```
793+
794+
2. **Push to your fork**:
756795

757796
```bash
758797
git push origin feature/branch-name
759798
```
760799

761-
2. **Create PR to upstream**:
800+
3. **Create PR to upstream**:
762801

763802
```bash
764-
gh pr create --repo projectbluefin/documentation --web
803+
gh pr create --repo projectbluefin/documentation --head castrojo:feature/branch-name --title "Title" --body "Description"
765804
```
766805

767-
The `--web` flag opens your browser with the PR form pre-filled. You will:
768-
- Add the PR title
769-
- Write the PR description
770-
- Submit when ready
806+
4. **Verify PR is clean**:
807+
808+
```bash
809+
# Check files in PR
810+
gh pr view <pr-number> --repo projectbluefin/documentation --json files --jq '.files[].path'
811+
# Should show ONLY your intended files (no .beads/, no fork-specific docs)
812+
```
771813

772-
3. **After merge**: Update your fork
814+
5. **After merge**: Update your fork
773815
```bash
774816
git checkout main
775817
git pull upstream main
@@ -2379,22 +2421,44 @@ feat(components)!: redesign ProjectCard with stats API
23792421
```bash
23802422
git status # Check what changed
23812423
git add <files> # Stage code changes
2382-
bd sync --from-main # Pull beads updates from main
2383-
git commit -m "conventional commit" # Commit with conventional format
2424+
bd sync --from-main # Pull beads updates from main (if on fork branch)
2425+
git commit --no-verify -m "conventional commit" # Skip beads hook if on upstream branch
23842426
git push origin feature/branch-name # Push to your fork
23852427
```
2386-
5. **CREATE PULL REQUEST** - Always use feature branches:
2428+
5. **CREATE PULL REQUEST** - CRITICAL: Branch strategy depends on destination:
2429+
2430+
**For upstream PRs (projectbluefin/documentation):**
2431+
2432+
```bash
2433+
# MUST branch from upstream/main (not origin/main)
2434+
git fetch upstream main
2435+
git checkout -b feature/branch-name upstream/main
2436+
# Make changes, commit with --no-verify
2437+
git push origin feature/branch-name
2438+
gh pr create --repo projectbluefin/documentation --head castrojo:feature/branch-name --title "Title" --body "Description"
2439+
# Verify PR contains NO .beads/ files:
2440+
gh pr view <pr-number> --repo projectbluefin/documentation --json files --jq '.files[].path'
2441+
```
2442+
2443+
**For fork-only changes (beads/internal docs):**
2444+
23872445
```bash
2388-
gh pr create --repo projectbluefin/documentation --web
2389-
# Opens browser with PR form - add title and description
2446+
# Branch from origin/main
2447+
git checkout -b feature/branch-name origin/main
2448+
# Make changes, commit normally
2449+
git push origin feature/branch-name
2450+
# Merge directly to fork main (no upstream PR)
23902451
```
2391-
6. **NEVER PUSH DIRECTLY TO MAIN** - All code changes go through PRs
2452+
2453+
6. **NEVER PUSH DIRECTLY TO MAIN** - All code changes go through PRs or explicit feature branch merges
23922454
7. **Hand off** - Provide PR URL and context for next session
23932455
23942456
**CRITICAL RULES:**
23952457
23962458
- **ALWAYS use feature branches** - Never commit code directly to main
23972459
- **ALL code changes require PRs** - This is a fork workflow (castrojo → projectbluefin)
2460+
- **Branch from upstream/main for upstream PRs** - Prevents beads metadata leaking to upstream
2461+
- **Use --no-verify when on upstream branches** - Skips beads git hooks
23982462
- Work is NOT complete until PR is created
23992463
- NEVER say "ready to push when you are" - YOU must create the PR
24002464
- Exception: Beads metadata commits happen automatically on beads-metadata branch

0 commit comments

Comments
 (0)