Documentation
¶
Index ¶
- func AvailableLanguages() []string
- func FileExists(path string) bool
- func Generate(t *Template) string
- func MergeAddons(t *Template, results []*AddonResult)
- func PrefixAddonResult(r *AddonResult, dir string)
- func Register(d Detector)
- func RegisterAddon(a Addon)
- func RegisterTemplate(p TemplateProvider)
- type Addon
- type AddonResult
- type Detector
- type ProjectInfo
- type SubProject
- type Template
- type TemplateProvider
- type TemplateTarget
- type TemplateVariable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AvailableLanguages ¶
func AvailableLanguages() []string
AvailableLanguages returns the names of all registered detectors.
func FileExists ¶
FileExists returns true if the path exists on disk.
func MergeAddons ¶
func MergeAddons(t *Template, results []*AddonResult)
MergeAddons appends addon targets into the template, skipping any target whose name already exists (first writer wins, with a debug log on conflict).
func PrefixAddonResult ¶
func PrefixAddonResult(r *AddonResult, dir string)
PrefixAddonResult prepends a directory prefix to all target names and adjusts recipes with directory context.
func Register ¶
func Register(d Detector)
Register adds a language/project detector to the registry.
func RegisterAddon ¶
func RegisterAddon(a Addon)
RegisterAddon adds an addon detector to the registry.
func RegisterTemplate ¶
func RegisterTemplate(p TemplateProvider)
RegisterTemplate adds a template provider to the registry.
Types ¶
type Addon ¶
type Addon interface {
Name() string
Detect(repoRoot string) *AddonResult // nil if not detected
}
Addon detects a tool, platform, or infrastructure component and contributes its own targets to the generated Vibefile. Each addon is self-contained — detection and target generation live in the same package.
type AddonResult ¶
type AddonResult struct {
Label string // human-readable label, e.g. "Docker", "Helm"
Targets []TemplateTarget // targets contributed by this addon
}
AddonResult is returned by an Addon when it detects a matching tool/platform.
func DetectAddons ¶
func DetectAddons(repoRoot string) []*AddonResult
DetectAddons runs all registered addons and returns results for those that matched.
func DetectAddonsInDir ¶
func DetectAddonsInDir(repoRoot, relDir string) []*AddonResult
DetectAddonsInDir runs all addons against a specific directory and optionally prefixes target names and recipe context when relDir is non-empty.
type Detector ¶
type Detector interface {
Name() string
Detect(repoRoot string) (*ProjectInfo, bool)
}
Detector identifies a project's language and tooling from the repo root.
type ProjectInfo ¶
type ProjectInfo struct {
Language string // "go", "node", "python", "rust"
Framework string // "gin", "next", "flask" (optional)
PackageManager string // "go", "npm", "pip", "cargo"
Version string // language version from go.mod, .nvmrc, etc.
BinaryName string // inferred from module path or package.json name
Module string // go module path, npm package name, etc.
Modules []string // workspace module directories (e.g. from go.work)
HasTests bool // test files detected
Metadata map[string]string // detector-specific extras
}
ProjectInfo holds detected information about the project's language and tooling.
func DetectByLanguage ¶
func DetectByLanguage(repoRoot, language string) (*ProjectInfo, bool)
DetectByLanguage runs only the detector matching the given language name.
func DetectLanguage ¶
func DetectLanguage(repoRoot string) *ProjectInfo
DetectLanguage runs all registered language detectors and returns the first match.
type SubProject ¶
type SubProject struct {
Dir string
Project *ProjectInfo
}
SubProject pairs a detected project with its relative directory within a monorepo. Dir is "" for root-level projects and e.g. "go" or "ui" for subdirectory projects.
func ScanSubdirectories ¶
func ScanSubdirectories(repoRoot string) []SubProject
ScanSubdirectories walks immediate children of repoRoot and runs all language detectors against each directory. Returns all matches as SubProjects.
type Template ¶
type Template struct {
Variables []TemplateVariable `yaml:"variables"`
Targets []TemplateTarget `yaml:"targets"`
}
Template describes the variables and targets for a generated Vibefile.
func ResolveSubProjectTemplate ¶
func ResolveSubProjectTemplate(repoRoot string, sp SubProject) (*Template, error)
ResolveSubProjectTemplate resolves a template for a SubProject. When the sub-project lives in a subdirectory, target names get prefixed with the directory name (build -> go-build), dependencies are prefixed, recipes get directory context, and sections include the directory name.
func ResolveTemplate ¶
func ResolveTemplate(repoRoot, language string, project *ProjectInfo) (*Template, error)
ResolveTemplate finds the best template for the given language by checking: 1. .vibe/templates/<lang>.yaml (project-local) 2. ~/.vibe/templates/<lang>.yaml (user-global) 3. Built-in provider
type TemplateProvider ¶
type TemplateProvider interface {
Language() string
Provide(project *ProjectInfo) *Template
}
TemplateProvider returns a Template for a detected project. Built-in providers are Go structs; external providers are loaded from YAML.
type TemplateTarget ¶
type TemplateTarget struct {
Name string `yaml:"name"`
Dependencies []string `yaml:"dependencies,omitempty"`
Recipe string `yaml:"recipe"`
Section string `yaml:"section,omitempty"`
Directives []string `yaml:"directives,omitempty"`
}
TemplateTarget is a single target definition for the generated Vibefile.
type TemplateVariable ¶
TemplateVariable is a key-value pair for the Vibefile header.