Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Replaces the delete button on workspace items with a kebab menu containing Fork, Compact, and Delete actions. Adds modal experiences for Fork and Compact operations following the pattern established by /new command and NewWorkspaceModal.

Changes

New Components

  • ForkWorkspaceModal: Modal for forking workspaces with command display
  • CompactModal: Modal for compacting conversation history with configurable options

Enhanced Functionality

  • WorkspaceListItem: Replaced delete button (×) with KebabMenu component
  • KebabMenu items:
    • 🔱 Fork - Create a fork of the workspace
    • 🗜️ Compact - Summarize conversation history
    • 🗑️ Delete - Remove workspace (existing functionality)

Shared Utilities

  • formatForkCommand() - Generate /fork command string for display
  • formatCompactCommand() - Generate /compact command string for display
  • Both utilities follow the pattern of formatNewCommand()

Implementation Details

Code Reuse Pattern

Maximizes code reuse by:

  1. Shared backend logic: Both modals and slash commands use same forkWorkspace() and executeCompaction() utilities
  2. Command display: All modals show equivalent command using format functions
  3. Consistent UX: Same modal structure, form patterns, and error handling

Grid Layout

Updated WorkspaceListItem grid from auto auto 1fr auto to auto auto 1fr auto auto to accommodate KebabMenu in 5th column.

Modal Features

Both modals include:

  • Auto-focus on primary input field
  • Real-time command display updates
  • Loading states during operations
  • Error handling with user-friendly messages
  • Form validation

Testing

Manual testing needed:

  • Open kebab menu on workspace item
  • Fork workspace via modal
  • Compact workspace via modal with custom options
  • Delete workspace via modal (existing flow)
  • Verify command display matches actual command syntax
  • Test error handling (invalid names, network errors)

Generated with cmux

- Replace delete button with KebabMenu (Fork, Compact, Delete)
- Add ForkWorkspaceModal with command display pattern
- Add CompactModal with command display pattern
- Export formatForkCommand and formatCompactCommand utilities
- Maximize code reuse following /new + NewWorkspaceModal pattern

Generated with `cmux`
- Move FormGroup, ErrorMessage, HelpText to shared exports
- Move CommandDisplay and CommandLabel to shared exports
- Update ForkWorkspaceModal, CompactModal, NewWorkspaceModal to use shared components
- Eliminates ~180 lines of duplication

Generated with `cmux`
Generated with `cmux`
- Rename internal execution types to avoid confusion
- ForkOptions/CompactOptions are now user-facing types
- ForkExecutionOptions/CompactExecutionOptions for internal use
- Modals use options type directly as state
- Eliminates intermediate object construction

Generated with `cmux`
The deprecated function was just pointless indirection.

Generated with `cmux`
- Remove formatForkCommand overloads (only ForkOptions signature needed)
- Remove formatCompactCommand overloads (only CompactOptions signature needed)
- Fix lint issues:
  - Remove unused Tooltip imports in WorkspaceListItem
  - Use nullish coalescing (??) instead of logical OR (||) in CompactModal
  - Fix missing dependencies in useEffect hook

All call sites already use the options object signature.
- CompactExecutionOptions now extends CompactOptions
- ForkOptions (execution) now extends UserForkOptions (base)
- Moved UserForkOptions definition to workspaceFork.ts (source of truth)
- Pass options object directly to formatCompactCommand (no reconstruction)
- Eliminates field duplication and ensures type consistency
- Created useCompactOptions hook to centralize default model resolution
- Both CompactModal and /compact command now use same model logic
- Hook initializes with preferred compaction model from localStorage
- Provides resetOptions() to reset form while preserving model preference
- Simplifies useEffect dependencies in CompactModal

Ensures consistent treatment of model defaults across modal and slash command paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant