diff --git a/internal/api/app.go b/internal/api/app.go index 3e2c6b4..8dde2ef 100644 --- a/internal/api/app.go +++ b/internal/api/app.go @@ -101,9 +101,13 @@ func expandPath(path string) string { // ReloadPlugins re-discovers plugins from disk and returns a summary. func (a *App) ReloadPlugins() (int, string) { + // Resolve plugin directories relative to the binary location + binDir := filepath.Dir(os.Args[0]) + pluginDir := filepath.Join(binDir, "plugins") + discoveryDirs := []string{ "~/.config/verstak/plugins", - "./plugins", + pluginDir, } // Expand tilde in all paths diff --git a/main.go b/main.go index 8fb5b5c..69a02ac 100644 --- a/main.go +++ b/main.go @@ -71,9 +71,14 @@ func main() { log.Printf("[main] registered vault capability") // ─── Plugin Discovery ─────────────────────────────────── + // Resolve plugin directories relative to the binary location, + // not CWD (Wails may launch from a different directory). + binDir := filepath.Dir(os.Args[0]) + pluginDir := filepath.Join(binDir, "plugins") + discoveryDirs := []string{ "~/.config/verstak/plugins", - "./plugins", + pluginDir, } // Expand tilde in all paths diff --git a/scripts/build.sh b/scripts/build.sh index 8bbf776..2c69f83 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -127,6 +127,12 @@ if [ -n "$WAILS" ]; then echo " 🔨 wails build..." (cd "$ROOT" && "$WAILS" build -clean $WAILS_TAGS) report "wails build" $? + # Copy plugins/ to build/bin/ so the binary can find them at runtime + if [ -d "$ROOT/plugins" ]; then + mkdir -p "$ROOT/build/bin/plugins" + cp -r "$ROOT/plugins/"* "$ROOT/build/bin/plugins/" 2>/dev/null || true + echo " 📦 plugins copied to build/bin/plugins/" + fi # Show where the binary ended up if [ -f "$ROOT/build/bin/$WAILS_BINARY" ]; then echo " 📦 binary: $ROOT/build/bin/$WAILS_BINARY"