feat: milestone 5a — frontend plugin host, contribution lifecycle, UI shell

- Contribution Registry: ListByPoint, idempotent Register (Unregister-before-add)
- Flat ContributionSummary types for frontend (no nested .item.)
- Sidebar.svelte: items from ContributionRegistry, sort by position, error boundary
- ViewContainer.svelte: declarative placeholder host with error boundary
- PluginManager.svelte: settings panels from registry, knoppka only with settingsPanel
- PluginCard.svelte: settingsPanels prop, disabled state for Settings button
- Error boundary: ViewContainer + PluginManager catch errors, shell stays stable
- ReloadPlugins: Unregister before Register contributions (no duplicates)
- Smoke: -test-contributions flag, enable/disable/reload lifecycle verification
- Build: global_update() — pull all repos, build official plugins, install to desktop
This commit is contained in:
2026-06-17 17:07:52 +08:00
parent 9bb35a9fd0
commit 86eeadd2a9
12 changed files with 1108 additions and 122 deletions
+78 -2
View File
@@ -2,7 +2,9 @@
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
VERSTAK_ROOT="$(cd "$ROOT/.." && pwd)"
FAILED=0
GLOBAL_ERRORS=""
report() {
if [ "$2" -eq 0 ]; then
@@ -13,6 +15,71 @@ report() {
fi
}
# ── Global update: pull all repos, build official plugins ─────────────────
global_update() {
local repos=("verstak-desktop" "verstak-sdk" "verstak-official-plugins" "verstak-sync-server" "verstak-browser-extension" "verstak-docs")
local errors=""
echo ""
echo "=== global update: pull all repos ==="
for repo in "${repos[@]}"; do
local repo_path="$VERSTAK_ROOT/$repo"
if [ ! -d "$repo_path" ]; then
errors="$errors ⚠️ $repo: directory not found at $repo_path\n"
continue
fi
echo "[$repo]"
(cd "$repo_path" && git pull --ff-only 2>&1) && echo " ✅ pulled" || {
errors="$errors$repo: git pull failed\n"
echo " ❌ git pull failed"
}
done
# Build official plugins
local official_plugins="$VERSTAK_ROOT/verstak-official-plugins"
if [ -d "$official_plugins" ]; then
echo ""
echo "=== build official plugins ==="
(cd "$official_plugins" && if [ -f "package.json" ] && [ -d "plugins" ]; then
if [ ! -d "node_modules" ]; then
echo "[official-plugins] installing npm deps..."
npm install --no-audit --no-fund 2>&1 || true
fi
# Build each plugin that has a frontend
for plugin_dir in plugins/*/; do
local plugin_name=$(basename "$plugin_dir")
local fe_dir="$plugin_dir/frontend"
if [ -d "$fe_dir" ] && [ -f "$fe_dir/package.json" ]; then
echo "[$plugin_name] building frontend..."
(cd "$fe_dir" && [ ! -d "node_modules" ] && npm install --no-audit --no-fund 2>&1 || true; npm run build 2>&1 || true)
fi
# Build backend if main.go exists
local backend_dir="$plugin_dir/backend"
if [ -f "$backend_dir/main.go" ]; then
echo "[$plugin_name] building backend..."
(cd "$backend_dir" && go build -o "$(basename "$backend_dir")" . 2>&1 || true)
fi
done
echo " ✅ official plugins built"
else
echo " ️ no plugins to build"
fi)
fi
# Copy official plugins to desktop
local dest="$ROOT/plugins"
if [ -d "$official_plugins/plugins" ]; then
echo ""
echo "=== install official plugins to desktop ==="
rm -rf "$dest"
mkdir -p "$dest"
cp -r "$official_plugins/plugins/"* "$dest/" 2>/dev/null || true
echo " ✅ plugins installed to $dest"
fi
GLOBAL_ERRORS="$errors"
}
ensure_npm_deps() {
local dir="$1"
if [ ! -f "$dir/package.json" ]; then
@@ -31,6 +98,10 @@ ensure_npm_deps() {
}
echo "=== verstak-desktop build ==="
echo ""
# ── Global update (best-effort — errors collected, not fatal) ──
global_update
# ── Dependency checks ──
echo "[deps]"
@@ -146,9 +217,14 @@ else
fi
echo ""
if [ "$FAILED" -eq 0 ]; then
if [ "$FAILED" -eq 0 ] && [ -z "$GLOBAL_ERRORS" ]; then
echo "✅ build passed"
else
echo "❌ build failed"
echo "❌ build completed with issues"
if [ -n "$GLOBAL_ERRORS" ]; then
echo ""
echo "Global update errors:"
echo -e "$GLOBAL_ERRORS"
fi
fi
exit "$FAILED"
+10
View File
@@ -86,5 +86,15 @@ if [ "$SMOKE_WS_EXIT" -ne 0 ]; then
exit 1
fi
# ── test contributions via Go smoke ──
echo ""
echo "[go smoke: contributions]"
(cd "$ROOT" && go run -mod=mod ./cmd/smoke-platform/ -test-contributions 2>&1)
SMOKE_CONT_EXIT=$?
if [ "$SMOKE_CONT_EXIT" -ne 0 ]; then
echo " ❌ smoke-platform: contributions test failed"
exit 1
fi
echo ""
echo "✅ smoke-platform all tests done"