feat(prompts): add create and rename flows for CLI and TUI#160
Merged
SaladDay merged 2 commits intoSaladDay:mainfrom May 6, 2026
Merged
feat(prompts): add create and rename flows for CLI and TUI#160SaladDay merged 2 commits intoSaladDay:mainfrom
SaladDay merged 2 commits intoSaladDay:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR completes prompt management workflows across both the CLI and the TUI by adding create + rename flows, a TUI refresh action, and shared backend service methods so both frontends behave consistently.
Changes:
- Added prompt creation (TUI overlay + editor submit) and prompt renaming (CLI + TUI) workflows.
- Introduced shared backend helpers:
PromptService::create_prompt,PromptService::rename_prompt, and shared prompt ID generation. - Updated TUI key hints/help text, CLI command surface (
create [name], newrename <id> [name]), and added/extended tests.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src-tauri/tests/prompt_commands.rs | Adds tests covering prompt create (explicit name) and rename behavior. |
| src-tauri/src/services/prompt.rs | Adds shared prompt ID generation plus create_prompt/rename_prompt service methods. |
| src-tauri/src/cli/tui/ui/prompts.rs | Updates Prompts page key legend to include create/refresh/rename. |
| src-tauri/src/cli/tui/runtime_actions/prompts.rs | Adds runtime action handler for prompt rename. |
| src-tauri/src/cli/tui/runtime_actions/mod.rs | Wires Action::PromptRename into the runtime action dispatcher. |
| src-tauri/src/cli/tui/runtime_actions/editor.rs | Adds editor submit handling for prompt creation and a corresponding test. |
| src-tauri/src/cli/tui/app/types.rs | Extends TextSubmit to support prompt create-name and rename flows. |
| src-tauri/src/cli/tui/app/tests.rs | Adds TUI key/overlay/action unit tests for create/rename/refresh behavior. |
| src-tauri/src/cli/tui/app/overlay_handlers/dialogs.rs | Handles prompt create-name and rename submits via the text input overlay. |
| src-tauri/src/cli/tui/app/editor_state.rs | Adds EditorSubmit::PromptCreate. |
| src-tauri/src/cli/tui/app/content_entities.rs | Adds prompts-page keybindings: c create, r reload, n rename. |
| src-tauri/src/cli/tui/app/content_config.rs | Adds helper to open the create-name text input overlay with a default name. |
| src-tauri/src/cli/tui/app/app_state.rs | Adds new Action::PromptRename { id, name }. |
| src-tauri/src/cli/mod.rs | Updates CLI command description to include create/rename. |
| src-tauri/src/cli/i18n/texts/toasts.rs | Adds new toasts for prompt created/renamed. |
| src-tauri/src/cli/i18n/texts/providers.rs | Adds a TUI key label for “rename”. |
| src-tauri/src/cli/i18n/texts/core.rs | Updates TUI help text to include new prompt keybindings. |
| src-tauri/src/cli/i18n/texts/config_actions.rs | Adds prompt create/rename overlay titles/prompts and empty-name toast text. |
| src-tauri/src/cli/i18n.rs | Mirrors i18n updates (help/footer/key labels/toasts/prompts) in the monolithic texts module. |
| src-tauri/src/cli/commands/prompts.rs | Extends CLI prompts commands: create [name] and new rename <id> [name]. |
| README.md | Documents new/updated CLI prompt commands. |
| README_ZH.md | Documents new/updated CLI prompt commands (Chinese). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Owner
|
LGTM, THANKS! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR completes prompt management as a first-class workflow instead of leaving it half in CLI and half missing in TUI.
It adds:
What changed
CLI
cc-switch prompts rename <id> [name]renamefalls back to an interactive single-line prompt whennameis omittedcc-switch prompts createtocc-switch prompts create [name]createnow lets users set the prompt name up front instead of only generating a timestamp nameTUI
con the Prompts page to create a promptnon the Prompts page to rename a promptron the Prompts page to reload prompt data so prompts created outside the current TUI session become visible without restartingTextInputoverlay for prompt naming and the existing multiline editor for prompt contentShared backend
PromptService::create_prompt(...)PromptService::rename_prompt(...)Why this design
The original prompt UX had three gaps:
This change keeps the implementation aligned with existing repo patterns:
Validation
Ran with
cargo +stableinsrc-tauri/.Passed:
cargo +stable fmt --allcargo +stable test --test prompt_commands -- --nocapturecargo +stable test prompts_ --lib -- --nocapturecargo +stable test submit_prompt_create_persists_prompt_and_refreshes_selection --lib -- --nocaptureNotes
The local environment still has a flaky install path for the repo's pinned Rust
1.91.1toolchain, so validation was run withcargo +stable.