scaffold

package
v0.84.2 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package scaffold composes functional workflow scaffolds via Assembly Grammar.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyResult added in v0.83.1

type ApplyResult struct {
	Modules   []config.ModuleConfig
	Workflows map[string]any
	GlueGaps  []string
}

ApplyResult is the Category-A wire output: the (possibly extended) module list, the emitted workflows.<class> sections (entry-point + routes), and any glue-gaps (unselected Attaches.To targets) surfaced as NEXT_STEPS data.

func GrammarWire added in v0.83.1

func GrammarWire(mods []config.ModuleConfig, g MergedGrammar, reg *schema.ModuleSchemaRegistry, alwaysSelect []string) ApplyResult

GrammarWire applies Category-A Assembly Grammar to mods (D16/D17/D18/D22/D23, + P2/P6/P8 fixes):

  • Requires (by type): ensure-selected (visited-set transitive closure) + DependsOn.
  • RouteMiddlewares (by TYPE — P8): materialize an instance (named defaultName(mwt)) so the runtime GetService resolves consistently with the emitted route reference.
  • AlwaysSelect (P2): entry-point-class-declared types always materialized (e.g. http.router + health.checker for the http class, for v0.82.0 parity).
  • ensure-selected materializes WITH DefaultConfig from reg (P6).
  • Attaches.To: DependsOn + entry-point section; unselected (real type) → glue-gap; phantom → already rejected at MergeGrammar (D23).
  • Fragment: emit the route block with RouteMiddlewares-as-defaultNames (D4 crud-route).

reg is the engine ModuleSchemaRegistry (for DefaultConfig + type lookups); g is the MergeGrammar output. The function does not append to res.Modules after Pass A, so pointers indexed post-Pass-A stay valid through Pass B (⊥ storing pointers into a slice that is still being appended to — retro #1 dangling-pointer class).

type MergedGrammar

type MergedGrammar map[string]schema.GrammarDecl

MergedGrammar is the per-module-type resolved grammar (engine ∪ plugins).

func MergeGrammar

MergeGrammar merges engine ModuleSchemaRegistry grammar ∪ plugin Provider.Grammar. Order: engine-first, then plugins by (provider-name, module-type). Conflict policy (D2/D16/D17/D22/D23):

  • scalar-field conflict = error (per-field across structs); list-field = union;
  • engine wins for engine-registered types (D25);
  • phantom Attaches/Requires target = load-error (D23);
  • circular Requires = error (D17, via Tarjan SCC).

Returns the merged grammar + the sorted, de-duplicated union of Category-B RuntimeHooks (for NEXT_STEPS documentation, D3).

Jump to

Keyboard shortcuts

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