Documentation
¶
Overview ¶
Package discover finds projects that look like they have a dev server and proposes a command for each, so adding a server rarely means typing one.
Detection is conservative, because a wrong suggestion is worse than none: a suggestion gets an automatic port only when its command is known to listen on {PORT} or $PORT, and a project kind is proposed only on clear evidence. Node and Deno scripts live in node.go, JavaScript workspace roots in workspace.go, Python in python.go, other ecosystems and Compose in backends.go. Names taken from the project (folders, scripts) enter a generated command only when they are plain words.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommandKind ¶ added in v0.4.2
CommandKind names the tool a server command in dir starts, following package scripts the way detection does, so the dashboard can show how to bind that tool to 127.0.0.1: "compose", "vite", "next", "astro", "nuxt", "nuxt2", "remix" and "react-router" (their Vite dev servers), "remix-serve" (remix-serve, react-router-serve and the classic remix dev, which read HOST), "node" (a script run by node, tsx, bun and similar, or Nest), "go", "rails", "phoenix", "uvicorn", "fastapi", "flask", "django", "gunicorn", "hypercorn" and "http.server". It returns "" for any other command.
Types ¶
type Installed ¶
Installed reports whether a command is on the PATH that servers get (the login shell's, not necessarily the caller's), for proposals that depend on a tool such as uv.
type Suggestion ¶
type Suggestion struct {
Name string `json:"name"`
Dir string `json:"dir"`
Cmd string `json:"cmd"`
Kind string `json:"kind"` // e.g. "next", "vite", "compose"
Port int `json:"port,omitempty"`
NoPort bool `json:"noPort,omitempty"`
StopAfter string `json:"stopTimeout,omitempty"`
DirectoryConfigured bool `json:"directoryConfigured,omitempty"`
}
Suggestion is a proposed server definition.
func Prepare ¶
func Prepare(cfg *config.Config, found []Suggestion) []Suggestion
Prepare removes configured commands, marks shared directories and assigns unique names and automatic ports, checking the roster and live listeners.