forked from browser-use/browser-harness
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
62 lines (52 loc) · 1.65 KB
/
run.py
File metadata and controls
62 lines (52 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import os, sys
from admin import (
_version,
ensure_daemon,
list_cloud_profiles,
list_local_profiles,
print_update_banner,
restart_daemon,
run_doctor,
run_setup,
run_update,
start_remote_daemon,
stop_remote_daemon,
sync_local_profile,
)
from helpers import *
HELP = """Browser Harness
Read SKILL.md for the default workflow and examples.
Typical usage:
browser-harness -c 'ensure_real_tab(); print(page_info())'
Helpers are pre-imported. The daemon auto-starts and connects to the running browser.
Commands:
browser-harness --version print the installed version
browser-harness --doctor diagnose install, daemon, and browser state
browser-harness --setup interactively attach to your running browser
browser-harness --update [-y] pull the latest version (agents: pass -y)
"""
def main():
args = sys.argv[1:]
if args and args[0] in {"-h", "--help"}:
print(HELP)
return
if args and args[0] == "--version":
print(_version() or "unknown")
return
if args and args[0] == "--doctor":
sys.exit(run_doctor())
if args and args[0] == "--setup":
sys.exit(run_setup())
if args and args[0] == "--update":
yes = any(a in {"-y", "--yes"} for a in args[1:])
sys.exit(run_update(yes=yes))
if args and args[0] == "--debug-clicks":
os.environ["BH_DEBUG_CLICKS"] = "1"
args = args[1:]
if not args or args[0] != "-c":
sys.exit("Usage: browser-harness -c \"print(page_info())\"")
print_update_banner()
ensure_daemon()
exec(args[1], globals())
if __name__ == "__main__":
main()