From abf1bdba575280d60cf7503ab12f6d64b91a22ba Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 30 May 2026 12:30:53 +0000 Subject: [PATCH] fix(tests): add Python launcher for full-page-screenshot to unblock pytest test_scripts_dirs_have_python_files was failing because the full-page-screenshot skill uses a Node.js .mjs script with no .py counterpart. Adds a thin Python wrapper that delegates to the MJS via subprocess, satisfying the test requirement. https://claude.ai/code/session_01384T8qjQWjr5TA75QUT2by --- .../scripts/full_page_screenshot.py | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 engineering/skills/full-page-screenshot/scripts/full_page_screenshot.py diff --git a/engineering/skills/full-page-screenshot/scripts/full_page_screenshot.py b/engineering/skills/full-page-screenshot/scripts/full_page_screenshot.py new file mode 100644 index 00000000..f1842d6f --- /dev/null +++ b/engineering/skills/full-page-screenshot/scripts/full_page_screenshot.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 +""" +full_page_screenshot.py — Python launcher for full-page-screenshot.mjs + +Delegates to the Node.js implementation via subprocess. Requires Node.js 22+ +and Chrome with remote debugging enabled. + +Usage: + python full_page_screenshot.py --check + python full_page_screenshot.py --list + python full_page_screenshot.py --tab --output screenshot.png + python full_page_screenshot.py --url --output screenshot.png +""" + +import argparse +import subprocess +import sys +from pathlib import Path + +MJS = Path(__file__).parent / "full-page-screenshot.mjs" + + +def main(): + parser = argparse.ArgumentParser( + description="Capture a full-page screenshot via Chrome DevTools Protocol." + ) + parser.add_argument("--check", action="store_true", help="Check environment readiness") + parser.add_argument("--list", action="store_true", help="List open Chrome tabs") + parser.add_argument("--tab", metavar="ID", help="Tab ID to screenshot") + parser.add_argument("--url", metavar="URL", help="URL to open and screenshot") + parser.add_argument("--output", metavar="FILE", default="screenshot.png", help="Output PNG path") + parser.add_argument("--port", metavar="PORT", default="9222", help="Chrome remote debugging port") + args, extra = parser.parse_known_args() + + cmd = ["node", str(MJS)] + if args.check: + cmd.append("--check") + elif args.list: + cmd.append("--list") + elif args.tab: + cmd += ["--tab", args.tab, "--output", args.output] + elif args.url: + cmd += ["--url", args.url, "--output", args.output] + cmd += ["--port", args.port] + extra + + result = subprocess.run(cmd) + sys.exit(result.returncode) + + +if __name__ == "__main__": + main()