@johngalt5/bsv-overlay 0.2.0
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/README.md +339 -0
- package/SKILL.md +327 -0
- package/clawdbot.plugin.json +55 -0
- package/index.ts +1062 -0
- package/package.json +47 -0
- package/scripts/overlay-cli.mjs +4536 -0
- package/scripts/setup.sh +96 -0
package/scripts/setup.sh
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# bsv-overlay skill — first-run setup
|
|
3
|
+
#
|
|
4
|
+
# Ensures the @a2a-bsv/core library is accessible and the wallet is initialized.
|
|
5
|
+
# Safe to run multiple times (idempotent).
|
|
6
|
+
|
|
7
|
+
set -euo pipefail
|
|
8
|
+
|
|
9
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
10
|
+
SKILL_DIR="$(dirname "$SCRIPT_DIR")"
|
|
11
|
+
A2A_BSV_ROOT="${A2A_BSV_ROOT:-/home/dylan/a2a-bsv}"
|
|
12
|
+
CORE_PKG="$A2A_BSV_ROOT/packages/core"
|
|
13
|
+
|
|
14
|
+
echo "🔧 bsv-overlay setup"
|
|
15
|
+
echo " Skill dir: $SKILL_DIR"
|
|
16
|
+
echo " Core lib: $CORE_PKG"
|
|
17
|
+
echo ""
|
|
18
|
+
|
|
19
|
+
# 1. Verify the core library exists
|
|
20
|
+
if [ ! -f "$CORE_PKG/dist/index.js" ]; then
|
|
21
|
+
echo "❌ @a2a-bsv/core not found at $CORE_PKG/dist/index.js"
|
|
22
|
+
echo " Build it first: cd $A2A_BSV_ROOT/packages/core && npm run build"
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
# 2. Create node_modules symlink for @a2a-bsv/core resolution
|
|
27
|
+
SKILL_NM="$SKILL_DIR/node_modules/@a2a-bsv"
|
|
28
|
+
if [ ! -L "$SKILL_NM/core" ]; then
|
|
29
|
+
mkdir -p "$SKILL_NM"
|
|
30
|
+
ln -sf "$CORE_PKG" "$SKILL_NM/core"
|
|
31
|
+
echo "✅ Symlinked @a2a-bsv/core → $CORE_PKG"
|
|
32
|
+
else
|
|
33
|
+
echo "✅ @a2a-bsv/core symlink already exists"
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# 3. Symlink @bsv/sdk so the CLI can import it
|
|
37
|
+
BSV_SDK="$CORE_PKG/node_modules/@bsv/sdk"
|
|
38
|
+
BSV_SDK_LINK="$SKILL_DIR/node_modules/@bsv/sdk"
|
|
39
|
+
if [ ! -L "$BSV_SDK_LINK" ] && [ -d "$BSV_SDK" ]; then
|
|
40
|
+
mkdir -p "$SKILL_DIR/node_modules/@bsv"
|
|
41
|
+
ln -sf "$BSV_SDK" "$BSV_SDK_LINK"
|
|
42
|
+
echo "✅ Symlinked @bsv/sdk"
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
# 4. Symlink knex + better-sqlite3 (needed by wallet-toolbox)
|
|
46
|
+
for dep in knex better-sqlite3; do
|
|
47
|
+
DEP_PATH="$CORE_PKG/node_modules/$dep"
|
|
48
|
+
DEP_LINK="$SKILL_DIR/node_modules/$dep"
|
|
49
|
+
if [ ! -L "$DEP_LINK" ] && [ -d "$DEP_PATH" ]; then
|
|
50
|
+
ln -sf "$DEP_PATH" "$DEP_LINK"
|
|
51
|
+
echo "✅ Symlinked $dep"
|
|
52
|
+
fi
|
|
53
|
+
done
|
|
54
|
+
|
|
55
|
+
# 5. Symlink @bsv/wallet-toolbox
|
|
56
|
+
WT_PATH="$CORE_PKG/node_modules/@bsv/wallet-toolbox"
|
|
57
|
+
WT_LINK="$SKILL_DIR/node_modules/@bsv/wallet-toolbox"
|
|
58
|
+
if [ ! -L "$WT_LINK" ] && [ -d "$WT_PATH" ]; then
|
|
59
|
+
mkdir -p "$SKILL_DIR/node_modules/@bsv"
|
|
60
|
+
ln -sf "$WT_PATH" "$WT_LINK"
|
|
61
|
+
echo "✅ Symlinked @bsv/wallet-toolbox"
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
# 6. Install ws for WebSocket connect command
|
|
65
|
+
WS_LINK="$SKILL_DIR/node_modules/ws"
|
|
66
|
+
if [ ! -d "$WS_LINK" ] && [ ! -L "$WS_LINK" ]; then
|
|
67
|
+
echo "📦 Installing ws for WebSocket support..."
|
|
68
|
+
cd "$SKILL_DIR" && npm install ws --no-save 2>/dev/null || true
|
|
69
|
+
echo "✅ ws installed"
|
|
70
|
+
else
|
|
71
|
+
echo "✅ ws already available"
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
echo ""
|
|
75
|
+
|
|
76
|
+
# 6. Initialize the wallet if it doesn't exist
|
|
77
|
+
CLI="$SCRIPT_DIR/overlay-cli.mjs"
|
|
78
|
+
if [ -f "$CLI" ]; then
|
|
79
|
+
echo "🔑 Initializing wallet..."
|
|
80
|
+
node "$CLI" setup 2>&1 || true
|
|
81
|
+
# Issue #8: Restrict permissions on wallet identity (contains private key)
|
|
82
|
+
WALLET_IDENTITY="${BSV_WALLET_DIR:-$HOME/.clawdbot/bsv-wallet}/wallet-identity.json"
|
|
83
|
+
[ -f "$WALLET_IDENTITY" ] && chmod 600 "$WALLET_IDENTITY" && echo "🔒 Set 0600 on wallet-identity.json"
|
|
84
|
+
echo ""
|
|
85
|
+
echo "📬 Wallet address:"
|
|
86
|
+
node "$CLI" address 2>&1 || true
|
|
87
|
+
echo ""
|
|
88
|
+
echo "✅ Setup complete!"
|
|
89
|
+
echo ""
|
|
90
|
+
echo "Next steps:"
|
|
91
|
+
echo " 1. Fund the wallet address above with a small amount of BSV"
|
|
92
|
+
echo " 2. Import the funding tx: node $CLI import <txid> [vout]"
|
|
93
|
+
echo " 3. Register on overlay: node $CLI register"
|
|
94
|
+
else
|
|
95
|
+
echo "⚠️ overlay-cli.mjs not found — skipping wallet init"
|
|
96
|
+
fi
|