Documentation
¶
Overview ¶
Package contractfinal owns the Cobra-keyed ContractFinal runtime store and the annotate+store registration seam.
All registration — products, helpers, shortcuts, and framework code (corecmd.AttachContract) — calls RegisterRuntimeContractFinal here directly. internal/corecmd never imports any internal/cli package.
Types remain in internal/corecmd/contract (DTO only — no cobra store). Annotate writers live in internal/corecmd/runtimeannotate.
Index ¶
- func ApplyParamDecls(cmd *cobra.Command, decls []contract.ParamDecl) error
- func ClearRuntimeContractFinalForTest(cmd *cobra.Command)
- func HasDeclaredOrAnnotatedConfirmation(cmd *cobra.Command) bool
- func HasRuntimeContractFinal(cmd *cobra.Command) bool
- func RegisterRuntimeContractFinal(cmd *cobra.Command, payload contract.ContractFinalPayload)
- func ResolveRuntimeSafety(canonicalPath, cliPath string) (safety contract.SafetySpec, declared, ok bool)
- func RuntimeContractFinal(cmd *cobra.Command) (contract.ContractFinalPayload, bool)
- func StoreRuntimeContractFinalRawForTest(cmd *cobra.Command, raw any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyParamDecls ¶
ApplyParamDecls emits parameter declarations as dws.schema.* annotations on the command's flags. Called at assembly time when all flags exist on the tree. Each non-blank ParamDecl.Name must resolve to an existing Cobra flag; unknown names fail closed so typos cannot silently drop during generation.
func ClearRuntimeContractFinalForTest ¶
ClearRuntimeContractFinalForTest removes a registration (tests only).
func HasDeclaredOrAnnotatedConfirmation ¶
HasDeclaredOrAnnotatedConfirmation reports whether confirmation semantics are covered by typed Contract SafetySpec. The risk/gate annotation branches are residual bridges: their production writers are retired, so they only fire for hand-built annotations (tests and overlay-bridge probes).
func HasRuntimeContractFinal ¶
HasRuntimeContractFinal reports whether the leaf has a registered final overlay.
func RegisterRuntimeContractFinal ¶
func RegisterRuntimeContractFinal(cmd *cobra.Command, payload contract.ContractFinalPayload)
RegisterRuntimeContractFinal annotates dws.schema.contract then stores the typed final Schema overlay. This is the atomic annotate+store implementation.
Ownership lives under the command framework (this package). All callers — products and corecmd.AttachContract alike — call this function directly.
func ResolveRuntimeSafety ¶ added in v1.0.58
func ResolveRuntimeSafety(canonicalPath, cliPath string) (safety contract.SafetySpec, declared, ok bool)
ResolveRuntimeSafety finds the live ContractFinal safety declaration for an invocation identity. declared distinguishes a matched declaration whose safety is unavailable or conflicting from a legacy invocation with no unified declaration context. Repeated equivalent command-tree registrations are accepted; conflicting matches fail closed with ok=false.
func RuntimeContractFinal ¶
func RuntimeContractFinal(cmd *cobra.Command) (contract.ContractFinalPayload, bool)
RuntimeContractFinal returns the registered final Schema overlay (read-only).
func StoreRuntimeContractFinalRawForTest ¶
StoreRuntimeContractFinalRawForTest injects a raw map value (tests only).
Types ¶
This section is empty.