discovery

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStaleGlobalConfig = errors.New("stale global config entry")

ErrStaleGlobalConfig indicates the global config references a project path but the kan data directory doesn't exist. This can happen if the user manually deletes the .kan/ directory.

Functions

This section is empty.

Types

type Result

type Result struct {
	ProjectRoot   string // Absolute path to project root
	DataLocation  string // Relative path for kan data (empty = default .kan/)
	WasRegistered bool   // Whether this project was found in global config
}

Result contains the discovered project root and data location.

func DiscoverProject

func DiscoverProject(globalCfg *model.GlobalConfig) (*Result, error)

DiscoverProject finds the project root by walking up from cwd. Priority: 1. Directory that's a key in global config -> use configured DataLocation 2. Directory containing .kan/ -> use as self-discoverable default

Returns nil if no project found (not initialized). Returns error if global config references a path but data is missing.

func DiscoverProjectFrom

func DiscoverProjectFrom(startDir string, globalCfg *model.GlobalConfig) (*Result, error)

DiscoverProjectFrom finds the project root starting from a given directory.

Jump to

Keyboard shortcuts

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