contextref

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package contextref observes a repository's tracked context-reference manifest and aggregates CE v2 gate-doctor output.

It reports identity and state only. It does not load agent instructions, interpret Skill content, execute descriptor commands, or mutate Git configuration, the index, worktree files, modes, or hooks.

The consumed CE contract is origin tag v0.8.3 (ac7445978423df45cb77ffaea0e34f7725e744b2), capability ce.task.gate-doctor/v2. TASK-083 c4913da6 and a local ce --version are not that release.

Index

Constants

View Source
const (
	CapabilityID       = "context-reference-observe-v1"
	ObservationSchema  = "gz-git.context-observation/v1"
	ManifestSchema     = "gz-git.context-reference/v1"
	ManifestFile       = ".gz-git-context.yaml"
	CECapabilityID     = "ce.task.gate-doctor/v2"
	CEDoctorSchema     = 2
	ReleasedCETag      = "v0.8.3"
	ReleasedCECommit   = "ac7445978423df45cb77ffaea0e34f7725e744b2"
	OutcomeObserved    = "observed"
	OutcomeAbsent      = "absent"
	OutcomeUnsupported = "unsupported"
	OutcomeFault       = "fault"
	DomainTransport    = "gz-git-transport"
	DomainCEInvocation = "ce-invocation"
	ReasonNotDeclared  = "context.not-declared"
	ReasonUntracked    = "context.manifest-untracked"
	ReasonMissingFile  = "context.manifest-not-materialized"
	ReasonUnsupported  = "context.unsupported-platform"
	ReasonInvalid      = "context.manifest-invalid"
	ReasonLimit        = "context.limit-exceeded"
	ReasonPathInvalid  = "context.path-invalid"
	ReasonSymlink      = "context.symlink"
	ReasonNonRegular   = "context.non-regular"
	ReasonDuplicate    = "context.duplicate-path"
	ReasonIndexOnly    = "index-only"
	ReasonDirty        = "dirty"
	ReasonChanged      = "context.changed"
	ReasonUntrackedEP  = "context.untracked-path"
	ReasonBadMode      = "context.non-blob-mode"
)

Capability and schema identifiers allocated by TASK-168 / D6 W7.

Variables

This section is empty.

Functions

func MapCEExit

func MapCEExit(ceExit int, envelopeStatus string) (gzExit int, outcome, domain string)

MapCEExit translates a CE v2 process exit and decoded envelope status into gz-git's exit contract. CE codes are never passed through.

Types

type CEDescriptor

type CEDescriptor struct {
	Path         string
	Digest       string
	CapabilityID string
}

CEDescriptor is a trusted CE installation. Path must be absolute. Digest is sha256:<64 lowercase hex> of the regular non-symlink executable.

type Component

type Component struct {
	ComponentOutcome string          `json:"component_outcome"`
	Reason           string          `json:"reason,omitempty"`
	FaultDomain      string          `json:"fault_domain,omitempty"`
	ProviderStatus   string          `json:"provider_status,omitempty"`
	Manifest         *ManifestState  `json:"manifest,omitempty"`
	Entrypoints      []Entrypoint    `json:"entrypoints,omitempty"`
	Report           json.RawMessage `json:"report,omitempty"`
}

Component is one aggregation result. ComponentOutcome describes transport only; repository state is carried by reason codes.

type Entrypoint

type Entrypoint struct {
	Path           string `json:"path"`
	Reason         string `json:"reason,omitempty"`
	HEAD           string `json:"head,omitempty"`
	Index          string `json:"index,omitempty"`
	WorktreeDigest string `json:"worktree_digest,omitempty"`
	Dirty          bool   `json:"dirty"`
	IndexOnly      bool   `json:"index_only,omitempty"`
	GitMode        string `json:"git_mode,omitempty"`
	Size           int64  `json:"size,omitempty"`
}

Entrypoint is one context.entrypoints observation. Worktree bytes are never emitted.

type ManifestState

type ManifestState struct {
	Schema         string `json:"schema,omitempty"`
	Tracked        bool   `json:"tracked"`
	Present        bool   `json:"present"`
	HEAD           string `json:"head,omitempty"`
	Index          string `json:"index,omitempty"`
	WorktreeDigest string `json:"worktree_digest,omitempty"`
	Dirty          bool   `json:"dirty"`
	GitMode        string `json:"git_mode,omitempty"`
	Size           int64  `json:"size,omitempty"`
}

ManifestState is the four-state matrix plus identities.

type Observation

type Observation struct {
	Schema           string    `json:"schema"`
	CapabilityID     string    `json:"capability_id"`
	ReleasedCETag    string    `json:"released_ce_tag"`
	ReleasedCECommit string    `json:"released_ce_commit"`
	WorktreeRoot     string    `json:"worktree_root"`
	Context          Component `json:"context"`
	CE               Component `json:"ce"`
	ExitCode         int       `json:"exit_code"`
}

Observation is the gz-git.context-observation/v1 envelope.

func Observe

func Observe(ctx context.Context, opts Options) (Observation, error)

Observe reports the D6 four-state context-reference matrix and, when a CE descriptor is supplied, aggregates CE v2 gate-doctor output.

type Options

type Options struct {
	Dir     string
	Git     *gitcmd.Executor
	CE      *CEDescriptor
	Timeout time.Duration
}

Options configure a single-repository observation.

Jump to

Keyboard shortcuts

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