fix(workspace): open the link pickers on a workspace that already has the project's name

Merged
RA
2mo ago
+720-39

Issue for this PR

Closes #1378

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

With no workspace linked, every place that offers a quick create (the altimate-code link CLI, the TUI's on-demand picker, and the setup dialog shown after a project scan) made a second workspace with the project's name on a plain Enter, even when one already existed.

  • Matching. One shared helper finds the listed workspaces with the project's name. It ignores case, whitespace and control characters, but not accents, through a Unicode collator pinned to en, so the host locale can't change the result. "Straße" matches "STRASSE"; "café" and "cafe", or dotless and dotted i, stay different.
  • What Enter does. A picker opens on a same-named workspace only if you own it. A colleague's is listed as "same name, owned by someone else" but not preselected, because linking sends this machine's memory to the workspace. An existing link still comes first.
  • Creating anyway. Every create path (quick create, or browser setup where offered) asks first when the name is taken. The default answer is No, and declining changes nothing.
  • The setup dialog offers your own same-named workspace as its first, default choice.

Not covered: when the workspace list can't be read, there is nothing to compare against, and create works as before.

How did you verify your code works?

  • Matrix tests for the helper: matching (case, sharp S, final sigma, ligatures, NFC and NFD, zero-width and bidi characters, dotless i, accents, Danish aa), which namesake may be preselected, the row labels, where a picker opens, and which choices confirm.

  • Wiring tests render the setup dialog and the on-demand picker against a stand-in select and drive their callbacks:

    • both create actions ask first;
    • No makes no create;
    • Yes creates exactly once;
    • your own namesake is preselected, a colleague's is not.

    Each test fails when its gate is removed.

  • Typecheck is clean. The workspace, plugin and CLI link suites pass.

  • The CLI and the TUI picker were driven in a terminal against a local stand-in workspace API. The setup dialog opens only after an agent's project scan, so it was covered by the wiring tests rather than driven.

Screenshots / recordings

An unlinked "analytics" repo. Before (main): the picker opens on create, and Enter makes a second "analytics".

before

After, with only a colleague's "analytics": it is labelled, not preselected.

cli colleague

Enter on create asks first, with No as the default, and No changes nothing.

cli confirm

cli declined

After, with your own "analytics": the picker opens on it.

cli mine

The TUI picker, in the same two cases, and its confirmation:

tui colleague

tui confirm

tui mine

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

🤖 Generated with Claude Code

https://claude.ai/code/session_0172qrhMa5TQgETASi5hxMqD