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. It reads the compile-time catalog (internal/catalog) for the ADR-0081 close-enabled-set migration - a leaf import that keeps this package off the render path.
Migrations collect ordered typed Change values for every performed operation. The command owner presents only terminal results; a no-op run collects no changes.
Index ¶
- func AuthorityLockPath(root string) string
- func ConfigForCurrentSchema(src []byte, from int) ([]byte, error)
- func Current() int
- func GateState(root string) (string, int, error)
- func GateStateForGeneration(gen int) string
- func Generation(root string) (int, error)
- func ProjectPresent(root string) bool
- func ProjectPresentFromFiles(has func(string) bool) bool
- type Change
- type Changes
- type GroundingSkillCollisionError
- type LegacyResidents
- type Migration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthorityLockPath ¶ added in v0.22.0
AuthorityLockPath returns the lock belonging to the active config layout. It keeps all knowledge of retired layout paths inside the migration package.
func ConfigForCurrentSchema ¶ added in v0.30.0
ConfigForCurrentSchema applies the config-byte portions of registered migrations after from through the current generation. Snapshot consumers use it to compare a historical committed config with a current staged config without relaxing the current strict parser. Migrations that do not mutate config.yaml have no byte-level action here.
func Current ¶
func Current() int
Current is the current schema generation (the highest registered To).
func GateState ¶
GateState classifies a project ("ok" | "gate" | "autobump" | "ahead") and returns the generation it classified, so callers need only one Generation call for both the state and their messages.
func GateStateForGeneration ¶ added in v0.22.0
GateStateForGeneration classifies an already-loaded schema generation with the same migration-registry semantics as GateState. Snapshot-aware callers use it after loading a lock from their own universe instead of rereading the working tree.
func Generation ¶
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 1 when no lock - such a tree is the tree-layout port's output (the port deletes the legacy lock), so every later migration up to and including the To:3 relocation must still apply; the legacy single file reports 0; nothing present reports Current(). A present-but-unreadable lock in either lock-bearing layout is a hard error, never a sentinel generation (ADR-0076 Decision 2, narrowing ADR-0016 Decision 6's presence keying).
func ProjectPresent ¶ added in v0.11.0
ProjectPresent reports whether any awf config layout (current tree, pre-relocation tree, or legacy single file) exists under root - the distinction Generation cannot express, since "nothing present" reports Current() (ADR-0076 Decision 4).
func ProjectPresentFromFiles ¶ added in v0.22.0
ProjectPresentFromFiles reports project presence through a repository-relative file lookup. Snapshot consumers use it so current and legacy layout knowledge remains owned by the migration package rather than being duplicated.
Types ¶
type Change ¶ added in v0.30.0
type Change struct {
Text string
}
Change is one ordered semantic fact produced by a migration. It is data for the upgrade owner, not terminal output.
func CurrentSchemaChange ¶ added in v0.30.0
func CurrentSchemaChange() Change
CurrentSchemaChange reports the migration domain's proven no-migration state to its terminal owner.
type Changes ¶ added in v0.30.0
type Changes struct {
// contains filtered or unexported fields
}
Changes collects typed migration facts in mutation order; no command writer reaches a migration.
type GroundingSkillCollisionError ¶ added in v0.32.0
type GroundingSkillCollisionError struct {
Path string
}
GroundingSkillCollisionError reports that a project-local grounding skill occupies the standard name required by the guarded schema-37 backfill.
func (*GroundingSkillCollisionError) Diagnostic ¶ added in v0.32.0
func (e *GroundingSkillCollisionError) Diagnostic(priorChanges []Change) (presentation.Diagnostic, error)
Diagnostic maps this migration-owned refusal to the central actionable presentation model. priorChanges are facts proved by earlier migrations.
func (*GroundingSkillCollisionError) Error ¶ added in v0.32.0
func (e *GroundingSkillCollisionError) Error() string
type LegacyResidents ¶ added in v0.30.0
type LegacyResidents struct {
// PrimaryRoot is the checkout that owns the resident roots. Residents are
// repository-wide, so they live here even when another linked checkout
// invoked the upgrade.
PrimaryRoot string
// Quarantine lists the PrimaryRoot-relative forward-slash paths proven
// obsolete, sorted bytewise. Each is quarantined whole: a single legacy
// leaf under the efforts root, or the entire standalone memory root.
Quarantine []string
}
LegacyResidents is the complete read-only classification of the schema-1 residents a project still carries.
func ClassifyLegacyResidents ¶ added in v0.30.0
func ClassifyLegacyResidents(ctx context.Context, root string) (LegacyResidents, error)
ClassifyLegacyResidents inspects every schema-1 binary-owned leaf and every Git fact those leaves refer to, without mutating a byte. It returns the resident paths the journal may quarantine, or refuses. A refusal always leaves the tree exactly as it found it, so the caller may report it before a journal exists.
Source Files
¶
- adrnumberprovenance.go
- anchoredglobs.go
- changes.go
- closeenabledset.go
- commitpolicy.go
- configedit.go
- decisionitemslugs.go
- dropauditbase.go
- dropgateauditsettings.go
- drophooks.go
- dropmaxclaimspertopic.go
- dropreplacewith.go
- dropselection.go
- dropseveritysettings.go
- dropworkflowtelemetry.go
- enablebootstrap.go
- enablerunner.go
- globaltopicownership.go
- groundingskillbackfill.go
- historicalconfig.go
- historicalgraph.go
- integrationbranch.go
- intrinsicadrformat.go
- layercataloglists.go
- legacy.go
- maxclaimspertopic.go
- migrate.go
- orientingbackfill.go
- pitfalls.go
- relocation.go
- remove_workflow_residents.go
- renameretiredcommands.go
- retargetcheckcommands.go
- retirementtokens.go
- retireplanresync.go
- singletonstandarddocs.go
- structuralheadings.go
- supersessionkeys.go
- treelayout.go
- unified_effort_residents.go
- workflowtelemetry.go