mirror of
https://github.com/luxfi/sdk.git
synced 2026-10-30 15:19:23 +00:00
Lux Partners Limited is not the entity behind this work. Every place the old name stood — copyright lines, site footers, brand config, legal and compliance text — now names the company that actually holds it. lux.fund is the exception and is not renamed to match: that site belongs to Lux Assets Management LLC, a different company, and it says so. Two kinds of line were left for a person rather than rewritten. A dated news item recording that Lux Partners Limited was established in the Isle of Man is a historical fact, and renaming it would falsify the record. And a sentence asserting that the company is domiciled in the Isle of Man is a claim about a jurisdiction, not a name — an Inc or an LLC is not an Isle of Man company, so swapping the name there would assert something untrue. Co-authored-by: Hanzo Dev <[email protected]>
83 lines
2.2 KiB
Go
83 lines
2.2 KiB
Go
// Copyright (C) 2025, Lux Industries Inc All rights reserved.
|
|
|
|
// Package lpm provides Lux Plugin Manager client wrapper for CLI integration.
|
|
package lpm
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/go-git/go-git/v5/plumbing/transport/http"
|
|
luxlpm "github.com/luxfi/lpm/lpm"
|
|
"github.com/spf13/afero"
|
|
)
|
|
|
|
// Client wraps the LPM functionality for CLI use
|
|
type Client struct {
|
|
lpm *luxlpm.LPM
|
|
}
|
|
|
|
// NewClient creates a new LPM client
|
|
func NewClient(lpmDir string, pluginDir string, adminAPIEndpoint string) (*Client, error) {
|
|
config := luxlpm.Config{
|
|
Directory: lpmDir,
|
|
Auth: http.BasicAuth{},
|
|
AdminAPIEndpoint: adminAPIEndpoint,
|
|
PluginDir: pluginDir,
|
|
Fs: afero.NewOsFs(),
|
|
}
|
|
|
|
lpmInstance, err := luxlpm.New(config)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("failed to create LPM instance: %w", err)
|
|
}
|
|
|
|
return &Client{lpm: lpmInstance}, nil
|
|
}
|
|
|
|
// AddRepository adds a new repository
|
|
func (c *Client) AddRepository(alias string, url string, branch string) error {
|
|
return c.lpm.AddRepository(alias, url, branch)
|
|
}
|
|
|
|
// Update updates all repositories
|
|
func (c *Client) Update() error {
|
|
return c.lpm.Update()
|
|
}
|
|
|
|
// Install installs a plugin/VM
|
|
func (c *Client) Install(alias string) error {
|
|
return c.lpm.Install(alias)
|
|
}
|
|
|
|
// Uninstall removes a plugin/VM
|
|
func (c *Client) Uninstall(alias string) error {
|
|
return c.lpm.Uninstall(alias)
|
|
}
|
|
|
|
// Upgrade upgrades plugins/VMs
|
|
func (c *Client) Upgrade(alias string) error {
|
|
return c.lpm.Upgrade(alias)
|
|
}
|
|
|
|
// ListRepositories lists all configured repositories
|
|
func (c *Client) ListRepositories() error {
|
|
return c.lpm.ListRepositories()
|
|
}
|
|
|
|
// JoinChain installs all VMs required for a chain
|
|
func (c *Client) JoinChain(alias string) error {
|
|
return c.lpm.JoinChain(alias)
|
|
}
|
|
|
|
// Placeholder methods to maintain compatibility with existing LPM interface
|
|
|
|
// GetVM is a placeholder to maintain compatibility
|
|
func (c *Client) GetVM(alias string, version string) (*VMUpload, error) {
|
|
return nil, fmt.Errorf("GetVM not implemented in LPM - use Install instead")
|
|
}
|
|
|
|
// AddVM is a placeholder to maintain compatibility
|
|
func (c *Client) AddVM(vm *VMUpload) error {
|
|
return fmt.Errorf("AddVM not implemented in LPM - use repository-based installation")
|
|
}
|