modgen

package module
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 5 Imported by: 1 module, 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.

README

modgen

AI module generator: validated Tier 1 Go module projects (go.mod + module.go + README.md plus domain/api/store/admin overlays) from a natural-language brief, powered by an OpenAI-compatible API. Generated projects pass the module-contract gate (slug grammar, file allowlist, Go parse, kernel.Module lifecycle shape, layer import policy, httpx envelope rule, migration hygiene) plus a generated-content scan; failures feed a bounded two-attempt repair loop over the original readable output before the project is refused. Staged projects are inert source under modules-gen/: Tier 1 modules link at compile time, so there is no runtime install — the download ships an INSTALL.md with the custom-edition wiring and rebuild steps.

  • domain/ — brief/project types, validation (slug grammar, file allowlist, size caps, surface vocabulary), envelope parser, orchestration service with the repair loop, validator.
  • infrastructure/ — OpenAI-compatible client + per-call grounded prompts (distilled module contract, host kernel pin).
  • store/ — filesystem store under modules-gen/ with project.json manifests and stdlib zips.
  • api/ — browser handler: generate, apply, unapply, list, download, delete.
  • admin/ — admin-shell manifest (Module Generator + Modules nav).

Documentation

Overview

Package modgen is the official AI module module: the generator over OpenAI-compatible APIs, the filesystem store, and the browser handler.

Index

Constants

View Source
const Name = "modgen"

Name is the registry key for this module.

View Source
const Version = "0.1.0"

Version is the module version reported via Module.Version.

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module is the modgen kernel module.

func New

func New(opts ...Option) *Module

New builds the module, adopting the composition root's wiring. The handler is built once here so routes serve the same instance.

func (*Module) AdminManifest

func (m *Module) AdminManifest() kernel.AdminExtensionManifest

AdminManifest declares this module's admin-shell extensions.

func (*Module) Handler

func (m *Module) Handler() *api.ModuleGenHandler

Handler exposes the module generator handler for core mounting. Core mounts it explicitly (rather than via RouteProvider) because the surface is gated by the modGenEnabled feature flag, which a single RegisterRoutes call cannot express.

func (*Module) Init

func (m *Module) Init(_ kernel.Kernel) error

Init wires the module. The handler is already built by New; Init only validates presence.

func (*Module) Name

func (m *Module) Name() string

Name returns the registry key.

func (*Module) Optional

func (m *Module) Optional() []string

Optional lists soft dependencies.

func (*Module) Requires

func (m *Module) Requires() []string

Requires lists hard dependencies. Generation degrades without module sources, so nothing is required.

func (*Module) Service

func (m *Module) Service() *modgendomain.Service

Service exposes the orchestration service. It stays valid for the module's lifetime.

func (*Module) Shutdown

func (m *Module) Shutdown() error

Shutdown releases module resources. There are none beyond memory.

func (*Module) Version

func (m *Module) Version() string

Version returns the module version.

type Option

type Option func(*Module)

Option configures a Module. The composition root supplies every option; direct construction without options yields a standalone module that serves nothing (the handler built over nil dependencies must not be invoked).

func WithApplyTimeout

func WithApplyTimeout(timeout time.Duration) Option

WithApplyTimeout sets the server-side apply request budget. Non-positive selects the handler default.

func WithLogger

func WithLogger(logger kernel.Logger) Option

WithLogger attaches the module logger. Without one handler failures are dropped (discard sink).

func WithService

func WithService(service *modgendomain.Service) Option

WithService adopts the orchestration service (composition root, nil when unconfigured). The handler is only mounted when generation is enabled.

Directories

Path Synopsis
Package admin owns this module's admin-shell manifest: the declarative UI the single admin SPA renders for module generation.
Package admin owns this module's admin-shell manifest: the declarative UI the single admin SPA renders for module generation.
Package modgen is the AI module generator module's domain layer: the brief, project, and validation value types, the generation/store ports, the envelope parser, and the Go/module-contract validator.
Package modgen is the AI module generator module's domain layer: the brief, project, and validation value types, the generation/store ports, the envelope parser, and the Go/module-contract validator.
Package infrastructure adapts the modgen domain port onto OpenAI-compatible chat-completion APIs.
Package infrastructure adapts the modgen domain port onto OpenAI-compatible chat-completion APIs.
Package store persists generated module projects on disk: one directory per project under modules-gen, a project.json metadata file, and stdlib zip archives for download.
Package store persists generated module projects on disk: one directory per project under modules-gen, a project.json metadata file, and stdlib zip archives for download.

Jump to

Keyboard shortcuts

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