Documentation
¶
Overview ¶
Package project detects project types (Go, Node, Python) and their associated dev server commands. It scans for lock files, config files, and conventions to determine the project type and available scripts.
Key types:
- Project: detected project with type, root path, and commands
- ProjectType: enum (GoProject, NodeProject, PythonProject)
- CommandDef: a runnable command with label and command string
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCommandNames ¶
GetCommandNames returns all command names for a project.
func GetScriptCommand ¶ added in v0.8.0
GetScriptCommand returns the command string for a named script from package.json. Returns empty string if not found.
func HasCommand ¶
HasCommand checks if a project has a command with the given name.
Types ¶
type CommandDef ¶
type CommandDef struct {
// Name is the command identifier (e.g., "test", "lint", "build").
Name string `json:"name"`
// Description is a human-readable description.
Description string `json:"description"`
// Command is the executable to run.
Command string `json:"command"`
// Args are the default arguments.
Args []string `json:"args,omitempty"`
// Timeout is the default timeout in seconds (0 = no timeout).
Timeout int `json:"timeout,omitempty"`
// Persistent indicates this is a long-running process (dev server).
Persistent bool `json:"persistent,omitempty"`
}
CommandDef defines a runnable command for a project.
func DefaultGoCommands ¶
func DefaultGoCommands() []CommandDef
DefaultGoCommands returns the default commands for a Go project.
func DefaultNodeCommands ¶
func DefaultNodeCommands(packageManager string) []CommandDef
DefaultNodeCommands returns the default commands for a Node.js project.
func DefaultPythonCommands ¶
func DefaultPythonCommands() []CommandDef
DefaultPythonCommands returns the default commands for a Python project.
func DefaultWailsCommands ¶ added in v0.11.1
func DefaultWailsCommands() []CommandDef
DefaultWailsCommands returns the default commands for a Wails (Go desktop) project.
func GetCommandByName ¶
func GetCommandByName(proj *Project, name string) *CommandDef
GetCommandByName finds a command by name in a project.
type Project ¶
type Project struct {
// Path is the absolute path to the project root.
Path string `json:"path"`
// Type is the detected project type.
Type ProjectType `json:"type"`
// Name is the project name (from config files or directory name).
Name string `json:"name"`
// Commands are the available commands for this project.
Commands []CommandDef `json:"commands"`
// PackageManager is the detected package manager (for Node.js).
PackageManager string `json:"package_manager,omitempty"`
// Metadata holds additional project-specific info.
Metadata map[string]string `json:"metadata,omitempty"`
}
Project represents a detected development project.
type ProjectType ¶
type ProjectType string
ProjectType identifies the kind of project.
const ( // ProjectGo is a Go project (go.mod). ProjectGo ProjectType = "go" // ProjectNode is a Node.js project (package.json). ProjectNode ProjectType = "node" // ProjectPython is a Python project (pyproject.toml, setup.py, requirements.txt). ProjectPython ProjectType = "python" // ProjectUnknown is an unrecognized project type. ProjectUnknown ProjectType = "unknown" )