Skip to content
Merged
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
15 changes: 10 additions & 5 deletions libs/code/deepagents_code/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import json
import logging
import os
import shlex
import shutil
import sys
import traceback
Expand All @@ -40,6 +41,11 @@
"""Marker stored by `--sandbox` with no value, resolved to `[sandboxes].default`."""


def _tail_log_command(log_path: Path | str) -> str:
"""Return a copy-pasteable command for following a log file."""
return f"tail -f {shlex.quote(str(log_path))}"


def build_version_text() -> str:
"""Build the plain-text output for the `--version` CLI flag.

Expand Down Expand Up @@ -371,7 +377,7 @@ def _run_startup_auto_update(console: "Console") -> None:
return
log_path = create_update_log_path()
console.print(
f"Progress: tail -f {log_path}",
f"Update log: {_tail_log_command(log_path)}",
style="dim",
highlight=False,
markup=False,
Expand Down Expand Up @@ -2973,7 +2979,7 @@ def cli_main() -> None:
sys.exit(0)
log_path = create_update_log_path()
console.print(
f"Update log: {log_path}\nTail progress: tail -f {log_path}",
f"Update log: {_tail_log_command(log_path)}",
style="dim",
highlight=False,
markup=False,
Expand Down Expand Up @@ -3094,8 +3100,7 @@ def cli_main() -> None:
console.print(f"Installing package '{package}'...")
pkg_log_path = create_update_log_path()
console.print(
f"Install log: {pkg_log_path}\n"
f"Tail progress: tail -f {pkg_log_path}",
f"Install log: {_tail_log_command(pkg_log_path)}",
style="dim",
highlight=False,
markup=False,
Expand Down Expand Up @@ -3205,7 +3210,7 @@ def cli_main() -> None:
console.print(f"Installing extra '{extra}'...")
log_path = create_update_log_path()
console.print(
f"Install log: {log_path}\nTail progress: tail -f {log_path}",
f"Install log: {_tail_log_command(log_path)}",
style="dim",
highlight=False,
markup=False,
Expand Down
2 changes: 2 additions & 0 deletions libs/code/tests/unit_tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ def test_successful_update_restarts_before_launch(self) -> None:
_run_startup_auto_update(console)

upgrade.assert_awaited_once()
printed = " ".join(str(c.args[0]) for c in console.print.call_args_list)
assert "tail -f /tmp/dcode-update.log" in printed
restart.assert_called_once_with()

def test_successful_update_skips_restart_when_shadowed(self) -> None:
Expand Down
2 changes: 2 additions & 0 deletions libs/code/tests/unit_tests/test_main_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -1937,6 +1937,7 @@ def test_success_renders_installed_message(self) -> None:
assert code == 0
text = self._printed_text(console_mock)
assert "Installed extra 'quickjs'" in text
assert "tail -f /tmp/deepagents-install.log" in text

def test_failure_renders_log_path_and_manual_command(self) -> None:
"""A failed install surfaces both the log path and manual script command."""
Expand Down Expand Up @@ -2106,6 +2107,7 @@ def test_package_with_yes_runs(self) -> None:
perform_mock.assert_awaited_once()
text = self._printed_text(console_mock)
assert "Installed package 'langchain-custom'" in text
assert "tail -f /tmp/deepagents-install.log" in text

def test_package_non_interactive_without_yes_refuses(self) -> None:
"""Non-TTY stdin + no --yes must exit 2 without installing."""
Expand Down
Loading