Skip to content

Commit 5611e61

Browse files
authored
feat(plugin): pin the MCP launcher to the release it ships with (#819)
The launcher downloads the exact release and rejects any binary older than the pinned version, replacing the latest-tracking download and the dead npm and PyPI tiers. sync_plugin_version.py moves the pin on every release and fails the drift check when it lags.
1 parent 4d7b4b3 commit 5611e61

108 files changed

Lines changed: 243 additions & 289 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎plugin/.ai-rulez-generated.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"schema_version": "v1",
3-
"source_hash": "blake3:0dcc205aedd52f89642ecf0d56b267853276fa6b400b3aa0bbf00e59476e16ef",
3+
"source_hash": "blake3:b382e8ca41cc40dfdeb9135bfc738f60da51752c273b72481b7b1c91bd3ad4aa",
44
"outputs": {
55
".claude-plugin/plugin.json": {
66
"content_hash": "blake3:0960da1f87dbb56aba73a3d4c584cf30917d3a721e0391eee0add87b064b4c8f",
@@ -427,7 +427,7 @@
427427
"mode": "0644"
428428
},
429429
"scripts/mcp-launch.sh": {
430-
"content_hash": "blake3:8ef4f1d5caece9e604a60ba71a1bcabefdfa4861887aedacd31520bd7d0a3ba8",
430+
"content_hash": "blake3:a6fdc4c35572513c99227d33836b5a5482f71a511f6d5664ea99300e1824a43b",
431431
"mode": "0755"
432432
},
433433
"skills/crawlberg-automating-the-browser/SKILL.md": {

‎plugin/.ai-rulez/scripts/mcp-launch.sh‎

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
NPM_PKG="@xberg-io/crawlberg-cli"
5-
PYPI_PKG="crawlberg-cli"
4+
# ~keep Rewritten by scripts/sync_plugin_version.py on every release. The plugin only accepts a
5+
# ~keep binary at or above this version, and downloads exactly this release, so a plugin update
6+
# ~keep cannot keep running an older crawlberg that happens to be installed.
7+
PINNED_VERSION="1.13.1"
68

79
log() { printf 'crawlberg-launch: %s\n' "$*" >&2; }
810
die() {
@@ -12,8 +14,8 @@ die() {
1214

1315
LAUNCHER="${CRAWLBERG_LAUNCHER:-auto}"
1416
case "$LAUNCHER" in
15-
auto | npx | uvx | brew | download) ;;
16-
*) die "invalid CRAWLBERG_LAUNCHER='$LAUNCHER' (expected auto|npx|uvx|brew|download)" ;;
17+
auto | brew | download) ;;
18+
*) die "invalid CRAWLBERG_LAUNCHER='$LAUNCHER' (expected auto|brew|download)" ;;
1719
esac
1820

1921
want() { [ "$LAUNCHER" = "auto" ] || [ "$LAUNCHER" = "$1" ]; }
@@ -32,7 +34,21 @@ BIN="$BIN_DIR/$BINARY_NAME"
3234

3335
have() { command -v "$1" >/dev/null 2>&1; }
3436

35-
runs_ok() { [ -x "$1" ] && "$1" --version >/dev/null 2>&1; }
37+
# True when $1 runs and reports a version at or above PINNED_VERSION. A prerelease of a version
38+
# sorts below that version (SemVer), so 1.13.1-rc.1 does not satisfy a 1.13.1 pin. ~keep
39+
runs_ok() {
40+
local out found base
41+
[ -x "$1" ] || return 1
42+
out="$("$1" --version 2>/dev/null)" || return 1
43+
found="$(printf '%s\n' "$out" | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?' | head -n 1)"
44+
[ -n "$found" ] || return 1
45+
base="${found%%-*}"
46+
if [ "$(printf '%s\n%s\n' "$PINNED_VERSION" "$base" | sort -V | head -n 1)" != "$PINNED_VERSION" ] ||
47+
{ [ "$base" = "$PINNED_VERSION" ] && [ "$found" != "$base" ]; }; then
48+
log "ignoring $1: version $found is older than the pinned $PINNED_VERSION"
49+
return 1
50+
fi
51+
}
3652

3753
if runs_ok "$BIN"; then
3854
log "using cached crawlberg at $BIN"
@@ -46,28 +62,6 @@ if have "$BINARY_NAME"; then
4662
fi
4763
fi
4864

49-
if want npx && have npx; then
50-
log "resolving npx $NPM_PKG@latest ..."
51-
scratch="$(mktemp -d)"
52-
# Resolve in an empty project, then execute the selected binary in the caller's cwd. ~keep
53-
if npm_bin="$(cd "$scratch" && npx -y --package "$NPM_PKG@latest" --call "command -v ${BINARY_NAME%.exe}" 2>/dev/null)" && runs_ok "$npm_bin"; then
54-
rm -rf "$scratch"
55-
log "launching npm package binary $npm_bin"
56-
exec "$npm_bin" "$@"
57-
fi
58-
rm -rf "$scratch"
59-
log "npx $NPM_PKG not available (no CLI bin yet); falling through"
60-
fi
61-
62-
if want uvx && have uvx; then
63-
log "probing uvx --from $PYPI_PKG $BINARY_NAME ..."
64-
if uvx --from "$PYPI_PKG" "$BINARY_NAME" --version >/dev/null 2>&1; then
65-
log "launching via uvx --from $PYPI_PKG $BINARY_NAME"
66-
exec uvx --from "$PYPI_PKG" "$BINARY_NAME" "$@"
67-
fi
68-
log "uvx $PYPI_PKG not available (no CLI entry point yet); falling through"
69-
fi
70-
7165
if want brew && have brew; then
7266
log "installing via 'brew install xberg-io/tap/crawlberg' ..."
7367
if brew install xberg-io/tap/crawlberg >&2; then
@@ -116,7 +110,7 @@ download_install() {
116110
*) ext="tar.gz" ;;
117111
esac
118112

119-
base_url="https://github.com/xberg-io/crawlberg/releases/latest/download"
113+
base_url="https://github.com/xberg-io/crawlberg/releases/download/v${PINNED_VERSION}"
120114
asset="crawlberg-cli-${triple}.${ext}"
121115
asset_url="${base_url}/${asset}"
122116

@@ -134,7 +128,7 @@ download_install() {
134128
trap "rm -rf '$tmp'" RETURN
135129

136130
log "warning: this download path does not verify release checksums; integrity relies on TLS only."
137-
log "downloading $asset from latest release ..."
131+
log "downloading $asset from release v$PINNED_VERSION ..."
138132
if ! fetch "$asset_url" "$tmp/$asset"; then
139133
log "download: fetch failed (asset missing or network error): $asset_url; falling through"
140134
return 1
@@ -180,5 +174,5 @@ fi
180174
die "could not locate or install a crawlberg binary. Install one manually:
181175
brew install xberg-io/tap/crawlberg
182176
cargo install crawlberg-cli --features all
183-
or download a release from https://github.com/xberg-io/crawlberg/releases/latest
177+
or download a release from https://github.com/xberg-io/crawlberg/releases/tag/v${PINNED_VERSION}
184178
then ensure 'crawlberg' is on PATH (or place it at $BIN)."

‎plugin/.cursor-plugin/commands/crawlberg-crawl.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name: crawlberg-crawl
66
<!--
77
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
88
Content-Hash: blake3:35251d5fa9d0a18c16430ed6c49c4568ed75a0864a513b1b5ceccd62c3e59315
9-
Source-Hash: blake3:0dcc205aedd52f89642ecf0d56b267853276fa6b400b3aa0bbf00e59476e16ef
9+
Source-Hash: blake3:b382e8ca41cc40dfdeb9135bfc738f60da51752c273b72481b7b1c91bd3ad4aa
1010
Schema-Version: v1
1111
-->
1212

‎plugin/.cursor-plugin/commands/crawlberg-scrape.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name: crawlberg-scrape
66
<!--
77
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
88
Content-Hash: blake3:a08b63e5e37553d22f686250a0f684872c54fc0409f2feefc3f3726d90e2dbd6
9-
Source-Hash: blake3:0dcc205aedd52f89642ecf0d56b267853276fa6b400b3aa0bbf00e59476e16ef
9+
Source-Hash: blake3:b382e8ca41cc40dfdeb9135bfc738f60da51752c273b72481b7b1c91bd3ad4aa
1010
Schema-Version: v1
1111
-->
1212

‎plugin/.cursor-plugin/skills/crawlberg-automating-the-browser/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name: crawlberg-automating-the-browser
66
<!--
77
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
88
Content-Hash: blake3:a333d7ec586948ca3e195c02441494ee99272b227c25bf6037f920dc15d80b5b
9-
Source-Hash: blake3:0dcc205aedd52f89642ecf0d56b267853276fa6b400b3aa0bbf00e59476e16ef
9+
Source-Hash: blake3:b382e8ca41cc40dfdeb9135bfc738f60da51752c273b72481b7b1c91bd3ad4aa
1010
Schema-Version: v1
1111
-->
1212

‎plugin/.cursor-plugin/skills/crawlberg-automating-the-browser/index.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--
22
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
33
Content-Hash: blake3:6b2dca9b4e6d3e3914abef798158d085039331fee8979c6c41ba70a51aecabdf
4-
Source-Hash: blake3:0dcc205aedd52f89642ecf0d56b267853276fa6b400b3aa0bbf00e59476e16ef
4+
Source-Hash: blake3:b382e8ca41cc40dfdeb9135bfc738f60da51752c273b72481b7b1c91bd3ad4aa
55
Schema-Version: v1
66
-->
77

‎plugin/.cursor-plugin/skills/crawlberg-crawling-a-site/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name: crawlberg-crawling-a-site
66
<!--
77
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
88
Content-Hash: blake3:2b9ef3346b813f235cf3e3623ee2a8bf454de3aede996c625411c127443f837f
9-
Source-Hash: blake3:0dcc205aedd52f89642ecf0d56b267853276fa6b400b3aa0bbf00e59476e16ef
9+
Source-Hash: blake3:b382e8ca41cc40dfdeb9135bfc738f60da51752c273b72481b7b1c91bd3ad4aa
1010
Schema-Version: v1
1111
-->
1212

‎plugin/.cursor-plugin/skills/crawlberg-crawling-a-site/index.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--
22
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
33
Content-Hash: blake3:1f0c441ad8bb57c48ff0073a3795e78da8b1de81f1416ef52442db8869365e82
4-
Source-Hash: blake3:0dcc205aedd52f89642ecf0d56b267853276fa6b400b3aa0bbf00e59476e16ef
4+
Source-Hash: blake3:b382e8ca41cc40dfdeb9135bfc738f60da51752c273b72481b7b1c91bd3ad4aa
55
Schema-Version: v1
66
-->
77

‎plugin/.cursor-plugin/skills/crawlberg-headless-fallback/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name: crawlberg-headless-fallback
66
<!--
77
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
88
Content-Hash: blake3:96b8fc624830e81d41d770e07bed8f15671042d9d84c5a4cee43604f06b23316
9-
Source-Hash: blake3:0dcc205aedd52f89642ecf0d56b267853276fa6b400b3aa0bbf00e59476e16ef
9+
Source-Hash: blake3:b382e8ca41cc40dfdeb9135bfc738f60da51752c273b72481b7b1c91bd3ad4aa
1010
Schema-Version: v1
1111
-->
1212

‎plugin/.cursor-plugin/skills/crawlberg-headless-fallback/index.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--
22
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
33
Content-Hash: blake3:bd4776a639d6f8d2f227969d0712b59d5808def0e1e8d090b225fa7cc23506fb
4-
Source-Hash: blake3:0dcc205aedd52f89642ecf0d56b267853276fa6b400b3aa0bbf00e59476e16ef
4+
Source-Hash: blake3:b382e8ca41cc40dfdeb9135bfc738f60da51752c273b72481b7b1c91bd3ad4aa
55
Schema-Version: v1
66
-->
77

0 commit comments

Comments
 (0)