Skip to content

feat (desktop): rename branches one word and smaller#787

Merged
AviPeltz merged 3 commits intomainfrom
rename-branches
Jan 18, 2026
Merged

feat (desktop): rename branches one word and smaller#787
AviPeltz merged 3 commits intomainfrom
rename-branches

Conversation

@AviPeltz
Copy link
Copy Markdown
Collaborator

@AviPeltz AviPeltz commented Jan 17, 2026

Description

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Other (please describe):

Testing

Screenshots (if applicable)

Additional Notes

Summary by CodeRabbit

  • Bug Fixes

    • Workspace creation now generates more robust default branch names to reduce name conflicts during setup.
  • Chores

    • Replaced name-generation dependency (added friendly-words, removed unique-names-generator).
    • Added TypeScript types for the new word list.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 17, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Workspace branch-name generation now avoids collisions by listing existing local and remote branches and using a friendly-words-based generator. The repo dependency was switched from unique-names-generator to friendly-words and a TypeScript declaration for it was added.

Changes

Cohort / File(s) Summary
Package manifest
apps/desktop/package.json
Replaced unique-names-generator with friendly-words dependency.
Workspace creation router
apps/desktop/src/lib/trpc/routers/workspaces/procedures/create.ts
Fetches local+remote branches via listBranches and passes them to generateBranchName; uses `input.branchName?.trim()
Git utilities
apps/desktop/src/lib/trpc/routers/workspaces/utils/git.ts
Reworked generateBranchName(existingBranches: string[] = []) to use friendly-words, add collision-avoidance with retries/fallbacks, and added/used listBranches.
Types
apps/desktop/src/types/friendly-words.d.ts
Added ambient module declaration for friendly-words exposing friendlyWords arrays (objects, predicates, teams, collections).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

I'm a rabbit in code, nibbling names with glee 🐇
Friendly words I gather, no collisions I see 🌿
One-hop, two-hop, a branch made fine —
If a name's taken, I'll try again in time ⏳
Hooray for clean branches and a tidy tree 🌳

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description uses the repository template but provides no concrete details about the changes, implementation, testing, or rationale. Only the 'Refactor' checkbox is checked; all substantive sections remain empty or contain only template comments. Fill in the Description section with details about the branch naming refactor, add related issue links if applicable, and describe testing steps to verify the collision-avoidance logic works correctly.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title describes the main change: replacing the two-word branch naming scheme (unique-names-generator) with a single friendly word approach (friendly-words), which directly corresponds to the changeset's primary objective.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 17, 2026

🚀 Preview Deployment

🔗 Preview Links

Service Status Link
Neon Database (Neon) View Branch
Fly.io Electric (Fly.io) View App
Vercel API (Vercel) Open Preview
Vercel Web (Vercel) Open Preview
Vercel Marketing (Vercel) Open Preview
Vercel Admin (Vercel) Open Preview
Vercel Docs (Vercel) Open Preview

Preview updates automatically with new commits

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apps/desktop/src/lib/trpc/routers/workspaces/utils/git.ts`:
- Around line 292-311: The generateBranchName function should avoid magic
numbers and ensure the fallback cannot collide: introduce named constants (e.g.,
MAX_ATTEMPTS and FALLBACK_MAX_SUFFIX) and use them instead of 10 and 100, keep
the existingSet from existingBranches for case-insensitive checks, and change
the fallback to loop up to MAX_ATTEMPTS (or another bounded count) generating
candidates like `${word}-${n}` with n in [0, FALLBACK_MAX_SUFFIX) and returning
the first candidate that is not in existingSet; if none found after the bounded
attempts, return a deterministic safe value (e.g., append Date.now() or an
increment) to guarantee uniqueness. Ensure all membership checks use the same
lowercasing logic as before and reference generateBranchName, words, and
existingSet when implementing.

Comment thread apps/desktop/src/lib/trpc/routers/workspaces/utils/git.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant