migrate

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package migrate ports a project's awf config across schema generations. It is the sole reader of the legacy single-file .claude/awf.yaml (ADR-0010 inv: legacy-read-isolation, the named exemption to ADR-0009 inv: config-root) and is imported by nothing on the render/sync/check load path.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Current

func Current() int

Current is the current schema generation (the highest registered To).

func GateState

func GateState(root string) string

GateState classifies a project: "ok" | "gate" | "autobump".

func Generation

func Generation(root string) int

Generation reports the project's schema generation. Detection is by layout: a .awf/ tree reports its lock's SchemaVersion (or Current() when no lock yet — fresh init / just-upgraded); a pre-relocation .claude/awf/ tree reports its lock's schema, or Current()-1 when no lock, so the To:3 relocation gates; the legacy single file reports 0; nothing present reports Current().

func Upgrade

func Upgrade(root string) ([]string, error)

Upgrade applies every registered migration with To > Generation(root), in ascending To order, and returns the applied migration names. Idempotent: at the current generation it applies nothing and returns an empty slice, nil error. After applying any migration it restamps an existing tree lock to Current() so Generation reflects the new state and the terminal sync's schema gate passes (a tree→tree upgrade keeps its lock, unlike the legacy 0→1 port which drops it).

Types

type Migration

type Migration struct {
	To    int
	Name  string
	Apply func(root string) error
}

A Migration ports a project from the generation below To up to To.

Jump to

Keyboard shortcuts

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