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

repositoryinspect

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 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.

func Reconcile added in v0.4.8

func Reconcile(findings []Finding, manifest *application.Manifest) ([]CapabilityIntent, []ReconciliationItem)

Reconcile compares read-only repository evidence with the explicit application contract. It never mutates the manifest. In particular, "stale" means only that current inspection did not rediscover evidence; it is never permission to remove a declared capability.

Types

type Artifact

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

type CapabilityIntent added in v0.4.8

type CapabilityIntent struct {
	Capability string    `json:"capability"`
	Name       string    `json:"name,omitempty"`
	Direction  Direction `json:"direction,omitempty"`
}

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 Direction added in v0.4.8

type Direction string
const (
	DirectionConsume   Direction = "consume"
	DirectionProvide   Direction = "provide"
	DirectionExport    Direction = "export"
	DirectionReceive   Direction = "receive"
	DirectionProvision Direction = "provision"
)

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"
	EvidenceEndpoint   EvidenceKind = "endpoint"
	EvidenceCall       EvidenceKind = "call"
)

type Finding

type Finding struct {
	Capability string             `json:"capability"`
	Name       string             `json:"name,omitempty"`
	Direction  Direction          `json:"direction,omitempty"`
	Operations []RuntimeOperation `json:"operations,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 ReconciliationItem added in v0.4.8

type ReconciliationItem struct {
	Capability string              `json:"capability"`
	Name       string              `json:"name,omitempty"`
	Direction  Direction           `json:"direction,omitempty"`
	State      ReconciliationState `json:"state"`
	Operations []RuntimeOperation  `json:"operations,omitempty"`
	Confidence Confidence          `json:"confidence,omitempty"`
	Evidence   []Evidence          `json:"evidence,omitempty"`
}

type ReconciliationState added in v0.4.8

type ReconciliationState string
const (
	ReconciliationSatisfied ReconciliationState = "satisfied"
	ReconciliationNew       ReconciliationState = "new"
	ReconciliationStale     ReconciliationState = "stale"
	ReconciliationAmbiguous ReconciliationState = "ambiguous"
)

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"`
	Declared          []CapabilityIntent   `json:"declared_capabilities,omitempty"`
	Reconciliation    []ReconciliationItem `json:"reconciliation,omitempty"`
}

func Inspect

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

type RuntimeOperation added in v0.4.8

type RuntimeOperation string
const (
	RuntimeCreate RuntimeOperation = "runtime.create"
	RuntimeGet    RuntimeOperation = "runtime.get"
	RuntimeDelete RuntimeOperation = "runtime.delete"
	RuntimeRotate RuntimeOperation = "runtime.rotate"
)

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