candywalk

package
v0.2026228.209 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 5 Imported by: 1 module, 1 package

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 candywalk is the SHARED entity-discovery walk over a charly repo: the superproject plus every box/<distro> submodule, reading every candy/ + box/ charly.yml and returning one Entity per top-level node. It is the ONE discovery abstraction (R3) both out-of-process generator plugins use — candy/plugin-docs (the docs site generator) and candy/plugin-marketplace (the harness/marketplace generator) — so the two never fork their own directory conventions.

Discovery is PURE FILESYSTEM walking + os.ReadFile — it never shells out to git, never runs charly commands. "Defined, not default-active": it returns every DEFINED entity (what an author wrote down), never the resolved/enabled set (the resolver's surfaces are wrong for a catalog — `charly box list boxes` resolves through main's import: closure and omits every debian.* and ubuntu.* box). Each repo (the superproject + each checked-out box/<distro> submodule) is walked as its own root and the results unioned; an uninitialised submodule (no charly.yml) is skipped.

The kit carries NO charly import — only the stdlib + yaml.v3. It returns the raw per-node kind discriminator + value node; the caller owns the projection into its own types (the docs plugin decodes `candy:` into its candyView/boxView; the marketplace plugin decodes `skill:`/`hook:`/ `marketplace:` into the generated spec types).

Index

Constants

View Source
const UnifiedFileName = "charly.yml"

UnifiedFileName is the one entity filename (the project rulebook's "one filename charly.yml").

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity

type Entity struct {
	Name      string    // the top-level node name (as authored)
	Namespace string    // "" for the superproject, else the box/<distro> submodule name
	Dir       string    // directory holding this charly.yml, relative to the repo root
	Kind      string    // the node's kind discriminator ("candy", "skill", "hook", "marketplace", …)
	Value     yaml.Node // the kind value body
}

Entity is one top-level node of a discovered charly.yml, regardless of kind. The value node is the node's kind value (the body under `<name>: {<kind>: …}`).

Value is a VALUE yaml.Node, not a pointer: yaml.v3's decode into `map[string]map[string]*yaml.Node` silently drops nested structs when the caller then Decodes the leaf (a plugin-fleet candy's `plugin:` block came back nil), while the value-node decode round-trips faithfully. The value-node form is what the original plugin-docs walk used.

func CollectEntities

func CollectEntities(roots []Root) ([]Entity, error)

CollectEntities reads every entity node across every repo root, for the two discovery directories the loader uses (candy/ and box/). Discovery is by directory convention (candy/<name>/charly.yml, box/<name>/charly.yml) — the same two the loader uses — so the result is exactly what an author has written down.

func ReadEntityFile

func ReadEntityFile(path string, r Root, relDir string) ([]Entity, error)

ReadEntityFile decodes one charly.yml into its top-level nodes. The file is a map of entity NAME to a single kind key (name-first shape); each (name, kind, value) triple is one Entity. A charly.yml that does not fit the name-first shape (a multi-doc bed, a template) is skipped rather than failing the whole discovery.

type Root

type Root struct {
	Namespace string // "" for the superproject, else the box/<distro> submodule name
	Dir       string // absolute path
}

Root is one project tree to walk: the superproject, or a box/<distro> submodule.

func RepoRoots

func RepoRoots(root string) ([]Root, error)

RepoRoots enumerates the superproject plus every box/<distro> submodule that is actually checked out. A submodule with no charly.yml is an uninitialised gitlink — skipped rather than failed, so discovery still runs in a partially-initialised clone.

Jump to

Keyboard shortcuts

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