detect

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MigrateDirCandidates = []string{
	"migrations",
	"migrate",
	"db/migrations",
	"db/migrate",
	"sql/migrations",
	"backend/migrations",
	"backend/migrate",
}

MigrateDirCandidates lists common migration directory names (relative to project root). Shared between detect, contract, and CLI packages so the list is defined once.

View Source
var SeedDirCandidates = []string{
	"seed",
	"seeds",
	"db/seed",
	"db/seeds",
	"sql/seed",
	"sql/seeds",
	"backend/seed",
	"backend/seeds",
}

SeedDirCandidates lists common seed directory names (relative to project root).

Functions

func ParseEnvFiles

func ParseEnvFiles(dir string) map[string]string

ParseEnvFiles reads all .env files from a directory using the shared env parser.

func ScanLogFiles added in v0.15.0

func ScanLogFiles(dir string) []string

ScanLogFiles recursively searches for *.log files in a project directory. It skips common non-project directories like .git, node_modules, vendor, etc. Returns nil if no log files are found.

Types

type APIResult

type APIResult struct {
	BaseURL  string `toml:"base_url,omitempty"`
	Spec     string `toml:"spec,omitempty"`
	Auth     string `toml:"auth,omitempty"`
	AuthType string `toml:"auth_type,omitempty"`
}

type DatabaseResult

type DatabaseResult struct {
	Source     string `toml:"source"`
	Type       string `toml:"type"`
	MigrateDir string `toml:"migrate_dir,omitempty"`
	SeedDir    string `toml:"seed_dir,omitempty"`
}

type Detector

type Detector struct {
	// contains filtered or unexported fields
}

func New

func New(dir string) *Detector

func (*Detector) Detect

func (d *Detector) Detect() *Result

type DockerResult added in v0.25.0

type DockerResult struct {
	ComposeFile string              `toml:"compose_file,omitempty"`
	Services    []DockerServiceInfo `toml:"services,omitempty"`
}

DockerResult represents detected Docker service information.

type DockerServiceInfo added in v0.25.0

type DockerServiceInfo struct {
	Name    string `json:"name"`
	Image   string `json:"image,omitempty"`
	Ports   string `json:"ports,omitempty"`
	HasDB   bool   `json:"has_db"`
	HasAPI  bool   `json:"has_api"`
	HasGRPC bool   `json:"has_grpc"`
}

DockerServiceInfo represents a single Docker Compose service.

type GRPCResult

type GRPCResult struct {
	Addr       string `toml:"addr,omitempty"`
	ProtoDir   string `toml:"proto_dir,omitempty"`
	Reflection bool   `toml:"reflection"`
}

type LogResult added in v0.14.0

type LogResult struct {
	Files []string
}

type Result

type Result struct {
	Database *DatabaseResult `toml:"database,omitempty"`
	API      *APIResult      `toml:"api,omitempty"`
	GRPC     *GRPCResult     `toml:"grpc,omitempty"`
	Log      *LogResult      `toml:"log,omitempty"`
	Docker   *DockerResult   `toml:"docker,omitempty"`
}

Jump to

Keyboard shortcuts

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