Documentation
¶
Index ¶
- func Add(sourcePath string) error
- func CopyDirForTest(src, dst string) error
- func Exists(name string) (bool, error)
- func Remove(name string) error
- func TemplatesDir() string
- func WriteTemplateMeta(dir string, meta *TemplateMeta) error
- type GitHubClient
- type GitHubRef
- type ScaffoldRequest
- type ScaffoldResult
- type StepResult
- type Template
- type TemplateMeta
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Add ¶
Add copies a local directory into the templates store. The destination name is the base name of sourcePath.
func CopyDirForTest ¶
CopyDirForTest exposes copyDir for internal use in tests and other packages that need to reuse the same semantics. It is not part of the public API surface.
func TemplatesDir ¶
func TemplatesDir() string
TemplatesDir returns the absolute path to ~/.structify/templates.
func WriteTemplateMeta ¶
func WriteTemplateMeta(dir string, meta *TemplateMeta) error
WriteTemplateMeta writes .structify-meta.yaml inside dir with the given metadata.
Types ¶
type GitHubClient ¶
type GitHubClient struct {
// contains filtered or unexported fields
}
GitHubClient provides operations over GitHub repositories required by Structify.
func NewGitHubClient ¶
func NewGitHubClient() *GitHubClient
NewGitHubClient returns a GitHubClient with sane defaults.
func (*GitHubClient) Clone ¶
func (c *GitHubClient) Clone(ref *GitHubRef, destDir string) error
Clone clones the given GitHub repository into destDir. If ref.Ref is empty, Clone will use the repository's default branch. For now, Clone performs a shallow clone (depth=1) regardless of ref shape.
func (*GitHubClient) ResolveDefaultBranch ¶
func (c *GitHubClient) ResolveDefaultBranch(ref *GitHubRef) (string, error)
ResolveDefaultBranch returns the default branch name for the given repository using the public GitHub API.
func (*GitHubClient) ValidateTemplateRepo ¶
func (c *GitHubClient) ValidateTemplateRepo(clonedPath string) (*dsl.Manifest, error)
ValidateTemplateRepo verifies that clonedPath contains a valid Structify template. It expects scaffold.yaml at the repository root.
type GitHubRef ¶
GitHubRef represents a normalized GitHub repository reference.
func ParseGitHubURL ¶
ParseGitHubURL parses and normalizes supported GitHub URL formats:
- github.com/user/repo
- github.com/user/repo@v1.2.0
- https://github.com/user/repo
- https://github.com/user/repo.git
- git@github.com:user/repo.git
type ScaffoldRequest ¶
type ScaffoldRequest struct {
Template *Template
OutputDir string
Variables dsl.Context
DryRun bool
}
ScaffoldRequest contains everything needed to scaffold a project.
type ScaffoldResult ¶
type ScaffoldResult struct {
FilesCreated []string
FilesSkipped []string
StepsExecuted []StepResult
StepsFailed []StepResult
}
ScaffoldResult summarizes what the engine did.
type StepResult ¶
StepResult is the outcome of executing a single step.
type Template ¶
type Template struct {
Manifest *dsl.Manifest
Path string
Source string // "builtin" | "local" | "github"
Meta *TemplateMeta
}
Template represents a scaffolding template loaded from some source.
func List ¶
List returns all locally installed templates from ~/.structify/templates/. Folders without scaffold.yaml are ignored (not an error).
func LoadBuiltins ¶
LoadBuiltins loads templates embedded in the binary.
func LoadFromPath ¶
LoadFromPath loads a template from a local filesystem path.
type TemplateMeta ¶
TemplateMeta contains optional metadata about the origin of a template.