Documentation
¶
Index ¶
- func AppendToFile(code, content string) string
- func CheckConflicts(m *Manifest) []string
- func InsertBeforeClosingBrace(code, content string) string
- func InsertLineAfter(code, after, content string) string
- func Install(pluginDir string, m *Manifest, vars map[string]string) error
- func ResolveSource(source string) (pluginDir string, cleanup func(), err error)
- func TrackInstall(m *Manifest) error
- func Validate(m *Manifest) error
- type EnvVar
- type File
- type Injection
- type Manifest
- type PluginData
- type Registry
- type RegistryEntry
- type Tracker
- type TrackerEntry
- type Variable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendToFile ¶
AppendToFile appends content to the end of the code, ensuring a newline separator.
func CheckConflicts ¶
CheckConflicts checks if generated files already exist in the project. Returns a list of conflicting file paths.
func InsertBeforeClosingBrace ¶
InsertBeforeClosingBrace inserts content before the last closing brace `}` in the code. This is the same pattern used by scaffold route injection.
func InsertLineAfter ¶
InsertLineAfter finds the first line containing `after` and inserts `content` on the next line.
func Install ¶
Install orchestrates the full plugin installation: dirs → files → injections → env vars → dependencies.
func ResolveSource ¶
ResolveSource determines the plugin source type and returns the local path to the plugin directory (downloading if needed).
Supported sources:
- Local path: ./local-plugin or /absolute/path
- Git URL: github.com/user/repo
- Short name: "auth" (resolved via registry)
func TrackInstall ¶
TrackInstall records a plugin installation in .catuaba/plugins.yaml.
Types ¶
type Injection ¶
type Injection struct {
File string `yaml:"file"`
Action string `yaml:"action"`
Import string `yaml:"import"`
Method string `yaml:"method"`
Attribute string `yaml:"attribute"`
Content string `yaml:"content"`
After string `yaml:"after"`
}
Injection describes a code modification to an existing file.
type Manifest ¶
type Manifest struct {
Name string `yaml:"name"`
Version string `yaml:"version"`
Description string `yaml:"description"`
Author string `yaml:"author"`
Repository string `yaml:"repository"`
Variables []Variable `yaml:"variables"`
Dependencies []string `yaml:"dependencies"`
Directories []string `yaml:"directories"`
Files []File `yaml:"files"`
Injections []Injection `yaml:"injections"`
EnvVars []EnvVar `yaml:"env_vars"`
PostInstall []string `yaml:"post_install"`
}
Manifest represents the declarative plugin.yaml file.
func LoadManifest ¶
LoadManifest reads and parses a plugin.yaml from the given path.
type PluginData ¶
PluginData is the data available to plugin templates.
type Registry ¶
type Registry struct {
Plugins map[string]RegistryEntry `yaml:"plugins"`
}
Registry holds the list of available plugins.
func LoadRegistry ¶
LoadRegistry fetches the plugin registry, using a local cache with 24h TTL. If refresh is true, the cache is bypassed.
type RegistryEntry ¶
type RegistryEntry struct {
Repository string `yaml:"repository"`
Description string `yaml:"description"`
Version string `yaml:"version"`
}
RegistryEntry is a single plugin entry in the registry.
type Tracker ¶
type Tracker struct {
Installed map[string]TrackerEntry `yaml:"installed"`
}
Tracker stores which plugins are installed in the project.
func LoadTracker ¶
LoadTracker reads the tracker file from the current project.
type TrackerEntry ¶
type TrackerEntry struct {
Version string `yaml:"version"`
InstalledAt string `yaml:"installed_at"`
FilesCreated []string `yaml:"files_created"`
}
TrackerEntry records metadata about an installed plugin.