-
Notifications
You must be signed in to change notification settings - Fork 11
🤖 feat: add -m flag to /new command + UX improvements #475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Support /new -m <model> to set initial model (like /compact) - Forward start message and model to modal when errors occur - Add textarea in NewWorkspaceModal for start message display - Model selector defaults to provided model or workspace default - Send start message with specified model after workspace creation Fixes three bugs: 1. Missing -m flag support for model selection 2. Lost start message on errors (now preserved in modal) 3. No way to see/edit start message in error modal All tests pass (16 /new command tests + 54 other slash command tests).
Replaced 8 separate useState declarations with a single workspaceModalState object. This reduces setState calls from 8 to 1 when opening/closing the modal, making updates atomic and improving code organization. Changes: - Consolidated state: isOpen, projectPath, projectName, branches, defaultTrunk, loadError, startMessage, model - Updated handleAddWorkspace to use single setState - Updated modal onClose to use single setState - Updated handleCreateWorkspace and modal render to reference new state Generated with `cmux`
The start message textarea now only appears when initialStartMessage is provided (i.e., from /new command flow). In the normal modal flow where users manually create workspaces, the field is hidden since users can just send a message after workspace creation. This reduces visual clutter and makes the modal more focused for the common case. Generated with `cmux`
Extracted duplicated state to constants/helpers: - INITIAL_WORKSPACE_MODAL_STATE in App.tsx (used in useState + onClose) - resetForm() in NewWorkspaceModal.tsx (used in handleCancel + handleSubmit) Reduces duplication and ensures consistent state resets across all paths. Generated with `cmux`
…acks Simplifications in App.tsx for net negative LoC: - Moved INITIAL_WORKSPACE_MODAL_STATE to module scope (prevents recreation) - Removed thin wrapper callbacks (handleAddProjectCallback, etc.) - Directly pass functions to LeftSidebar (addProject, handleAddWorkspace, handleRemoveProject) Net impact: 774 → 757 lines (-17 LoC) Generated with `cmux`
00f55bc to
c06300d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Moved all workspace modal management out of App.tsx into a dedicated custom hook for better separation of concerns: - Created src/hooks/useWorkspaceModal.ts (181 lines) - Removed 126 lines of modal logic from App.tsx - App.tsx reduced from 755 → 629 lines (net -126 LOC in App.tsx) - Overall project net +55 LOC (181 new - 126 removed) Benefits: - App.tsx is now more minimal and focused on layout/routing - Modal logic is self-contained and reusable - Easier to test modal behavior in isolation - Clearer separation between UI structure and modal state management Generated with `cmux`
The parsed model value was not being forwarded to createNewWorkspace, so successful '/new -m <model>' commands still sent the start message with whatever model was previously active. Only the error path and modal reused the flag. Fixed by: - Added model?: string to CreateWorkspaceOptions interface - Applied model override to sendMessageOptions before sending message - Forwarded parsed.model from handleNewCommand to createNewWorkspace Now -m flag works correctly for both successful and failed /new attempts. Generated with `cmux`
- Removed unused useState import - Removed unused RuntimeConfig and getRuntimeKey imports - Fixed workspaceModal dependency warnings by including whole object - Fixed promise-returning function warnings with explicit void wrappers - Fixed unsafe any types in useWorkspaceModal with WorkspaceSelection type - Fixed registerParamsRef type issues with explicit BuildSourcesParams type Generated with `cmux`
Summary
Adds model selection flag to
/newcommand and improves workspace modal UX by consolidating state management and conditionally showing the start message textarea.Changes
1. Add
-mflag for model selection/newcommand now supports-m <model>to specify initial model (like/compactdoes)-m sonnet→anthropic:claude-sonnet-4-52. Forward start message to modal on errors
/newfails or opens modal, preserves start message and model3. Consolidate workspace modal state
useStatedeclarations with singleworkspaceModalStateobjectINITIAL_WORKSPACE_MODAL_STATEconstant for DRY4. Conditional textarea display
initialStartMessageis provided5. DRY improvements
resetForm()helper in NewWorkspaceModalTesting
✅ All 16
/newcommand tests pass✅ All 70 slash command tests pass
✅ Type checking passes (main + renderer)
✅ Code formatted
Example Usage
Generated with
cmux