adfmode

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package adfmode resolves the strict vs best-effort ADF mode for a given CLI invocation, applying both the precedence ladder and per-path defaults.

Precedence (highest first): command flag > JIRA_ADF_STRICT env > profile adf_strict > per-path default (read/render → best-effort, mutation submit → strict). The resolver is the only place mode selection happens; commands pass their resolved Mode into pkg/adf entry points.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FlagChoice

type FlagChoice uint8

FlagChoice is a bitmask so the resolver can detect if the caller wired both --adf-strict and --adf-best-effort on the same invocation (a programmer error — cobra mutex should prevent it, but we defend anyway).

const (
	// FlagUnset means neither --adf-strict nor --adf-best-effort was passed.
	FlagUnset FlagChoice = 0
	// FlagStrict is the bit set by --adf-strict.
	FlagStrict FlagChoice = 1 << 0
	// FlagBestEffort is the bit set by --adf-best-effort.
	FlagBestEffort FlagChoice = 1 << 1
)

type Inputs

type Inputs struct {
	Flag    FlagChoice
	Env     string // raw value of JIRA_ADF_STRICT
	Profile *bool  // nil = unset
	Path    Path
}

Inputs is the resolver input set. All fields are optional; zero values map to "unset" and the resolver falls through to the next precedence level.

type Mode

type Mode int

Mode is the resolved ADF processing mode for a single invocation.

const (
	// ModeBestEffort tolerates ADF that cannot be fully represented, degrading
	// with warnings; the default for reads and rendering.
	ModeBestEffort Mode = iota
	// ModeStrict rejects ADF that cannot be fully represented; the default for
	// mutation submission.
	ModeStrict
)

func Resolve

func Resolve(in Inputs) (Mode, error)

Resolve returns the ADF Mode for the given inputs.

func (Mode) String

func (m Mode) String() string

type Path

type Path int

Path is the kind of ADF interaction this invocation performs. It selects the default mode when no higher-priority signal is set.

const (
	// PathRead reads an issue's ADF back from Jira (best-effort default).
	PathRead Path = iota
	// PathRender renders ADF to the terminal (best-effort default).
	PathRender
	// PathPlainExtract extracts plain text from ADF (best-effort default).
	PathPlainExtract
	// PathRawEmit emits the raw ADF document unchanged (best-effort default).
	PathRawEmit
	// PathMutationSubmit encodes ADF for a write to Jira (strict default).
	PathMutationSubmit
	// PathDryRun previews a mutation's ADF encoding (strict default).
	PathDryRun
)

Jump to

Keyboard shortcuts

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