Documentation
¶
Overview ¶
Package views owns the interpretation of view names: how the Jira filters and saved views inside a store are listed, and how one name resolves to exactly one of them.
Two surfaces speak views by name — `gadak views` (cmd/gadak) and the MCP gadak_show tool (internal/mcp) — and until GDK-612 each carried its own copy of this logic. The copies had already drifted: the same missing name drew "run `gadak views`" from the CLI and an available-views list from MCP, and MCP could not report a saved view's applied/unsupported clauses at all. Both surfaces now import this package; the 0-hit error is the MCP pair (empty-workspace diagnosis / available list) because it carries more information than the CLI hint it replaced.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashFromConfig ¶
func HashFromConfig(raw json.RawMessage) string
HashFromConfig returns the view hash stored in a saved-view config, or "" when the config is empty or does not unmarshal.
Types ¶
type ListedView ¶
type ListedView struct {
Kind string `json:"kind"` // jira | saved
ID string `json:"id"`
Name string `json:"name"`
JQL string `json:"jql,omitempty"`
Hash string `json:"hash"`
Favourite bool `json:"favourite,omitempty"`
Owner string `json:"owner,omitempty"`
Applied []string `json:"applied,omitempty"`
Unsupported []string `json:"unsupported,omitempty"`
Config json.RawMessage `json:"-"`
}
ListedView is one view a name can resolve to: a synced Jira filter (Kind "jira") or a view saved by `gadak views save` (Kind "saved"). Config rides along so callers that need the raw saved body (notably `views save` round-trips) do not re-read the store.
func FindView ¶
func FindView(db *store.DB, name string) (ListedView, error)
FindView resolves one name to one view. A name matches exactly against the view's id, name, or id suffix (the part after the last ":"), case- and space-insensitively; only when nothing matches exactly does a substring of the name or id count. Exact beats substring; a single substring hit is accepted so prefixes stay usable.
func LoadViews ¶
func LoadViews(db *store.DB) ([]ListedView, error)
LoadViews lists every resolvable view in the store: synced Jira filters first, then locally saved views. The saved rows are decoded through the same strict parse as HashFromConfig, so a config whose metadata cannot unmarshal surfaces as an empty Hash rather than half a view.