scaffold

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const GxModule = "github.com/alternayte/gx"

GxModule is the import path of the framework.

Variables

View Source
var Kinds = []string{"page", "action", "form", "component", "slice"}

Kinds lists what `gx new` can add.

Functions

func Agents

func Agents(name, adapter string) string

Agents returns the AGENTS.md of a new app with the adapter (REQ-AI-05).

func CheckAdapter

func CheckAdapter(adapter string) error

CheckAdapter reports whether Gx has the adapter (REQ-ACT-09).

func Generate

func Generate(dir string) ([]string, error)

Generate writes the generated Go of the app and returns the files, relative to dir.

func Init

func Init(opt Options) ([]string, error)

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

func New(dir, kind, target string) ([]string, error)

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

func OfficialRegistry(version string) string

OfficialRegistry returns the URL of the official registry of a release.

func UpdateAgents

func UpdateAgents(dir string) (bool, error)

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`.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL