detect

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package detect inspects a directory tree for project signals (go.mod, package.json, …) and reports the stack so @init can pre-tick the right modules.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OnPath

func OnPath(name string) bool

OnPath reports whether an executable is available on PATH. Used by modules to tell which referenced tools are already installed.

Types

type Project

type Project struct {
	Root           string // directory where the project signal was found
	Stack          Stack
	PackageManager string // for Node: pnpm | yarn | bun | npm
	Standardgo     bool   // for Go: standardgo is pinned as a tool dependency
}

Project is the result of detection: the stack plus useful context for module composition (project root, package manager, …).

func Detect

func Detect(dir string) (Project, error)

Detect walks up from dir looking for project signals and returns the first match. If nothing is recognized it returns a Project with StackUnknown rooted at dir. When multiple stacks are present in one directory, Go wins (a deliberate v1 simplification; revisit if it bites), and shell loses to everything — see inspect.

type Stack

type Stack string

Stack identifies a detected project type.

const (
	StackUnknown Stack = ""
	StackGo      Stack = "go"
	StackNode    Stack = "node"
	StackShell   Stack = "shell"
)

Jump to

Keyboard shortcuts

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