Help us shape the future of Go! Take the 2026 Go Developer Survey

projectconfig

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package projectconfig loads and validates Grafo's repository-level configuration without claiming sections owned by other consumers.

Index

Constants

View Source
const FileName = "grafo.yaml"

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	Name   string
	Roots  []ComponentRoot
	Line   int
	Column int
}

Component declares one explicitly named deployable boundary.

type ComponentRoot

type ComponentRoot struct {
	Path   string
	Line   int
	Column int
}

ComponentRoot is a normalized repository-relative ownership root together with the source location that proves the declaration.

type Config

type Config struct {
	Components []Component
	Adapters   calleffect.Registry
	HTTP       HTTP
	SQL        SQL
	Tests      Tests
	Index      IndexScope
	// IndexSeed is the repository's position on adopting a sibling worktree's
	// index when this worktree has none. Nil means unset, so the caller's own
	// default applies.
	IndexSeed       *bool
	UnknownSections map[string][]yaml.Node
}

Config contains Grafo-owned top-level configuration. Unknown top-level sections are deliberately ignored so their owning consumers remain free to interpret them.

func Load

func Load(root string) (Config, error)

Load reads grafo.yaml from root. A missing file is an empty configuration.

func Parse

func Parse(content []byte) (Config, error)

Parse validates Grafo-owned configuration while preserving YAML line and column evidence for component declarations.

type HTTP

type HTTP struct {
	RequestAPIs []HTTPRequestAPI
}

HTTP is the shared, validated outbound-HTTP adapter configuration.

func (HTTP) SemanticKey

func (h HTTP) SemanticKey() string

SemanticKey returns a deterministic digest of only the HTTP-owned subtree.

type HTTPRequestAPI

type HTTPRequestAPI struct {
	Language       string
	Symbol         string
	MethodArgument int
	URLArgument    int
	Line           int
}

HTTPRequestAPI identifies one exact callable and its zero-based method and URL argument positions. URLArgument also represents route_argument, whose spelling is an equivalent configuration alias.

type IndexScope

type IndexScope struct {
	Include []string
	Exclude []string
}

IndexScope is the repository-owned source membership policy. Empty Include means every otherwise eligible file; Exclude always wins.

func (IndexScope) Allows

func (s IndexScope) Allows(candidate string) bool

Allows reports whether a candidate is inside the configured scope. The root control file is always retained so scope changes remain observable.

func (IndexScope) SemanticKey

func (s IndexScope) SemanticKey() string

SemanticKey fingerprints normalized scope independently of YAML ordering.

type SQL

type SQL struct {
	DefaultDialect string
	Paths          []SQLPath
}

SQL is the shared, validated SQL-router configuration.

func (SQL) SemanticKey

func (s SQL) SemanticKey() string

SemanticKey returns a deterministic digest of only the SQL-owned subtree. Changes to components or unknown top-level sections therefore do not force unchanged SQL source files to be reparsed.

type SQLPath

type SQLPath struct {
	Pattern string
	Dialect string
	Line    int
}

SQLPath maps one path pattern to a dialect.

type Tests

type Tests struct {
	GDScriptBases []string
	Invalid       string
}

Tests is the fail-closed repository test-framework configuration. Invalid settings retain one diagnostic and no custom bases, allowing parsers to keep the verified built-in conventions without accepting an unvalidated name.

func (Tests) SemanticKey

func (t Tests) SemanticKey() string

SemanticKey fingerprints only the test-owned subtree. Invalid input is part of the key so fixing grafo.yaml reparses otherwise unchanged scripts.

Jump to

Keyboard shortcuts

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