Documentation
¶
Overview ¶
Package scaffold writes new Gx apps and new typed code into an app (REQ-DEV-10): `gx init`, `gx new` and the managed section of AGENTS.md (REQ-AI-05).
Index ¶
- Constants
- Variables
- func Agents(name, adapter string) string
- func CheckAdapter(adapter string) error
- func Generate(dir string) ([]string, error)
- func Init(opt Options) ([]string, error)
- func New(dir, kind, target string) ([]string, error)
- func OfficialRegistry(version string) string
- func UpdateAgents(dir string) (bool, error)
- type Options
Constants ¶
const GxModule = "github.com/alternayte/gx"
GxModule is the import path of the framework.
Variables ¶
var Kinds = []string{"page", "action", "form", "component", "slice"}
Kinds lists what `gx new` can add.
Functions ¶
func CheckAdapter ¶
CheckAdapter reports whether Gx has the adapter (REQ-ACT-09).
func Init ¶
Init writes a new app and returns the files it wrote, relative to the app directory (REQ-DEV-10). It refuses a directory that already holds an app.
func New ¶
New adds typed code to the app in dir (REQ-DEV-10) and returns the files it wrote or changed, relative to dir. The target of a page, an action or a form is "<slice>/<Name>"; of a component "<dir>/<Name>"; of a slice its package name.
func OfficialRegistry ¶
OfficialRegistry returns the URL of the official registry of a release.
func UpdateAgents ¶
UpdateAgents rewrites the managed section of AGENTS.md in dir and leaves every other byte alone (REQ-AI-05). It reports whether the file changed. A file with no managed section gets one at its end, and a missing file is written new.
Types ¶
type Options ¶
type Options struct {
// Dir is the directory of the new app. It may exist when it holds no
// app.
Dir string
// Module is the Go module path. It defaults to the directory name.
Module string
// Adapter is the hypermedia adapter: "datastar" or "htmx".
Adapter string
// Version is the Gx release the app requires, without the "v".
Version string
// Replace points the Gx module at a local checkout, for work on Gx
// itself.
Replace string
// Registry is the component registry URL or directory in gx.toml. It
// defaults to the official registry of Version.
Registry string
// Template is "app" (the default) or "docs": a docs site with the
// docs shell and the docs kit of the registry (REQ-CNT-06).
Template string
}
Options configure `gx init`.