@generativereality/browser-automation 0.4.13 → 0.4.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +3 -2
- package/LICENSE +21 -0
- package/README.md +10 -5
- package/dist/index.js +202 -13
- package/package.json +2 -2
- package/scripts/launch-chrome.sh +125 -19
- package/scripts/release.sh +189 -0
- package/scripts/sync-plugin.sh +37 -5
- package/skills/browser/SKILL.md +97 -334
- package/skills/browser/references/contributing.md +36 -0
- package/skills/browser/references/input-and-forms.md +137 -0
- package/skills/browser/references/renderer-health.md +213 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Cut a release. Two halves, with the human approval gate between them.
|
|
3
|
+
#
|
|
4
|
+
# scripts/release.sh plan # what would ship since the last tag; changes nothing
|
|
5
|
+
# scripts/release.sh cut <patch|minor|X.Y.Z> [--dry-run]
|
|
6
|
+
# # bump, check, commit onto master, tag, push the tag
|
|
7
|
+
# scripts/release.sh finish # after the run is APPROVED: wait for npm, sync the
|
|
8
|
+
# # plugin, update this machine's install
|
|
9
|
+
#
|
|
10
|
+
# Why a script: every release in September 2026 was improvised from CLAUDE.md
|
|
11
|
+
# prose, and each one hit something the prose did not say — local master
|
|
12
|
+
# checked out in another worktree, a plugin sync rejected because another plugin
|
|
13
|
+
# had synced first, `npm view` reporting the old version for minutes after a
|
|
14
|
+
# successful publish. The steps are mechanical; the JUDGEMENT (which version,
|
|
15
|
+
# whether to approve) is not, so the script does the first and refuses to do
|
|
16
|
+
# the second.
|
|
17
|
+
#
|
|
18
|
+
# It never approves the gated CI run. Approval belongs to the maintainer, and
|
|
19
|
+
# `gh api .../pending_deployments` CAN do it from here — which is exactly why
|
|
20
|
+
# a script must not: see CLAUDE.md, "Releasing".
|
|
21
|
+
set -euo pipefail
|
|
22
|
+
|
|
23
|
+
cd "$(dirname "$0")/.."
|
|
24
|
+
ROOT="$(pwd)"
|
|
25
|
+
# What gets released. Only ever origin/master for real; overridable so a dry run
|
|
26
|
+
# can be tested against a branch that has something unreleased on it.
|
|
27
|
+
BASE="${BA_RELEASE_BASE:-origin/master}"
|
|
28
|
+
REPO=generativereality/browser-automation
|
|
29
|
+
PKG=@generativereality/browser-automation
|
|
30
|
+
|
|
31
|
+
die() { echo "Error: $*" >&2; exit 1; }
|
|
32
|
+
say() { printf '\n== %s\n' "$*"; }
|
|
33
|
+
|
|
34
|
+
last_tag() { git -C "$ROOT" describe --tags --abbrev=0 "$BASE" 2>/dev/null || true; }
|
|
35
|
+
|
|
36
|
+
plan() {
|
|
37
|
+
git fetch -q origin --tags
|
|
38
|
+
local tag; tag="$(last_tag)"
|
|
39
|
+
[ -n "$tag" ] || die "no release tag reachable from origin/master"
|
|
40
|
+
say "Unreleased on $BASE since $tag"
|
|
41
|
+
git log --format=' %h %s' "$tag..$BASE"
|
|
42
|
+
[ -n "$(git log --format=%h "$tag..$BASE")" ] || { echo " (nothing)"; return 0; }
|
|
43
|
+
say "Files touched"
|
|
44
|
+
git diff --stat "$tag..$BASE" | tail -n 25
|
|
45
|
+
say "Decide the version (CLAUDE.md, Versioning policy)"
|
|
46
|
+
cat <<'TXT'
|
|
47
|
+
minor if ANY of these shipped, even inside a "fix":
|
|
48
|
+
- where the CLI keeps or reads user data (profile, sessions, downloads), or a migration of it
|
|
49
|
+
- a changed default, flag meaning, exit code, or output a script might parse
|
|
50
|
+
- anything a user may need to act on after upgrading
|
|
51
|
+
otherwise patch (fixes, and commands that complete the CLI).
|
|
52
|
+
Name it to the maintainer with the reason, and get a yes, before `cut`.
|
|
53
|
+
TXT
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
cut() {
|
|
57
|
+
local want="${1:-}" dry="${2:-}"
|
|
58
|
+
[ -n "$want" ] || die "cut needs patch, minor or X.Y.Z — the version is a decision, not a default"
|
|
59
|
+
git fetch -q origin --tags
|
|
60
|
+
|
|
61
|
+
# Build the release from origin/master exactly, in a throwaway worktree:
|
|
62
|
+
# this checkout is shared with other sessions and local master usually lives
|
|
63
|
+
# in another worktree, so neither "the current branch" nor "master" is safe
|
|
64
|
+
# to assume.
|
|
65
|
+
# Global, not `local`: the EXIT trap runs after this function has returned.
|
|
66
|
+
RELEASE_WT="$(mktemp -d "${TMPDIR:-/tmp}/ba-release.XXXXXX")"
|
|
67
|
+
git worktree add -q --detach "$RELEASE_WT" "$BASE"
|
|
68
|
+
trap 'cd "$ROOT"; git worktree remove --force "$RELEASE_WT" >/dev/null 2>&1 || true' EXIT
|
|
69
|
+
cd "$RELEASE_WT"
|
|
70
|
+
|
|
71
|
+
local cur; cur="$(node -p "require('./package.json').version")"
|
|
72
|
+
local plug; plug="$(node -p "require('./.claude-plugin/plugin.json').version")"
|
|
73
|
+
[ "$cur" = "$plug" ] || die "package.json ($cur) and plugin.json ($plug) disagree on origin/master"
|
|
74
|
+
local next
|
|
75
|
+
case "$want" in
|
|
76
|
+
patch) next="$(node -p "v='$cur'.split('.').map(Number);v[2]++;v.join('.')")" ;;
|
|
77
|
+
minor) next="$(node -p "v='$cur'.split('.').map(Number);v[1]++;v[2]=0;v.join('.')")" ;;
|
|
78
|
+
[0-9]*.[0-9]*.[0-9]*) next="$want" ;;
|
|
79
|
+
*) die "unknown version '$want'" ;;
|
|
80
|
+
esac
|
|
81
|
+
git rev-parse -q --verify "refs/tags/v$next" >/dev/null && die "v$next already exists"
|
|
82
|
+
[ -z "$(git log --format=%h "$(last_tag)..HEAD")" ] && die "nothing unreleased since $(last_tag)"
|
|
83
|
+
|
|
84
|
+
say "Releasing $cur -> $next"
|
|
85
|
+
git log --format=' %h %s' "$(last_tag)..HEAD"
|
|
86
|
+
|
|
87
|
+
node -e "
|
|
88
|
+
const fs=require('fs');
|
|
89
|
+
for (const f of ['package.json','.claude-plugin/plugin.json']) {
|
|
90
|
+
const s=fs.readFileSync(f,'utf8'), t=s.replace(/(\"version\":\s*\")$cur(\")/, '\$1$next\$2');
|
|
91
|
+
if (s===t) { console.error('no version to bump in '+f); process.exit(1) }
|
|
92
|
+
fs.writeFileSync(f,t)
|
|
93
|
+
}"
|
|
94
|
+
npm install --package-lock-only --silent >/dev/null 2>&1 || true
|
|
95
|
+
|
|
96
|
+
say "npm ci + npm run check"
|
|
97
|
+
npm ci --silent >/dev/null
|
|
98
|
+
local log; log="$(mktemp "${TMPDIR:-/tmp}/ba-check.XXXXXX")"
|
|
99
|
+
npm run check >"$log" 2>&1 || {
|
|
100
|
+
tail -n 30 "$log" >&2
|
|
101
|
+
echo "" >&2
|
|
102
|
+
echo "npm run check failed (full log: $log). If it is the renderer-health tests, a busy" >&2
|
|
103
|
+
echo "Chrome on this user's port can fail them locally (CLAUDE.md, Dev gotchas) — compare" >&2
|
|
104
|
+
echo "against master under the same conditions before believing it." >&2
|
|
105
|
+
exit 1
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
git add package.json .claude-plugin/plugin.json package-lock.json
|
|
109
|
+
git commit -q -m "release: v$next"
|
|
110
|
+
git tag -a "v$next" -m "v$next"
|
|
111
|
+
|
|
112
|
+
if [ "$dry" = "--dry-run" ]; then
|
|
113
|
+
# Tags are shared by every worktree of this repo — leave none behind.
|
|
114
|
+
git tag -d "v$next" >/dev/null
|
|
115
|
+
say "Dry run: would push $(git rev-parse --short HEAD) to master and tag v$next. Nothing pushed, no tag kept."
|
|
116
|
+
return 0
|
|
117
|
+
fi
|
|
118
|
+
[ "$BASE" = "origin/master" ] || die "BA_RELEASE_BASE is for --dry-run only"
|
|
119
|
+
# Fast-forward only: if master moved while this ran, stop and re-plan rather
|
|
120
|
+
# than release something nobody looked at.
|
|
121
|
+
git push -q origin "HEAD:refs/heads/master" || die "master moved (push was not a fast-forward). Run plan again."
|
|
122
|
+
git push -q origin "v$next"
|
|
123
|
+
|
|
124
|
+
say "Tag v$next pushed. The release run is now WAITING FOR APPROVAL:"
|
|
125
|
+
sleep 5
|
|
126
|
+
gh run list --repo "$REPO" --workflow release.yml --limit 1 --json url,status --jq '.[0] | " \(.url) (\(.status))"' || true
|
|
127
|
+
cat <<TXT
|
|
128
|
+
|
|
129
|
+
Approving is the maintainer's call. Ask them to approve it there — or approve it
|
|
130
|
+
yourself only if they told you to for THIS release. Then: scripts/release.sh finish
|
|
131
|
+
TXT
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
finish() {
|
|
135
|
+
git fetch -q origin --tags
|
|
136
|
+
local tag; tag="$(last_tag)"; local v="${tag#v}"
|
|
137
|
+
local run; run="$(gh run list --repo "$REPO" --workflow release.yml --branch "$tag" --limit 1 --json databaseId --jq '.[0].databaseId')"
|
|
138
|
+
[ -n "$run" ] || die "no release run for $tag"
|
|
139
|
+
|
|
140
|
+
say "Waiting for the release run of $tag"
|
|
141
|
+
local s
|
|
142
|
+
for _ in $(seq 1 90); do
|
|
143
|
+
s="$(gh run view "$run" --repo "$REPO" --json status,conclusion --jq '.status+" "+.conclusion')"
|
|
144
|
+
case "$s" in
|
|
145
|
+
"completed success") break ;;
|
|
146
|
+
completed*) die "release run $run finished: $s — $(gh run view "$run" --repo "$REPO" --json url --jq .url)" ;;
|
|
147
|
+
waiting*) echo " still waiting for approval…" ;;
|
|
148
|
+
esac
|
|
149
|
+
sleep 10
|
|
150
|
+
done
|
|
151
|
+
[ "$s" = "completed success" ] || die "release run did not finish in 15 minutes"
|
|
152
|
+
|
|
153
|
+
# The registry, not `npm view`: publishing reports success minutes before
|
|
154
|
+
# the version is served (3.5 min for 0.4.13), and `npm view` also caches.
|
|
155
|
+
say "Waiting for $v on the registry"
|
|
156
|
+
local name="${PKG/\//%2F}"
|
|
157
|
+
for _ in $(seq 1 60); do
|
|
158
|
+
[ "$(curl -s -o /dev/null -w '%{http_code}' "https://registry.npmjs.org/$name/$v")" = 200 ] && break
|
|
159
|
+
sleep 10
|
|
160
|
+
done
|
|
161
|
+
[ "$(curl -s -o /dev/null -w '%{http_code}' "https://registry.npmjs.org/$name/$v")" = 200 ] || die "$v not on the registry after 10 minutes"
|
|
162
|
+
echo " $PKG@$v is live"
|
|
163
|
+
|
|
164
|
+
say "Plugin marketplace"
|
|
165
|
+
# Sync from the released tag, not from whatever this checkout has.
|
|
166
|
+
RELEASE_WT="$(mktemp -d "${TMPDIR:-/tmp}/ba-finish.XXXXXX")"
|
|
167
|
+
git worktree add -q --detach "$RELEASE_WT" "$tag"
|
|
168
|
+
trap 'cd "$ROOT"; git worktree remove --force "$RELEASE_WT" >/dev/null 2>&1 || true' EXIT
|
|
169
|
+
# This checkout's script (an old tag's copy lacks its fixes), the tag's files.
|
|
170
|
+
BA_PLUGIN_SOURCE="$RELEASE_WT" bash "$ROOT/scripts/sync-plugin.sh"
|
|
171
|
+
|
|
172
|
+
say "This machine"
|
|
173
|
+
npm install -g "$PKG@$v" >/dev/null 2>&1 && echo " installed $(browser-automation --version)"
|
|
174
|
+
|
|
175
|
+
say "Downstream — not done by this script"
|
|
176
|
+
cat <<TXT
|
|
177
|
+
- rememberthis.ai vendors the skill: python3 scripts/sync-vendored-skills.py --update
|
|
178
|
+
there, re-read its LOCAL block, commit that one file (other sessions work in that
|
|
179
|
+
repo — do not sweep up their changes).
|
|
180
|
+
- Tell the maintainer anything a user must act on (a moved profile, a changed default).
|
|
181
|
+
TXT
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
case "${1:-}" in
|
|
185
|
+
plan) plan ;;
|
|
186
|
+
cut) shift; cut "$@" ;;
|
|
187
|
+
finish) finish ;;
|
|
188
|
+
*) sed -n '2,8p' "$0"; exit 1 ;;
|
|
189
|
+
esac
|
package/scripts/sync-plugin.sh
CHANGED
|
@@ -9,8 +9,11 @@
|
|
|
9
9
|
set -euo pipefail
|
|
10
10
|
|
|
11
11
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
# Where the payload is copied FROM. Defaults to this checkout; `release.sh
|
|
13
|
+
# finish` points it at the released tag, so what ships is what was tagged —
|
|
14
|
+
# while still running THIS copy of the script (an old tag's copy lacks fixes).
|
|
15
|
+
REPO_ROOT="${BA_PLUGIN_SOURCE:-$(dirname "$SCRIPT_DIR")}"
|
|
16
|
+
PLUGINS_DIR="${BA_PLUGINS_DIR:-$(dirname "$SCRIPT_DIR")/../plugins}" # override for tests
|
|
14
17
|
CHECK_ONLY=false
|
|
15
18
|
[ "${1:-}" = "--check" ] && CHECK_ONLY=true
|
|
16
19
|
|
|
@@ -27,7 +30,13 @@ PAYLOAD_FILES=(
|
|
|
27
30
|
"skills/browser/SKILL.md"
|
|
28
31
|
".claude-plugin/plugin.json"
|
|
29
32
|
"scripts/launch-chrome.sh"
|
|
33
|
+
"LICENSE"
|
|
30
34
|
)
|
|
35
|
+
# SKILL.md links to these for its long reference material; a payload without
|
|
36
|
+
# them leaves the skill pointing at files that are not there.
|
|
37
|
+
for f in "$REPO_ROOT"/skills/browser/references/*.md; do
|
|
38
|
+
[ -e "$f" ] && PAYLOAD_FILES+=("skills/browser/references/$(basename "$f")")
|
|
39
|
+
done
|
|
31
40
|
|
|
32
41
|
for rel in "${PAYLOAD_FILES[@]}"; do
|
|
33
42
|
if ! diff -q "$REPO_ROOT/$rel" "$PLUGINS_DIR/plugins/browser-automation/$rel" >/dev/null 2>&1; then
|
|
@@ -56,13 +65,36 @@ done
|
|
|
56
65
|
rm -f "$PLUGINS_DIR/plugins/browser-automation/.mcp.json"
|
|
57
66
|
|
|
58
67
|
cd "$PLUGINS_DIR"
|
|
59
|
-
if git diff --quiet; then
|
|
68
|
+
if git diff --quiet -- plugins/browser-automation && [ -z "$(git ls-files --others --exclude-standard -- plugins/browser-automation)" ]; then
|
|
60
69
|
echo "Plugins repo already up to date"
|
|
61
70
|
exit 0
|
|
62
71
|
fi
|
|
63
72
|
|
|
73
|
+
# **Other plugins publish to this repo too.** The 0.4.14 sync was rejected
|
|
74
|
+
# because a cctabs sync had landed on origin/main in between — the marketplace
|
|
75
|
+
# is shared, so "behind origin" is the normal state, not an error. Commit ONLY
|
|
76
|
+
# our directory, then replay it on top of whatever arrived and push; our
|
|
77
|
+
# commit touches nothing outside plugins/browser-automation, so the rebase
|
|
78
|
+
# cannot conflict with another plugin's sync. It can conflict with a sync of
|
|
79
|
+
# THIS plugin from another checkout — then stop rather than guess.
|
|
80
|
+
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
|
81
|
+
if [ "$BRANCH" != "main" ]; then
|
|
82
|
+
echo "Error: plugins repo is on '$BRANCH', not main. Not syncing into a branch." >&2
|
|
83
|
+
exit 1
|
|
84
|
+
fi
|
|
85
|
+
VERSION="$(node -p "require('$REPO_ROOT/package.json').version" 2>/dev/null || echo '?')"
|
|
64
86
|
git add plugins/browser-automation
|
|
65
|
-
git commit -m "chore: sync browser-automation plugin"
|
|
66
|
-
|
|
87
|
+
git commit -q -m "chore: sync browser-automation plugin to $VERSION"
|
|
88
|
+
for attempt in 1 2 3; do
|
|
89
|
+
git fetch -q origin main
|
|
90
|
+
if ! git rebase -q origin/main; then
|
|
91
|
+
git rebase --abort
|
|
92
|
+
echo "Error: rebasing the sync onto origin/main conflicted — something else changed" >&2
|
|
93
|
+
echo " plugins/browser-automation. Resolve in $PLUGINS_DIR, then push." >&2
|
|
94
|
+
exit 1
|
|
95
|
+
fi
|
|
96
|
+
git push -q origin main && break
|
|
97
|
+
[ "$attempt" = 3 ] && { echo "Error: push kept being rejected; see $PLUGINS_DIR." >&2; exit 1; }
|
|
98
|
+
done
|
|
67
99
|
|
|
68
100
|
echo "Synced browser-automation to plugins repo"
|