repoplan

package
v0.8.4 Latest Latest
Warning

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

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

Documentation

Overview

Package repoplan turns detected workspace packages into a read-only import plan: one proposed app per package, with collisions and risks flagged. Building a plan never creates anything.

Index

Constants

View Source
const (
	KindDockerfile = "dockerfile"
	KindBuildpack  = "buildpack"
	KindStatic     = "static"
)

Build kinds a plan row can propose.

View Source
const (
	WarnNoDockerfile  = "no_dockerfile"
	WarnNoPort        = "no_port"
	WarnDuplicatePort = "duplicate_port"
	WarnDuplicateName = "duplicate_name"
	WarnNameTaken     = "name_taken"
	WarnPackageCap    = "package_cap"
	WarnNoWorkspace   = "no_workspace"
	WarnTruncated     = "tree_truncated"
	WarnDetectFailed  = "detect_failed"
)

Warning codes a dashboard can translate.

Variables

This section is empty.

Functions

This section is empty.

Types

type Detection

type Detection struct {
	Port       int
	PortSource string
	Kind       string
	Failed     bool
}

Detection is what per-package analysis found. Failed is set when the package could not be analyzed; the row then carries a warning.

type Input

type Input struct {
	RepoURL       string
	Branch        string
	BaseDirectory string
	Tool          string
	Packages      []Package
	// Found is the member count before the cap; Cap is the cap that applied.
	Found, Cap int
	Truncated  bool
	// Detect maps a package directory to its detection.
	Detect map[string]Detection
	// Existing holds app names already taken.
	Existing map[string]bool
	// NameFor proposes a name for a package directory.
	NameFor func(dir string) string
	// MaxNameLen bounds suffixed names.
	MaxNameLen int
}

Input is everything Build needs; detection and name lookup are done by the caller.

type Package

type Package struct {
	PackageName string
	Dir         string
	Dockerfile  string
	DependsOn   []string
	WatchPaths  []string
}

Package is one workspace member as detected, before any naming.

type Plan

type Plan struct {
	RepoURL       string    `json:"repo_url"`
	Branch        string    `json:"branch"`
	BaseDirectory string    `json:"base_directory,omitempty"`
	Tool          string    `json:"tool,omitempty"`
	PackageCap    int       `json:"package_cap"`
	PackagesFound int       `json:"packages_found"`
	Packages      []Row     `json:"packages"`
	Warnings      []Warning `json:"warnings"`
	Totals        Totals    `json:"totals"`
}

Plan is the read-only result of planning one repository import.

func Build

func Build(in Input) Plan

Build assembles the plan. It is pure: same input, same output.

type Row

type Row struct {
	Name        string    `json:"name"`
	PackageName string    `json:"package_name"`
	Directory   string    `json:"directory"`
	Port        *int      `json:"port"`
	PortSource  string    `json:"port_source,omitempty"`
	BuildKind   string    `json:"build_kind"`
	Dockerfile  string    `json:"dockerfile,omitempty"`
	WatchPaths  []string  `json:"watch_paths"`
	DependsOn   []string  `json:"depends_on"`
	Warnings    []Warning `json:"warnings"`
}

Row is one proposed app.

type Totals

type Totals struct {
	Packages int `json:"packages"`
	Warnings int `json:"warnings"`
	Flagged  int `json:"flagged"`
}

Totals summarizes a plan for the header line.

type Warning

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

Warning is one finding about a row or the whole plan.

Jump to

Keyboard shortcuts

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