-
Notifications
You must be signed in to change notification settings - Fork 12
Add createFile param to the switch submode command #3867
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?
Add createFile param to the switch submode command #3867
Conversation
Preview deployments |
…h-ai-it-will-sometimes
76b1b4d to
2cbf92e
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.
Pull request overview
This PR enhances the AI assistant's user experience by adding a createFile parameter to the switch-submode command. When switching from interact mode to code mode, the assistant can now create a blank file immediately, allowing users to see an empty file instead of an index card while the AI generates code.
Changes:
- Added
createFileboolean parameter toSwitchSubmodeInputand introducedSwitchSubmodeResultcard definition for handling filename conflicts - Implemented file creation logic in switch-submode command with automatic conflict resolution when target files already exist
- Extracted filename conflict resolution logic to a reusable utility function and refactored patch-code command to use it
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/base/command.gts | Added createFile field to SwitchSubmodeInput and defined SwitchSubmodeResult card for communicating filename changes |
| packages/host/app/commands/switch-submode.ts | Implemented file creation logic with conflict resolution when switching from interact to code mode |
| packages/host/app/utils/file-name.ts | New utility function for finding non-conflicting filenames |
| packages/host/app/commands/patch-code.ts | Refactored to use shared filename conflict resolution utility |
| packages/runtime-common/ai/prompt.ts | Added instruction generation for AI when filename conflicts occur |
| packages/host/app/components/matrix/room-message-command.gts | Hide result cards for switch-submode commands in the UI |
| packages/host/tests/integration/commands/switch-submode-test.gts | Added tests for file creation and conflict resolution scenarios |
| packages/ai-bot/tests/prompt-construction-test.ts | Added test for AI instruction when filename conflicts occur |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…h-ai-it-will-sometimes
|
Accompanying PR: cardstack/boxel-skills#44 |
This PR addresses a user experience issue where:
This PR adds an optional boolean param
createFileto switch mode command where it will create the file the assistant is about to generate. The user will be transitioned to code mode, seeing a blank file until the AI assistant is done generating the code.The changes in this PR alone don't fix the mentioned issue yet - there will be another PR in the skills repo to teach the LLM when to use
createFileparameter (I have it almost ready and confirm it works with all of the above).Note
Introduces file-creation flow when switching to code mode and propagates the final filename back to the AI.
createFiletoSwitchSubmodeInputand newSwitchSubmodeResultcard inbase/command.gtsswitch-submodewhen entering code mode: creates blank file if missing; if target exists with content, picks a non-conflicting filename and returns it via result cardfindNonConflictingFilenameutility and reuses it inpatch-code(replacing local logic)SwitchSubmodeResultis returnedswitch-submoderesult card in room UI; adds unit/integration tests for the new behaviorWritten by Cursor Bugbot for commit 21d54b8. This will update automatically on new commits. Configure here.