feat: add import info from alr-repo.toml

This commit is contained in:
2025-07-07 17:45:20 +03:00
parent 1cc408ad7d
commit f42be105ad
19 changed files with 403 additions and 82 deletions

View File

@ -24,6 +24,7 @@ import (
"strings"
"sync"
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-plugin"
"gitea.plemya-x.ru/Plemya-x/ALR/internal/logger"
@ -32,6 +33,7 @@ import (
var pluginMap = map[string]plugin.Plugin{
"script-executor": &ScriptExecutorPlugin{},
"installer": &InstallerExecutorPlugin{},
"repos": &ReposExecutorPlugin{},
}
var HandshakeConfig = plugin.HandshakeConfig{
@ -57,6 +59,19 @@ func setCommonCmdEnv(cmd *exec.Cmd) {
}
}
func GetPluginServeCommonConfig() *plugin.ServeConfig {
return &plugin.ServeConfig{
HandshakeConfig: HandshakeConfig,
Logger: hclog.New(&hclog.LoggerOptions{
Name: "plugin",
Output: os.Stderr,
Level: hclog.Trace,
JSONFormat: true,
DisableTime: true,
}),
}
}
func GetSafeInstaller() (InstallerExecutor, func(), error) {
return getSafeExecutor[InstallerExecutor]("_internal-installer", "installer")
}
@ -65,6 +80,10 @@ func GetSafeScriptExecutor() (ScriptExecutor, func(), error) {
return getSafeExecutor[ScriptExecutor]("_internal-safe-script-executor", "script-executor")
}
func GetSafeReposExecutor() (ReposExecutor, func(), error) {
return getSafeExecutor[ReposExecutor]("_internal-repos", "repos")
}
func getSafeExecutor[T any](subCommand, pluginName string) (T, func(), error) {
var err error