diff --git a/abx_plugins/plugins/claudecode/claudecode_utils.py b/abx_plugins/plugins/claudecode/claudecode_utils.py index ca3a2b29..97f94466 100755 --- a/abx_plugins/plugins/claudecode/claudecode_utils.py +++ b/abx_plugins/plugins/claudecode/claudecode_utils.py @@ -165,7 +165,9 @@ def run_claude_code( Returns: (stdout, stderr, returncode) """ config = load_config(Path(__file__).with_name("config.json")) - binary = str(config.CLAUDECODE_BINARY) + binary = str(os.environ.get("CLAUDECODE_BINARY") or config.CLAUDECODE_BINARY) + if not Path(binary).exists(): + return "", f"Claude Code binary not found: {binary}", 1 cmd = [binary] diff --git a/abx_plugins/plugins/ytdlp/templates/card.html b/abx_plugins/plugins/ytdlp/templates/card.html index 6fe32098..9238b877 100644 --- a/abx_plugins/plugins/ytdlp/templates/card.html +++ b/abx_plugins/plugins/ytdlp/templates/card.html @@ -1,13 +1,61 @@ {% if media_files %} -
+
{% for file in media_files %} - - 📄 {{ file.name }} - + {% if file.is_browser_playable %} +
+ + + Download file + +
+ {% else %} + + {% endif %} {% endfor %}
+ {% else %}
🎬 diff --git a/abx_plugins/plugins/ytdlp/tests/test_ytdlp.py b/abx_plugins/plugins/ytdlp/tests/test_ytdlp.py index e7747808..726b41f8 100755 --- a/abx_plugins/plugins/ytdlp/tests/test_ytdlp.py +++ b/abx_plugins/plugins/ytdlp/tests/test_ytdlp.py @@ -124,6 +124,27 @@ def test_hook_script_exists(): assert YTDLP_HOOK.exists(), f"Hook not found: {YTDLP_HOOK}" +def test_card_template_loads_browser_media_on_click(): + """Card template should not fetch archived media until the user asks to play it.""" + template = (PLUGIN_DIR / "templates" / "card.html").read_text() + + assert "ytdlp-load-player" in template + assert 'data-src="{{ file.url|default:file.path|urlencode }}"' in template + assert "media.src = src" in template + assert " str: from abx_plugins.plugins.chrome.tests.chrome_test_helpers import get_test_env from abx_plugins.plugins.base.utils import load_required_binary @@ -336,14 +343,6 @@ def install_claude_code_with_abxpkg() -> str: elif not Path(claude_bin).exists(): pytest.fail(f"CLAUDECODE_BINARY is set but does not exist: {claude_bin}") - # Check API key - api_key = os.environ.get("ANTHROPIC_API_KEY", "") - if not api_key: - pytest.fail( - "ANTHROPIC_API_KEY not set. Claude Code integration tests " - "require a valid API key.", - ) - # Quick smoke test: claude --version result = subprocess.run( [claude_bin, "--version"], @@ -367,8 +366,8 @@ def ensure_anthropic_api_key(): """ api_key = os.environ.get("ANTHROPIC_API_KEY", "") if not api_key: - pytest.fail( - "ANTHROPIC_API_KEY not set. Integration tests that call the " - "Anthropic API require a valid API key.", + pytest.skip( + "ANTHROPIC_API_KEY not set. Integration tests that call the " + "Anthropic API require live credentials.", ) return api_key