Documentation
¶
Overview ¶
directives.go — the loaderkit-local WALK-only directives: MaxIncludeDepth, namespaceAliasRe, and validateNamespaceAlias. The kind-blind document directives (ImportList/ImportEntry, DiscoverConfig/ScanSpec, anchorScanSpecs, docShape/classifyDoc) relocated to sdk/kit (loader_directives.go + loader_classify.go) so charly core AND sdk/loaderkit share ONE copy (R3) — see kit.ImportList / kit.DiscoverConfig / kit.AnchorScanSpecs / kit.ClassifyDoc.
discover.go — the K1 port of charly/unified.go's discover walk (ApplyDiscover / applyDiscoveredManifest): scans each `discover:` spec for directories carrying its manifest (via the shared kit.FindEntityDirs primitive) and PARSES every document each discovered manifest contains into a spec.DiscoveredManifest. Faithful port, MINUS the host-only candy-image lazy-ref registration + normalizeNodeInto fold (materialize — the registry-coupled kind-decode the host keeps, boundary law) — this file only WALKS + PARSES, exactly like the rest of loaderkit.
Package loaderkit is the importable form of charly's unified-config PARSE — the parse half of LoadUnified relocated out of charly core (P6). It decomposes one node-form YAML document into the generic, sdk-expressible spec.ParsedProject the host MATERIALIZES into the typed *UnifiedFile. Shared by the loader plugin candy (candy/plugin-loader, its OpLoad) and, during the transition, by charly core — the SAME parse, one copy (R3), the way sdk/kit is the one copy of the check walk.
The parse consults ONLY spec vocabulary (CUE-sourced) + yaml + host-threaded kind-recognition DATA (Threaded) — never the provider registry directly. The registry is core fabric; the host snapshots which words it recognizes (kinds / deploy substrates / structural / scalar-sugar primaries) into Threaded before the parse, and the re-entrant connect-then-reload re-parses with an updated snapshot. That keeps the parse a kind-blind mechanism (boundary law clause D).
walk.go — the K1 port of charly's unified-config loader ORCHESTRATION: the kind-blind WALK+PARSE half of LoadUnified (charly/unified.go) relocated out of charly core. Walk drives the import queue + discover + namespaced-import mounts and PARSES every document (via the existing loaderkit.ParseDoc, P6) into a generic spec.LoadedProject envelope — it does NO materialize (registry kind-decode) and NO merge (root-wins field folding) into a typed *UnifiedFile; the host replays materialize+merge over the returned spec.LoadedProject to reconstruct that, exactly as it did inline before.
Everything registry-coupled or host-coupled (the parse pre-scan + connect-declared-kind-plugins side effects, the #NodeDoc CUE validate-before-execute gate, remote-ref resolution + the project-repo cache, and the repo-identity cycle-break) is a SEAM CALLBACK the host supplies via WalkSeams — Walk itself calls the seam and never does the coupled work directly (boundary law clause D: Walk consults host-threaded DATA, never the provider registry).
Faithful-port mapping (see charly/unified.go + charly/ns_identity.go):
LoadUnified (the walk portion only) → Walk loadUnifiedInto → (*walker).walkFile mergeUnifiedDocs (the parse portion) → (*walker).parseDocs (materialize/mergeUnified excluded) loadNamespaceCached → (*walker).walkNamespace the per-project "load + discover" body → (*walker).walkProject ApplyDiscover/… → discover.go
The kind-blind document DIRECTIVES (kit.ImportList/kit.DiscoverConfig/kit.ClassifyDoc/ kit.FindEntityDirs/…) live in sdk/kit (loader_directives.go/loader_classify.go/ loader_discover.go), shared with charly core (R3) — this package keeps only its own walk-scoped namespace-alias validation (directives.go).
Index ¶
Constants ¶
const MaxIncludeDepth = 8
MaxIncludeDepth caps recursive include resolution. A cycle or excessive depth raises a clear error with the offending file path.
Variables ¶
This section is empty.
Functions ¶
func ParseDoc ¶
func ParseDoc(doc *yaml.Node, t spec.Threaded) (directives map[string]*yaml.Node, pp spec.ParsedProject, err error)
ParseDoc decomposes a node-form document mapping into its reserved directives + the generic spec.ParsedProject (its top-level entity nodes, each with the opaque JSON body the host materializes). Faithful port of core's parseNodeTree + genericNodeToParsed.
func Walk ¶ added in v0.2026194.1400
func Walk(rootDir string, rootData []byte, rootIdentity string, seams WalkSeams) (spec.LoadedProject, error)
Walk walks a project rooted at rootDir and returns its kind-blind parse envelope. rootData is the (possibly bootstrap-transformed) bytes of the root charly.yml — used for the root file instead of re-reading; pass nil for a namespace child (read from disk). rootIdentity is the root project's own repo identity (the host's rootRepoIdentity), seeded into the cycle-break so a transitive self-import resolves to the in-progress root — mirrors LoadUnified seeding loadingRepos[rootRepoIdentity(dir)] = merged BEFORE the walk starts.
Types ¶
type WalkSeams ¶ added in v0.2026194.1400
type WalkSeams struct {
// Parser is the per-document parse (the host passes the registered spec.DocParser).
Parser spec.DocParser
// Boundary runs at each PROJECT boundary (the root file AND each namespace root — i.e. every
// depth-0 walkFile) BEFORE that boundary's documents parse: the host does the parse pre-scan +
// connect-declared-kind-plugins side effects (registry mutation). data = the boundary file bytes.
Boundary func(dir string, data []byte) error
// Threaded returns the current registry-derived kind-recognition snapshot. Called fresh per
// document parse (the host's loaderThreaded()).
Threaded func() spec.Threaded
// ResolveRef resolves an import ref (local path OR remote "@host/org/repo[/sub]:ver") to a
// stable cache KEY + a concrete on-disk PATH. The host owns remote fetch + cache + auto-migration.
ResolveRef func(ref, baseDir string) (key, path string, err error)
// GateDoc runs the host #NodeDoc CUE validate-before-execute gate on one raw document's bytes.
GateDoc func(label string, raw []byte) error
// RepoIdentity returns the canonical repo identity of an import ref (for the cycle-break), or ""
// (the host's nsRepoIdentity). Empty → version-keyed fallback.
RepoIdentity func(ref, baseDir string) string
}
WalkSeams is the set of host-supplied callbacks Walk needs for everything registry-coupled or host-coupled. Walk calls each seam; it never does the coupled work itself (boundary law clause D — Walk consults host-threaded DATA/mechanisms, never the provider registry directly).