Documentation
¶
Overview ¶
Package workspace provides workspace detection and management.
Index ¶
- Constants
- Variables
- func Find(startDir string) (string, error)
- func FindFromCwd() (string, error)
- func FindFromCwdOrError() (string, error)
- func FindOrError(startDir string) (string, error)
- func GetTownName(townRoot string) (string, error)
- func GetTownNameFromCwd() (string, error)
- func IsWorkspace(dir string) (bool, error)
- func MustGetTownName(townRoot string) string
Constants ¶
const ( // PrimaryMarker is the main config file that identifies a workspace. // The town.json file lives in mayor/ along with other mayor config. PrimaryMarker = "mayor/town.json" // SecondaryMarker is an alternative indicator at the town level. // Note: This can match rig-level mayors too, so we continue searching // upward after finding this to look for primary markers. SecondaryMarker = "mayor" )
Markers used to detect a Gas Town workspace.
Variables ¶
var ErrNotFound = errors.New("not in a Gas Town workspace")
ErrNotFound indicates no workspace was found.
Functions ¶
func Find ¶
Find locates the town root by walking up from the given directory. It prefers mayor/town.json over mayor/ directory as workspace marker. When in a worktree path (polecats/ or crew/), continues to outermost workspace. Does not resolve symlinks to stay consistent with os.Getwd().
func FindFromCwd ¶
FindFromCwd locates the town root from the current working directory.
func FindFromCwdOrError ¶
FindFromCwdOrError is like FindFromCwd but returns an error if not found.
func FindOrError ¶
FindOrError is like Find but returns a user-friendly error if not found.
func GetTownName ¶
GetTownName loads the town name from the workspace's town.json config. This is used for generating unique tmux session names that avoid collisions when running multiple Gas Town instances.
func GetTownNameFromCwd ¶
GetTownNameFromCwd locates the town root from the current working directory and returns the town name from its configuration.
func IsWorkspace ¶
IsWorkspace checks if the given directory is a Gas Town workspace root. A directory is a workspace if it has a primary marker (mayor/town.json) or a secondary marker (mayor/ directory).
func MustGetTownName ¶
MustGetTownName returns the town name or panics if it cannot be loaded. Use sparingly - prefer GetTownName with proper error handling.
Types ¶
This section is empty.