feat(desktop): let users type a workspace name on the new-workspace screen

Closed
AN
3mo ago
+118-4

Fixes #6398

What & why

The new-workspace screen (experiment test arm) had no way to type a name:
whatever was entered went through as an AI naming hint, and picking "No
agent" did not change that. Under the hood a typed name is the cheaper,
exact path — resolveNames returns it and workspaces.create sets
wantAi = false (skipping the LLM call and the deferred rename) — but the
UI never offered it.

This adds a "Workspace name (optional)" field above the composer. It writes
workspaceName/workspaceNameEdited into the existing draft store, which
the submit path already reads via resolveNames. So a name alone (no
prompt) creates an exact-named workspace and the branch seeds from the
name. This matters especially for remote hosts, where the branch-picker
workaround required pushing a throwaway branch first.

Files changed

  • apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/NewWorkspaceScreen/NewWorkspaceScreen.tsx
    — add the name input (mirrors the control modal's field: updateDraft +
    workspaceNameEdited, clears on blur if empty).
  • apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/PromptGroup/hooks/useSubmitWorkspace/resolveNames.test.ts
    — new unit tests for the naming path.

How I tested it

  • bun install clean.
  • bun test resolveNames.test.ts -> 5 pass / 0 fail (typed name
    resolves to a real workspace name, an unedited/AI-suggested name is
    ignored, typed branch/name pairs both resolve).
  • biome check clean on both files.
  • bun x tsc --noEmit -p apps/desktop/tsconfig.json introduces no new
    errors vs main (85 pre-existing, identical before/after).

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass (no new errors vs main)
  • "Allow edits from maintainers" is checked on fork PRs
  • I have added tests that prove the feature works

Summary by cubic

Lets users type a workspace name on the new-workspace screen and treats it as the exact name. Previously any text acted as a naming hint and always used automatic naming; now a typed name creates an exact-named workspace and skips the deferred rename.

  • Adds a name input above the composer; writes workspaceName/workspaceNameEdited to the draft and clears both on blur when empty.
  • Updates resolveNames to prefer an explicitly edited branch; otherwise sanitizes the typed workspaceName and uses it as the branch candidate; ignores unedited/suggested names; returns a null branch if sanitization empties it.
  • Adds unit tests covering typed names, ignoring unedited suggestions, branch sanitization (including empty results and preserving spaces), and typed name plus typed branch together.

Summary by CodeRabbit

  • New Features

    • Added an optional workspace-name field when creating a new workspace.
    • Workspace names are retained when entered and cleared when left blank.
    • When no branch name is provided, the workspace name is used as a sanitized fallback for the branch name.
    • Explicitly provided branch names continue to take precedence over workspace names.
  • Tests

    • Added coverage for workspace and branch-name resolution, including edited names, suggested names, empty drafts, and branch-name formatting.