@@ -54,6 +54,57 @@ if [ "$REMOTE_VER" != "$LOCAL_VER" ]; then
5454fi
5555```
5656
57+ ### Install birdeye-plugin-runtime npm package (auto-injected)
58+
59+ ``` bash
60+ # Verify Node.js >= 18 + npm
61+ command -v node > /dev/null 2>&1 || {
62+ echo " ERROR: Node.js >= 18 is required (install from https://nodejs.org)" >&2
63+ exit 1; }
64+ NODE_MAJOR=$( node -e ' console.log(process.versions.node.split(".")[0])' 2> /dev/null || echo 0)
65+ if [ " $NODE_MAJOR " -lt 18 ]; then
66+ echo " ERROR: Node.js >= 18 required (found: $( node --version 2> /dev/null) )" >&2
67+ exit 1
68+ fi
69+ command -v npm > /dev/null 2>&1 || {
70+ echo " ERROR: npm is required (usually ships with Node.js)" >&2
71+ exit 1; }
72+
73+ # Download .tgz + checksums to a sandbox, verify SHA256 before installing.
74+ # Fail-closed: any mismatch / missing checksum entry refuses the install.
75+ # Matches the producer-side workflow at
76+ # .github/workflows/plugin-publish.yml which uploads `birdeye-plugin-runtime.tgz`
77+ # alongside `checksums.txt` under each release tag.
78+ PKG_TMP=$( mktemp -d)
79+ RELEASE_BASE=" https://github.com/okx/plugin-store/releases/download/plugins/birdeye-plugin@0.1.0"
80+ curl -fsSL " ${RELEASE_BASE} /birdeye-plugin-runtime.tgz" -o " $PKG_TMP /birdeye-plugin-runtime.tgz" || {
81+ echo " ERROR: failed to download birdeye-plugin-runtime.tgz from ${RELEASE_BASE} " >&2
82+ rm -rf " $PKG_TMP " ; exit 1; }
83+ curl -fsSL " ${RELEASE_BASE} /checksums.txt" -o " $PKG_TMP /checksums.txt" || {
84+ echo " ERROR: failed to download checksums.txt for birdeye-plugin@0.1.0" >&2
85+ rm -rf " $PKG_TMP " ; exit 1; }
86+
87+ EXPECTED=$( awk -v b=" birdeye-plugin-runtime.tgz" ' $2 == b {print $1; exit}' " $PKG_TMP /checksums.txt" )
88+ if command -v sha256sum > /dev/null 2>&1 ; then
89+ ACTUAL=$( sha256sum " $PKG_TMP /birdeye-plugin-runtime.tgz" | awk ' {print $1}' )
90+ else
91+ ACTUAL=$( shasum -a 256 " $PKG_TMP /birdeye-plugin-runtime.tgz" | awk ' {print $1}' )
92+ fi
93+ if [ -z " $EXPECTED " ] || [ " $EXPECTED " != " $ACTUAL " ]; then
94+ echo " ERROR: birdeye-plugin-runtime.tgz SHA256 mismatch — refusing to install." >&2
95+ echo " expected=$EXPECTED actual=$ACTUAL " >&2
96+ rm -rf " $PKG_TMP " ; exit 1
97+ fi
98+
99+ # Install globally (npm wires up CLI commands from package.json's `bin` field) + clean up
100+ npm install -g " $PKG_TMP /birdeye-plugin-runtime.tgz"
101+ rm -rf " $PKG_TMP "
102+
103+ # Register version
104+ mkdir -p " $HOME /.plugin-store/managed"
105+ echo " 0.1.0" > " $HOME /.plugin-store/managed/birdeye-plugin"
106+ ```
107+
57108---
58109
59110
0 commit comments