Documentation
¶
Index ¶
- Variables
- func CompileSchema(schema *jsonschema.Schema) (*jsonschemav6.Schema, error)
- func FormatUpdateWarning(result *UpdateCheckResult) *ux.WarningMessage
- func RecordUpdateWarningShown(extension *Extension)
- func ResolveCommandFlags(metadata *ExtensionCommandMetadata, args []string) []string
- func ResolveCommandPath(metadata *ExtensionCommandMetadata, args []string) []string
- func ValidateAgainstSchema(schema *jsonschema.Schema, data any) error
- func VersionIsCompatible(extVersion *ExtensionVersion, azdVersion *semver.Version) bool
- func WithClaimsContext(ctx context.Context, claims *ExtensionClaims) context.Context
- type Argument
- type CapabilityType
- type Command
- type CommandExample
- type ConfigurationMetadata
- type EnvironmentVariable
- type Extension
- func (e *Extension) Fail(err error)
- func (e *Extension) GetReportedError() error
- func (e *Extension) HasCapability(capability ...CapabilityType) bool
- func (e *Extension) Initialize()
- func (e *Extension) SetReportedError(err error)
- func (e *Extension) StdErr() *output.DynamicMultiWriter
- func (e *Extension) StdIn() io.Reader
- func (e *Extension) StdOut() *output.DynamicMultiWriter
- func (e *Extension) WaitUntilReady(ctx context.Context) error
- type ExtensionArtifact
- type ExtensionChecksum
- type ExtensionClaims
- type ExtensionCommandMetadata
- type ExtensionDependency
- type ExtensionExample
- type ExtensionMetadata
- type ExtensionRunError
- type ExtensionValidationResult
- type ExtensionVersion
- type FilterOptions
- type Flag
- type InvokeOptions
- type Manager
- func (m *Manager) DeleteMetadata(extensionId string) error
- func (m *Manager) FindExtensions(ctx context.Context, options *FilterOptions) ([]*ExtensionMetadata, error)
- func (m *Manager) GetInstalled(options FilterOptions) (*Extension, error)
- func (m *Manager) HasMetadataCapability(extensionId string) bool
- func (m *Manager) Install(ctx context.Context, extension *ExtensionMetadata, versionPreference string) (extVersion *ExtensionVersion, err error)
- func (m *Manager) ListInstalled() (map[string]*Extension, error)
- func (m *Manager) LoadMetadata(extensionId string) (*ExtensionCommandMetadata, error)
- func (m *Manager) MetadataExists(extensionId string) bool
- func (m *Manager) Uninstall(id string) error
- func (m *Manager) UpdateInstalled(extension *Extension) error
- func (m *Manager) Upgrade(ctx context.Context, extension *ExtensionMetadata, versionPreference string) (*ExtensionVersion, error)
- type McpConfig
- type McpServerConfig
- type Provider
- type ProviderType
- type Registry
- type RegistryCache
- type RegistryCacheManager
- func (m *RegistryCacheManager) Get(ctx context.Context, sourceName string) (*RegistryCache, error)
- func (m *RegistryCacheManager) GetCacheDir() string
- func (m *RegistryCacheManager) GetExtensionLatestVersion(ctx context.Context, sourceName string, extensionId string) (string, error)
- func (m *RegistryCacheManager) IsExpiredOrMissing(ctx context.Context, sourceName string) bool
- func (m *RegistryCacheManager) Set(ctx context.Context, sourceName string, extensions []*ExtensionMetadata) error
- type RegistryValidationResult
- type Runner
- type Source
- type SourceConfig
- type SourceKind
- type SourceManager
- func (sm *SourceManager) Add(ctx context.Context, name string, source *SourceConfig) error
- func (sm *SourceManager) CreateSource(ctx context.Context, config *SourceConfig) (Source, error)
- func (sm *SourceManager) Get(ctx context.Context, name string) (*SourceConfig, error)
- func (sm *SourceManager) List(ctx context.Context) ([]*SourceConfig, error)
- func (sm *SourceManager) Remove(ctx context.Context, name string) error
- type UpdateCheckResult
- type UpdateChecker
- type ValidationIssue
- type ValidationSeverity
- type VersionCompatibilityResult
Constants ¶
This section is empty.
Variables ¶
var ( ErrExtensionNotFound = errors.New("extension not found") ErrInstalledExtensionNotFound = errors.New("extension not found") ErrRegistryExtensionNotFound = errors.New("extension not found in registry") ErrExtensionInstalled = errors.New("extension already installed") )
var ( // ErrCacheExpired indicates the cache entry has expired ErrCacheExpired = errors.New("cache expired") // ErrCacheNotFound indicates no cache file exists ErrCacheNotFound = errors.New("cache not found") )
var ( ErrSourceNotFound = errors.New("extension source not found") ErrSourceExists = errors.New("extension source already exists") ErrSourceTypeInvalid = errors.New("invalid extension source type") )
var ValidCapabilities = []CapabilityType{ CustomCommandCapability, LifecycleEventsCapability, McpServerCapability, ServiceTargetProviderCapability, FrameworkServiceProviderCapability, MetadataCapability, }
ValidCapabilities defines the valid capability types for extensions.
var ValidPlatforms = []string{
"windows/amd64",
"windows/arm64",
"darwin/amd64",
"darwin/arm64",
"linux/amd64",
"linux/arm64",
}
ValidPlatforms defines the valid os/arch combinations for extension artifacts.
Functions ¶
func CompileSchema ¶
func CompileSchema(schema *jsonschema.Schema) (*jsonschemav6.Schema, error)
CompileSchema compiles a JSON Schema for validation. Returns a compiled JSON Schema
func FormatUpdateWarning ¶
func FormatUpdateWarning(result *UpdateCheckResult) *ux.WarningMessage
FormatUpdateWarning formats the update warning message
func RecordUpdateWarningShown ¶
func RecordUpdateWarningShown(extension *Extension)
RecordUpdateWarningShown updates the extension's LastUpdateWarning timestamp. Mutates the provided extension in place (caller should save it via Manager.UpdateInstalled)
func ResolveCommandFlags ¶
func ResolveCommandFlags(metadata *ExtensionCommandMetadata, args []string) []string
ResolveCommandFlags returns the matching flag names for the command invoked by args.
func ResolveCommandPath ¶
func ResolveCommandPath(metadata *ExtensionCommandMetadata, args []string) []string
ResolveCommandPath finds the best matching command path for the given args using extension metadata.
func ValidateAgainstSchema ¶
func ValidateAgainstSchema(schema *jsonschema.Schema, data any) error
ValidateAgainstSchema validates data against a JSON Schema. Returns nil if validation succeeds, or a detailed error if it fails.
func VersionIsCompatible ¶
func VersionIsCompatible(extVersion *ExtensionVersion, azdVersion *semver.Version) bool
VersionIsCompatible checks if an extension version is compatible with the given azd version. Returns true if: - No RequiredAzdVersion is set on the extension version - The azdVersion satisfies the RequiredAzdVersion constraint expression
RequiredAzdVersion supports semantic versioning constraint expressions (e.g. ">= 1.24.0").
func WithClaimsContext ¶
func WithClaimsContext(ctx context.Context, claims *ExtensionClaims) context.Context
WithClaimsContext returns a new context with the validated extension claims stored in it.
Types ¶
type Argument ¶
type Argument struct {
// Name is the argument name
Name string `json:"name"`
// Description explains the purpose of the argument
Description string `json:"description"`
// Required indicates if the argument is required
Required bool `json:"required"`
// Variadic indicates if the argument accepts multiple values
Variadic bool `json:"variadic,omitempty"`
// ValidValues contains the allowed values for the argument
ValidValues []string `json:"validValues,omitempty"`
}
Argument represents a positional argument for a command
type CapabilityType ¶
type CapabilityType string
const ( // Custom commands expose new command groups & comments to AZD CustomCommandCapability CapabilityType = "custom-commands" // Lifecycle events enable extensions to subscribe to AZD project & service lifecycle events LifecycleEventsCapability CapabilityType = "lifecycle-events" // McpServerCapability enables extensions to start an MCP server McpServerCapability CapabilityType = "mcp-server" // Service target providers enable extensions to package, publish, and deploy to custom service targets ServiceTargetProviderCapability CapabilityType = "service-target-provider" // Framework service providers enable extensions to provide custom language frameworks and build systems FrameworkServiceProviderCapability CapabilityType = "framework-service-provider" // Metadata capability enables extensions to provide comprehensive metadata about their commands and capabilities MetadataCapability CapabilityType = "metadata" )
type Command ¶
type Command struct {
// Name is the command path as an array of strings (e.g., ["demo", "context"])
Name []string `json:"name"`
// Short is a brief one-line description of the command
Short string `json:"short"`
// Long is an optional detailed multi-line description (markdown supported)
Long string `json:"long,omitempty"`
// Usage is an optional usage template string
Usage string `json:"usage,omitempty"`
// Examples contains example usages of the command
Examples []CommandExample `json:"examples,omitempty"`
// Args defines the positional arguments accepted by the command, in the order it is received
Args []Argument `json:"args,omitempty"`
// Flags defines the flags/options accepted by the command
Flags []Flag `json:"flags,omitempty"`
// Subcommands contains nested subcommands
Subcommands []Command `json:"subcommands,omitempty"`
// Hidden indicates if the command should be hidden from help output
Hidden bool `json:"hidden,omitempty"`
// Aliases contains alternative names for the command
Aliases []string `json:"aliases,omitempty"`
// Deprecated contains a deprecation notice if the command is deprecated
Deprecated string `json:"deprecated,omitempty"`
}
Command represents a command or subcommand in the extension's command tree
type CommandExample ¶
type CommandExample struct {
// Description explains what the example demonstrates
Description string `json:"description"`
// Command is the example command string
Command string `json:"command"`
}
CommandExample represents an example usage of a command
type ConfigurationMetadata ¶
type ConfigurationMetadata struct {
// Global contains JSON Schema for global-level configuration options
Global *jsonschema.Schema `json:"global,omitempty"`
// Project contains JSON Schema for project-level configuration options
Project *jsonschema.Schema `json:"project,omitempty"`
// Service contains JSON Schema for service-level configuration options
Service *jsonschema.Schema `json:"service,omitempty"`
// EnvironmentVariables describes environment variables used by the extension
EnvironmentVariables []EnvironmentVariable `json:"environmentVariables,omitempty"`
}
ConfigurationMetadata describes extension configuration options (Phase 2). Each field contains a JSON Schema (github.com/invopop/jsonschema) that defines the structure and validation rules for extension configuration at different scopes.
RECOMMENDED: Extension developers should define configuration using Go types with json tags and generate schemas via reflection:
type CustomGlobalConfig struct {
APIKey string `json:"apiKey" jsonschema:"required,description=API key,minLength=10"`
Timeout int `json:"timeout,omitempty" jsonschema:"minimum=1,maximum=300,default=60"`
}
config := &extensions.ConfigurationMetadata{
Global: jsonschema.Reflect(&CustomGlobalConfig{}),
}
Advanced: Schemas can also be built programmatically:
props := jsonschema.NewProperties()
props.Set("apiKey", &jsonschema.Schema{
Type: "string",
Description: "API key for authentication",
})
config := &extensions.ConfigurationMetadata{
Global: &jsonschema.Schema{
Type: "object",
Properties: props,
Required: []string{"apiKey"},
},
}
type EnvironmentVariable ¶
type EnvironmentVariable struct {
// Name is the environment variable name (e.g., "EXTENSION_API_KEY")
Name string `json:"name"`
// Description explains when and why to use this environment variable
Description string `json:"description"`
// Default is the default value used if the environment variable is not set
Default string `json:"default,omitempty"`
// Example provides an example value for documentation purposes
Example string `json:"example,omitempty"`
}
EnvironmentVariable represents an environment variable used or recognized by the extension
type Extension ¶
type Extension struct {
Id string `json:"id"`
Namespace string `json:"namespace"`
Capabilities []CapabilityType `json:"capabilities,omitempty"`
DisplayName string `json:"displayName"`
Description string `json:"description"`
Version string `json:"version"`
Usage string `json:"usage"`
Path string `json:"path"`
Source string `json:"source"`
Providers []Provider `json:"providers,omitempty"`
McpConfig *McpConfig `json:"mcp,omitempty"`
LastUpdateWarning string `json:"lastUpdateWarning,omitempty"`
// contains filtered or unexported fields
}
Extension represents an installed extension.
func (*Extension) GetReportedError ¶
GetReportedError returns the structured error reported by the extension, if any.
func (*Extension) HasCapability ¶
func (e *Extension) HasCapability(capability ...CapabilityType) bool
HasCapability checks if the extension has the specified capabilities.
func (*Extension) Initialize ¶
func (e *Extension) Initialize()
Initialize signals that the extension is ready.
func (*Extension) SetReportedError ¶
SetReportedError stores a structured error reported by the extension via gRPC.
func (*Extension) StdErr ¶
func (e *Extension) StdErr() *output.DynamicMultiWriter
StdErr returns the standard error writer for the extension.
func (*Extension) StdOut ¶
func (e *Extension) StdOut() *output.DynamicMultiWriter
StdOut returns the standard output writer for the extension.
type ExtensionArtifact ¶
type ExtensionArtifact struct {
// URL is the location of the artifact
URL string `json:"url"`
// Checksum is the checksum of the artifact
Checksum ExtensionChecksum `json:"checksum"`
// AdditionalMetadata is a map of additional metadata for the artifact
AdditionalMetadata map[string]any `json:"-"`
}
ExtensionArtifact represents the artifact information of an extension An artifact can be a URL to a single binary file or a zip archive.
func (ExtensionArtifact) MarshalJSON ¶
func (c ExtensionArtifact) MarshalJSON() ([]byte, error)
func (*ExtensionArtifact) UnmarshalJSON ¶
func (c *ExtensionArtifact) UnmarshalJSON(data []byte) error
type ExtensionChecksum ¶
type ExtensionChecksum struct {
// Algorithm is the algorithm used to calculate the checksum
// Examples: sha256, sha512
Algorithm string `json:"algorithm"`
// Value is the checksum value to match during the integrity check.
Value string `json:"value"`
}
ExtensionChecksum represents the checksum of an extension artifact used to validate the integrity of the artifact.
type ExtensionClaims ¶
type ExtensionClaims struct {
jwt.RegisteredClaims
Capabilities []CapabilityType `json:"cap,omitempty"`
}
ExtensionClaims represents the claims in the JWT token for the extension.
func GetClaimsFromContext ¶
func GetClaimsFromContext(ctx context.Context) (*ExtensionClaims, error)
GetClaimsFromContext retrieves validated extension claims from the context. Claims must have been stored by the gRPC auth interceptor via WithClaimsContext.
type ExtensionCommandMetadata ¶
type ExtensionCommandMetadata struct {
// SchemaVersion is the version of the metadata schema (e.g., "1.0")
SchemaVersion string `json:"schemaVersion"`
// ID is the extension identifier matching extension.yaml
ID string `json:"id"`
// Commands is the list of root-level commands provided by the extension
Commands []Command `json:"commands"`
// Configuration describes extension configuration options (Phase 2)
Configuration *ConfigurationMetadata `json:"configuration,omitempty"`
}
ExtensionCommandMetadata represents the complete metadata for an extension including commands and configuration
type ExtensionDependency ¶
type ExtensionDependency struct {
// Id is the unique identifier of the dependent extension
Id string `json:"id"`
// Version is the version of the dependent extension and supports semantic versioning expressions.
Version string `json:"version,omitempty"`
}
ExtensionDependency represents a dependency of an extension
type ExtensionExample ¶
type ExtensionMetadata ¶
type ExtensionMetadata struct {
// Id is a unique identifier for the extension
Id string `json:"id"`
// Namespace is used to expose extension commands within a named group
Namespace string `json:"namespace,omitempty"`
// DisplayName is the name of the extension
DisplayName string `json:"displayName"`
// Description is a brief description of the extension
Description string `json:"description"`
// Website is the URL to the extension's documentation or homepage
Website string `json:"website,omitempty"`
// Versions is a list of versions of the extension that are released over time.
Versions []ExtensionVersion `json:"versions"`
// Source is used to store the extension source from where the extension is fetched
Source string `json:"source,omitempty"`
// Tags is a list of tags that can be used to filter extensions
Tags []string `json:"tags,omitempty"`
// Platforms is a map of platform specific metadata required for extensions
Platforms map[string]map[string]any `json:"platforms,omitempty"`
}
Extension represents an extension in the registry
type ExtensionRunError ¶
ExtensionRunError represents an error that occurred while running an extension.
func (*ExtensionRunError) Error ¶
func (e *ExtensionRunError) Error() string
func (*ExtensionRunError) Unwrap ¶
func (e *ExtensionRunError) Unwrap() error
type ExtensionValidationResult ¶
type ExtensionValidationResult struct {
// Id is the extension ID (may be empty if missing).
Id string `json:"id"`
// DisplayName is the extension display name.
DisplayName string `json:"displayName"`
// LatestVersion is the latest version string found.
LatestVersion string `json:"latestVersion"`
// Capabilities lists the capabilities of the latest version.
Capabilities []CapabilityType `json:"capabilities"`
// Platforms lists the platforms of the latest version.
Platforms []string `json:"platforms"`
// Issues contains all validation issues found.
Issues []ValidationIssue `json:"issues"`
// Valid is true if no errors were found.
Valid bool `json:"valid"`
}
ExtensionValidationResult represents the validation result for a single extension.
type ExtensionVersion ¶
type ExtensionVersion struct {
// Version is the version of the extension
Version string `json:"version"`
// RequiredAzdVersion is the azd core version constraint required to use this extension version.
// When set, azd will only install this version if the running azd version satisfies the constraint.
// Supports semantic versioning constraint expressions (e.g. ">= 1.24.0").
RequiredAzdVersion string `json:"requiredAzdVersion,omitempty"`
// Capabilities is a list of capabilities that the extension provides
Capabilities []CapabilityType `json:"capabilities,omitempty"`
// Providers is a list of providers that this extension version registers
Providers []Provider `json:"providers,omitempty"`
// Usage is show how to use the extension
Usage string `json:"usage"`
// Examples is a list of examples for the extension
Examples []ExtensionExample `json:"examples"`
// Artifacts is a map of artifacts for the extension key on platform (os & architecture)
Artifacts map[string]ExtensionArtifact `json:"artifacts,omitempty"`
// Dependencies is a list of dependencies for the extension
// An extension with dependencies and no artifacts is considered an extension pack.
// The dependencies are resolved and installed when the extension pack is installed.
Dependencies []ExtensionDependency `json:"dependencies,omitempty"`
// Entry point is the entry point for the extension
// This will typically be the name of the executable or script to run
EntryPoint string `json:"entryPoint,omitempty"`
// McpConfig is the MCP server configuration for this extension version
McpConfig *McpConfig `json:"mcp,omitempty"`
}
ExtensionVersion represents a version of an extension
func LatestVersion ¶
func LatestVersion(versions []ExtensionVersion) *ExtensionVersion
LatestVersion returns the ExtensionVersion with the highest semantic version from the provided slice. It compares all elements using semver so the result is correct regardless of slice ordering. Returns nil if the slice is empty.
type FilterOptions ¶
type FilterOptions struct {
// Id is used to specify the id of the extension to install
Id string
// Namespace is used to specify the namespace of the extension to install
Namespace string
// Version is used to specify the version of the extension to install
Version string
// Source is used to specify the source of the extension to install
Source string
// Tags is used to specify the tags of the extension to install
Tags []string
// Capability is used to filter extensions by capability type
Capability CapabilityType
// Provider is used to filter extensions by provider name
Provider string
}
FilterOptions is used to filter, lookup, and list extensions with various criteria
type Flag ¶
type Flag struct {
// Name is the flag name without dashes
Name string `json:"name"`
// Shorthand is the optional single character shorthand (without dash)
Shorthand string `json:"shorthand,omitempty"`
// Description explains the purpose of the flag
Description string `json:"description"`
// Type is the data type: "string", "bool", "int", "stringArray", "intArray"
Type string `json:"type"`
// Default is the default value when the flag is not provided
Default any `json:"default,omitempty"`
// Required indicates if the flag is required
Required bool `json:"required,omitempty"`
// ValidValues contains the allowed values for the flag
ValidValues []string `json:"validValues,omitempty"`
// Hidden indicates if the flag should be hidden from help output
Hidden bool `json:"hidden,omitempty"`
// Deprecated contains a deprecation notice if the flag is deprecated
Deprecated string `json:"deprecated,omitempty"`
}
Flag represents a command-line flag/option
type InvokeOptions ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is responsible for managing extensions
func NewManager ¶
func NewManager( configManager config.UserConfigManager, sourceManager *SourceManager, lazyRunner *lazy.Lazy[*Runner], transport policy.Transporter, ) (*Manager, error)
NewManager creates a new extension manager
func (*Manager) DeleteMetadata ¶
DeleteMetadata removes cached metadata for an extension
func (*Manager) FindExtensions ¶
func (m *Manager) FindExtensions(ctx context.Context, options *FilterOptions) ([]*ExtensionMetadata, error)
func (*Manager) GetInstalled ¶
func (m *Manager) GetInstalled(options FilterOptions) (*Extension, error)
GetInstalled retrieves an installed extension by filter criteria
func (*Manager) HasMetadataCapability ¶
HasMetadataCapability checks if the extension with the given ID has the metadata capability.
func (*Manager) Install ¶
func (m *Manager) Install( ctx context.Context, extension *ExtensionMetadata, versionPreference string, ) (extVersion *ExtensionVersion, err error)
Install an extension from metadata with optional version preference If no version is provided, the latest version is installed Latest version is determined by semver comparison across all available versions
func (*Manager) ListInstalled ¶
ListInstalled retrieves a list of installed extensions
func (*Manager) LoadMetadata ¶
func (m *Manager) LoadMetadata(extensionId string) (*ExtensionCommandMetadata, error)
LoadMetadata loads cached metadata for an extension
func (*Manager) MetadataExists ¶
MetadataExists checks if cached metadata exists for an extension
func (*Manager) UpdateInstalled ¶
UpdateInstalled updates an installed extension's metadata in the config
func (*Manager) Upgrade ¶
func (m *Manager) Upgrade( ctx context.Context, extension *ExtensionMetadata, versionPreference string, ) (*ExtensionVersion, error)
Upgrade upgrades the extension to the specified version This is a convenience method that uninstalls the existing extension and installs the new version If the version is not specified, the latest version is installed
type McpConfig ¶
type McpConfig struct {
// Server contains configuration for starting the extension's MCP server
Server McpServerConfig `json:"server"`
}
McpConfig represents the MCP server configuration for an extension
type McpServerConfig ¶
type McpServerConfig struct {
// Args are the command-line arguments to pass when starting the MCP server
Args []string `json:"args"`
// Env are additional environment variables to set when starting the MCP server
Env []string `json:"env,omitempty"`
}
McpServerConfig represents the configuration for starting an extension's MCP server
type Provider ¶
type Provider struct {
// Name is the unique identifier for this provider within the extension
Name string `json:"name"`
// Type is the type of provider
Type ProviderType `json:"type"`
// Description is the description of what this provider does
Description string `json:"description"`
}
Provider represents a provider registered by an extension
type ProviderType ¶
type ProviderType string
const ( // Service target provider type for custom deployment targets ServiceTargetProviderType ProviderType = "service-target" )
type Registry ¶
type Registry struct {
// Extensions is a list of extensions in the registry
Extensions []*ExtensionMetadata `json:"extensions"`
}
Registry represents the registry.json structure
type RegistryCache ¶
type RegistryCache struct {
// ExpiresOn is the time when this cache entry expires (RFC3339 format)
ExpiresOn string `json:"expiresOn"`
// Extensions is the list of extension metadata from the registry
Extensions []*ExtensionMetadata `json:"extensions"`
}
RegistryCache represents cached registry data for a single source
type RegistryCacheManager ¶
type RegistryCacheManager struct {
// contains filtered or unexported fields
}
RegistryCacheManager handles reading and writing per-source registry cache files
func NewRegistryCacheManager ¶
func NewRegistryCacheManager() (*RegistryCacheManager, error)
NewRegistryCacheManager creates a new cache manager
func (*RegistryCacheManager) Get ¶
func (m *RegistryCacheManager) Get(ctx context.Context, sourceName string) (*RegistryCache, error)
Get retrieves cached registry data for a source if valid (not expired)
func (*RegistryCacheManager) GetCacheDir ¶
func (m *RegistryCacheManager) GetCacheDir() string
GetCacheDir returns the cache directory path
func (*RegistryCacheManager) GetExtensionLatestVersion ¶
func (m *RegistryCacheManager) GetExtensionLatestVersion( ctx context.Context, sourceName string, extensionId string, ) (string, error)
GetExtensionLatestVersion finds an extension in the cache and returns its latest version
func (*RegistryCacheManager) IsExpiredOrMissing ¶
func (m *RegistryCacheManager) IsExpiredOrMissing(ctx context.Context, sourceName string) bool
IsExpiredOrMissing checks if cache for a source needs refresh
func (*RegistryCacheManager) Set ¶
func (m *RegistryCacheManager) Set( ctx context.Context, sourceName string, extensions []*ExtensionMetadata, ) error
Set writes registry data to the cache for a source
type RegistryValidationResult ¶
type RegistryValidationResult struct {
// Extensions contains validation results for each extension.
Extensions []ExtensionValidationResult `json:"extensions"`
// Valid is true if all extensions are valid.
Valid bool `json:"valid"`
}
RegistryValidationResult represents the validation result for an entire registry file.
func ValidateExtensions ¶
func ValidateExtensions(exts []*ExtensionMetadata, strict bool) *RegistryValidationResult
ValidateExtensions validates a slice of parsed extension metadata.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func NewRunner ¶
func NewRunner(commandRunner exec.CommandRunner) *Runner
type Source ¶
type Source interface {
// Name returns the name of the source.
Name() string
// ListExtensions returns a list of AZD compatible templates.
ListExtensions(ctx context.Context) ([]*ExtensionMetadata, error)
// GetExtension returns a template by path.
GetExtension(ctx context.Context, extensionId string) (*ExtensionMetadata, error)
}
type SourceConfig ¶
type SourceConfig struct {
Name string `json:"name,omitempty"`
Type SourceKind `json:"type,omitempty"`
Location string `json:"location,omitempty"`
}
SourceConfig represents the configuration for an extension source.
type SourceKind ¶
type SourceKind string
SourceKind represents the type of extension source.
const ( SourceKindFile SourceKind = "file" SourceKindUrl SourceKind = "url" )
type SourceManager ¶
type SourceManager struct {
// contains filtered or unexported fields
}
SourceManager manages extension sources.
func NewSourceManager ¶
func NewSourceManager( serviceLocator ioc.ServiceLocator, configManager config.UserConfigManager, transport policy.Transporter, ) *SourceManager
func (*SourceManager) Add ¶
func (sm *SourceManager) Add(ctx context.Context, name string, source *SourceConfig) error
Add adds a new extension source.
func (*SourceManager) CreateSource ¶
func (sm *SourceManager) CreateSource(ctx context.Context, config *SourceConfig) (Source, error)
Source returns a hydrated extension source for the current config.
func (*SourceManager) Get ¶
func (sm *SourceManager) Get(ctx context.Context, name string) (*SourceConfig, error)
Get returns an extension source by name.
func (*SourceManager) List ¶
func (sm *SourceManager) List(ctx context.Context) ([]*SourceConfig, error)
List returns a list of extension sources.
type UpdateCheckResult ¶
type UpdateCheckResult struct {
// HasUpdate is true if a newer version is available
HasUpdate bool
// InstalledVersion is the currently installed version
InstalledVersion string
// LatestVersion is the latest available version
LatestVersion string
// ExtensionId is the ID of the extension
ExtensionId string
// ExtensionName is the display name of the extension
ExtensionName string
}
UpdateCheckResult contains the result of checking for extension updates
type UpdateChecker ¶
type UpdateChecker struct {
// contains filtered or unexported fields
}
UpdateChecker checks for extension updates and manages warning cool downs
func NewUpdateChecker ¶
func NewUpdateChecker(cacheManager *RegistryCacheManager) *UpdateChecker
NewUpdateChecker creates a new update checker
func (*UpdateChecker) CheckForUpdate ¶
func (c *UpdateChecker) CheckForUpdate( ctx context.Context, extension *Extension, ) (*UpdateCheckResult, error)
CheckForUpdate checks if an extension has an available update
func (*UpdateChecker) ShouldShowWarning ¶
func (c *UpdateChecker) ShouldShowWarning(extension *Extension) bool
ShouldShowWarning checks if a warning should be shown (respecting cool down) Uses the extension's LastUpdateWarning field
type ValidationIssue ¶
type ValidationIssue struct {
// Severity is the severity of the validation issue (error or warning).
Severity ValidationSeverity `json:"severity"`
// Message describes the validation issue.
Message string `json:"message"`
}
ValidationIssue represents a single validation finding.
type ValidationSeverity ¶
type ValidationSeverity string
ValidationSeverity represents the severity of a validation error.
const ( // ValidationError is a validation error that prevents the registry from being valid. ValidationError ValidationSeverity = "error" // ValidationWarning is a validation warning that does not prevent the registry from being valid. ValidationWarning ValidationSeverity = "warning" )
type VersionCompatibilityResult ¶
type VersionCompatibilityResult struct {
// Compatible contains only the extension versions compatible with the current azd version
Compatible []ExtensionVersion
// LatestOverall is the latest version available regardless of compatibility
LatestOverall *ExtensionVersion
// LatestCompatible is the latest version that is compatible with the current azd
LatestCompatible *ExtensionVersion
// HasNewerIncompatible is true when a newer version exists but is not compatible
HasNewerIncompatible bool
}
VersionCompatibilityResult holds the result of filtering extension versions for compatibility
func FilterCompatibleVersions ¶
func FilterCompatibleVersions( versions []ExtensionVersion, azdVersion *semver.Version, ) *VersionCompatibilityResult
FilterCompatibleVersions filters extension versions based on compatibility with the current azd version. It returns a result containing compatible versions and information about incompatible newer versions.