Skip to content

[feature] Add workspaces from the sidebar and show empty workspaces #2115

Description

@zerob13

Summary

Users cannot add a directory directly from the sidebar workspace section. Adding only a folder-picker button is insufficient because the sidebar currently removes workspace groups that have no Sessions.

Priority: P1

Current behavior

The workspace header in src/renderer/src/components/WindowSideBar.vue exposes only the project/date grouping toggle.

The existing projectStore.openFolderPicker() in
src/renderer/src/stores/ui/project.ts already provides the correct typed route for selecting and activating a directory, and the New Thread page uses it.

However, baseFilteredGroups in WindowSideBar.vue is built from Session groups and then filters every group whose Session list is empty. projectStore.environments is used only to sort groups that already exist.

Therefore, wiring the picker to a new sidebar button would produce a broken flow:

  1. The user selects a directory.
  2. The environment is persisted successfully.
  3. The directory has no Session yet.
  4. The sidebar still does not show it, so the action appears to have failed.

Related contracts and documentation

  • docs/features/complete-directory-management/spec.md makes src/main/project/ the owner of managed directory metadata and defines active directories independently of Session rows.
  • The same contract says directory management and project-group sidebar mode share persisted order and lifecycle state.
  • Issue [Feature] Complete directory management #1785 and PR feat(directory): manage environments #1787 implemented complete directory management, but the sidebar still projects only Session-derived groups.

The renderer must project the managed-environment source of truth, not infer workspace existence from Session history.

Proposed experience

Before
Workspace                         [group]
  project-a
  project-b

After
Workspace                    [+]  [group]
  new-project                    0
  project-a                     12
  project-b                      3
  • Add a compact Add workspace action to the workspace header.
  • Merge active projectStore.environments with Session-derived groups.
  • Create an empty group for a managed directory with zero Sessions.
  • Selecting an empty group should open a new draft with that workspace preselected.
  • Missing/archived/removed environments must retain their existing lifecycle rules.

Impact

  • The most natural entry point for workspace creation is absent.
  • Users must discover the New Thread page or Settings first.
  • A naïve UI-only button would persist data while appearing to do nothing.
  • Empty workspaces cannot be prepared or managed from the main navigation.

Acceptance criteria

  • The sidebar workspace header includes an accessible Add workspace action.
  • Selecting a directory creates or activates one managed environment through the existing project route.
  • A newly added zero-Session environment appears immediately in project-group mode.
  • Selecting that group creates/opens a draft with the correct projectDir.
  • Search, archive, remove, missing-path, default-workspace, and drag-order behavior remains correct.
  • Tests cover adding an empty environment, event-driven refresh, duplicate selection, and first Session creation.

User benefit

Users can create a workspace where they see and manage workspaces, and the new directory becomes immediately visible even before its first conversation.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions