registrycheck

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package registrycheck inspects the user-owned devvault registry for entries that no longer describe reality.

devvault already answers "is this host ready" (internal/doctor), "does this repository still ship the files devvault would run" (internal/trust) and "can this project start" (internal/readiness). Nothing answered "is devvault's own bookkeeping still consistent" — so a registration pointing at a directory that was renamed or two registrations for the same directory were only ever found by reading ~/.devvault/projects.yaml by hand.

Everything here is read-only. Each finding names the command that resolves it and devvault never runs it: every one of those commands deletes or rewrites a registration, and a registration is the user's own assertion of which credentials a directory may mount (CLAUDE.md §5 rule 1a).

Index

Constants

View Source
const ActiveSubject = "active"

ActiveSubject is the Subject of a finding about the registry itself rather than about one project.

Variables

This section is empty.

Functions

func CredentialSetKey

func CredentialSetKey(customer, set string) string

CredentialSetKey is how a credential set is named in a finding: the customer it belongs to and the set itself, the same two levels the directory layout below ~/.aws-kunden uses.

Types

type Finding

type Finding struct {
	Kind     Kind
	Severity Severity
	// Subject names what the finding is about: a project id, a credential set
	// as "<customer>/<set>", the directory of a duplicate, the shared alias, or
	// ActiveSubject.
	Subject string
	// Projects lists every registry id involved, so a duplicate or an alias
	// collision names all of its members and not only the one in Subject.
	Projects []string
	Message  string
	// Fix is a single devvault command. It is a suggestion, never something
	// this package runs.
	Fix string
}

Finding is one inconsistency, together with the command that resolves it.

Message and Fix are ready to print: every value that came out of a repository or a hand-edited registry is already quoted and truncated, so a caller may write them to a terminal unchanged (CLAUDE.md §5 rule 6).

type Kind

type Kind string

Kind identifies what is wrong. It is part of the machine-readable surface, so the values are stable strings rather than an enum a consumer has to guess.

const (
	// KindMissingPath is a registered directory that is gone, unreadable or
	// not a directory at all.
	KindMissingPath Kind = "missing_path"
	// KindDuplicatePath is more than one registry entry for the same
	// directory.
	KindDuplicatePath Kind = "duplicate_path"
	// KindUnreadableConfig is a registered directory devvault cannot read a
	// project config in.
	KindUnreadableConfig Kind = "unreadable_config"
	// KindMissingGitRepository is an entry that records a Git remote for a
	// directory that is no longer a checkout.
	KindMissingGitRepository Kind = "missing_git_repository"
	// KindDanglingActiveProject is an `active` key naming a project the
	// registry does not have.
	KindDanglingActiveProject Kind = "dangling_active_project"
	// KindAliasCollision is one alias shared by several projects.
	KindAliasCollision Kind = "alias_collision"
	// KindOrphanedCredentialSet is a credential set no registered project
	// uses.
	KindOrphanedCredentialSet Kind = "orphaned_credential_set"
	// KindMissingCredentialMount is a credential set whose host directory does
	// not exist.
	KindMissingCredentialMount Kind = "missing_credential_mount"
)

type Report

type Report struct {
	Findings []Finding
}

Report is the result of one pass over the registry.

func Run

func Run() (Report, error)

Run reads the registry and reports every inconsistency it finds.

It fails only when the registry itself cannot be read. A single broken project must not hide the rest: a directory that is gone, a config that no longer parses and an entry pointing at a file are each a finding, never a reason to stop.

The findings come out grouped and in a stable order — the active project first, then per project by id, then duplicates, alias collisions and credential sets — so two runs over the same registry print the same report.

func (Report) Errors

func (r Report) Errors() int

Errors counts the findings devvault cannot work around.

func (Report) OK

func (r Report) OK() bool

OK reports whether the registry is free of findings.

func (Report) Warnings

func (r Report) Warnings() int

Warnings counts the findings that only mislead.

type Severity

type Severity string

Severity separates the entries devvault cannot work with from the ones that only confuse.

const (
	// SeverityError marks a registry entry devvault cannot use: a command that
	// reaches it fails, or it makes another entry ambiguous.
	SeverityError Severity = "error"
	// SeverityWarning marks state devvault still works with, but that
	// misleads the user about what it is doing.
	SeverityWarning Severity = "warning"
)

Jump to

Keyboard shortcuts

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