protoLabs Studio follows a feature-branch workflow with branch protection on main. This guide covers branching strategies, commit conventions, PR processes, and git worktree isolation for agent execution.
Never push directly to main. All changes must go through pull requests, even for small fixes.
Why:
- Ensures code review for all changes
- Maintains clean commit history
- Prevents accidental breaking changes
- Enables CI/CD automation
- Create a feature branch:
git checkout main
git pull origin main
git checkout -b feature/my-feature-nameBranch naming conventions:
feature/- New features or enhancementsfix/- Bug fixesdocs/- Documentation changesrefactor/- Code restructuringtest/- Test additions or updates
- Make your changes:
# Edit files
# Run tests locally
npm run test:server
npm run test- Commit with conventional commits:
git add .
git commit -m "feat: add user authentication service"See Commit Conventions below.
- Push and create PR:
git push origin feature/my-feature-name
gh pr create --title "Add user authentication service" --body "..."For larger features organized into epics, protoLabs Studio uses a hierarchical PR structure:
main
↑
epic/foundation ──────────── Epic PR (targets main)
↑ ↑ ↑
feat-a feat-b feat-c Feature PRs (target epic branch)
Creating an epic branch:
git checkout main
git pull origin main
git checkout -b epic/my-epic-name
# Make initial commit (epic branches need at least one commit)
git commit --allow-empty -m "feat: initialize epic/my-epic-name"
git push origin epic/my-epic-nameCreating a feature under an epic:
git checkout epic/my-epic-name
git pull origin epic/my-epic-name
git checkout -b feature/child-feature
# Make changes
git push origin feature/child-feature
gh pr create --base epic/my-epic-name --title "Child feature"Merge order:
- Merge feature PRs into epic branch
- Once all features complete, merge epic PR into main
protoLabs Studio executes AI agents in isolated git worktrees to protect the main branch during implementation.
A git worktree is a separate working directory linked to the same repository. protoLabs Studio uses worktrees to:
- Isolate agent execution - Agents work in
.worktrees/{branch-name}/ - Protect main branch - Main codebase remains untouched during agent runs
- Enable parallel work - Multiple agents can work on different features simultaneously
Worktrees are auto-created when an agent starts if one doesn't exist for the feature's branch:
# Worktrees are stored in:
{projectPath}/.worktrees/{branch-name}/If you need to manually work in a worktree:
# Create worktree
git worktree add .worktrees/my-branch -b my-branch
# Work in worktree
cd .worktrees/my-branch
# Make changes
# Return to main working tree
cd ../..
# Remove worktree
git worktree remove .worktrees/my-branchprotoLabs Studio follows Conventional Commits for clear commit history and automated changelog generation.
<type>(<scope>): <description>
[optional body]
[optional footer]
| Type | Description | Example |
|---|---|---|
feat |
New feature | feat(auth): add JWT token validation |
fix |
Bug fix | fix(board): resolve drag-and-drop race condition |
docs |
Documentation | docs: update MCP tools reference |
refactor |
Code restructure (no behavior change) | refactor(agent): extract prompt builder |
test |
Test additions/updates | test(server): add unit tests for feature loader |
chore |
Maintenance tasks | chore: upgrade dependencies |
perf |
Performance improvements | perf(ui): optimize board render cycle |
style |
Formatting/linting | style: run prettier on all files |
Scope indicates which package or area is affected:
feat(server): add new API endpoint
fix(ui): resolve button styling issue
docs(mcp): enhance tool examples
refactor(types): simplify Feature interface
Mark breaking changes with ! or BREAKING CHANGE: footer:
feat(api)!: rename /features to /board
BREAKING CHANGE: The /features endpoint is now /board. Update all API clients.
- Push your branch:
git push origin feature/my-feature- Create PR via GitHub CLI:
gh pr create \
--title "Add user authentication service" \
--body "## Summary
- Implement JWT token validation
- Add login/logout endpoints
- Update user types
## Test Plan
- [ ] Unit tests pass
- [ ] Integration tests pass
- [ ] Manually tested login flow"Before requesting review:
- All tests pass -
npm run test:all - Build succeeds -
npm run build:packages && npm run build:server - Linter passes -
npm run lint - Formatter applied -
npm run format - Documentation updated - If adding features, update docs
- Commit history clean - Squash WIP commits if needed
- PR description complete - Summary, test plan, breaking changes
Once approved, use GitHub's merge button or:
gh pr merge <pr-number> --squashSquash merge is preferred to keep main branch history clean.
git checkout main
git pull origin main
git checkout feature/my-feature
git merge main
# Or use rebase for linear history
git rebase main# After merge/rebase conflicts
git status # See conflicted files
# Edit files to resolve conflicts
git add <resolved-files>
git commit # Or git rebase --continuegit reset --soft HEAD~1 # Keep changes staged
git reset --mixed HEAD~1 # Keep changes unstagedgit log --oneline --graph --decorate --all
# Or use gh CLI
gh pr list
gh pr view <number>protoLabs Studio uses Husky for git hooks:
Runs linter and formatter before each commit:
# Defined in .husky/pre-commit
npm run lint
npm run formatIf checks fail, commit is blocked. Fix issues and retry.
Solution: You tried pushing to main. Create a feature branch:
git checkout -b feature/my-fix
git push origin feature/my-fixSolution: Your branch is out of sync with main:
git checkout feature/my-feature
git pull origin main --rebase
git push origin feature/my-feature --force-with-leaseSolution: Clean up stale worktree:
git worktree remove .worktrees/old-branch
# Or if worktree is missing
git worktree pruneSolution: Commit or stash changes first:
cd .worktrees/my-branch
git add .
git commit -m "WIP: save work"
cd ../..
git worktree remove .worktrees/my-branch- Monorepo Architecture - Package structure and dependencies
- CONTRIBUTING.md - Complete contribution guide
- Conventional Commits - Commit message format