Documentation
¶
Index ¶
- func DetectFrameworkVersion(dir string, composerPackageName string, extraSections ...string) string
- func DetectFrameworkVersionWithKey(dir string, composerPackageName string, versionKey string, ...) string
- func DetectFrameworkWithStore(dir string) (string, bool)
- func DetectVersionFromFile(dir, relPath, pattern string) string
- func ResolveVersion(dir string, rules []config.FrameworkRule, available []string, fallback string) string
- func WatchIndex(interval time.Duration)
- type Client
- func (c *Client) DetectFromStore(dir string) (*IndexEntry, string, bool)
- func (c *Client) FetchFramework(name, version string) (*config.Framework, error)
- func (c *Client) FetchIndex() (*Index, error)
- func (c *Client) FetchServiceIndex() (*ServiceIndex, error)
- func (c *Client) FetchServicePreset(name string) ([]byte, error)
- func (c *Client) RefreshIndex() (*Index, error)
- func (c *Client) Search(query string) ([]IndexEntry, error)
- func (c *Client) SearchServices(query string) ([]ServiceIndexEntry, error)
- type Index
- type IndexEntry
- type ServiceIndex
- type ServiceIndexEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectFrameworkVersion ¶
DetectFrameworkVersion reads composer.json in dir and returns the major version of the given composer package. It searches require, require-dev, and any extra sections specified. If the constraint is unparseable (e.g. "*"), it falls back to the versionKey dot-path in composer.json.
func DetectFrameworkVersionWithKey ¶ added in v1.11.0
func DetectFrameworkVersionWithKey(dir string, composerPackageName string, versionKey string, extraSections ...string) string
DetectFrameworkVersionWithKey is like DetectFrameworkVersion but also accepts a versionKey (dot-path into composer.json) as a fallback when the constraint is "*".
func DetectFrameworkWithStore ¶
DetectFrameworkWithStore wraps config.DetectFramework with a store fallback. When no local framework matches and stdin is a terminal, it checks the store index and prompts the user to install a matching definition. Returns the framework name and true if resolved, ("", false) otherwise.
func DetectVersionFromFile ¶ added in v1.11.0
DetectVersionFromFile reads a file and extracts the major version using a regex pattern.
func ResolveVersion ¶ added in v1.11.0
func ResolveVersion(dir string, rules []config.FrameworkRule, available []string, fallback string) string
ResolveVersion detects the framework version from detect rules, checking composer.json constraints and version_file regex matches. Returns the first version that matches one of the available versions, or fallback if none match.
func WatchIndex ¶ added in v1.28.1
WatchIndex refreshes the cached store index once at startup and then on every interval tick. Meant to run as a goroutine from the long-running watcher.
Types ¶
type Client ¶
Client fetches framework definitions from the remote store. BaseURL is tried first; Fallbacks are tried in order if it fails, so a binary can reach the new store location after an org move and fall back to the old one before it.
func NewServiceClient ¶ added in v1.28.1
func NewServiceClient() *Client
NewServiceClient returns a store client pointed at the service-preset store.
func (*Client) DetectFromStore ¶
func (c *Client) DetectFromStore(dir string) (*IndexEntry, string, bool)
DetectFromStore checks the store index for a framework matching the given project directory. Returns the matching entry, the resolved version, and true if found. The version is auto-detected from composer.lock when possible.
func (*Client) FetchFramework ¶
FetchFramework downloads a framework definition from the store. Always fetches from remote to ensure definitions are up to date.
func (*Client) FetchIndex ¶
FetchIndex downloads the store index.
func (*Client) FetchServiceIndex ¶ added in v1.28.1
func (c *Client) FetchServiceIndex() (*ServiceIndex, error)
FetchServiceIndex downloads and parses the service-preset store index.
func (*Client) FetchServicePreset ¶ added in v1.28.1
FetchServicePreset downloads a preset's YAML, validates it against the local Preset schema, and saves it verbatim into the store-cache dir. It returns the raw bytes on success. Validation happens before the save so a malformed remote preset never lands in the cache where the seam would try to serve it.
func (*Client) RefreshIndex ¶ added in v1.28.1
RefreshIndex downloads the store index, updates the local cache, and returns it, so offline detection and listing can read the full catalogue without a network round trip.
func (*Client) Search ¶
func (c *Client) Search(query string) ([]IndexEntry, error)
Search filters the store index by a case-insensitive substring match on name or label.
func (*Client) SearchServices ¶ added in v1.28.1
func (c *Client) SearchServices(query string) ([]ServiceIndexEntry, error)
SearchServices filters the store index by a case-insensitive substring match on name, description, or family.
type Index ¶
type Index struct {
Frameworks []IndexEntry `json:"frameworks"`
}
Index is the top-level store index listing all available frameworks.
type IndexEntry ¶
type IndexEntry struct {
Name string `json:"name"`
Label string `json:"label"`
Versions []string `json:"versions"`
Latest string `json:"latest"`
Detect []config.FrameworkRule `json:"detect"`
}
IndexEntry describes a single framework available in the store.
type ServiceIndex ¶ added in v1.28.1
type ServiceIndex struct {
Services []ServiceIndexEntry `json:"services"`
}
ServiceIndex is the top-level index of the service-preset store.
type ServiceIndexEntry ¶ added in v1.28.1
type ServiceIndexEntry struct {
Name string `json:"name"`
Description string `json:"description"`
Family string `json:"family,omitempty"`
Dashboard string `json:"dashboard,omitempty"`
DependsOn []string `json:"depends_on,omitempty"`
Image string `json:"image,omitempty"`
Versions []config.PresetVersion `json:"versions,omitempty"`
DefaultVersion string `json:"default_version,omitempty"`
}
ServiceIndexEntry describes one preset available in the store, carrying enough to render the install picker (name, description, versions) without fetching every preset file. The full definition is fetched on install.