Skip to content

Workspace directory independence #1

Description

@tonythethompson

Goal

Workspaces become self-contained: each stores its own Directory. ProjectShortcutId is removed from runtime behavior and persisted JSON after one-time migration. Create from shortcut copies a normalized folder path at selection time; it does not create a lasting link.

flowchart LR
  subgraph before [Current]
    WS1[Workspace] -->|ProjectShortcutId| SC[Shortcut]
    SC --> DIR1[Directory]
  end
  subgraph after [Target]
    WS2[Workspace] --> DIR2[Directory]
    SC2[Shortcut] -.->|copy on create only| WS2
  end
Loading

Binding product decisions

  • Directory is required on a workspace and is the launch source of truth.
  • Creating from a shortcut copies a normalized path only; it creates no runtime link.
  • Shortcut context menus discover related workspaces by normalized directory equality.
  • Deleting a shortcut never affects workspaces.
  • Workspace entries continue to inherit one shared workspace directory.
  • No sequential launch, process supervision, readiness checks, or linked-shortcut sync in this pass.

Work plan

1. Data model and path utilities

  • Add Workspace.Directory and remove runtime use of ProjectShortcutId.
  • Add WorkspacePath to centralize normalization, existence checks, and normalized equality. Delegate to the existing shortcut path validation/WSL-aware resolver rather than duplicating path rules.
  • Update WorkspaceDisplay.ToLaunchShortcut to accept string directory.
  • Show workspace.Directory in display and search subtitles.

2. Load-time migration

In WorkspaceRepository.NormalizeAll during load:

  • When Directory is empty and legacy ProjectShortcutId is present, resolve the shortcut once and copy its normalized Directory.
  • If the shortcut no longer exists, retain the workspace with an empty directory for repair UX.
  • Prefer an existing Directory over any legacy ID.
  • Normalize existing directories in place.
  • Persist only the directory-based schema after a successful migration.
  • Apply the same normalization path to imported legacy JSON.
  • Update workspaces.example.json.

3. Validation and persistence

  • Remove project-shortcut existence requirements.
  • Require a configured, normalizable directory.
  • Require an existing directory at save and launch, consistent with shortcut behavior.
  • Normalize Directory before persistence.
  • Preserve global home-keyword uniqueness against shortcuts.

4. Launch behavior

Update OpenWorkspaceCommand and OpenWorkspaceEntryCommand:

  • Empty directory: Workspace needs a project folder. Edit the workspace to choose one.
  • Missing directory: Folder not found: {path}.
  • Otherwise launch each entry using WorkspaceDisplay.ToLaunchShortcut(entry, workspace.Directory).
  • Preserve current partial-launch behavior.

5. Creation and editor UX

  • Shortcut-picker creation copies the normalized shortcut directory into the draft and suggests {shortcut.Name} — Agents.
  • Add a first-class Project folder field in the workspace editor, with text entry, Browse, Paste, and Choose from shortcut.
  • Choosing a shortcut updates only the draft directory.
  • Rename/remove project-shortcut-specific navigation state and picker modes.
  • Do not save until the user explicitly saves the workspace.

6. Broken-state UX

Add WorkspaceHealth:

  • NeedsFolder: directory empty.
  • FolderMissing: configured directory does not exist.

List/editor subtitles should show the shortened directory when healthy, and clear warnings such as ⚠ Choose project folder or ⚠ Folder missing when not. Broken workspaces remain visible and editable.

7. Discovery and shortcut context menus

  • Replace GetByProjectShortcutId with GetByDirectory using WorkspacePath.PathsEqual.
  • Shortcut context menus retain Create workspace from this shortcut and list matching workspaces by normalized directory equality.
  • Search matches workspace name, keyword, entry labels/commands, and directory.

8. Remove delete coupling

  • Remove all workspace guards from DeleteShortcutCommand and related delete paths.
  • Deleting or renaming a shortcut has no effect on workspaces.

9. Import/export and cleanup

  • Workspace export is self-contained.
  • Invalid imported paths are retained as repairable broken states rather than crashing or being discarded.
  • Update clone, fallback page, list item, validation, and display paths to use Directory.
  • Remove dead ProjectShortcutId code, project-link messages, and obsolete editor navigation helpers.

Verification

  1. Create from shortcut saves a copied Directory and launches entries in that folder.
  2. Save with no folder fails validation.
  3. Launch against a missing folder shows a clear error and opens nothing.
  4. A valid legacy ProjectShortcutId migrates to Directory and is not persisted afterward.
  5. A dead legacy ID produces a repairable broken workspace.
  6. Deleting a formerly referenced shortcut leaves a workspace launchable.
  7. Shortcut context menus show workspaces with the same normalized path.
  8. Multiple workspaces may share one directory and launch independently.
  9. WSL paths normalize and launch through existing terminal behavior.
  10. Cross-machine imports with invalid paths load as broken, not fatal.
  11. Search finds workspaces by directory fragment.
  12. Run dotnet build QuickShell.sln and the relevant automated tests, then complete the manual matrix above.

Out of scope

  • Optional linked-shortcut synchronization.
  • Combined shortcuts/workspaces backup format.
  • Automatic path repair or relative paths.
  • Process sequencing, supervision, or readiness management.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions