Documentation
¶
Overview ¶
Package generate scaffolds Puzzle source files — components, views, layouts, and models — from frozen-grammar stub templates (constellation/doc/DOC-SPEC.md §6, §7, §11). It never parses or rewrites JavaScript (decision D3): the model registry (app/models/index.js) is left untouched and the caller prints a hint instead. All generated .pzl output is exercised by the repo's own parser+codegen in generate_test.go, so a scaffold is guaranteed to compile.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindProjectRoot ¶
FindProjectRoot walks up from start (inclusive) until it finds a directory holding package.json or puzzle.config.js, stopping at the filesystem root.
Types ¶
type Options ¶
type Options struct {
// Root is the project root (holds package.json / puzzle.config.js).
Root string
// Kind is the file type to generate.
Kind Kind
// Name is the component/view/layout PascalCase name, or the lower-case
// singular model name.
Name string
// Dir overrides the output directory, relative to Root. Empty uses the
// per-kind default.
Dir string
// Force allows overwriting an existing file.
Force bool
}
Options describe one scaffold request.
type Result ¶
type Result struct {
// Path is the absolute path of the written file.
Path string
// Rel is Path relative to the project root (for display).
Rel string
// Hint is a non-empty, multi-line instruction when the user must take a
// manual follow-up step (model registration); empty otherwise.
Hint string
}
Result reports what Generate produced.