@aiassesstech/mighty-mark 0.5.1 → 0.5.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiassesstech/mighty-mark",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "System Health Sentinel for AI Assess Tech Fleet — autonomous monitoring, watchdog recovery, and fleet infrastructure oversight.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,204 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # deploy-fleet.sh — Deploy OpenClaw fleet to VPS
4
+ #
5
+ # Usage:
6
+ # ./deploy-fleet.sh # Deploy all 6 plugins + fleet-bus
7
+ # ./deploy-fleet.sh jessie mighty-mark # Deploy only specified plugins + fleet-bus
8
+ # ./deploy-fleet.sh --dry-run # Show what would be done
9
+ #
10
+ # This script implements Rule 806 (OpenClaw Extension Upgrade Pattern):
11
+ # 1. Plugins FIRST (npm install + manual dist sync)
12
+ # 2. Fleet-bus LAST (npm pack + tar extract — Bug 5)
13
+ # 3. Update global mighty-mark binary
14
+ # 4. Validate config before restart
15
+ # 5. Restart and verify
16
+ #
17
+ # Run this ON THE VPS as root.
18
+
19
+ set -euo pipefail
20
+
21
+ ALL_PLUGINS=(grillo noah nole mighty-mark jessie sam)
22
+ EXTENSIONS_DIR="/root/.openclaw/extensions"
23
+ CONFIG_FILE="/root/.openclaw/openclaw.json"
24
+ DRY_RUN=false
25
+
26
+ # Parse arguments
27
+ PLUGINS=()
28
+ for arg in "$@"; do
29
+ case $arg in
30
+ --dry-run) DRY_RUN=true ;;
31
+ *) PLUGINS+=("$arg") ;;
32
+ esac
33
+ done
34
+
35
+ # Default to all plugins if none specified
36
+ if [ ${#PLUGINS[@]} -eq 0 ]; then
37
+ PLUGINS=("${ALL_PLUGINS[@]}")
38
+ fi
39
+
40
+ # Validate plugin names
41
+ for p in "${PLUGINS[@]}"; do
42
+ found=false
43
+ for valid in "${ALL_PLUGINS[@]}"; do
44
+ if [ "$p" = "$valid" ]; then found=true; break; fi
45
+ done
46
+ if ! $found; then
47
+ echo "❌ Unknown plugin: $p"
48
+ echo " Valid plugins: ${ALL_PLUGINS[*]}"
49
+ exit 1
50
+ fi
51
+ done
52
+
53
+ echo "╔══════════════════════════════════════════════════════════════╗"
54
+ echo "║ OpenClaw Fleet Deployment (Rule 806) ║"
55
+ echo "╚══════════════════════════════════════════════════════════════╝"
56
+ echo ""
57
+ echo "Plugins to deploy: ${PLUGINS[*]}"
58
+ echo "Extensions dir: $EXTENSIONS_DIR"
59
+ echo ""
60
+
61
+ if $DRY_RUN; then
62
+ echo "🔍 DRY RUN — no changes will be made"
63
+ echo ""
64
+ fi
65
+
66
+ # ── Step 0: Pre-flight checks ───────────────────────────────────
67
+
68
+ echo "=== Step 0: Pre-flight checks ==="
69
+
70
+ if [ ! -d "$EXTENSIONS_DIR" ]; then
71
+ echo "❌ Extensions directory not found: $EXTENSIONS_DIR"
72
+ exit 1
73
+ fi
74
+
75
+ for p in "${PLUGINS[@]}"; do
76
+ if [ ! -d "$EXTENSIONS_DIR/$p" ]; then
77
+ echo "❌ Extension directory not found: $EXTENSIONS_DIR/$p"
78
+ exit 1
79
+ fi
80
+ done
81
+
82
+ # Show current versions
83
+ echo ""
84
+ echo "Current versions:"
85
+ for p in "${PLUGINS[@]}"; do
86
+ ver=$(python3 -c "import json; print(json.load(open('$EXTENSIONS_DIR/$p/package.json'))['version'])" 2>/dev/null || echo "???")
87
+ echo " $p: $ver"
88
+ done
89
+
90
+ fb_ver=$(python3 -c "import json; print(json.load(open('$EXTENSIONS_DIR/${PLUGINS[0]}/node_modules/@aiassesstech/fleet-bus/package.json'))['version'])" 2>/dev/null || echo "not installed")
91
+ echo " fleet-bus: $fb_ver"
92
+ echo ""
93
+
94
+ if $DRY_RUN; then
95
+ echo "🔍 Would proceed with: npm cache clean, install plugins, sync fleet-bus, validate, restart"
96
+ exit 0
97
+ fi
98
+
99
+ # ── Step 1: Clear npm cache ─────────────────────────────────────
100
+
101
+ echo "=== Step 1: Clear npm cache ==="
102
+ npm cache clean --force 2>/dev/null
103
+ echo "✅ Cache cleared"
104
+ echo ""
105
+
106
+ # ── Step 2: Install and sync plugins (FIRST — Rule 806) ────────
107
+
108
+ echo "=== Step 2: Install and sync plugins ==="
109
+ for p in "${PLUGINS[@]}"; do
110
+ echo " Installing $p..."
111
+ cd "$EXTENSIONS_DIR/$p"
112
+ npm install "@aiassesstech/$p@latest" --no-fund --no-audit 2>&1 | tail -1
113
+ cp -r "node_modules/@aiassesstech/$p/dist/"* dist/
114
+ cp "node_modules/@aiassesstech/$p/package.json" package.json
115
+ cp -r "node_modules/@aiassesstech/$p/agent/"* agent/ 2>/dev/null || true
116
+ new_ver=$(python3 -c "import json; print(json.load(open('package.json'))['version'])" 2>/dev/null || echo "???")
117
+ echo " ✅ $p → v$new_ver"
118
+ done
119
+ echo ""
120
+
121
+ # ── Step 3: Re-install fleet-bus AFTER plugins (Bug 5) ──────────
122
+
123
+ echo "=== Step 3: Install fleet-bus (AFTER plugins — Bug 5) ==="
124
+ cd /tmp
125
+ npm pack @aiassesstech/fleet-bus@latest 2>/dev/null
126
+ for p in "${ALL_PLUGINS[@]}"; do
127
+ mkdir -p "$EXTENSIONS_DIR/$p/node_modules/@aiassesstech/fleet-bus"
128
+ tar -xzf aiassesstech-fleet-bus-*.tgz \
129
+ -C "$EXTENSIONS_DIR/$p/node_modules/@aiassesstech/fleet-bus" \
130
+ --strip-components=1
131
+ done
132
+ rm -f /tmp/aiassesstech-fleet-bus-*.tgz
133
+ new_fb=$(python3 -c "import json; print(json.load(open('$EXTENSIONS_DIR/${ALL_PLUGINS[0]}/node_modules/@aiassesstech/fleet-bus/package.json'))['version'])" 2>/dev/null || echo "???")
134
+ echo "✅ fleet-bus → v$new_fb (synced to all 6 extensions)"
135
+ echo ""
136
+
137
+ # ── Step 4: Update global mighty-mark binary ────────────────────
138
+
139
+ echo "=== Step 4: Update global mighty-mark binary ==="
140
+ npm update -g @aiassesstech/mighty-mark --no-fund --no-audit 2>&1 | tail -1
141
+ global_ver=$(node -e "console.log(require('/usr/lib/node_modules/@aiassesstech/mighty-mark/package.json').version)" 2>/dev/null || echo "???")
142
+ echo "✅ Global mighty-mark → v$global_ver"
143
+ echo ""
144
+
145
+ # ── Step 5: Validate config before restart ──────────────────────
146
+
147
+ echo "=== Step 5: Validate config ==="
148
+ if command -v openclaw &>/dev/null; then
149
+ if openclaw doctor 2>&1 | grep -q "Config valid\|All good"; then
150
+ echo "✅ Config valid"
151
+ else
152
+ echo "⚠️ Config validation returned warnings (check output above)"
153
+ echo " Run 'openclaw doctor' to see details"
154
+ echo " If critical, fix config before proceeding"
155
+ read -p " Continue with restart? (y/N): " confirm
156
+ if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
157
+ echo "Aborted."
158
+ exit 1
159
+ fi
160
+ fi
161
+ else
162
+ echo "⚠️ 'openclaw' command not found — skipping config validation"
163
+ fi
164
+ echo ""
165
+
166
+ # ── Step 6: Restart gateway ─────────────────────────────────────
167
+
168
+ echo "=== Step 6: Restart gateway ==="
169
+ systemctl restart openclaw-gateway
170
+ echo "Waiting 10 seconds for startup..."
171
+ sleep 10
172
+ echo ""
173
+
174
+ # ── Step 7: Verify ──────────────────────────────────────────────
175
+
176
+ echo "=== Step 7: Verify deployment ==="
177
+ echo ""
178
+ echo "Fleet-bus initialization:"
179
+ journalctl -u openclaw-gateway --no-pager -n 100 | grep -E 'fleet-bus.*initialized' || echo " ⚠️ No fleet-bus init lines found"
180
+ echo ""
181
+
182
+ echo "Standalone warnings (should be NONE):"
183
+ standalone=$(journalctl -u openclaw-gateway --no-pager -n 100 | grep -c 'standalone' || true)
184
+ if [ "$standalone" -eq 0 ]; then
185
+ echo " ✅ No standalone warnings"
186
+ else
187
+ echo " ❌ $standalone standalone warnings found!"
188
+ journalctl -u openclaw-gateway --no-pager -n 100 | grep 'standalone'
189
+ fi
190
+ echo ""
191
+
192
+ echo "Final versions:"
193
+ for p in "${ALL_PLUGINS[@]}"; do
194
+ ver=$(python3 -c "import json; print(json.load(open('$EXTENSIONS_DIR/$p/package.json'))['version'])" 2>/dev/null || echo "???")
195
+ echo " $p: $ver"
196
+ done
197
+ fb_ver=$(python3 -c "import json; print(json.load(open('$EXTENSIONS_DIR/${ALL_PLUGINS[0]}/node_modules/@aiassesstech/fleet-bus/package.json'))['version'])" 2>/dev/null || echo "???")
198
+ echo " fleet-bus: $fb_ver"
199
+ echo " mighty-mark (global): $global_ver"
200
+ echo ""
201
+
202
+ echo "╔══════════════════════════════════════════════════════════════╗"
203
+ echo "║ ✅ Deployment complete — run 'mighty-mark check' to verify ║"
204
+ echo "╚══════════════════════════════════════════════════════════════╝"