boardscope

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package boardscope resolves the `--board NAME` / `--board-id N` flag pair against the local board cache and renders the result into JQL clauses and envelope data. FromFlags is the single place that decides which precedence path won (flag, default, or none); it is shared by issue list and jql build.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFlags

func AddFlags(cmd *cobra.Command)

AddFlags wires the `--board NAME` / `--board-id N` flag pair (with mutual exclusion) onto a list-style command. Shared by `issue list` and `jql build` so the surface stays in lockstep.

func ApplyClauseToJQL

func ApplyClauseToJQL(query string, scope jira.BoardScope) string

ApplyClauseToJQL inserts the board scope's JQL clause into query, preserving any top-level ORDER BY suffix so the result stays a valid query.

func EnvelopeData

func EnvelopeData(scope jira.BoardScope) map[string]any

EnvelopeData renders a BoardScope into the envelope's data.board_scope map. The `applied` flag is sourced from JQLClause — the single owner of the "did this scope produce a clause?" decision — so any future emission rule flows through one predicate.

func FromFlags

func FromFlags(cmd *cobra.Command) (jira.BoardScope, string, error)

FromFlags reads the active command's `--board NAME` / `--board-id N` flag values, falls through to the active profile's `default_board` config (when defined), resolves the requested board against the cache, and returns the resulting (scope, precedence, err).

Precedence rules:

--board NAME explicit → flag wins, precedence "flag"
--board-id N  explicit → flag wins, precedence "flag"
--board ""    explicit → suppresses default, precedence "none"
neither + default set → resolves default, precedence "default_board"
neither + no default  → no scope, precedence "none"

Types

type ValidationError

type ValidationError struct {
	Msg        string
	Candidates []map[string]any
}

ValidationError is a typed error that asks the error mapper to classify the failure as a validation error (exit 3) — used for both default-board-missing and ambiguous-name disambiguation. Its CandidateRows method lets the envelope writer surface disambiguation choices.

func (ValidationError) CandidateRows added in v0.9.0

func (e ValidationError) CandidateRows() []map[string]any

CandidateRows surfaces the disambiguation rows for the envelope's candidates[] field. The method is CandidateRows (not Candidates) because Candidates is a field.

func (ValidationError) Code added in v0.9.0

func (e ValidationError) Code() errtax.Code

Code varies with state, as the taxonomy contract requires: multiple boards matched → board_ambiguous, so the caller picks from candidates[]; a candidate-less failure (a configured default_board that no longer resolves) keeps the validation_failed catch-all and its canonical hint.

func (ValidationError) Error

func (e ValidationError) Error() string

Jump to

Keyboard shortcuts

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