-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathTaskfile.yml
More file actions
159 lines (141 loc) · 6.07 KB
/
Copy pathTaskfile.yml
File metadata and controls
159 lines (141 loc) · 6.07 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
version: '3'
tasks:
cli:dev:
desc: Run the browser-use CLI from source, forwarding args after --
silent: true
cmds:
- |
scripts/install-agent-ripgrep.sh target/debug/agent-tools >/dev/null
BUT_TELEMETRY="${BUT_TELEMETRY:-0}" \
BUT_AGENT_TOOLS_DIR="$PWD/target/debug/agent-tools" \
cargo run -p browser-use-cli -- {{.CLI_ARGS}}
tui:dev:
aliases:
- dev
- up
desc: Run the browser-use TUI from source, forwarding args after --
silent: true
cmds:
- |
scripts/install-agent-ripgrep.sh target/debug/agent-tools >/dev/null
BUT_TELEMETRY="${BUT_TELEMETRY:-0}" \
BUT_AGENT_TOOLS_DIR="$PWD/target/debug/agent-tools" \
cargo run -p browser-use-tui -- {{.CLI_ARGS}}
reset:onboarding:
aliases:
- onboarding:reset
- reset-onboarding
desc: Reset TUI onboarding, history, and stored auth
silent: true
cmds:
- |
set -eu
state_dir="${STATE_DIR:-$HOME/.browser-use-terminal}"
db="$state_dir/state.db"
# Re-show onboarding from a clean local state. Two things must be cleared:
# 1) app_settings — drops setup.complete, model, account, saved auth, etc.
# (clearing only setup.complete isn't enough: a leftover model keeps
# model_configured=true, so the app auto-completes setup on the first
# tick and skips the wizard before you ever see it).
# 2) every other table (sessions/events/artifacts/...) — otherwise History
# still lists old runs and the home screen won't show the first-run
# examples (those only appear when history is empty).
# IMPORTANT: close the TUI first — a running app holds sessions in memory and
# rewrites them on exit, which would undo this.
if [ -f "$db" ]; then
tables="$(sqlite3 "$db" "SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%';")"
for t in $tables; do
case "$t" in
app_settings)
sqlite3 "$db" "DELETE FROM app_settings;" ;;
schema_migrations)
# NEVER touch: wiping this makes the app re-run migrations against an
# already-migrated schema -> "duplicate column name" on next launch.
: ;;
*)
sqlite3 "$db" "DELETE FROM \"$t\";" ;;
esac
done
sqlite3 "$db" "VACUUM;" || true
echo "onboarding reset: $db (settings, history, and stored auth cleared)"
else
echo "no existing state.db at $db — nothing to reset"
fi
echo "launch onboarding: cargo run -q -p browser-use-tui -- --state-dir \"$state_dir\""
echo ""
echo "NOTE: provider connection status also reads credentials OUTSIDE this DB."
echo "If a provider still says connected, a key is set in this shell. Unset it first:"
echo " unset ANTHROPIC_API_KEY OPENAI_API_KEY OPENROUTER_API_KEY DEEPSEEK_API_KEY"
echo " unset LLM_BROWSER_ANTHROPIC_API_KEY LLM_BROWSER_OPENAI_API_KEY LLM_BROWSER_OPENAI_COMPAT_API_KEY LLM_BROWSER_DEEPSEEK_API_KEY"
echo " (Codex login at ~/.codex/auth.json is left intact — global Codex auth.)"
reset:profile:
aliases:
- profile:reset
- reset-profile
desc: Clear the saved default local Chrome profile
silent: true
cmds:
- |
set -eu
state_dir="${STATE_DIR:-$HOME/.browser-use-terminal}"
db="$state_dir/state.db"
if [ -f "$db" ]; then
sqlite3 "$db" "DELETE FROM app_settings WHERE key IN ('browser.preference.profile', 'browser.preference.profile_label');"
echo "profile reset: $db"
else
echo "no existing state.db at $db — nothing to reset"
fi
auth:clear:
aliases:
- clear-auth
desc: Clear stored auth and reset the TUI onboarding state
silent: true
cmds:
- |
set -eu
state_dir="${STATE_DIR:-$HOME/.browser-use-terminal}"
backup_root="${BACKUP_ROOT:-/tmp}"
timestamp="$(date +%Y%m%d-%H%M%S)"
backup_dir="$backup_root/but-onboarding-reset-$timestamp"
case "$state_dir" in
""|"."|"./"|"/")
echo "refusing unsafe STATE_DIR: $state_dir" >&2
exit 1
;;
esac
if [ -d "$state_dir" ]; then
project_root="$(pwd -P)"
state_real="$(cd "$state_dir" && pwd -P)"
if [ "$state_real" = "$project_root" ]; then
echo "refusing to clear project root as STATE_DIR: $state_dir" >&2
exit 1
fi
if [ -f "$state_dir/.env" ]; then
echo "refusing to clear state dir containing .env: $state_dir" >&2
exit 1
fi
fi
echo "leaving .env unchanged"
if [ -d "$state_dir" ]; then
if [ -f "$state_dir/state.db" ]; then
sqlite3 "$state_dir/state.db" "DELETE FROM app_settings WHERE key LIKE 'auth.%' OR key='telemetry.laminar.api_key'; UPDATE app_settings SET value='0', updated_ms=(strftime('%s','now') * 1000) WHERE key='setup.complete';"
fi
mkdir -p "$backup_dir"
cp -a "$state_dir" "$backup_dir/"
rm -rf "$state_dir"
echo "archived scrubbed state: $backup_dir/$(basename "$state_dir")"
else
echo "no existing state dir: $state_dir"
fi
cargo run -q -p browser-use-cli -- --state-dir "$state_dir" config set account "OpenAI API key" >/dev/null
cargo run -q -p browser-use-cli -- --state-dir "$state_dir" config set agent.backend openai >/dev/null
cargo run -q -p browser-use-cli -- --state-dir "$state_dir" config set setup.complete 0 >/dev/null
echo "local TUI auth cleared"
echo "launch onboarding: cargo run -q -p browser-use-tui -- --state-dir \"$state_dir\""
auth:status:
aliases:
- auth-status
desc: Show provider auth status for the TUI state
silent: true
cmds:
- cargo run -q -p browser-use-cli -- --state-dir "${STATE_DIR:-$HOME/.browser-use-terminal}" auth status