layout

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 7 Imported by: ? 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 layout defines the PDLC layout contract: where every product-definition artifact belongs in a project repository, how to recognize a misplaced one, and what each project profile requires.

Go types are the source of truth; JSON Schema is generated from them.

Index

Constants

This section is empty.

Variables

Profiles lists the built-in profiles in increasing breadth.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	// ID uniquely identifies the artifact kind.
	ID string `json:"id" yaml:"id" jsonschema:"required"`

	// Domain is the evaluation domain this artifact belongs to.
	Domain string `json:"domain" yaml:"domain" jsonschema:"required"`

	// Canonical is the repository-relative path where the artifact belongs.
	Canonical string `json:"canonical" yaml:"canonical" jsonschema:"required"`

	// Authority is how binding the artifact is after handoff.
	Authority Authority `json:"authority" yaml:"authority"`

	// Profiles sets the requirement level per profile.
	Profiles map[Profile]Level `json:"profiles" yaml:"profiles"`

	// Detect holds heuristics for recognizing a misplaced instance.
	Detect Detect `json:"detect,omitempty" yaml:"detect,omitempty"`
}

Artifact is one kind of product-definition artifact.

func (Artifact) LevelFor

func (a Artifact) LevelFor(p Profile) Level

LevelFor returns the requirement level of the artifact under profile. Unlisted profiles default to LevelOptional.

type Authority

type Authority string

Authority is how binding an artifact is on the builder after handoff.

const (
	// AuthorityNormative is a binding requirement.
	AuthorityNormative Authority = "normative"

	// AuthorityInformative is context and rationale.
	AuthorityInformative Authority = "informative"

	// AuthorityAdvisory is a recommended approach the builder may replace.
	AuthorityAdvisory Authority = "advisory"

	// AuthorityEvidence is machine-written proof, not a requirement.
	AuthorityEvidence Authority = "evidence"
)

func (Authority) Valid

func (a Authority) Valid() bool

Valid reports whether a is a known authority.

type Confidence

type Confidence string

Confidence expresses how strongly an inventory entry matched an artifact kind.

const (
	// ConfidenceHigh comes from an exact filename match or an already-canonical path.
	ConfidenceHigh Confidence = "high"

	// ConfidenceMedium comes from a directory-name or content match.
	ConfidenceMedium Confidence = "medium"

	// ConfidenceLow means the match is a guess and needs human confirmation.
	ConfidenceLow Confidence = "low"
)

type Detect

type Detect struct {
	// Filenames are base names that identify the artifact (case-insensitive).
	Filenames []string `json:"filenames,omitempty" yaml:"filenames,omitempty"`

	// Dirnames are directory base names that identify the artifact.
	Dirnames []string `json:"dirnames,omitempty" yaml:"dirnames,omitempty"`

	// Content are substrings whose presence identifies the artifact.
	Content []string `json:"content,omitempty" yaml:"content,omitempty"`

	// Under restricts matches to paths containing one of these segments.
	Under []string `json:"under,omitempty" yaml:"under,omitempty"`

	// NotUnder rejects matches under any of these segments.
	NotUnder []string `json:"notUnder,omitempty" yaml:"not_under,omitempty"`
}

Detect holds heuristics for classifying an existing file or directory as an artifact kind. Rules are additive: any match proposes the artifact, while Under and NotUnder constrain where a match is credible.

func (Detect) Empty

func (d Detect) Empty() bool

Empty reports whether no detection heuristics are configured.

type Domain

type Domain struct {
	// ID is the domain identifier, used as the readiness category name.
	ID string `json:"id" yaml:"id" jsonschema:"required"`

	// Title is the human-readable name.
	Title string `json:"title,omitempty" yaml:"title,omitempty"`

	// QualityOnly marks a domain that has no canonical artifacts and exists
	// only as an evaluation (for example accessibility or consistency).
	QualityOnly bool `json:"qualityOnly,omitempty" yaml:"qualityOnly,omitempty"`

	// LeafReports are repository-relative paths holding this domain's
	// tool-produced evaluation evidence.
	LeafReports []string `json:"leafReports,omitempty" yaml:"leafReports,omitempty"`

	// Profiles sets the requirement level per profile. Used for quality-only
	// domains; artifact-backed domains derive their level from artifacts.
	Profiles map[Profile]Level `json:"profiles,omitempty" yaml:"profiles,omitempty"`
}

Domain groups artifacts into an evaluation category.

func (Domain) LevelFor

func (d Domain) LevelFor(p Profile) Level

LevelFor returns the requirement level of the domain under profile. Unlisted profiles default to LevelOptional.

type Entry

type Entry struct {
	// Path is the repository-relative path found on disk.
	Path string `json:"path"`

	// ArtifactID is the matched artifact kind, empty when unclassified.
	ArtifactID string `json:"artifactId,omitempty"`

	// Canonical is where the artifact belongs, empty when unclassified.
	Canonical string `json:"canonical,omitempty"`

	// Confidence is the strength of the classification.
	Confidence Confidence `json:"confidence,omitempty"`

	// Conformant reports whether Path is already at its canonical location.
	Conformant bool `json:"conformant"`

	// Reason explains why the classification matched.
	Reason string `json:"reason,omitempty"`

	// Alternatives are other artifact kinds that also matched. A non-empty
	// list means the classification is ambiguous and needs human resolution.
	Alternatives []string `json:"alternatives,omitempty"`

	// Conflicts are other paths that classified to the same canonical
	// location. Only one file can occupy a canonical path, so a conflict
	// always requires a human to choose.
	Conflicts []string `json:"conflicts,omitempty"`
}

Entry is one classified path in a project repository.

func (Entry) Ambiguous

func (e Entry) Ambiguous() bool

Ambiguous reports whether the entry needs human resolution before it can be moved, because it matched several artifact kinds, matched only weakly, or contests a canonical path with another file.

func (Entry) NeedsMove

func (e Entry) NeedsMove() bool

NeedsMove reports whether the entry can be moved without human input: it is classified, misplaced, confidently matched, and uncontested. Weak or contested matches are reported as ambiguities instead, so a move plan never acts on a guess.

type Inventory

type Inventory struct {
	// Root is the absolute path of the scanned repository.
	Root string `json:"root"`

	// Entries are the classified paths, sorted by path.
	Entries []Entry `json:"entries"`
}

Inventory is the classification of a project repository.

func (Inventory) Ambiguities

func (inv Inventory) Ambiguities() []Entry

Ambiguities returns entries a human must decide between: those matching more than one artifact kind, or contesting a canonical path with another file.

func (Inventory) Found

func (inv Inventory) Found(artifactID string) (Entry, bool)

Found reports whether any entry was classified as the given artifact kind.

func (Inventory) Moves

func (inv Inventory) Moves() []Entry

Moves returns the entries that are classified but not at their canonical path.

func (Inventory) Possibles

func (inv Inventory) Possibles() []Entry

Possibles returns entries matched only by weak evidence, such as a content signature in a file whose name suggests nothing. They are worth a look during adoption but are never proposed as moves.

type Level

type Level string

Level is how strongly a profile expects an artifact or domain.

const (
	// LevelRequired means a stage gate fails when the artifact is absent.
	LevelRequired Level = "required"

	// LevelRecommended means the gate reports absence but does not fail.
	LevelRecommended Level = "recommended"

	// LevelOptional means the artifact is evaluated only when present.
	LevelOptional Level = "optional"

	// LevelExcluded means the domain is out of scope; it is reported as
	// excluded rather than as a failure.
	LevelExcluded Level = "excluded"
)

func ApplyOverride

func ApplyOverride(base, override Level) Level

ApplyOverride combines a profile-derived level with a project override.

An override of excluded removes the artifact from scope. An override of required promotes anything still in scope. A weaker override demotes, so a project can keep a domain in scope without letting it block a gate. An artifact excluded by the profile stays excluded: an override adjusts emphasis, it does not introduce artifacts the profile does not define.

func (Level) Rank

func (l Level) Rank() int

Rank orders levels by strength, so they can be compared and combined.

func (Level) Valid

func (l Level) Valid() bool

Valid reports whether l is a known level.

type Manifest

type Manifest struct {
	// APIVersion identifies the contract version.
	APIVersion string `json:"apiVersion" yaml:"apiVersion" jsonschema:"required"`

	// Kind is always "LayoutManifest".
	Kind string `json:"kind" yaml:"kind" jsonschema:"required"`

	// Version is the manifest revision.
	Version int `json:"version" yaml:"version"`

	// Immovable lists repository-relative directories that must never be
	// moved, reorganized, or written to. These are tool-native contracts
	// (AWS AI-DLC, Spec Kit, VisionSpec working state) plus machine-written
	// projections.
	Immovable []string `json:"immovable" yaml:"immovable"`

	// Ignore lists directory base names that never hold a project's own
	// product artifacts, such as templates, examples, and test fixtures.
	// Classification skips them entirely.
	Ignore []string `json:"ignore,omitempty" yaml:"ignore,omitempty"`

	// Domains are the evaluation groupings. The readiness report emits one
	// category per non-excluded domain.
	Domains []Domain `json:"domains" yaml:"domains"`

	// Artifacts are the artifact kinds with their canonical locations.
	Artifacts []Artifact `json:"artifacts" yaml:"artifacts"`
}

Manifest is the complete layout contract.

func (*Manifest) Artifact

func (m *Manifest) Artifact(id string) (Artifact, bool)

Artifact returns the artifact with the given ID.

func (*Manifest) ArtifactsInDomain

func (m *Manifest) ArtifactsInDomain(id string) []Artifact

ArtifactsInDomain returns every artifact belonging to domain id.

func (*Manifest) Classify

func (m *Manifest) Classify(root string) (Inventory, error)

Classify walks root and classifies every file and directory against the manifest's artifact kinds. Immovable directories are skipped entirely, so their contents can never appear in a move plan.

func (*Manifest) Domain

func (m *Manifest) Domain(id string) (Domain, bool)

Domain returns the domain with the given ID.

func (*Manifest) IsIgnored

func (m *Manifest) IsIgnored(relPath string) bool

IsIgnored reports whether any segment of the repository-relative path is an ignored directory name, meaning the path cannot hold a product artifact.

func (*Manifest) IsImmovable

func (m *Manifest) IsImmovable(relPath string) bool

IsImmovable reports whether the repository-relative path lies within a directory that must never be moved or written to.

func (*Manifest) Validate

func (m *Manifest) Validate() error

Validate checks the manifest for internal consistency. It reports every problem found rather than stopping at the first.

type Profile

type Profile string

Profile names the breadth of product-definition work a project carries. The layout contract is identical at every profile; profiles select which domains are in scope.

const (
	// ProfileMinimal is specs, API, and baseline only.
	ProfileMinimal Profile = "minimal"

	// ProfileStandard adds prototype, guides, and descriptive requirements.
	ProfileStandard Profile = "standard"

	// ProfileFull is the reference practice: every domain including
	// localization, personas, and narrative artifacts.
	ProfileFull Profile = "full"

	// ProfileCustom relies entirely on per-domain overrides.
	ProfileCustom Profile = "custom"
)

func (Profile) Valid

func (p Profile) Valid() bool

Valid reports whether p is a known profile.

Jump to

Keyboard shortcuts

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