Skip to content

Commit 3643bff

Browse files
committed
feat: Add enable/disable commands for prompt management
- enable: Marks a prompt as active for a specific app type - disable: Marks a prompt as inactive These commands only change the prompt state in the database. Use 'sync' to write content to file, 'unsync' to clear files.
1 parent 5c27b30 commit 3643bff

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

code_assistant_manager/cli/prompts_commands.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,68 @@ def delete_prompt(
221221
raise typer.Exit(1)
222222

223223

224+
@prompt_app.command("enable")
225+
def enable_prompt(
226+
prompt_id: str = typer.Argument(..., help="Prompt identifier to enable"),
227+
app_type: str = typer.Option(
228+
...,
229+
"--app",
230+
"-a",
231+
help="App type to enable prompt for (claude, codex, gemini, copilot)",
232+
),
233+
):
234+
"""Enable a prompt for a specific app.
235+
236+
This marks the prompt as active for the specified app type.
237+
Only one prompt can be active per app type at a time.
238+
Use 'sync' command to write the content to the app's prompt file.
239+
"""
240+
manager = _get_prompt_manager()
241+
prompt = manager.get(prompt_id)
242+
243+
if not prompt:
244+
typer.echo(f"{Colors.RED}✗ Prompt '{prompt_id}' not found{Colors.RESET}")
245+
raise typer.Exit(1)
246+
247+
target_app = resolve_single_app(app_type, VALID_APP_TYPES)
248+
249+
try:
250+
manager.activate(prompt_id, app_type=target_app)
251+
typer.echo(
252+
f"{Colors.GREEN}✓ Enabled '{prompt_id}' for {target_app}{Colors.RESET}"
253+
)
254+
typer.echo(
255+
f" {Colors.CYAN}Tip:{Colors.RESET} Use 'cam prompt sync -a {target_app}' to write to file"
256+
)
257+
except ValueError as e:
258+
typer.echo(f"{Colors.RED}✗ Error: {e}{Colors.RESET}")
259+
raise typer.Exit(1)
260+
261+
262+
@prompt_app.command("disable")
263+
def disable_prompt(
264+
prompt_id: str = typer.Argument(..., help="Prompt identifier to disable"),
265+
):
266+
"""Disable a prompt.
267+
268+
This marks the prompt as inactive. The prompt file is not modified.
269+
Use 'unsync' command to clear the app's prompt file.
270+
"""
271+
manager = _get_prompt_manager()
272+
prompt = manager.get(prompt_id)
273+
274+
if not prompt:
275+
typer.echo(f"{Colors.RED}✗ Prompt '{prompt_id}' not found{Colors.RESET}")
276+
raise typer.Exit(1)
277+
278+
try:
279+
manager.deactivate(prompt_id)
280+
typer.echo(f"{Colors.GREEN}✓ Disabled '{prompt_id}'{Colors.RESET}")
281+
except ValueError as e:
282+
typer.echo(f"{Colors.RED}✗ Error: {e}{Colors.RESET}")
283+
raise typer.Exit(1)
284+
285+
224286
@prompt_app.command("sync")
225287
def sync_prompts(
226288
prompt_id: Optional[str] = typer.Argument(

0 commit comments

Comments
 (0)