Skip to content

Commit 0942d44

Browse files
jzhuclaude
andcommitted
refactor: Remove duplicate enable/disable commands from prompt CLI
The enable/disable commands were redundant with activate/deactivate: - disable and deactivate did exactly the same thing (set enabled=False) - enable was confusing since it didn't sync to file (activate does) Removed: - enable and disable CLI commands from prompts_commands.py - enable() and disable() methods from PromptManager class - Corresponding unit test The activate/deactivate pair now serves as the clear, unified API for managing prompt state. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 62f74dd commit 0942d44

3 files changed

Lines changed: 0 additions & 63 deletions

File tree

code_assistant_manager/cli/prompts_commands.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -195,35 +195,6 @@ def delete_prompt(
195195
raise typer.Exit(1)
196196

197197

198-
@prompt_app.command("enable")
199-
def enable_prompt(prompt_id: str = typer.Argument(..., help="Prompt identifier")):
200-
"""Enable a prompt (does not sync to file)."""
201-
manager = _get_prompt_manager()
202-
203-
try:
204-
manager.enable(prompt_id)
205-
typer.echo(f"{Colors.GREEN}✓ Prompt enabled: {prompt_id}{Colors.RESET}")
206-
typer.echo(
207-
f"{Colors.CYAN}Note: Use 'cam prompt activate' to sync to app file{Colors.RESET}"
208-
)
209-
except ValueError as e:
210-
typer.echo(f"{Colors.RED}✗ Error: {e}{Colors.RESET}")
211-
raise typer.Exit(1)
212-
213-
214-
@prompt_app.command("disable")
215-
def disable_prompt(prompt_id: str = typer.Argument(..., help="Prompt identifier")):
216-
"""Disable a prompt."""
217-
manager = _get_prompt_manager()
218-
219-
try:
220-
manager.disable(prompt_id)
221-
typer.echo(f"{Colors.GREEN}✓ Prompt disabled: {prompt_id}{Colors.RESET}")
222-
except ValueError as e:
223-
typer.echo(f"{Colors.RED}✗ Error: {e}{Colors.RESET}")
224-
raise typer.Exit(1)
225-
226-
227198
@prompt_app.command("activate")
228199
def activate_prompt(
229200
prompt_id: str = typer.Argument(..., help="Prompt identifier"),

code_assistant_manager/prompts.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -207,26 +207,6 @@ def delete(self, prompt_id: str) -> None:
207207
self._save_prompts(prompts)
208208
logger.info(f"Deleted prompt: {prompt_id}")
209209

210-
def enable(self, prompt_id: str) -> None:
211-
"""Enable a prompt."""
212-
prompts = self._load_prompts()
213-
if prompt_id not in prompts:
214-
raise ValueError(f"Prompt with id '{prompt_id}' not found")
215-
prompts[prompt_id].enabled = True
216-
prompts[prompt_id].updated_at = int(datetime.now().timestamp() * 1000)
217-
self._save_prompts(prompts)
218-
logger.info(f"Enabled prompt: {prompt_id}")
219-
220-
def disable(self, prompt_id: str) -> None:
221-
"""Disable a prompt."""
222-
prompts = self._load_prompts()
223-
if prompt_id not in prompts:
224-
raise ValueError(f"Prompt with id '{prompt_id}' not found")
225-
prompts[prompt_id].enabled = False
226-
prompts[prompt_id].updated_at = int(datetime.now().timestamp() * 1000)
227-
self._save_prompts(prompts)
228-
logger.info(f"Disabled prompt: {prompt_id}")
229-
230210
def import_from_file(self, file_path: Path) -> None:
231211
"""Import prompts from a JSON file."""
232212
try:

tests/unit/test_prompts.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -148,20 +148,6 @@ def test_manager_delete_prompt(self, temp_config_dir):
148148
manager.delete("test")
149149
assert manager.get("test") is None
150150

151-
def test_manager_enable_disable(self, temp_config_dir):
152-
"""Test enabling and disabling prompts."""
153-
manager = PromptManager(temp_config_dir)
154-
prompt = Prompt(id="test", name="Test", content="Content", enabled=False)
155-
manager.create(prompt)
156-
157-
manager.enable("test")
158-
loaded = manager.get("test")
159-
assert loaded.enabled is True
160-
161-
manager.disable("test")
162-
loaded = manager.get("test")
163-
assert loaded.enabled is False
164-
165151
def test_manager_upsert(self, temp_config_dir):
166152
"""Test upserting a prompt."""
167153
manager = PromptManager(temp_config_dir)

0 commit comments

Comments
 (0)