Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/doberman/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
from doberman.demo import format_outcome_line, format_summary_table, run_demo
from doberman.discovery.mcp_scan import MCP_CONFIG_FILES, scan_mcp_configs
from doberman.discovery.scan import enumerate_capabilities, rate_capabilities, render_risk_map
from doberman.hosthooks.install import DASHBOARD_COMMAND
from doberman.policy.checklist import recommend_policy
from doberman.policy.drift import (
_verify_possession_factor,
Expand Down Expand Up @@ -1690,7 +1691,7 @@ def install_hooks(
typer.echo("[dry-run] would add:")
typer.echo(" PreToolUse -> doberman hook pre")
typer.echo(" PostToolUse -> doberman hook post")
typer.echo(" SessionStart -> doberman dashboard")
typer.echo(f" SessionStart -> {DASHBOARD_COMMAND}")
return

write_settings(settings_path, merged)
Expand Down Expand Up @@ -1849,7 +1850,7 @@ def uninstall_hooks(
typer.echo("[dry-run] would remove:")
typer.echo(" PreToolUse -> doberman hook pre")
typer.echo(" PostToolUse -> doberman hook post")
typer.echo(" SessionStart -> doberman dashboard")
typer.echo(f" SessionStart -> {DASHBOARD_COMMAND}")
return

write_settings(settings_path, cleaned)
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/test_install_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,15 @@ def test_dry_run_output_mentions_hooks(self, tmp_path):
assert "doberman hook pre" in result.output
assert "doberman hook post" in result.output

def test_dry_run_shows_the_command_the_installer_writes(self, tmp_path):
result = runner.invoke(
cli_module.app, ["install-hooks", "--path", str(tmp_path), "--dry-run"]
)

assert result.exit_code == 0, result.output
assert f"SessionStart -> {DASHBOARD_COMMAND}" in result.output
assert "doberman dashboard" not in result.output

def test_install_is_idempotent(self, tmp_path):
runner.invoke(cli_module.app, ["install-hooks", "--path", str(tmp_path)])
runner.invoke(cli_module.app, ["install-hooks", "--path", str(tmp_path)])
Expand Down Expand Up @@ -424,6 +433,8 @@ def test_dry_run_writes_nothing(self, tmp_path):
)
assert result.exit_code == 0
assert "[dry-run]" in result.output
assert f"SessionStart -> {DASHBOARD_COMMAND}" in result.output
assert "doberman dashboard" not in result.output
assert settings_path.read_text(encoding="utf-8") == content_before

def test_creates_bak_on_uninstall(self, tmp_path):
Expand Down
Loading