feat: dev plugin install flow + smoke-platform

- .gitignore: add plugins/ (local dev install, never committed)
- scripts/install-dev-plugins.sh: install dist package from ../verstak-official-plugins/dist/ into ./plugins/
- scripts/smoke-platform.sh: headless verification of plugin discovery, manifest, capabilities, contributions
- cmd/smoke-platform/main.go: Go smoke command for headless plugin verification
- docs/DEV_PLUGINS.md: dev plugin flow documentation
This commit is contained in:
2026-06-16 16:46:00 +08:00
parent d72ebeb7ec
commit 1c75389535
5 changed files with 368 additions and 0 deletions
+56
View File
@@ -0,0 +1,56 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
echo "=== verstak-desktop: install dev plugins ==="
# ── locate sibling repo ──
OFFICIAL_PLUGINS="$ROOT/../verstak-official-plugins"
if [ ! -d "$OFFICIAL_PLUGINS" ]; then
echo "❌ sibling repo not found at $OFFICIAL_PLUGINS"
echo " Expected structure:"
echo " ../verstak-official-plugins/"
echo " ../verstak-desktop/ (this repo)"
exit 1
fi
# ── ensure dist package exists ──
DIST_PACKAGE="$OFFICIAL_PLUGINS/dist/platform-test"
if [ ! -d "$DIST_PACKAGE" ]; then
echo " ️ dist package not found at $DIST_PACKAGE"
echo " → Running build.sh in verstak-official-plugins..."
(cd "$OFFICIAL_PLUGINS" && ./scripts/build.sh)
echo ""
if [ ! -d "$DIST_PACKAGE" ]; then
echo "❌ dist package still missing after build"
exit 1
fi
fi
# ── create ./plugins/platform-test ──
PLUGIN_DIR="$ROOT/plugins/platform-test"
echo " → installing platform-test to $PLUGIN_DIR"
mkdir -p "$ROOT/plugins"
# Atomic replace: install to temp then rename
TMP_DIR=$(mktemp -d "$ROOT/plugins/.platform-test-tmp.XXXXXX")
cp -r "$DIST_PACKAGE/." "$TMP_DIR/"
rm -f "$PLUGIN_DIR" 2>/dev/null # remove broken symlink if any
rm -rf "$PLUGIN_DIR" # remove old directory
mv "$TMP_DIR" "$PLUGIN_DIR"
# ── verify ──
if [ -f "$PLUGIN_DIR/plugin.json" ]; then
PLUGIN_ID=$(python3 -c "import json; print(json.load(open('$PLUGIN_DIR/plugin.json')).get('id','unknown'))" 2>/dev/null || echo "unknown")
FILE_COUNT=$(find "$PLUGIN_DIR" -type f | wc -l)
echo " ✅ installed: $PLUGIN_DIR"
echo " plugin id: $PLUGIN_ID"
echo " files: $FILE_COUNT"
else
echo "❌ install failed: plugin.json missing in $PLUGIN_DIR"
exit 1
fi
echo "✅ install-dev-plugins done"
+64
View File
@@ -0,0 +1,64 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
echo "=== verstak-desktop: smoke-platform ==="
# ── verify platform-test is installed ──
PLUGIN_DIR="$ROOT/plugins/platform-test"
if [ ! -d "$PLUGIN_DIR" ]; then
echo "❌ platform-test not installed at $PLUGIN_DIR"
echo " Run: ./scripts/install-dev-plugins.sh"
exit 1
fi
echo " ✅ plugin directory: $PLUGIN_DIR"
# ── validate plugin.json ──
if [ ! -f "$PLUGIN_DIR/plugin.json" ]; then
echo " ❌ plugin.json not found"
exit 1
fi
if command -v python3 &>/dev/null; then
python3 -c "
import json
with open('$PLUGIN_DIR/plugin.json') as f:
m = json.load(f)
checks = {
'id': m.get('id') == 'verstak.platform-test',
'name': m.get('name') == 'Platform Test',
'version': m.get('version') == '0.1.0',
'apiVersion': m.get('apiVersion') == '0.1.0',
'schemaVersion': m.get('schemaVersion') == 1,
'provides': 'verstak/platform-test/v1' in m.get('provides', []),
'permissions': 'vault.read' in m.get('permissions', []),
'frontend.entry': m.get('frontend', {}).get('entry') == 'frontend/dist/index.js',
'contributes.views': len(m.get('contributes', {}).get('views', [])) > 0,
'contributes.commands': len(m.get('contributes', {}).get('commands', [])) > 0,
}
all_ok = True
for name, ok in checks.items():
print(f\" {'✅' if ok else '❌'} manifest.{name}\")
if not ok:
all_ok = False
if not all_ok:
exit(1)
" 2>&1 || { echo " ❌ manifest validation failed"; exit 1; }
echo " ✅ manifest validation passed"
else
echo " ️ python3 not available — skipping manifest validation"
fi
# ── run Go smoke command ──
echo ""
echo "[go smoke]"
(cd "$ROOT" && go run -mod=mod ./cmd/smoke-platform/ 2>&1)
SMOKE_EXIT=$?
if [ "$SMOKE_EXIT" -ne 0 ]; then
echo " ❌ smoke-platform: Go verification failed"
exit 1
fi
echo ""
echo "✅ smoke-platform done"