Moves the codeless build, validation and pack path from cli/internal/bnp into a public bnp package so the CLI and the orchestrator share it. BuildCodelessFS packs from an fs.FS and returns the artifact bytes; the directory form calls it through os.DirFS. Output is byte-identical to the old CLI build. ADR 0009. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
45 lines
2.4 KiB
Markdown
45 lines
2.4 KiB
Markdown
# Codeless artifacts are packed by the SDK
|
|
|
|
Status: accepted (WO-076, 2026-11-19)
|
|
|
|
The orchestrator's website factory compiles a site brief into a codeless site
|
|
plugin and must turn that tree into a `.bnp` inside its own process (orchestrator
|
|
ADR 0063). The code that validates and packs a codeless artifact lived in
|
|
`cli/internal/bnp`, and Go's `internal` rule keeps it out of every other module.
|
|
That code already depended on this module alone, so it moves here and the CLI
|
|
and the orchestrator share one implementation.
|
|
|
|
Decision: a new package `bnp` holds the codeless build path. `BuildCodelessFS`
|
|
takes an `fs.FS` and returns the artifact bytes with a `BuildResult`, so a
|
|
caller can pack a tree held in memory. `BuildCodeless` resolves a directory,
|
|
calls `BuildCodelessFS` with `os.DirFS`, and writes the file. The validation
|
|
and packing pieces the CLI's wasm build also needs are exported over `fs.FS`:
|
|
`ValidateBlocksDir`, `ValidateSeedDir`, `ApplyManifestYAML`, `CollectDir`,
|
|
`PresentationEntries` and `Pack`, together with the artifact member names
|
|
(`FileMod`, `FileManifest`, `DirBlocks`, `DirTemplates`, `DirSeed`,
|
|
`FilePreview`, `DirScreenshots`) and `ScreenshotExtOK`.
|
|
|
|
The move keeps behaviour: the same validation rules, the same error handling
|
|
and the same bytes. The weareblissful site builds to the same sha256 with the
|
|
old CLI and through `BuildCodelessFS`. A symlinked optional directory is still
|
|
skipped, matching the old `filepath.WalkDir` walk. Error text for a missing
|
|
referenced file now names the path relative to the plugin root.
|
|
|
|
The wasm build (compile, DESCRIBE extraction) and `ninja plugin verify` stay in
|
|
the CLI: they need the Go toolchain and wazero at publish time and have one
|
|
consumer.
|
|
|
|
Consequences:
|
|
|
|
- New: `bnp/codeless.go`, `bnp/pack.go`, `bnp/screenshots.go` and their tests.
|
|
- The module now requires `github.com/klauspost/compress` and
|
|
`gopkg.in/yaml.v3`. A plugin that does not import `bnp` compiles none of it.
|
|
- The CLI's `internal/bnp` calls this package (cli ADR 0003) and the
|
|
orchestrator imports it for in-process packing.
|
|
|
|
Keywords: bnp, codeless, BuildCodeless, BuildCodelessFS, fs.FS, os.DirFS,
|
|
ValidateBlocksDir, ValidateSeedDir, ApplyManifestYAML, CollectDir,
|
|
PresentationEntries, Pack, Entry, BuildResult, BuildOptions, manifest.yaml,
|
|
blocks.yaml, seed.json, preview.png, screenshots, tar.zst, zstd, artifact
|
|
packing, byte-identical build, website factory, WO-076, ADR 0063
|