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

repositoryinspect

package
v0.4.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalJSONResult

func MarshalJSONResult(result Result) ([]byte, error)

MarshalJSONResult exists so control surfaces can share one stable rendering path without each re-encoding repository inspection state differently.

func ParsePublishedPort

func ParsePublishedPort(value string) (int, bool)

ParsePublishedPort extracts the host-side numeric port from common Compose short syntax. It is intentionally conservative and returns false on ambiguity.

Types

type Artifact

type Artifact struct {
	Kind string `json:"kind"`
	Path string `json:"path"`
}

type ComposeAnalysis

type ComposeAnalysis struct {
	WorkloadServices  []string       `json:"workload_services,omitempty"`
	PostgresInstances []string       `json:"postgres_instances,omitempty"`
	RedisInstances    []string       `json:"redis_instances,omitempty"`
	Ports             []PortEvidence `json:"ports,omitempty"`
	HealthChecks      []Evidence     `json:"health_checks,omitempty"`
}

func AnalyzeComposeFile

func AnalyzeComposeFile(root, rel string) (ComposeAnalysis, error)

type Confidence

type Confidence string
const (
	ConfidenceDetected  Confidence = "detected"
	ConfidenceSuggested Confidence = "suggested"
	ConfidencePossible  Confidence = "possible"
)

type Detector

type Detector interface {
	Name() string
	Detect(context.Context, Snapshot) ([]Finding, error)
}

type Engine

type Engine struct {
	Detectors []Detector
}

func DefaultEngine

func DefaultEngine() Engine

func (Engine) Inspect

func (e Engine) Inspect(ctx context.Context, root string) (Result, error)

type Evidence

type Evidence struct {
	Kind   EvidenceKind `json:"kind"`
	Path   string       `json:"path"`
	Detail string       `json:"detail"`
}

type EvidenceKind

type EvidenceKind string
const (
	EvidenceManifest   EvidenceKind = "manifest"
	EvidenceCompose    EvidenceKind = "compose"
	EvidenceDependency EvidenceKind = "dependency"
	EvidenceEnv        EvidenceKind = "env"
	EvidenceImport     EvidenceKind = "import"
	EvidencePort       EvidenceKind = "port"
	EvidenceHealth     EvidenceKind = "healthcheck"
	EvidenceConfig     EvidenceKind = "config"
)

type Finding

type Finding struct {
	Capability string     `json:"capability"`
	Name       string     `json:"name,omitempty"`
	Confidence Confidence `json:"confidence"`
	Evidence   []Evidence `json:"evidence"`
}

type PortEvidence

type PortEvidence struct {
	Path    string `json:"path"`
	Service string `json:"service,omitempty"`
	Value   string `json:"value"`
}

type Result

type Result struct {
	Root              string            `json:"root"`
	Application       string            `json:"application"`
	ExistingManifest  string            `json:"existing_manifest,omitempty"`
	Artifacts         []Artifact        `json:"artifacts,omitempty"`
	ComposeCandidates []string          `json:"compose_candidates,omitempty"`
	SelectedCompose   string            `json:"selected_compose,omitempty"`
	WorkloadServices  []string          `json:"workload_services,omitempty"`
	Findings          []Finding         `json:"findings,omitempty"`
	RequiredSecrets   []string          `json:"required_secrets,omitempty"`
	SecretCandidates  []string          `json:"secret_candidates,omitempty"`
	SecretSources     map[string]string `json:"secret_sources,omitempty"`
	Ports             []PortEvidence    `json:"ports,omitempty"`
	HealthChecks      []Evidence        `json:"health_checks,omitempty"`
}

func Inspect

func Inspect(ctx context.Context, root string) (Result, error)

type Snapshot

type Snapshot struct {
	Root  string
	Files map[string][]byte
}

Jump to

Keyboard shortcuts

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