Help us shape the future of Go! Take the 2026 Go Developer Survey

development

package
v0.4.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StackProfileAPIVersion = "baseharbor.dev/v1"
	StackProfileKind       = "StackProfile"
)
View Source
const (
	SourceModelVersion         = "baseharbor.sources/v1"
	WorkspaceMappingVersion    = "baseharbor.workspace/v1"
	WorkspaceResolutionVersion = "baseharbor.workspace-resolution/v1"
	SourceModelRelativePath    = ".baseharbor/sources.yaml"
)
View Source
const DevelopmentPlanVersion = "baseharbor.development-plan/v1"
View Source
const NewApplicationResultVersion = "baseharbor.app-new/v1"
View Source
const WorkspaceGitStatusVersion = "baseharbor.workspace-git-status/v1"

Variables

View Source
var (
	ErrWorkspaceSourceMissing = errors.New("workspace source is missing")
	ErrWorkspaceModelMissing  = errors.New("workspace source model is not initialized")
)

Functions

func RenderBackstageCatalog

func RenderBackstageCatalog(manifest application.Manifest, options BackstageCatalogOptions) (string, error)

func RepositoryProfileRoot

func RepositoryProfileRoot(repositoryRoot string) string

func SaveProfile

func SaveProfile(profile StackProfile, scope ProfileScope, repositoryRoot string) (string, error)

func SaveWorkspaceMapping

func SaveWorkspaceMapping(manifestPath string, mapping WorkspaceMapping) (string, error)

func UserProfileRoot

func UserProfileRoot() (string, error)

func ValidateWorkspace

func ValidateWorkspace(contract application.PortableContract, profile StackProfile, adapters Registry, workspace WorkspaceResolution) (map[string]Validation, error)

func WorkspaceMappingPath

func WorkspaceMappingPath(manifestPath, application string) (string, error)

func WriteGeneratedFiles

func WriteGeneratedFiles(root string, files []GeneratedFile) error

func WriteSourceModel

func WriteSourceModel(manifestPath string, model SourceModel) (string, error)

Types

type Action

type Action struct {
	Kind       ActionKind      `json:"kind"`
	Component  string          `json:"component"`
	Capability capability.Kind `json:"capability,omitempty"`
	Name       string          `json:"name"`
	Value      string          `json:"value,omitempty"`
}

type ActionKind

type ActionKind string
const (
	ActionDependency ActionKind = "dependency"
	ActionBinding    ActionKind = "binding"
	ActionSource     ActionKind = "source"
	ActionBuild      ActionKind = "build"
	ActionHealth     ActionKind = "health"
	ActionTelemetry  ActionKind = "telemetry"
)

type Adapter

type Adapter interface {
	Descriptor() extension.Metadata
	Detect(root string) (Detection, error)
	Supports(requirement capability.Requirement) bool
	Plan(contract application.PortableContract, profile StackProfile, component Component) ([]Action, error)
	Bootstrap(plan DevelopmentPlan, component Component) ([]GeneratedFile, error)
	Validate(root string, contract application.PortableContract, component Component) (Validation, error)
}

type BackstageCatalogOptions

type BackstageCatalogOptions struct {
	Owner     string `json:"owner"`
	Lifecycle string `json:"lifecycle,omitempty"`
}

func (BackstageCatalogOptions) Validate

func (o BackstageCatalogOptions) Validate() error

type BootstrapResult

type BootstrapResult struct {
	Manifest  application.Manifest         `json:"-"`
	Contract  application.PortableContract `json:"-"`
	Profile   StackProfile                 `json:"profile"`
	Plan      DevelopmentPlan              `json:"development_plan"`
	Files     []GeneratedFile              `json:"-"`
	FilePaths []string                     `json:"files"`
}

func BootstrapApplication

func BootstrapApplication(request NewApplicationRequest, registry Registry) (BootstrapResult, error)

type CapabilityPreference

type CapabilityPreference struct {
	Capability               capability.Kind `json:"capability" yaml:"capability"`
	Components               []string        `json:"components,omitempty" yaml:"components,omitempty"`
	ImplementationPreference string          `json:"implementation_preference,omitempty" yaml:"implementation-preference,omitempty"`
	DevelopmentIntegration   string          `json:"development_integration,omitempty" yaml:"development-integration,omitempty"`
}

type Component

type Component struct {
	ID      string `json:"id" yaml:"id"`
	Role    string `json:"role" yaml:"role"`
	Adapter string `json:"adapter" yaml:"adapter"`
}

type ComponentSource

type ComponentSource struct {
	Component string `json:"component" yaml:"component"`
	Source    string `json:"source" yaml:"source"`
	SubPath   string `json:"sub_path,omitempty" yaml:"subPath,omitempty"`
}

type ConformanceCheck

type ConformanceCheck struct {
	Name    string            `json:"name"`
	Status  ConformanceStatus `json:"status"`
	Message string            `json:"message,omitempty"`
}

type ConformanceReport

type ConformanceReport struct {
	AdapterID      string             `json:"adapter_id"`
	AdapterVersion string             `json:"adapter_version"`
	Status         ConformanceStatus  `json:"status"`
	Checks         []ConformanceCheck `json:"checks"`
}

func RunAdapterConformance

func RunAdapterConformance(root string, request NewApplicationRequest, adapter Adapter) ConformanceReport

func (*ConformanceReport) Add

func (r *ConformanceReport) Add(name string, err error)

func (ConformanceReport) Passed

func (r ConformanceReport) Passed() bool

type ConformanceStatus

type ConformanceStatus string
const (
	ConformancePass ConformanceStatus = "pass"
	ConformanceFail ConformanceStatus = "fail"
)

type CreationResult

type CreationResult struct {
	BootstrapResult
	Validation Validation `json:"validation"`
}

func CreateApplication

func CreateApplication(root string, request NewApplicationRequest, registry Registry) (CreationResult, error)

type Detection

type Detection struct {
	Detected bool     `json:"detected"`
	Evidence []string `json:"evidence,omitempty"`
}

type DevelopmentPlan

type DevelopmentPlan struct {
	SchemaVersion string          `json:"schema_version"`
	Application   string          `json:"application"`
	Profile       string          `json:"profile"`
	Sources       []PlannedSource `json:"sources,omitempty"`
	Actions       []Action        `json:"actions"`
}

func BuildPlan

func BuildPlan(contract application.PortableContract, profile StackProfile, adapters Registry) (DevelopmentPlan, error)

func BuildPlanForWorkspace

func BuildPlanForWorkspace(contract application.PortableContract, profile StackProfile, adapters Registry, workspace WorkspaceResolution) (DevelopmentPlan, error)

type GeneratedFile

type GeneratedFile struct {
	Path    string `json:"path"`
	Content []byte `json:"-"`
	Mode    uint32 `json:"mode,omitempty"`
}

type NewApplicationRequest

type NewApplicationRequest struct {
	ApplicationID          string            `json:"-"`
	Name                   string            `json:"name"`
	Environment            string            `json:"environment,omitempty"`
	Adapter                string            `json:"adapter,omitempty"`
	Profile                *StackProfile     `json:"profile,omitempty"`
	Capabilities           []capability.Kind `json:"capabilities"`
	Secrets                []string          `json:"secrets,omitempty"`
	EmitBackstage          bool              `json:"emit_backstage,omitempty"`
	BackstageOwner         string            `json:"backstage_owner,omitempty"`
	BackstageLifecycle     string            `json:"backstage_lifecycle,omitempty"`
	RepositoryStackProfile *StackProfile     `json:"repository_stack_profile,omitempty"`
}

type PlannedSource

type PlannedSource struct {
	Component string     `json:"component"`
	Source    string     `json:"source"`
	Type      SourceKind `json:"type"`
	Identity  string     `json:"identity"`
	Ref       string     `json:"ref,omitempty"`
	SubPath   string     `json:"sub_path,omitempty"`
	Image     string     `json:"image,omitempty"`
}

type ProfileCatalog

type ProfileCatalog map[string]StackProfile

func ProfileMap

func ProfileMap(entries ProfileCatalogEntries) ProfileCatalog

type ProfileCatalogEntries

type ProfileCatalogEntries map[string]ProfileEntry

func LoadProfileCatalog

func LoadProfileCatalog(repositoryRoot string, builtins map[string]StackProfile) (ProfileCatalogEntries, error)

func LoadProfileCatalogWithOrganization added in v0.4.19

func LoadProfileCatalogWithOrganization(repositoryRoot string, builtins map[string]StackProfile, organization map[string]string) (ProfileCatalogEntries, error)

type ProfileConflict

type ProfileConflict struct {
	Field    string `json:"field"`
	Current  string `json:"current"`
	Incoming string `json:"incoming"`
}

type ProfileEntry

type ProfileEntry struct {
	Profile StackProfile `json:"profile"`
	Scope   ProfileScope `json:"scope"`
	Path    string       `json:"path,omitempty"`
}

type ProfileMetadata

type ProfileMetadata struct {
	Name string `json:"name" yaml:"name"`
}

type ProfileResolution

type ProfileResolution struct {
	Profile   StackProfile      `json:"profile"`
	Sources   []string          `json:"sources"`
	Conflicts []ProfileConflict `json:"conflicts,omitempty"`
}

func ResolveStackProfile

func ResolveStackProfile(name string, catalog ProfileCatalog) (ProfileResolution, error)

type ProfileScope

type ProfileScope string
const (
	ProfileScopeBuiltin      ProfileScope = "built-in"
	ProfileScopeOrganization ProfileScope = "organization"
	ProfileScopeUser         ProfileScope = "user"
	ProfileScopeRepository   ProfileScope = "repository"
)

type ProjectResult

type ProjectResult struct {
	SchemaVersion string                   `json:"schema_version"`
	Root          string                   `json:"root"`
	Application   string                   `json:"application"`
	Profile       string                   `json:"profile"`
	Plan          DevelopmentPlan          `json:"development_plan"`
	Files         []string                 `json:"files"`
	Inspection    repositoryinspect.Result `json:"inspection"`
	Satisfied     bool                     `json:"satisfied"`
	Validations   map[string]Validation    `json:"validations,omitempty"`
}

func BootstrapProject

func BootstrapProject(root string, manifest application.Manifest, profile StackProfile, registry Registry, extras ...GeneratedFile) (ProjectResult, error)

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry(adapters ...Adapter) (Registry, error)

func (Registry) IDs

func (r Registry) IDs() []string

func (Registry) Resolve

func (r Registry) Resolve(id string) (Adapter, error)

func (Registry) Supports

func (r Registry) Supports(id string, kind capability.Kind) bool

type ResolvedComponentSource

type ResolvedComponentSource struct {
	Component string     `json:"component"`
	Source    string     `json:"source"`
	Type      SourceKind `json:"type"`
	Identity  string     `json:"identity"`
	Ref       string     `json:"ref,omitempty"`
	Root      string     `json:"root,omitempty"`
	SubPath   string     `json:"sub_path,omitempty"`
	Image     string     `json:"image,omitempty"`
}

type SourceDefinition

type SourceDefinition struct {
	ID         string     `json:"id" yaml:"id"`
	Type       SourceKind `json:"type" yaml:"type"`
	Repository string     `json:"repository,omitempty" yaml:"repository,omitempty"`
	Ref        string     `json:"ref,omitempty" yaml:"ref,omitempty"`
	Image      string     `json:"image,omitempty" yaml:"image,omitempty"`
}

type SourceKind

type SourceKind string
const (
	SourceRepository SourceKind = "repository"
	SourceOCI        SourceKind = "oci"
)

type SourceModel

type SourceModel struct {
	SchemaVersion string             `json:"schema_version" yaml:"schemaVersion"`
	Application   string             `json:"application" yaml:"application"`
	Sources       []SourceDefinition `json:"sources" yaml:"sources"`
	Components    []ComponentSource  `json:"components" yaml:"components"`
}

func LoadSourceModel

func LoadSourceModel(manifestPath string) (SourceModel, string, error)

func (SourceModel) Validate

func (m SourceModel) Validate() error

type StackProfile

type StackProfile struct {
	APIVersion   string                 `json:"api_version" yaml:"apiVersion"`
	Kind         string                 `json:"kind" yaml:"kind"`
	Metadata     ProfileMetadata        `json:"metadata" yaml:"metadata"`
	Extends      []string               `json:"extends,omitempty" yaml:"extends,omitempty"`
	Components   []Component            `json:"components" yaml:"components"`
	Capabilities []CapabilityPreference `json:"capabilities,omitempty" yaml:"capabilities,omitempty"`
}

func BuiltinProfile

func BuiltinProfile(adapterID, name string) StackProfile

func (StackProfile) Validate

func (p StackProfile) Validate() error

type Validation

type Validation struct {
	Satisfied    bool                     `json:"satisfied"`
	Capabilities map[capability.Kind]bool `json:"capabilities,omitempty"`
	Diagnostics  []string                 `json:"diagnostics,omitempty"`
}

func ValidateRepositoryCapabilities

func ValidateRepositoryCapabilities(root string, contract application.PortableContract, supports func(capability.Requirement) bool) (Validation, error)

type WorkspaceGitRepositoryStatus added in v0.4.20

type WorkspaceGitRepositoryStatus struct {
	Source           string            `json:"source"`
	Path             string            `json:"path"`
	State            WorkspaceGitState `json:"state"`
	Branch           string            `json:"branch,omitempty"`
	Upstream         string            `json:"upstream,omitempty"`
	Remote           string            `json:"remote,omitempty"`
	Relation         string            `json:"relation,omitempty"`
	Ahead            int               `json:"ahead,omitempty"`
	Behind           int               `json:"behind,omitempty"`
	CurrentRevision  string            `json:"current_revision,omitempty"`
	TargetRevision   string            `json:"target_revision,omitempty"`
	DeclaredRef      string            `json:"declared_ref,omitempty"`
	DeclaredRevision string            `json:"declared_revision,omitempty"`
	Dirty            bool              `json:"dirty,omitempty"`
	UpdateSafe       bool              `json:"update_safe"`
	Updated          bool              `json:"updated,omitempty"`
	Blocker          string            `json:"blocker,omitempty"`
	Problem          string            `json:"problem,omitempty"`
	NextAction       string            `json:"next_action,omitempty"`
}

type WorkspaceGitState added in v0.4.20

type WorkspaceGitState string
const (
	WorkspaceGitCurrent         WorkspaceGitState = "current"
	WorkspaceGitUpdateAvailable WorkspaceGitState = "update_available"
	WorkspaceGitDirty           WorkspaceGitState = "dirty"
	WorkspaceGitAhead           WorkspaceGitState = "ahead"
	WorkspaceGitDiverged        WorkspaceGitState = "diverged"
	WorkspaceGitDetached        WorkspaceGitState = "detached"
	WorkspaceGitNoUpstream      WorkspaceGitState = "no_upstream"
	WorkspaceGitUnavailable     WorkspaceGitState = "unavailable"
	WorkspaceGitNotRepository   WorkspaceGitState = "not_repository"
)

type WorkspaceGitStatus added in v0.4.20

type WorkspaceGitStatus struct {
	SchemaVersion string                         `json:"schema_version"`
	Repositories  []WorkspaceGitRepositoryStatus `json:"repositories"`
}

func InspectWorkspaceGit added in v0.4.20

func InspectWorkspaceGit(ctx context.Context, model SourceModel, mapping WorkspaceMapping, fetch bool) (WorkspaceGitStatus, error)

type WorkspaceGitUpdateResult added in v0.4.20

type WorkspaceGitUpdateResult struct {
	SchemaVersion string                         `json:"schema_version"`
	CheckOnly     bool                           `json:"check_only"`
	Repositories  []WorkspaceGitRepositoryStatus `json:"repositories"`
}

func UpdateWorkspaceGit added in v0.4.20

func UpdateWorkspaceGit(ctx context.Context, model SourceModel, mapping WorkspaceMapping, check bool) (WorkspaceGitUpdateResult, error)

type WorkspaceMapping

type WorkspaceMapping struct {
	SchemaVersion string            `json:"schema_version"`
	Application   string            `json:"application"`
	Manifest      string            `json:"manifest"`
	Sources       map[string]string `json:"sources"`
}

func ListWorkspaceMappings added in v0.4.22

func ListWorkspaceMappings() ([]WorkspaceMapping, []error, error)

func LoadWorkspaceMapping

func LoadWorkspaceMapping(manifestPath, application string) (WorkspaceMapping, string, error)

type WorkspaceResolution

type WorkspaceResolution struct {
	SchemaVersion string                    `json:"schema_version"`
	Application   string                    `json:"application"`
	Manifest      string                    `json:"manifest"`
	Components    []ResolvedComponentSource `json:"components"`
}

func ResolveWorkspace

func ResolveWorkspace(manifestPath string, model SourceModel, mapping WorkspaceMapping) (WorkspaceResolution, error)

type WorkspaceSourceError

type WorkspaceSourceError struct {
	Source    string
	Component string
	Path      string
	Problem   string
}

func (*WorkspaceSourceError) Error

func (e *WorkspaceSourceError) Error() string

func (*WorkspaceSourceError) Unwrap

func (e *WorkspaceSourceError) Unwrap() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL