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

detect

package
v0.52.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package detect provides framework and tooling auto-detection from filesystem signals. It identifies frameworks (Rails, Next.js, etc.), package managers, database adapters, and other project characteristics to generate appropriate configuration templates.

Index

Constants

This section is empty.

Variables

View Source
var EnvFileCandidates = []string{
	".env.local",
	".env.development",
	".env.development.local",
	".env",
	".env.example",
}

EnvFileCandidates is the priority-ordered list of env file names to check.

Functions

This section is empty.

Types

type Result

type Result struct {
	Framework         string // "nextjs", "vite", "rails", "phoenix", "node", "django", "python", "rust", "go", "unknown"
	HasPrisma         bool
	HasJSBundler      bool   // jsbundling-rails/cssbundling-rails or multi-process Procfile.dev
	HasDotenv         bool   // project has dotenv or equivalent wired up
	DBAdapter         string // "postgresql", "sqlite", ""
	DBTemplate        string // static development database name, when detected
	DBTemplateInvalid string // raw value from database.yml that was rejected as a non-identifier

	HasRedis       bool
	HasEnvFile     bool     // true if any env file exists on disk
	EnvFile        string   // best candidate: ".env.local", ".env.development", ".env", etc.
	EnvFiles       []string // all env files found, in priority order
	PackageManager string   // "npm", "yarn", "pnpm", "bundle", "mix", "cargo", "pip", ""
	IsUmbrella     bool     // Phoenix umbrella project (apps/*/mix.exs); not yet fully supported
	MergeTarget    string   // set by caller when git context is available
}

Result contains the detection findings for a project directory. All fields are populated by Detect() based on filesystem analysis.

func Detect

func Detect(root string) *Result

func (*Result) AutoLoadsEnvFile

func (r *Result) AutoLoadsEnvFile() bool

AutoLoadsEnvFile reports whether this framework natively loads .env files without the user needing to install a dotenv library.

func (*Result) DefaultEnvTarget

func (r *Result) DefaultEnvTarget() string

DefaultEnvTarget returns the conventional env file name for a framework.

func (*Result) IsServerFramework

func (r *Result) IsServerFramework() bool

IsServerFramework returns true if the detected framework typically runs a development server (Rails, Node, Django, etc.) as opposed to a CLI or library.

Jump to

Keyboard shortcuts

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