appwizard

package
v0.5.1 Latest Latest
Warning

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

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

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

View Source
const (
	EnvMaxFiles     = "APP_WIZARD_MAX_FILES"
	EnvMaxFileBytes = "APP_WIZARD_MAX_FILE_BYTES"
	EnvMaxEnvKeys   = "APP_WIZARD_MAX_ENV_KEYS"
)

Env vars bounding one analysis.

View Source
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"`
	FilesRead     int            `json:"files_read"`
	TreeTruncated bool           `json:"tree_truncated"`
}

Analysis is the full set of suggestions for one repository and ref.

func Analyze

func Analyze(ctx context.Context, src repolayout.Source, opts Options) (*Analysis, error)

Analyze lists the repository tree once, reads a bounded set of manifest files, and returns suggestions with evidence. It never clones and never returns env values.

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 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 Memory

type Memory struct {
	Bytes    int64  `json:"bytes"`
	Evidence string `json:"evidence"`
}

Memory is the suggested memory limit.

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 Port

type Port struct {
	Value    int    `json:"value"`
	Evidence string `json:"evidence"`
}

Port is the suggested listening port.

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.

type Text

type Text struct {
	Value    string `json:"value"`
	Evidence string `json:"evidence"`
}

Text is a suggested string with the evidence behind it.

type Warning

type Warning struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

Warning is a note to show before deploying.

Jump to

Keyboard shortcuts

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