Documentation
¶
Overview ¶
Package appwizard analyses a git repository through a provider file-tree API and returns pre-filled, evidence-backed suggestions for creating an app. Repository text is parsed as data only and env values are never returned.
Index ¶
Constants ¶
const ( ConfidenceHigh = "high" ConfidenceMedium = "medium" ConfidenceLow = "low" )
Confidence levels of a Detection.
const ( WarnNoLockfile = "no_lockfile" WarnMultiDockerfile = "multiple_dockerfiles" WarnMalformedManifest = "malformed_manifest" WarnDockerfileNoPort = "dockerfile_no_expose" WarnMonorepoNoApp = "monorepo_no_root_app" WarnRailpackNoRust = "railpack_unsupported" )
Detection warning codes.
const ( EnvMaxFiles = "APP_WIZARD_MAX_FILES" EnvMaxFileBytes = "APP_WIZARD_MAX_FILE_BYTES" EnvMaxEnvKeys = "APP_WIZARD_MAX_ENV_KEYS" )
Env vars bounding one analysis.
const ( WarnNothingDetected = "nothing_detected" WarnReadBudget = "read_budget" WarnTruncated = "tree_truncated" WarnMonorepo = "monorepo_choose_app" WarnNoPort = "port_unknown" )
Warning codes a dashboard can translate.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Analysis ¶
type Analysis struct {
RepoURL string `json:"repo_url"`
Branch string `json:"branch"`
Monorepo bool `json:"monorepo"`
AppDirectory string `json:"app_directory,omitempty"`
Name Text `json:"name"`
Stack Stack `json:"stack"`
Build Build `json:"build"`
Port Port `json:"port"`
Health Text `json:"health"`
Memory Memory `json:"memory"`
Domain Text `json:"domain"`
Env []EnvKey `json:"env"`
Databases []DatabaseNeed `json:"databases"`
Warnings []Warning `json:"warnings"`
Detection Detection `json:"detection"`
Packages []repolayout.Package `json:"packages"`
FilesRead int `json:"files_read"`
TreeTruncated bool `json:"tree_truncated"`
}
Analysis is the full set of suggestions for one repository and ref.
type Build ¶
type Build struct {
Type string `json:"type"`
DockerfilePath string `json:"dockerfile_path,omitempty"`
BaseDirectory string `json:"base_directory,omitempty"`
Evidence string `json:"evidence"`
Alternatives []repolayout.Suggestion `json:"alternatives"`
}
Build is the suggested build configuration, relative to the repository root.
type DatabaseNeed ¶
type DatabaseNeed struct {
Engine string `json:"engine"`
Version string `json:"version"`
SuggestedName string `json:"suggested_name"`
EnvVar string `json:"env_var"`
Field string `json:"field"`
Evidence string `json:"evidence"`
}
DatabaseNeed is a managed database the app appears to need.
type Detection ¶
type Detection struct {
Framework string `json:"framework"`
Language string `json:"language"`
BuildType string `json:"build_type"`
Confidence string `json:"confidence"`
Reasons []Reason `json:"reasons"`
Port PortGuess `json:"port"`
StartCommand string `json:"start_command,omitempty"`
BuildCommand string `json:"build_command,omitempty"`
OutputDir string `json:"output_dir,omitempty"`
HealthPath string `json:"health_path"`
RuntimeVersion Sourced `json:"runtime_version"`
EnvVars []EnvVarGuess `json:"env_vars"`
Warnings []Warning `json:"warnings"`
}
Detection explains what a repository is and how it would be built.
type EnvKey ¶
type EnvKey struct {
Key string `json:"key"`
Required bool `json:"required"`
Secret bool `json:"secret"`
Source string `json:"source"`
ProvidedBy string `json:"provided_by,omitempty"`
HasDefault bool `json:"has_default"`
}
EnvKey is one environment variable the repository declares. It never carries a value.
type EnvVarGuess ¶
type EnvVarGuess struct {
Name string `json:"name"`
Source string `json:"source"`
Required bool `json:"required"`
SecretGuess bool `json:"secret_guess"`
}
EnvVarGuess is one variable the repository declares, never with a value.
type Input ¶
type Input struct {
Paths []string
Read func(p string) (string, bool)
// Dir is the app directory inside the repository, "" for the root.
Dir string
Layout *repolayout.Result
}
Input is a repository tree, from a checkout or a provider listing. Read returns false for anything missing, unreadable or binary.
type Options ¶
type Options struct {
RepoURL string
Branch string
// BaseDirectory, DockerfilePath and BuildType override the recommended
// build suggestion when the operator picked an alternative.
BaseDirectory string
DockerfilePath string
BuildType string
Name string
// AppsBaseDomain, when set with DomainFor, yields a suggested domain.
AppsBaseDomain string
DomainFor func(name, base string) string
// DefaultVersion returns an engine's default version, "" when unknown.
DefaultVersion func(engine string) string
}
Options carries per-request inputs and environment hooks.
type Stack ¶
type Stack struct {
Runtime string `json:"runtime"`
Framework string `json:"framework,omitempty"`
Evidence string `json:"evidence"`
}
Stack is the detected runtime and framework.