config

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package config implements the `da config` command subtree.

Per spec config-distribution-model §10 and proposal `.agents/proposals/config-explain-live-surface.md`, this subtree is the operator-facing surface for inspecting the effective configuration of a repository — what value won, which layer set it, and how to extract one specific field for scripts.

The first commands in this subtree are `da config explain` and `da config verify`. The remaining siblings (`sync`, `lint`) are scoped to other tasks (config-v2-migration/p4c).

The subtree intentionally consumes a minimal snapshot view of the manifest. Once the layered resolver from config-v2-migration/p1 / p1b lands in `internal/config/snapshot.go`, the snapshot helpers in this package are expected to delegate to it without changing the command surface.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoManifest = errors.New("no manifest")

Exported error sentinel used by tests to assert the "missing manifest" branch without string matching. Kept as a var (not const) because errors.Is expects a typed sentinel.

Functions

func NewConfigCmd

func NewConfigCmd(deps Deps) *cobra.Command

NewConfigCmd builds the `da config` command tree.

Types

type Deps

type Deps struct {
	ErrorWithHints        func(message string, hints ...string) error
	UsageError            func(message string, hints ...string) error
	MaximumNArgsWithHints func(n int, hints ...string) cobra.PositionalArgs
	ExactArgsWithHints    func(n int, hints ...string) cobra.PositionalArgs
	// JSON reports the resolved global `--json` flag, so `da config` honors the
	// same persistent flag as every other command (status, workflow, kg) rather
	// than defining its own local `--json`. Nil is treated as false.
	JSON func() bool
}

Deps carries UX helpers from the root `commands` package without an import cycle (the same shape used by other subtrees like `commands/agents` and `commands/hooks`).

type FieldExplanation

type FieldExplanation struct {
	Field       string       `json:"field"`
	Value       any          `json:"value"`
	ActiveLayer string       `json:"active_layer,omitempty"`
	Layers      []LayerValue `json:"layers"`
}

FieldExplanation is the JSON shape emitted by `da config explain <path> --json`. The shape is documented in the proposal at `.agents/proposals/config-explain-live-surface.md` and intentionally kept stable so scripts can pin against it.

type LayerValue

type LayerValue struct {
	Layer  string `json:"layer"`
	Value  any    `json:"value"`
	Active bool   `json:"active"`
}

LayerValue is one slot in a single field's provenance stack.

Active=true on exactly one entry per field, except when no layer sets the field (all entries Active=false, all Value=nil).

type VerifyCheck

type VerifyCheck struct {
	Name   string `json:"name"`
	Status string `json:"status"` // pass | warn | fail
	Detail string `json:"detail,omitempty"`
}

VerifyCheck is one line in the verify report.

type VerifyReport

type VerifyReport struct {
	OK     bool          `json:"ok"`
	Checks []VerifyCheck `json:"checks"`
}

VerifyReport is the stable JSON shape emitted by `da config verify --json`. OK is false iff any check failed (warnings do not flip OK), so CI can gate on the top-level boolean without parsing individual checks.

Jump to

Keyboard shortcuts

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