Documentation
¶
Overview ¶
Package roots loads and represents the Taskfile graphs for one or more workspace roots. It is the single owner of the *Root value type and contains all URI canonicalisation and Taskfile graph parsing helpers.
This package must not import the MCP SDK; it is consumed by the server package, which adapts roots.Root values into MCP state.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalRootURI ¶
CanonicalRootURI resolves a client-provided local file URI to the canonical absolute file URI we use as the server's internal root identity. Equivalent aliases such as file:///repo and file://localhost/repo collapse to the same canonical URI and directory.
Types ¶
type Root ¶
type Root struct {
Taskfile *ast.Taskfile
Workdir string
WatchDirs []string
WatchTaskfiles map[string]struct{}
}
Root holds the loaded per-root Taskfile data. Once a *Root is published to a consumer (e.g. a server's roots map) its fields are treated as read-only; mutations are performed by replacing the pointer rather than writing through the existing value, so concurrent readers (snapshots, watchers) always observe a consistent state. *Root values therefore must NOT be mutated by code outside of construction sites in this package.
The fields are exported because reconcile, tool planning, and watcher code lives in other packages and needs to read them. They are still considered immutable after construction.
func Build ¶
Build resolves the Taskfile graph for workdir, sets up a task executor, and returns a fully populated *Root. workdir must already be an absolute path.
func NewUnloaded ¶
NewUnloaded creates a root placeholder for a workspace that does not yet have a loadable root Taskfile. Watching the root directory lets callers pick up a Taskfile that is created or fixed after startup.