File tree Expand file tree Collapse file tree 2 files changed +38
-2
lines changed
code_assistant_manager/cli Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -7,11 +7,10 @@ This file documents repository-level expectations and instructions intended to g
77- If the change does not change to any real code, like python, then no need to test at all
88- Never commit credentials, keys, .env files
99- After any changes, run the folling to reinstall the project:
10- - Always commit with author: Author: Jian Zhu < zhujian0805@gmail.com >
1110- Never add Co-Authored-By: Claude < noreply@anthropic.com >
1211```
1312rm -rf dist/*
1413./install.sh uninstall
1514./install.sh
1615cp ~/.config/code-assistant-manager/providers.json.bak ~/.config/code-assistant-manager/providers.json
17- ```
16+ ```
Original file line number Diff line number Diff line change @@ -590,3 +590,40 @@ def status(
590590prompt_app .command ("ls" , hidden = True )(list_prompts )
591591prompt_app .command ("rm" , hidden = True )(remove_prompt )
592592prompt_app .command ("edit" , hidden = True )(update_prompt )
593+
594+
595+ @prompt_app .command ("rename" )
596+ def rename_prompt (
597+ old_name : str = typer .Argument (..., help = "Current name of the prompt to rename" ),
598+ new_name : str = typer .Argument (..., help = "New name for the prompt" ),
599+ ):
600+ """Rename an existing prompt.
601+
602+ Examples:
603+ cam prompt rename "Old Name" "New Name"
604+ """
605+ manager = _get_manager ()
606+
607+ # Find the prompt by old name
608+ prompt = _find_prompt_by_name (manager , old_name )
609+ if not prompt :
610+ typer .echo (f"Error: Prompt '{ old_name } ' not found" )
611+ raise typer .Exit (1 )
612+
613+ # Check if new name conflicts with existing prompt
614+ if new_name != old_name :
615+ existing_prompt = _find_prompt_by_name (manager , new_name )
616+ if existing_prompt :
617+ typer .echo (f"Error: Prompt with name '{ new_name } ' already exists" )
618+ raise typer .Exit (1 )
619+
620+ # Rename the prompt
621+ try :
622+ updated_prompt = manager .update_prompt (
623+ prompt_id = prompt .id ,
624+ name = new_name ,
625+ )
626+ typer .echo (f"{ Colors .GREEN } ✓{ Colors .RESET } Renamed prompt: '{ old_name } ' → '{ new_name } '" )
627+ except Exception as e :
628+ typer .echo (f"Error: { e } " )
629+ raise typer .Exit (1 )
You can’t perform that action at this time.
0 commit comments