internal

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 27 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const RuntimeVersion = "1.1.0"

Variables

View Source
var (
	ManifestNotFound = errors.New("manifest not found")
)

Functions

func RunPluginHook added in v1.0.13

func RunPluginHook(ctx context.Context, directory, hook string, input []byte, options PluginRunOptions) (any, error)

RunPluginHook deliberately bypasses NewSdkManager and all user/project state.

func TestPlugin added in v1.0.13

func TestPlugin(ctx context.Context, directory string, options PluginTestOptions) error

TestPlugin discovers files and reports each result immediately. Each file gets a fresh VM and deadline, including when a previous file failed or timed out.

Types

type Arg

type Arg struct {
	Name    string
	Version string
}

type Manager

type Manager struct {
	RuntimeEnvContext *env.RuntimeEnvContext // runtime environment context
	// contains filtered or unexported fields
}

func NewSdkManager

func NewSdkManager() (*Manager, error)

NewSdkManager create a new SdkManager

func (*Manager) Add

func (m *Manager) Add(pluginName, url, alias string) error

Add a plugin to plugin home directory 1. If the plugin is an official plugin, fetch the plugin manifest from the registry. 2. If the plugin is a custom plugin, install the plugin from the specified URL. 3. Validate the plugin and install it to the plugin home directory. examples:

vfox add nodejs
vfox add --alias node nodejs
vfox add --source /path/to/plugin.zip
vfox add --source /path/to/plugin.zip --alias node [nodejs]

func (*Manager) AliasesFor added in v1.1.0

func (m *Manager) AliasesFor(sdkName string) map[string]string

AliasesFor returns the aliases of an SDK as alias -> version.

func (*Manager) Available

func (m *Manager) Available() (RegistryIndex, error)

func (*Manager) CleanTmp added in v0.2.3

func (m *Manager) CleanTmp()

func (*Manager) Close

func (m *Manager) Close()

func (*Manager) Diagnose added in v1.1.0

func (m *Manager) Diagnose(name string, version sdk.Version, inEffect VersionInEffect) ([]sdk.Finding, error)

Diagnose runs the checks of `vfox doctor`. name and version narrow them down to one SDK, or to one version of it; both empty checks everything. The PATH is only looked at for the version in effect, which inEffect names; without it that is the version Sdk.Current reports, which does not know about the fallback to an installed version that `vfox env` makes. It only reads, so it is safe to run at any time.

func (*Manager) GetRegistryAddress added in v0.3.0

func (m *Manager) GetRegistryAddress(uri string) string

func (*Manager) LoadAllSdk

func (m *Manager) LoadAllSdk() ([]sdk.Sdk, error)

func (*Manager) LookupSdk

func (m *Manager) LookupSdk(name string) (sdk.Sdk, error)

LookupSdk lookup sdk by name Loads SDK plugins and generates env keys based on the tool versions in the chain

func (*Manager) LookupSdkWithInstall added in v0.3.2

func (m *Manager) LookupSdkWithInstall(name string, autoConfirm bool) (sdk.Sdk, error)

func (*Manager) ParseLegacyFile added in v0.4.0

func (m *Manager) ParseLegacyFile(dirPath string, output func(sdkname, version string)) error

ParseLegacyFile parse legacy file and output the sdkname and version

func (*Manager) Remove

func (m *Manager) Remove(pluginName string) error

func (*Manager) RemoveAliasesFor added in v1.1.0

func (m *Manager) RemoveAliasesFor(sdkName string, version sdk.Version) ([]string, error)

RemoveAliasesFor drops the user's aliases that name a version, which is about to go away. It returns the aliases it removed.

func (*Manager) ResolveAlias added in v1.1.0

func (m *Manager) ResolveAlias(sdkName string, s sdk.Sdk, version sdk.Version) sdk.Version

ResolveAlias turns an alias into the version it names. A version that is installed under that very name always wins, and anything that is not an alias is returned unchanged, so it is safe to call on any input.

func (*Manager) ResolveVersion added in v0.7.0

func (m *Manager) ResolveVersion(sdkName string, version sdk.Version) sdk.Version

func (*Manager) ResolveVersionName added in v1.1.0

func (m *Manager) ResolveVersionName(sdkName string, s sdk.Sdk, typed sdk.Version) sdk.Version

ResolveVersionName turns the version a user typed into the version to act on. The name as typed comes first: an installed version of that name, or an alias for one. Only when there is neither is a leading "v" read as the usual way to spell a version (v20.1.0), and the name without it gets the same two checks. What matches neither way is returned without the "v" and left to the caller, which prefix-matches or reports that it is not installed.

func (*Manager) SetAlias added in v1.1.0

func (m *Manager) SetAlias(sdkName, alias string, version sdk.Version) error

SetAlias names an installed version. The alias is stored in the user config.

func (*Manager) UnsetAlias added in v1.1.0

func (m *Manager) UnsetAlias(sdkName, alias string) error

UnsetAlias removes an alias from the user config.

func (*Manager) Update

func (m *Manager) Update(pluginName string) error

type NotFoundError added in v0.3.2

type NotFoundError struct {
	Msg string
}

func (NotFoundError) Error added in v0.3.2

func (n NotFoundError) Error() string

type PluginRunOptions added in v1.0.13

type PluginRunOptions struct {
	OS, Arch    string
	Offline     bool
	Timeout     time.Duration
	Diagnostics io.Writer
}

type PluginTestOptions added in v1.0.13

type PluginTestOptions struct {
	File                string
	Online              bool
	Timeout             time.Duration
	Output, Diagnostics io.Writer
}

type RegistryIndex added in v0.3.0

type RegistryIndex []*RegistryIndexItem

RegistryIndex is the index of the registry

type RegistryIndexItem added in v0.3.0

type RegistryIndexItem struct {
	Name     string `json:"name"`
	Desc     string `json:"desc"`
	Homepage string `json:"homepage"`
}

RegistryIndexItem is the item in the registry index

type RegistryPluginManifest added in v0.3.0

type RegistryPluginManifest struct {
	Name              string `json:"name"`
	Version           string `json:"version"`
	License           string `json:"license"`
	Author            string `json:"author"`
	DownloadUrl       string `json:"downloadUrl"`
	MinRuntimeVersion string `json:"minRuntimeVersion"`
}

RegistryPluginManifest is the manifest of a remote plugin

type VersionInEffect added in v1.1.0

type VersionInEffect func(s sdk.Sdk) sdk.Version

VersionInEffect says which version of an SDK the shell uses, or "" when it uses none.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL