feat(desktop): set project, host, environment and size with # in the new-workspace composer

Merged
HA
6d ago
+629-73

Summary

  • Typing # in the new-workspace composer opens a menu for the pickers under it: project, host (local device, Cloud, other hosts), and on Cloud, environment and machine size. Picking an entry removes the typed #token and changes the setting. Nothing is added to the prompt.
  • The placeholder now mentions it, e.g. "Track down that flaky test… · # to change project, host, and more".
  • chat-ui fix: the composer's "Add → Attach files" row and completionQuery drill-down were hardcoded to @. They now follow the trigger character that opened the menu.

Why / Context

Setting up a workspace meant typing the prompt, then moving to the mouse for up to four pickers. With # you can set them without leaving the keyboard. # is separate from @ on purpose: @ adds context to the prompt (issues, PRs, plugins, files), while # changes workspace settings and adds nothing to the prompt.

How It Works

  • PromptInput already supports a trigger character per mention provider. The new useWorkspaceSettingMentionProviders hook returns static # providers. Each entry's select() calls the same handler as the matching picker.
  • In NewWorkspaceScreen.tsx, the pickers' inline handlers moved into shared useCallbacks (handleSelectProject, handleSelectHostId, handleSelectEnvironment, handleSelectMachineSize), so the pickers and the # menu run the same logic.
  • Entries carry their section name as a keyword, so #env, #size, #host and #project filter to one section. Typing part of a value's name (#large, #pdev) also works.
  • Environment and size providers only exist when the host is Cloud. The menu rebuilds after a host switch.
  • # only reaches this screen. The in-workspace chat composer and the channel composer (where # references channels) are unchanged.

Manual QA Checklist

Done in the dev desktop app in a cloud workspace, using real keyboard input via xdotool:

  • # on Local Device shows Project and Host sections. No "Attach files" row.
  • #clo + Enter switches host to Cloud. The token is removed, and the environment and size pickers appear.
  • On Cloud, # lists cloud projects (including GitHub App repos). #env lists environments, and picking "Paradev" updates the environment picker.
  • #large + Enter sets the size picker to Large · 8 vCPU · 16 GB.
  • Fix the flaky login test #pdev + Enter keeps the prompt text, removes #pdev, and switches the project.
  • @ still shows Add / Link / Plugins as before.
  • Placeholder shows the hint on one line at the default window width.
  • Not checked: hosts other than this dev account's, a completionQuery provider on a non-@ trigger (no such provider exists yet), and narrow windows where the placeholder wraps.

Testing

  • bunx tsc --noEmit in apps/desktop and packages/chat-ui
  • bunx biome check on changed files
  • bun test src/components/PromptInput (chat-ui): 54 pass
  • bun test on DashboardNewWorkspaceModal (desktop): 35 pass
  • bun run check:i18n: passes, no untranslated messages

No new automated tests. The hook is thin wiring over existing handlers. I'm happy to add one for the trigger-scoped "Add" row in ComposerBody if reviewers want it.

Design Decisions

  • # instead of @: the @ menu is already long and adds references to the prompt. Putting settings there would mix two kinds of action, and names would collide (for example, a "Paradev" project, environment, plugin and task). The placeholder hint makes # easy to discover.
  • Flat lists, no drill-down: each section is a static provider, so one # query searches all of them.

Known Limitations

  • Translations for the new strings (section keywords, "Machine size", placeholder hint) were written by an agent. A native-speaker pass would help, especially for ja/ko/zh/tr word order.
  • Environment and size are remembered per project (existing behavior). Switching the project with # can reset the environment picker to "Select environment", the same as using the picker.

Summary by cubic

Typing # in the new-workspace composer now opens a menu for the pickers below it: project, host (local device, Cloud, other hosts), and on Cloud, environment and machine size. Selecting an entry removes the typed #token and updates the setting through the same handlers the pickers use; nothing is added to the prompt. The placeholder now shows the hint, and offline hosts are marked as such, matching the device picker.

# stays separate from @: @ adds references to the prompt, while # changes workspace settings and adds nothing. Environment and size entries only appear when the host is Cloud, and the menu rebuilds after a host switch. Only the new-workspace screen is affected; the in-workspace chat and channel composers are unchanged.

Refactors

  • useMachineSizeOptions is memoized so an open # menu no longer reloads its entries on each keystroke.
  • Each section search matches both the translated and English section names, so #env, #size, #host, and #project work in every locale.

Bug fixes

  • The composer's "Add → Attach files" row and completionQuery drill-down were hardcoded to @; they now follow the trigger that opened the menu.

Summary by CodeRabbit

  • New Features
    • Use # in the new workspace prompt to choose a project, host, or session, and—when using a cloud host—an environment or machine size.
    • Prompt guidance and related labels are available in multiple languages.
  • Bug Fixes
    • Mention suggestions now match the active trigger, and file attachment options appear only for the default trigger.