Files
PandeyandGitHub f6b600e4a0 refactor(domain): split material types (#109)
## Summary
- Split material domain into writer-facing `Material` and
traversal-capable `StructuredMaterial` interfaces with concrete
`YAMLMaterial`, `JSONMaterial`, `INIMaterial`, and `BlobMaterial` types.
- Inline INI and YAML format helpers into their respective material
types and remove `format.go` and `ini.go`.
- Rename interface methods for clarity: `Contents` → `JSONContents`,
`WithContents` → `CloneWithJSONContents`, `IsMultiDoc` →
`HasMultipleDocuments`.
- Switch material constructors to `internal/errors` with
`TypeInvalidInput` for parse failures, `TypeInternal` for canonical-JSON
marshaling failures, and `TypeNotFound` for missing traversal paths.
- Add `MustNew{JSON,YAML,INI}Material` constructors and split tests into
per-type `*_material_test.go` files.
- Tighten interface doc comments to follow godoc convention (lead with
identifier, drop pure restatement, document the gjson dotted-key path
syntax).
- Move `ini.PrettyFormat = false` into a package `init()` so the global
is touched once instead of on every `FmtContents` call.
2026-05-01 12:07:26 +05:30

17 lines
918 B
Go

// Package domain contains Foundry's shared domain primitives.
//
// This package is for value objects and pure helpers that are used across
// configuration loading, molding, casting, patching, and writing. Examples
// include structured materials, opaque blob materials, template wrappers,
// addresses, formats, pointer helpers, and serialization helpers.
//
// Keep this package free of orchestration and side effects. It must not decide
// which pipeline phase runs, select deployment implementations, execute tools,
// write files, read user configuration, or contain platform-specific rendering
// behavior. Put that logic in the package that owns the behavior instead.
//
// The only Foundry package this package may import is internal/errors. Do not
// import api/v1alpha1 or any internal orchestration, casting, molding,
// infrastructure, writer, tooler, config, or ledger package from here.
package domain