detect

package
v0.0.0-...-5adab22 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package detect inspects a project directory and works out what it needs to run: language runtimes, backing services, and which third-party APIs it talks to. Everything is inferred from files that are already in the repository — Cauldron never requires its own config file.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoProject = errors.New("no recognisable project manifest found")

ErrNoProject is returned when a directory contains nothing Cauldron can read.

Functions

This section is empty.

Types

type Kind

type Kind string

Kind classifies a detected requirement.

const (
	// KindRuntime is a language runtime, e.g. PHP 8.5 or Node 24.
	KindRuntime Kind = "runtime"
	// KindService is a backing service Cauldron boots itself, e.g. PostgreSQL.
	KindService Kind = "service"
	// KindRecipe is a third-party API Cauldron emulates, e.g. Stripe.
	KindRecipe Kind = "recipe"
)

type Project

type Project struct {
	Root         string
	Framework    string
	Requirements []Requirement
	// Unmatched holds dependencies that look like third-party API clients but
	// have no Recipe yet. Surfacing these is deliberate: silently falling back
	// to the real network is how a test suite starts lying.
	Unmatched []Requirement
}

Project is the result of inspecting a directory.

func Detect

func Detect(root string) (*Project, error)

Detect inspects root and returns everything it can determine.

func (*Project) Has

func (p *Project) Has(kind Kind, name string) bool

Has reports whether a requirement of the given kind and name was detected.

func (*Project) Of

func (p *Project) Of(kind Kind) []Requirement

Of returns every requirement of a given kind.

type Requirement

type Requirement struct {
	Kind Kind
	// Name is the canonical identifier: "php", "postgres", "stripe".
	Name string
	// Version is the resolved or requested version, when one is knowable.
	Version string
	// Source records which file produced this requirement, so `cauldron doctor`
	// can explain itself rather than being a black box.
	Source string
	// Evidence is the specific token that triggered detection, e.g. the package
	// name "stripe/stripe-php".
	Evidence string
}

Requirement is a single thing the project needs.

Jump to

Keyboard shortcuts

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