discover

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func CommandKind(dir, cmd string) string

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.

func Slug

func Slug(s string) string

Slug turns any string into a valid server name.

Types

type Installed

type Installed func(name string) bool

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.

func Scan

func Scan(root string, depth int, skip map[string]bool, has Installed) []Suggestion

Scan walks root up to depth levels deep and returns suggestions sorted by directory. Directories in skip (absolute paths) are left out, and each directory is visited once however many symlinks lead to it.

Jump to

Keyboard shortcuts

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