feat(desktop): per-project workspace/branch naming instructions
Summary
Adds a per-project Naming instructions setting — a free-text prompt that guides how AI-generated workspace titles and branch names are produced when creating a workspace (e.g. "always include the Linear ticket id (bin-344) in the branch name" or "prefix branches with fix/ or feat/").
- Storage: new
naming_instructionscolumn on the host-service localprojectstable (migration0015, auto-applies at startup). Exposed viaproject.get; newproject.setNamingInstructionsmutation (trims, blank →NULL, 2000-char cap). - Injection:
generateWorkspaceNamesFromPrompttakes the project's instructions and appends them to the naming system prompt on both paths (small-model and agent-CLI fallback). Wired intoworkspaces.createandworkspaces.aiRename. - Sanitization: with instructions set, the branch candidate allows
/(forfix/-style prefixes) and gets a 60-char budget. Unset keeps today's behavior byte-for-byte (25 chars, no slashes, "No prefixes" prompt). - UI: self-contained
NamingInstructionsSectiontextarea in V2 project settings (debounced save, Saved/error states), placed under Branch prefix.
Verification
Beyond unit tests, verified end-to-end against the dev app via CDP (real clicks/keystrokes): set instructions on a scratch project, created a workspace through the New Workspace composer with prompt "bin-731: fix the typo in the README heading" → workspace named "Fix typo in README heading", branch fix/bin-731-readme-typo (confirmed in host SQLite + git branch --show-current). Cleared the setting → column back to NULL, default naming restored. Test workspace/branch deleted afterwards.
Test plan
-
bun run lintclean,bun run typecheck37/37 - 4 new unit tests: instructions injected into system prompt; default prompt unchanged; slash/60-char sanitization only with instructions; slashes still stripped without
-
V2ProjectSettings.test.tsxwiring test for the new section - Live E2E: set → persist (survives reload, raw SQLite row) → honored branch name → clear
Notes for reviewers
- The AI branch rename does not re-apply the separate branch-prefix setting — pre-existing behavior, unchanged.
- Only the V2/host-service path is wired; the sunset V1 Electron-main generators are untouched.
- No-prompt workspace creation (pure random friendly name) has no LLM step, so instructions don't apply there by design.
Summary by cubic
Adds per-project naming instructions to guide generated workspace titles and branch names, and reorganizes V2 project settings into clear sections. Adds a quick link from the new workspace flow to update a project's naming rules, gated on setup and deep-linking to focus the field.
-
New Features
- Storage: added
naming_instructionson localprojects(0015); exposed viaproject.get; newproject.setNamingInstructions(trims, blank →NULL, 2000-char cap). - Generation: injects instructions into naming prompts in both small-model and agent-CLI paths; applied in
workspaces.createandworkspaces.aiRename. - Sanitization: with instructions, branches allow “/” and up to 60 chars; without, keep the 25-char, no-slash behavior.
- UI: new
NamingInstructionsSectionin V2 project settings with debounced save and Saved/error states; “Update naming instructions” button on both new workspace surfaces that deep-links via afocusparam and focuses the field, shown only after host setup; adjusted window-drag region so both buttons remain clickable.
- Storage: added
-
Refactors
- Settings UI organized into sections: General, Branches & naming, Location & checkout, Scripts, and Danger zone.
- Promoted
SettingsSectionto shared settings components and updated header styling for readability.
Summary by CodeRabbit
- New Features
- Added project-specific naming instructions in project settings.
- Instructions guide AI-generated workspace and branch names.
- Added shortcuts from workspace creation screens to naming settings.
- Instructions save automatically and can be cleared by leaving the field blank.
- Improvements
- Custom guidance supports longer branch names and slash prefixes.
- Added a 2,000-character limit and saving, saved, and error states.
- Reorganized project settings into clearer sections.
- Settings shortcuts open and focus the naming instructions field.
- Bug Fixes
- Preserved existing naming behavior when no custom instructions are provided.