config

package
v0.24.3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config loads and saves ~/.gadak/config.json.

Credentials (email/token) share the file with the site settings, but they never reach the database, a log line, or a snapshot (constitution article 8). The file is written 0600.

Index

Constants

View Source
const (
	ActorKindAgent  = "agent"
	ActorKindPerson = "person"
)

Actor kinds (GDK-1973). "" is the pre-1973 block — an agent — kept byte-for-byte; "agent" says it out loud; "person" makes the block a person's identity, whose slug may be derived from the display name.

View Source
const (
	ActorSourceEnv    = "env"    // GADAK_ACTOR
	ActorSourceConfig = "config" // config.json actor
	ActorSourceAuto   = "auto"   // Claude Code detection
)

Actor sources, in ladder order. status reports which rung answered so an agent can see that its environment was (or was not) recognized.

View Source
const (
	KindConnected  = "connected"
	KindStandalone = "standalone"
)

Workspace kinds. Empty Kind on disk is connected — existing configs keep working with no rewrite.

Deprecated vocabulary (GDK-1278): these two values conflated what the origin is with where it is. A paired workspace reported KindConnected while its origin was a gadak tracker one machine away. Prefer OriginType() and Transport(); these constants remain because they are still on disk and still on the JSON surface.

View Source
const (
	OriginJira   = "jira"
	OriginLinear = "linear"
	OriginGadak  = "gadak" // gadak's own tracker (issuetap), in-process or behind a serve

	// OriginJiraServer is Jira Server / Data Center (GDK-1635). It is a
	// type of its own rather than a flag on OriginJira because the two
	// share a name and little else: REST v2 with no v3, wiki-markup
	// strings where Cloud sends ADF, users keyed by name instead of
	// accountId, attachment bytes under /secure/attachment, and a
	// Personal Access Token where Cloud takes email + API token. A
	// boolean would scatter `if server` across every one of those; a
	// separate type makes each branch a decision someone wrote down.
	OriginJiraServer = "jira-server"
)

Origin types — which tracker this workspace's origin is (GDK-1278). The vocabulary is the one the product already used for sources.

View Source
const (
	TransportLocal  = "local"
	TransportRemote = "remote"
)

Transports — how that origin is reached (GDK-1278). The axis is whether the call goes in-process or over the serve API, not how far away the machine is: a serve on loopback is TransportRemote, because the cost model and the capability set follow the transport, not the geography.

View Source
const (
	DefaultSyncIntervalSec      = 60   // 1 minute
	DefaultReconcileIntervalSec = 3600 // 1 hour
	MinSyncIntervalSec          = 15   // seconds
	MinReconcileIntervalSec     = 300  // 5 minutes
)

Sync loop defaults and floors. Zero in the file means "use default". Floors reject values that would thrash Jira or busy-loop the local process.

View Source
const (
	SourceFlag    = "flag"
	SourceEnv     = "env"
	SourceStored  = "stored"
	SourceDefault = "default"
)

Workspace selection source. WorkspaceSource reports one of these; when the kind is SourceEnv, the env variable name is returned alongside.

View Source
const (
	// Name is the CLI binary, desktop app, and user-facing product name.
	Name = "gadak"
	// DirName is the directory under $HOME that holds the default profile.
	DirName = ".gadak"
	// DevDirName is the home a dev build uses instead of DirName when
	// GADAK_HOME is unset (GDK-1697): a checkout build and the installed
	// release never share workspace files by accident. SetDevBuild flips it.
	DevDirName = ".gadak-dev"
	// DBFile is the SQLite filename inside a profile directory.
	DBFile = "gadak.db"
	// EnvPrefix is prepended to HOME, PROFILE, WORKSPACE, TOKEN, SITE, EMAIL, PROJECTS.
	EnvPrefix = "GADAK_"
)
View Source
const (
	TerminalAppearanceDark   = "dark"
	TerminalAppearanceFollow = "follow"
)

The terminal dock's appearance values (GDK-1357). Dark is the default and stores as the zero value; follow makes the dock take the app palette.

View Source
const (
	// DefaultTerminalScrollback is the pane scrollback in lines.
	DefaultTerminalScrollback = 5000
	// MinTerminalScrollback / MaxTerminalScrollback bound a stored value.
	MinTerminalScrollback = 200
	MaxTerminalScrollback = 100000
)

The terminal behavior block (GDK-896). Defaults named once so the catalog descriptions, the validators' messages, and EffectiveTerminal cannot drift apart.

View Source
const (
	TokenExpiryOK       = "ok"
	TokenExpiryExpiring = "expiring"
	TokenExpiryExpired  = "expired"
	TokenExpiryUnknown  = "unknown"

	TokenExpirySourceUser    = "user"
	TokenExpirySourceAssumed = "assumed"

	// TokenDefaultLifetimeDays is Atlassian's default API-token lifetime
	// when the user skipped the date from the create dialog.
	TokenDefaultLifetimeDays = 365
	// TokenExpiryWarnDays is the first day the warning surfaces (inclusive).
	TokenExpiryWarnDays = 14
	// TokenExpiryUrgentDays is the first day the warning is urgent (inclusive).
	TokenExpiryUrgentDays = 3

	// TokenTimeFormat is ISOMilli so assumed dates line up with
	// tokenVerifiedAt and every other store timestamp.
	TokenTimeFormat = ISOMilli
)

Token expiry assessment. One owner: AssessTokenExpiry. Surfaces (status, sync_health, the freshness chip) render what this returns; they do not re-derive state.

View Source
const DefaultRetroSessionGap = "30m"

DefaultRetroSessionGap is what an unset retro.sessionGap means. Every surface that prints or defaults the gap names this constant — the CLI flag's default and usage line (cmd/gadak/retro.go) and EffectiveRetroSessionGap below — so the value lives in this file alone.

View Source
const ISOMilli = "2006-01-02T15:04:05.000Z"

ISOMilli is the millisecond-precision UTC ISO-8601 layout every timestamp gadak writes — store columns, token expiry, usage flush — and that the `delta` cursor contract depends on. Milliseconds are not decoration: a whole-second cursor would drop a row written in the same second the cursor was taken.

View Source
const SkillAutoInstallPath = "skill.autoInstall"

SkillAutoInstallPath is the catalog path of the skill auto-install switch. Named here so the settings catalog, the CLI's undo line and the opt-out check cannot drift apart on the spelling.

View Source
const TimeMilli = "2006-01-02T15:04:05.000-0700"

TimeMilli is how Jira stamps timestamps: ISO-8601 with a fixed millisecond fraction and a numeric offset with no colon in it, which is why time.RFC3339 does not parse them. jira.Layout is this constant under its package-local name; the string lives here so the parse owner below and the packages that stamp it cannot drift (GDK-1130).

Variables

View Source
var ErrNotConfigured = errors.New("not configured — run gadak init (Jira), gadak init --local (built-in tracker), or gadak init --pairing-code (another machine's serve)")

ErrNotConfigured is the single owner of "this workspace has no origin yet" (GDK-454). CLI verbs that refuse because HasCredential is false print this — sync, writes, open, api, pairing list, status stderr, init's missing- values path. Paired workspaces are configured: HasCredential already counts remote-origin.json (GDK-442) and these verbs must not use this sentence for them. A Linear apiKey is a credential too: this sentence must not fire on a Linear-only workspace.

origin.errNeedCredential is a different error (Client/Wiki construction when a connected workspace lacks site/email/token) and is quoted by wikiPathStatus; it is not this sentence.

View Source
var FeatureNames = []string{"feed", "deploy", "qa", "teamGroups"}

FeatureNames is every optional-surface flag PUT / gadak config accept. Unknown keys in a features map are dropped.

Functions

func ApplyAppearance added in v0.15.2

func ApplyAppearance(c *Config, a Appearance) error

ApplyAppearance writes a validated look block onto c. "system" theme and "dark" terminal are the defaults and store as zero values, so an untouched look never persists a block at all.

func ApplyConfluence added in v0.15.2

func ApplyConfluence(c *Config, enabled *bool, spaces []string) error

ApplyConfluence is the PUT settings/ confluence rule, shared with `gadak config set confluence*`. enabled:false turns the source off; enabled:true creates/replaces the block; spaces alone requires it on.

func ApplyTerminalDisplay added in v0.20.0

func ApplyTerminalDisplay(c *Config, scrollback int, cursorBlink bool) error

ApplyTerminalDisplay sets the two display fields of the terminal block and leaves shell and workingDir as stored. It is the only terminal write PUT settings/ performs (GDK-1069: that endpoint admits paired serve-scope Bearers, so the fields that name the next spawned binary are not on it).

func ApplyUIConfig added in v0.17.2

func ApplyUIConfig(c *Config, next *UIConfig) error

ApplyUIConfig validates next and installs it on c. Warnings are printed to stderr here (LoadFor's migration notices set the precedent: the write succeeded and the warning is part of its output, not an API result).

func ApplyUIConfigWithWarnings added in v0.17.3

func ApplyUIConfigWithWarnings(c *Config, next *UIConfig) ([]tokencheck.Violation, error)

ApplyUIConfigWithWarnings is ApplyUIConfig with the write-time warnings returned as well: under warn+save the warning IS the interesting part of the answer — why the saved look will render the way it does — and the settings PUT carries them on its response (uiWarnings) so a writer that never sees the CLI's stderr still reads them. The stderr print stays; server logs keep the same record a CLI session leaves.

func AttachmentDir

func AttachmentDir() (string, error)

AttachmentDir is where attachment bytes are cached, next to the mirror it belongs to (so a profile keeps its own, and deleting a profile takes its cache with it).

func AttachmentDirFor

func AttachmentDirFor(profile string) (string, error)

AttachmentDirFor is where attachment bytes are cached for the named profile.

func ClearStoredWorkspace added in v0.17.0

func ClearStoredWorkspace() error

ClearStoredWorkspace removes the stored default so Profile() falls through to the root. Missing file is success.

func ConfigVersionOfDir added in v0.17.2

func ConfigVersionOfDir(dir string) string

ConfigVersionOfDir is the disk identity of a profile's config.json, for a directory already in hand (webConfig gets the loaded Config's Directory()). Every writer (CLI `config set`, PUT settings/, LoadFor's legacy-field rewrite) goes through the same atomic temp+rename, so mtime+size changes exactly when the content does. The ui-focus poll carries it; the web refetches config.json when it moves. A monotonic counter was rejected because it needed a second owner (local_meta) and a CLI↔SQLite coupling on a path that already had a single owner: the file.

func DBPath

func DBPath() (string, error)

DBPath is the default SQLite path for the active profile.

func DBPathFor

func DBPathFor(profile string) (string, error)

DBPathFor is the SQLite path for the named profile.

func DevHome added in v0.22.0

func DevHome() bool

DevHome reports whether the default home is the dev one (SetDevBuild was called with true and GADAK_HOME is unset). doctor prints it.

func Dir

func Dir() (string, error)

Dir is GADAK_HOME or ~/.gadak, plus profiles/<name> when a profile is active.

func DirFor

func DirFor(profile string) (string, error)

DirFor is the config directory for a named profile. "" or "default" means the root (GADAK_HOME / ~/.gadak); any other name lives under profiles/<name>. Names that fail validProfileName return an error and no path.

func Env

func Env(suffix string) string

Env returns GADAK_<suffix>. An empty value is treated as unset, the same rule warnUnknownGADAK follows, so a blank export cannot masquerade as a setting.

func HomeRoot added in v0.22.0

func HomeRoot() (string, error)

HomeRoot is the directory the default profile lives in: GADAK_HOME, else ~/.gadak-dev for a dev build, else ~/.gadak.

func JiraFamily added in v0.22.0

func JiraFamily(originType string) bool

JiraFamily reports whether an origin type speaks a Jira REST API at all — Cloud or Server. Use it only where the two genuinely agree (browse URLs, "is there an Atlassian credential"); anywhere the shapes differ, branch on the type itself, because that is the difference this split exists to keep visible.

func LooksLikeProjectKey added in v0.17.2

func LooksLikeProjectKey(s string) bool

LooksLikeProjectKey reports that shape without case-folding. "Fix" (the create --help example) is a summary word; "FIX" / "GDK" look like keys.

func MachineBoolSetting added in v0.24.3

func MachineBoolSetting(path string) (value, ok bool)

MachineBoolSetting reads one machine-level bool path. ok is false when the key is absent or not a bool, which every caller reads as the default.

func NormalizeFeatures added in v0.15.2

func NormalizeFeatures(set map[string]bool) map[string]bool

NormalizeFeatures projects the optional-surface flags. An explicit key wins; missing keys stay off except feed, which defaults on.

func NormalizeProfile added in v0.17.0

func NormalizeProfile(name string) string

NormalizeProfile is the display name of a profile: the empty string and "default" name the same root profile (Profile() returns "" for it) and both serialize as "default". Single owner of that mapping (GDK-619) — serve's workspace list, settings' profile display, and sameProfile all call this instead of re-spelling the branch.

func NotConfiguredWith added in v0.17.0

func NotConfiguredWith(addendum string) error

NotConfiguredWith appends a verb-specific addendum to ErrNotConfigured.

func ParseActorShorthand added in v0.17.0

func ParseActorShorthand(v string) (slug, name string)

ResolveActor is the single owner of "who does this process write as" (GDK-586). Ladder, first match wins:

  1. env GADAK_ACTOR — "slug" or "slug|display name"
  2. the config.json actor block (the workspace default)
  3. Claude Code auto-detection: CLAUDECODE=1 derives "claude:<first 8 of CLAUDE_CODE_SESSION_ID>" (or bare "claude" with no session id), display name "Claude Code"

Nothing set means no actor: origins see the identity they always did (the in-process user / seed account) and no header is sent.

AI_AGENT is deliberately not a slug source: as measured it carries the harness version ("claude-code_2-1-239_agent"), so a slug built from it would mint a new agent identity per upgrade — the opposite of the stable-slug contract. ParseActorShorthand splits the one-line actor form shared by GADAK_ACTOR and `gadak config set actor`: "slug" or "slug|display name". An empty slug means unset.

func ParseTimestamp added in v0.22.0

func ParseTimestamp(s string) (time.Time, bool)

ParseTimestamp parses every timestamp spelling a mirror column or an origin payload carries, and is the single owner of that layout table (GDK-1130). Four parsers used to keep private copies, and the copies drifted: calendar's table rejected jira.Layout outright, so a Jira-stamped instant silently read as "no date"; other tables each accepted a different subset of the same spellings.

The set is three layouts, not a growing union: the two Jira no-colon stamps above, plus RFC3339Nano — whose optional fraction covers RFC3339, ISOMilli, and every colon-offset spelling in one entry. Callers whose domain adds genuinely different shapes (the calendar's space-separated forms, token expiry's date-only) parse those explicitly beside this call, never by extending this table: a shared table that grows per caller is the divergence this function exists to end. Unparseable or blank input answers false; a parse answers UTC-normalized time.

func Path

func Path() (string, error)

func PersonSlug added in v0.23.0

func PersonSlug(name string) string

PersonSlug derives a stable person slug from a display name (GDK-1973): trim, collapse whitespace runs to single dashes, lowercase ASCII letters only (a non-ASCII name passes through unchanged — the name is the identity here), prefix "person:", and cut to maxActorSlugLen on a rune boundary. An empty name is the empty slug — the caller refuses a person with no name instead of storing a bare prefix.

func Profile

func Profile() string

Profile is the single owner of workspace resolution: flag > env > stored default > root. "" is the root profile. "default" normalizes to "".

func Profiles

func Profiles() ([]string, error)

Profiles lists the configured profile names, excluding the default one.

func ReloadWorkspaceFromEnv added in v0.17.0

func ReloadWorkspaceFromEnv()

ReloadWorkspaceFromEnv forgets a SetProfile override and reads GADAK_WORKSPACE, then GADAK_PROFILE. Empty values are unset. When neither is set, Profile() still applies the stored default (then the root). Each process main must call this before flags (cmd/gadak does); importing this package does not. Tests call it after t.Setenv.

func RequireExistingProfile added in v0.13.0

func RequireExistingProfile() error

RequireExistingProfile is the single owner of "may this named profile be used without creating it?". The default profile (empty / "default") is always allowed so first-run can mint ~/.gadak. A named profile whose directory does not exist is an error; names that do exist are listed so a typo is obvious.

func SetDevBuild added in v0.22.0

func SetDevBuild(dev bool)

SetDevBuild tells config whether this binary is a checkout build. A dev build's default home is ~/.gadak-dev (DevDirName), not ~/.gadak, so the installed release and the checkout never open the same workspace files unless GADAK_HOME says so explicitly (GDK-1697; the in-place forward migration of GDK-1687 was the incident). Call it before the first homeRoot — in practice the first line of main.

func SetMachineSetting added in v0.24.3

func SetMachineSetting(path string, value any) error

SetMachineSetting stores one machine-level path. A nil value deletes the key (back to the default), mirroring the config.json convention that an untouched setting persists nothing.

func SetProfile

func SetProfile(name string)

SetProfile is called by the CLI's --workspace/--profile flag, which wins over the env var and the stored default. The source becomes SourceFlag even when name is empty.

func SetSkillAutoInstall added in v0.24.3

func SetSkillAutoInstall(enabled bool) error

SetSkillAutoInstall records the machine-wide skill auto-install switch. false opts out (init's "n" answer lands here too); true returns to the default, so the key is removed rather than stored as an explicit on.

func SetStoredWorkspace added in v0.17.0

func SetStoredWorkspace(name string) error

SetStoredWorkspace writes the home-root stored default used by Profile() when no flag or env selected a workspace. Empty and "default" clear it. A name whose directory does not exist is refused with the same error RequireExistingProfile prints — Profile() must not be pointed at a missing workspace that then silently becomes the root.

func SettingAliases added in v0.20.2

func SettingAliases() []string

SettingAliases returns "alias → canonical" pairs in a stable order, for the unknown-path listing.

func SettingPaths added in v0.15.2

func SettingPaths() []string

SettingPaths returns catalog paths in catalog order.

func SkillAutoInstallEnabled added in v0.24.3

func SkillAutoInstallEnabled() bool

SkillAutoInstallEnabled reports whether the automatic skill install is allowed on this machine. Absent means allowed: the opt-out is the state a user acts to create, so it is the only thing worth storing.

func UIDataColors added in v0.17.2

func UIDataColors(u *UIConfig) map[string]map[string]string

UIDataColors passes the stored data inks through the same value gate and returns what may render. Keys were validated at write time; this is the stale-schema defense for values that reached disk anyway.

func UIDataFamilies added in v0.22.0

func UIDataFamilies() []string

UIDataFamilies is the closed family set of ui.dataColors, exported so a surface that offers the families (the MCP write tool) can publish them instead of restating them. The rule for the KEYS inside a family stays here: it is the enforcement point of the repo-wide "never key on display names" trap.

func UIDimensionVars added in v0.17.3

func UIDimensionVars(u *UIConfig) (vars map[string]string, warns []tokencheck.Violation)

UIDimensionVars expands the stored dimension overrides into the single palette-agnostic CSS variable map the web consumes: cssVar ("--spacing-row") → value ("44px"). It is the sibling of UITokenVars with the palette axis removed — dimensions do not vary by theme. Mirrors its filter exactly: only names the dim catalog knows, tiers that may render, and values that parse are injected; everything else degrades to a load-time advisory (GDK-769 axis 3) so a config written by a newer build never blocks a boot. The map is overrides-only: base values keep coming from app.css and the JS layout constants.

func UIFontVars added in v0.19.0

func UIFontVars(u *UIConfig) map[string]string

UIFontVars expands the stored font overrides into the palette-agnostic CSS variable map the web consumes: cssVar (--font-mono-terminal) → stack. The sibling of UIDimensionVars without the advisories: with a one-token catalog the drop cases (unknown name, grammar failure) are self-explaining, and the load path never dies on a config written by a newer build (GDK-769 axis 3) — unknown names and stale values drop and the boot continues on the app.css base stack. Overrides only.

func UITokenVars added in v0.17.2

func UITokenVars(u *UIConfig) (vars map[string]map[string]string, warns []tokencheck.Violation)

UITokenVars expands the stored overrides into the final CSS variable maps the web consumes: palette → cssVar ("--color-accent") → hex. Only names the catalog knows and valid hex values are injected — anything else is reported as a load-time advisory so a config written by a newer build (renamed token) degrades to "override ignored" instead of an unbootable UI. Locked tiers RENDER (the write path warned and saved the value — filtering it here would turn that warning into a silent lie); the dimension sibling still filters its one locked token because a stored docked-min is genuinely dead (the runtime recomputes it).

func ValidateDefaultIssueTypeID added in v0.16.0

func ValidateDefaultIssueTypeID(s string) (string, error)

ValidateDefaultIssueTypeID accepts empty (unset) or a Jira issue type id.

func ValidateDefaultProject added in v0.16.0

func ValidateDefaultProject(s string) (string, error)

ValidateDefaultProject accepts empty (unset) or a project key with no whitespace. Membership in Projects is not checked here — that list can be empty ("every project") and can change after the default is set.

func ValidateGroupQuery added in v0.16.0

func ValidateGroupQuery(q string) error

ValidateGroupQuery accepts empty (disabled) or a single SELECT/WITH. Writes, PRAGMA, ATTACH, and multi-statement payloads are refused here so a bad save fails before the derived view tries to run it.

func ValidateIntervals added in v0.15.2

func ValidateIntervals(syncSec, reconcileSec int) error

ValidateIntervals is the PUT / gadak config rule for the two watch periods. 0 means "use the package default". A positive value below the floor is rejected so a typo cannot thrash Jira.

func ValidateLocale added in v0.17.0

func ValidateLocale(s string) (string, error)

ValidateLocale is validateLocale for callers outside this package — the verbs that take a locale as a flag rather than through `config set` (cmd/gadak demo --locale). One owner for the accepted set, so a flag cannot drift from the setting.

func ValidateProjectKeys added in v0.17.2

func ValidateProjectKeys(keys []string) ([]string, error)

ValidateProjectKeys is the single choke for the `projects` setting (GDK-809). Empty means "every project this account can see". Entries are trimmed and upper-cased (same as gadak init). Mixed-case values are refused as display names. Load does not call this — a file that already contains an unknown key keeps working until the next Set.

func ValidatePublicURLs added in v0.23.0

func ValidatePublicURLs(urls []string) ([]string, error)

ValidatePublicURLs is the serve.publicUrls / --public-url rule (GDK-1966): every entry is an http(s) origin — scheme://host[:port], no path, query, or fragment. A name on the finished list is one the rebinding guard steps aside for, so a sloppy entry must refuse here rather than silently widen nothing (bare host) or answer for more than was meant (a path is not a name). A trailing slash alone is tolerated and normalized away; duplicates by host (case-insensitively) collapse — the second one admits nothing new.

func ValidateTheme added in v0.15.2

func ValidateTheme(s string) (string, error)

ValidateTheme accepts empty/"system" (stored as "") and any lowercase identifier. "system", "light", and "dark" are always valid.

func ValidateUIConfig added in v0.17.2

func ValidateUIConfig(u *UIConfig) (warns []tokencheck.Violation, err error)

ValidateUIConfig is the write gate for the whole `ui` block. It returns the carry-along warnings (unknown names, unknown palettes) and an error that refuses the save. A nil config is valid and clears nothing.

func WorkspaceSource added in v0.17.0

func WorkspaceSource() (kind, envName string)

WorkspaceSource names what Profile() used: SourceFlag, SourceEnv, SourceStored, or SourceDefault. envName is the variable that supplied the value when kind is SourceEnv, otherwise "".

Types

type ActorConfig added in v0.17.0

type ActorConfig struct {
	Slug string `json:"slug,omitempty"`
	Name string `json:"name,omitempty"`
	Kind string `json:"kind,omitempty"`

	// Trailer turns off the Jira/Linear attribution line (nil = true, the
	// default): with an actor resolved and the origin unable to record one,
	// agent-authored comments and new issues carry one trailing
	// "— via gadak · <actor>" line (origin.ActorTrailer). The switch is also
	// the switch for any ledger derived from the line — a trailer-less
	// ledger would be a fact that exists nowhere in the origin.
	Trailer *bool `json:"trailer,omitempty"`
}

ActorConfig is the workspace-default acting identity for writes to an issuetap origin (builtIn or paired, GDK-586): the slug becomes the origin accountId verbatim and names an account there; Name is an optional display name. Kind says which sort of account it names — an agent (the default, and what env/auto detection always resolves) or a person (`gadak me set` writes person blocks; issuetap provisions those as human accounts). Nil (or empty slug) means unset. Per-machine identity — never team-exported.

func ValidateActor added in v0.17.0

func ValidateActor(slug, name, kind string) (*ActorConfig, error)

ValidateActor is the `gadak config set actor` rule: empty slug clears the block; a non-empty slug must be a stable identity, not a display name — no whitespace, within issuetap's cap. kind is "", "agent", or "person" (GDK-1973): a person block with no slug derives one from the name via PersonSlug — the one derivation point — and a person with no name is refused, because there is nothing to derive from and nothing to display.

type Appearance added in v0.15.2

type Appearance struct {
	Theme    string `json:"theme,omitempty"`
	Terminal string `json:"terminal,omitempty"`
}

Appearance is the look block in config.json. Empty Theme means "system". Terminal is the terminal dock's own appearance (GDK-1357): empty means "dark" — the dock paints the dark palette whatever the app theme, because the xterm ANSI palette is a dark-ground palette (9 of its 16 colours fall under 3.0:1 on paper). "follow" makes the dock take the app's palette.

type Config

type Config struct {
	// Kind names the origin's type: OriginJira, OriginJiraServer,
	// OriginLinear, or OriginGadak (GDK-1279, GDK-1635). Read it through OriginType(), which also
	// understands the values this field carried before that split —
	// "standalone" (now OriginGadak), and empty or "connected" (a
	// Jira-family site, derived from the credential). Those keep being
	// accepted forever: the mirror is a throwaway cache, but this file
	// is not.
	//
	// Where the origin *is* — in this process or across a serve API — is
	// the other axis, and Transport() answers it. Do not store "local"
	// here: it is a transport value, and it says nothing about which
	// tracker the origin is.
	Kind string `json:"kind,omitempty"`

	// Frozen stops every request to this workspace's origin — pulls and
	// writes alike (GDK-507). A scrubbed fixture with a live credential
	// decontaminates itself the moment something opens it (GDK-181), and the
	// same live credential could create real issues on the origin; both are
	// refused at the client mint (origin.ErrWorkspaceFrozen). Demo, recording
	// and screenshot workspaces set this. Mirror reads are unaffected.
	Frozen bool `json:"frozen,omitempty"`

	// The credential and what it connects to. Token is never copied out of this file.
	// A built-in workspace leaves these empty.
	Site     string   `json:"site,omitempty"` // https://your-site.atlassian.net
	Email    string   `json:"email,omitempty"`
	Token    string   `json:"token,omitempty"`
	Projects []string `json:"projects,omitempty"`

	// DevStatus turns on development-panel mirroring (GDK-496/497): sync
	// fetches each changed issue's dev-status (pull requests) from the origin
	// into dev_links. Off by default on a connected Cloud workspace — that
	// path calls Jira's internal /rest/dev-status API (Atlassian marks it
	// unstable) and adds per-issue requests. Built-in / issuetap always
	// fetches regardless of this flag (GDK-536): the panel is local.
	DevStatus bool `json:"devStatus,omitempty"`

	// Locale is the display-name language of a built-in workspace's
	// origin ("" | en | ko | ja | de; "" and "en" are both English,
	// GDK-597). It rides EmbeddedConfig into the embedded issuetap, so
	// status / issue-type / field-catalog names — and the agent alias
	// dictionary (GDK-593) — follow it; priority names stay English, like
	// a live Cloud site. A connected workspace ignores it: there the
	// language is the Atlassian account's, not ours.
	Locale string `json:"locale,omitempty"`

	// DefaultProject is the project key used when create omits --project /
	// project_key. Site-bound: never team-exported. Empty means unset.
	DefaultProject string `json:"defaultProject,omitempty"`
	// DefaultIssueTypeID is the Jira issue type id used when create omits
	// --type / issue_type. Stored as id, never a localized display name —
	// a Korean account's "Task" is "작업". Empty means unset. Display names
	// are not a fallback; see DefaultIssueType.
	DefaultIssueTypeID string `json:"defaultIssueTypeId,omitempty"`
	// DefaultIssueType is an optional display label for DefaultIssueTypeID.
	// Resolution never reads this field (names localize per account).
	DefaultIssueType string `json:"defaultIssueType,omitempty"`

	// Result of verifying the credential: when `PUT credential/` last confirmed it
	// against /myself, and who owns it. Unlike the token itself, both may be
	// returned in a response.
	TokenVerifiedAt string `json:"tokenVerifiedAt,omitempty"`
	TokenOwner      string `json:"tokenOwner,omitempty"`
	// TokenExpiresAt is when the stored API token stops working (RFC3339).
	// Set on connect / replace: the date typed from Atlassian's create
	// dialog, or verification time plus 365 days when that field was skipped.
	// There is no Atlassian API for this; the token string is opaque.
	// TokenExpirySource is "user" or "assumed" so a warning can hedge.
	TokenExpiresAt    string `json:"tokenExpiresAt,omitempty"`
	TokenExpirySource string `json:"tokenExpirySource,omitempty"`
	// AccountID is the Jira accountId returned by /myself. Used for feed
	// relevance (assignee/reporter/mention) and self-action filtering. Empty
	// when the credential was never verified against a live site.
	AccountID string `json:"account_id,omitempty"`

	// Sync field mapping (contracts/sync.md, "Field mapping").
	// Fields is the sole on-disk truth. FieldMap/EditableFields exist only as
	// unmarshal targets so LoadFor can migrate a pre-Fields config once.
	Fields []FieldSpec `json:"fields,omitempty"`
	// FieldsAppliedAt is when `gadak fields --apply` last succeeded (RFC3339,
	// millisecond UTC). Mapping lives in Fields; the timestamp lives here too
	// so a regenerated mirror does not lose "when discovery last ran".
	FieldsAppliedAt string `json:"fieldsAppliedAt,omitempty"`
	// FieldMap is a migration-only unmarshal target (alias → customfield id).
	// LoadFor converts it into Fields and clears it; new writes must not set it.
	FieldMap   map[string]string `json:"fieldMap,omitempty"`
	BodyFields []string          `json:"bodyFields,omitempty"` // ADF custom-field ids to fold into FTS
	// EditableFields is a migration-only unmarshal target (alias → field id).
	// LoadFor overlays it onto Fields (legacy wins per alias) and clears it.
	EditableFields map[string]string `json:"editableFields,omitempty"`

	// Optional surfaces carried over from the tool this was extracted from.
	Members    []Member    `json:"members,omitempty"`
	GroupRules []GroupRule `json:"groupRules,omitempty"`
	// GroupQuery is an optional read-only SELECT/WITH run when the derived
	// view is rebuilt (config or sync version change), never on a keystroke.
	// It must return two columns: issue key, group. An empty group string
	// leaves the issue unclassified; NULL (or a missing key) falls through
	// to groupRules and then the assignee's member group. Installation
	// logic belongs in this string, not in gadak source.
	GroupQuery     string             `json:"groupQuery,omitempty"`
	GroupLabels    map[string]string  `json:"groupLabels,omitempty"`
	GroupColors    map[string]string  `json:"groupColors,omitempty"`
	ProductByGroup map[string]Product `json:"productByGroup,omitempty"`
	Features       map[string]bool    `json:"features,omitempty"` // feed/deploy/qa/teamGroups
	QaDashboardURL string             `json:"qaDashboardUrl,omitempty"`

	StaleThresholdHours int `json:"staleThresholdHours,omitempty"` // 0 = the client default (72)

	// AttachmentCacheMB caps the on-disk attachment byte cache. 0 = package
	// default (512 MB); a negative value is treated as 0.
	AttachmentCacheMB int `json:"attachmentCacheMB,omitempty"`
	// AttachmentMaxMB caps one upload to a built-in origin, and the largest
	// file the byte cache will keep. 0 = the defaults; negative = no cap
	// at all, for someone who knows their own disk. A hard-coded
	// ceiling was wrong in both directions — too low for a workspace whose
	// largest file is 884 MiB, too high for a machine someone else can
	// reach over a tailnet — so it is settings, not a constant (GDK-1617).
	AttachmentMaxMB int `json:"attachmentMaxMB,omitempty"`

	// Sync periods in seconds. 0 means use DefaultSyncIntervalSec /
	// DefaultReconcileIntervalSec. Watch re-reads config on each cycle when
	// opts.Reload is set (serve, desktop, and workspace all pass config.Load),
	// so a change applies on the next tick without restarting the process.
	SyncIntervalSec      int `json:"syncIntervalSec,omitempty"`
	ReconcileIntervalSec int `json:"reconcileIntervalSec,omitempty"`

	// Notify enables OS desktop notifications from the sync watch loop after
	// new personal-feed events. Default true when absent; set false to opt out.
	// Pointer so omitempty can distinguish "unset" from explicit false.
	Notify *bool `json:"notify,omitempty"`

	// Appearance is the look of the web/desktop UI. Nil (or empty Theme) means
	// "system" and is not written — the default is not persisted. A pointer so
	// encoding/json omitempty can drop the block; a zero struct would write {}.
	Appearance *Appearance `json:"appearance,omitempty"`

	// UI is the user color-override block (GDK-786/791): token overrides,
	// per-palette overlays, and per-data-key inks. Nil means nothing is
	// overridden and is not written. See uitokens.go for the write contract.
	UI *UIConfig `json:"ui,omitempty"`

	// Actor is the workspace-default acting identity for agent writes to an
	// issuetap origin (GDK-586): the X-Issuetap-Actor slug (the origin
	// accountId, verbatim) plus an optional display name. Nil or empty slug
	// means unset; GADAK_ACTOR wins over it and Claude Code is auto-detected
	// when neither is set (internal/config/actor.go ResolveActor). Nil blocks
	// are not written.
	Actor *ActorConfig `json:"actor,omitempty"`

	// Terminal is the terminal behavior block (GDK-896): which shell a
	// session runs, where it starts, and how the pane renders. Nil means
	// every default and is not written — zero-value = defaults, so
	// existing configs are untouched and no migration exists. Style
	// (font family, size, line height) is deliberately absent: it stays
	// token-owned in ui.tokens.type.terminal.
	Terminal *TerminalConfig `json:"terminal,omitempty"`

	// Memory is the agent-memory pointer: the wiki space `memory add`
	// writes to and `memory search` scopes to. Memory is pages — there is
	// no second write path — so this is a space key, not a new store. Nil
	// means "not chosen": built-in falls back to its seeded space at the
	// verb, connected refuses rather than guess a team-visible space (the
	// fallback sentence lives in cmd; the seeded key belongs to origin,
	// which config cannot import without a cycle).
	Memory *MemoryConfig `json:"memory,omitempty"`

	// Retro is the retrospective tunables block (the --session-gap flag's
	// guide-based default, user-settable). Nil means every default.
	Retro *RetroConfig `json:"retro,omitempty"`

	// Serve is this machine's serve-surface block (GDK-1966): origins whose
	// DNS name the serve answers. Nil means none — the rebinding guard
	// refuses every DNS name, exactly as before this block existed. The
	// Tailscale MagicDNS name is probed at serve start and never stored.
	Serve *ServeConfig `json:"serve,omitempty"`

	// Confluence, when non-nil, enables the wiki-page mirror (second source).
	// Spaces empty means every *global* space — not every space the account can
	// see, which is what this comment used to claim and what a warning written
	// from it went on to tell users. Cloud gives each person a personal space,
	// so an unfiltered listing is mostly noise; personal spaces are mirrored
	// only when named here. The rule itself lives in internal/sync/confluence.go.
	Confluence *ConfluenceConfig `json:"confluence,omitempty"`

	// Linear, when non-nil, enables the Linear issue mirror (third source,
	// writes go through too since 0.16.1, GDK-263 opened the reads). Unlike Confluence it carries its own credential:
	// APIKey is a Linear personal API key and gets the same article-8
	// treatment as Token — never a log line, a snapshot, or a team export
	// (teamconfig classifies the whole block never-export).
	Linear *LinearConfig `json:"linear,omitempty"`
	// contains filtered or unexported fields
}

Config is the on-disk profile document (~/.gadak/config.json, or ~/.gadak/profiles/<name>/config.json). Credentials share this file with site settings but never reach the database, a log, or a snapshot; the file is written 0600.

func Load

func Load() (*Config, error)

Load returns an empty Config when the file does not exist; that is not an error.

func LoadFor

func LoadFor(profile string) (*Config, error)

LoadFor reads config.json for the named profile. Missing file returns an empty Config with dir set (not an error), matching Load's convention.

LoadFor is the single owner of the field-mapping rewrite rule: leftover fieldMap/editableFields are always normalized in memory so callers never see the legacy shape. A failed Save is a stderr warning, not a load error — a read-only home must still serve (the rewrite is a convenience, not a precondition). Callers (serve, desktop, MCP, status) must not re-implement this tolerate-the-write-failure rule.

func (*Config) ActorTrailerEnabled added in v0.21.0

func (c *Config) ActorTrailerEnabled() bool

ActorTrailerEnabled is the actor.trailer switch: true unless explicitly false. Nil-safe — a config that failed to load keeps the default.

func (*Config) ApplyTokenExpiry added in v0.14.2

func (c *Config) ApplyTokenExpiry(userRaw, verifiedAt string) error

ApplyTokenExpiry writes TokenExpiresAt and TokenExpirySource. A non-empty userRaw is source "user". An empty userRaw with a parseable verifiedAt assumes verifiedAt + 365 days. Empty userRaw and no verifiedAt leaves the fields untouched (offline init must not invent a date).

func (*Config) ApplyTokenExpiryIfNeeded added in v0.14.2

func (c *Config) ApplyTokenExpiryIfNeeded(userRaw, verifiedAt string, tokenReplaced bool) error

ApplyTokenExpiryIfNeeded is the init path: do not reset an existing date when the token was kept and the user did not supply a new one. Connect and replace-token always call ApplyTokenExpiry (they always store a token).

func (*Config) ApplyVerifiedIdentity added in v0.13.0

func (c *Config) ApplyVerifiedIdentity(accountID, displayName, verifiedAt string)

ApplyVerifiedIdentity stamps the three fields a successful Jira /myself call produces. CLI init uses this; the server onboarding path writes the same keys inline (internal/server/onboarding.go, write.go) — that package is outside this change's file boundary.

func (*Config) ClearTokenExpiry added in v0.14.2

func (c *Config) ClearTokenExpiry()

ClearTokenExpiry drops the stored date. Called when the credential is deleted.

func (*Config) CustomFieldsStatus added in v0.17.0

func (c *Config) CustomFieldsStatus() map[string]any

CustomFieldsStatus is the object `gadak status --json` and MCP gadak_status emit for field-mapping visibility (GDK-522). mapped is the effective spec count (FieldSpecs, so a leftover fieldMap still counts). applied_at is omitted when discovery has never been recorded. Does not scan the mirror.

func (*Config) Directory added in v0.16.0

func (c *Config) Directory() string

Directory is the profile directory this Config was loaded from (LoadFor). Empty on a Config that was never loaded.

func (*Config) EffectiveLocale added in v0.17.0

func (c *Config) EffectiveLocale() string

EffectiveLocale is the origin's display-name language (GDK-597). Empty on disk means English. Only a built-in workspace consumes it; see Locale.

func (*Config) EffectiveReconcileIntervalSec

func (c *Config) EffectiveReconcileIntervalSec() int

EffectiveReconcileIntervalSec returns the reconcile interval Watch should use.

func (*Config) EffectiveRetroSessionGap added in v0.21.0

func (c *Config) EffectiveRetroSessionGap() string

EffectiveRetroSessionGap is the session-split gap retro runs with when nothing more specific was asked: the stored retro.sessionGap, else DefaultRetroSessionGap. Nil-safe.

func (*Config) EffectiveSyncIntervalSec

func (c *Config) EffectiveSyncIntervalSec() int

EffectiveSyncIntervalSec returns the interval Watch should use.

func (*Config) EffectiveTerminal added in v0.19.0

func (c *Config) EffectiveTerminal() TerminalConfig

EffectiveTerminal resolves the terminal behavior block with defaults (GDK-896). Nil block (or nil Config) reads as every default, so an untouched config and a fresh one answer identically.

func (*Config) EffectiveTerminalAppearance added in v0.20.0

func (c *Config) EffectiveTerminalAppearance() string

EffectiveTerminalAppearance is the terminal dock's appearance with the default filled: "dark" unless the block says "follow" (GDK-1357). A stored value that is neither — a hand-edited config.json — reads as dark too, the way the web parses it; handing the raw string on made the theme picker echo it back on its next PUT and take a 400 for a field it never touched (v0.20 audit, GDK-1363).

func (*Config) EffectiveTheme added in v0.15.2

func (c *Config) EffectiveTheme() string

EffectiveTheme is the UI theme id. Empty on disk means "system".

func (*Config) FieldSpecs

func (c *Config) FieldSpecs() []FieldSpec

FieldSpecs returns the effective field specs. After LoadFor, this is Fields. In-memory configs that never went through LoadFor (tests, settings PUT) may still carry only FieldMap; synthesize the same Label/Role defaults the migration writes so those callers keep working until they switch.

func (*Config) HasAtlassianCredential added in v0.17.0

func (c *Config) HasAtlassianCredential() bool

HasAtlassianCredential reports whether Jira-family origin writes are possible: builtIn, site+email+token, or a pairing remote-origin.json. Linear's key is a different origin and is not counted here — callers that mean "can I talk to Jira / Confluence / issuetap" use this, not HasCredential.

func (*Config) HasBuiltInOrigin added in v0.22.0

func (c *Config) HasBuiltInOrigin() bool

HasBuiltInOrigin is the pre-split name for HasInProcessTracker. Prefer the new name: "built-in" reads like an origin-type question, which this is not — OriginType() == OriginGadak is the which-tracker question and answers true for a paired workspace, where this answers false. The old name is kept for the existing call sites (44 non-test at the GDK-1793 audit, almost all genuine in-process questions); do not add new ones.

func (*Config) HasCredential

func (c *Config) HasCredential() bool

HasCredential reports whether writes and the attachment proxy are possible. A built-in workspace has no site token; writes still go through the in-process origin, so it reports true. A connected workspace still requires site+email+token — that gate is not weakened. A Linear API key also counts: Linear writes are possible, so the workspace is configured. Jira-only callers that must not treat a Linear key as a site token use HasAtlassianCredential.

func (*Config) HasInProcessTracker added in v0.22.0

func (c *Config) HasInProcessTracker() bool

HasInProcessTracker reports a workspace whose stored kind says its origin is gadak's own tracker (issuetap), held on this machine. That is one question, and callers keep arriving here with the other two:

  • "which tracker is the origin?" is OriginType() == OriginGadak. A paired workspace answers true there and false here — its origin is the same tracker, one machine away. Gating a verb on this method refuses paired workspaces that should proceed (GDK-1793: project create refused a paired workspace and blamed Jira).
  • "how is the origin reached?" is Transport(). Note it is not simply this method's inverse: a home machine that minted a pairing gate keeps its `_home` routing token in remote-origin.json, which isPaired reads, so Transport() can answer remote while the tracker — and this method — stay true to this machine.

Mount, seed, persist, and advertise decisions ask exactly this; the which-tracker decisions must not.

func (*Config) HasLinearCredential added in v0.17.0

func (c *Config) HasLinearCredential() bool

HasLinearCredential reports whether Linear origin writes are possible: a linear block with an API key. Presence of an empty block is not a credential — origin.Linear still refuses a missing key.

func (*Config) HasOrigin added in v0.19.0

func (c *Config) HasOrigin() bool

HasOrigin reports whether this profile names a workspace at all — a built-in kind, any Atlassian credential field (a partial site/email/ token counts: that is a real workspace whose credential is incomplete, not a missing workspace), a Linear key, or a pairing remote. It is the empty-home gate write verbs fold onto (GDK-943): !HasOrigin answers ErrNotConfigured, while a workspace that merely lacks its credential keeps the verb's connected dialect (origin's errNeedCredential and the built-in-only refusals). HasCredential stays the "can I write" question; this is the "is there anything to write to" question.

func (*Config) MemorySpace added in v0.19.0

func (c *Config) MemorySpace() string

MemorySpace is the configured agent-memory space key, trimmed; empty when unset. The built-in fallback does not live here — the seeded key belongs to internal/origin, which imports this package, so the verbs resolve it (cmd/gadak/memory.go memorySpace).

func (c *Config) MirrorsDevLinks() bool

MirrorsDevLinks reports whether this workspace's sync fills the dev_links table at all. It is the single owner of that question (GDK-1496): sync asks it to decide whether to fetch, and doctor/status ask it to tell an empty table apart from a table that was never filled.

gadak's own tracker — built-in or paired — always mirrors the development panel: the read is in-process or one hop, and the DevStatus flag must not drain it (GDK-536). A connected Jira is opt-in, because the fetch goes to Atlassian's internal /rest/dev-status API and costs a request per issue. Linear has no development panel, so it is never on.

func (*Config) NormalizeLegacyFields added in v0.15.0

func (c *Config) NormalizeLegacyFields() (changed bool, shape string)

NormalizeLegacyFields converts leftover FieldMap/EditableFields into Fields using FieldSpecs() synthesis plus the EditableFields overlay (legacy wins per alias) and clears the legacy maps. No disk write — LoadFor persists. shape names the keys that were present, for the rewrite log line.

func (*Config) NotifyEnabled

func (c *Config) NotifyEnabled() bool

NotifyEnabled is true unless the user set notify: false. Absent means on.

func (*Config) OriginType added in v0.19.3

func (c *Config) OriginType() string

OriginType is OriginJira, OriginJiraServer, OriginLinear, or OriginGadak — which tracker this workspace writes through (GDK-1278, GDK-1635).

A paired workspace is OriginGadak: the origin it talks to is a gadak serve. Whether that serve in turn mirrors Jira is the home machine's business, and this side cannot see it — remote-origin.json carries an endpoint and a token, nothing about what is behind them.

func (*Config) ProfileName added in v0.17.0

func (c *Config) ProfileName() string

ProfileName is the profile this Config was loaded for (LoadFor); "" is the root profile. A Config that was never loaded also answers "" — callers that need the active profile as a fallback must check Directory() first, the way origin's profileDir does. This exists so a Config loaded for a mounted workspace carries its own identity: comparing a probe answer against the process-global Profile() routed a mounted workspace's origin calls to the primary profile's route (GDK-677).

func (*Config) ProjectMirrored added in v0.19.0

func (c *Config) ProjectMirrored(key string) bool

ProjectMirrored reports whether a write to project key may proceed: an empty list means "no explicit scope" and allows any project (GDK-467: paired workspaces carry no local Projects copy, and `gadak init --local` leaves projects null), a non-empty list is the allowlist. This is the single owner of that semantics — the REST create gate and the CLI pre-check both delegate here so the surfaces cannot split again (GDK-1034: they read the same empty list in opposite directions once).

func (*Config) Save

func (c *Config) Save() error

Save writes the file atomically with mode 0600. When c.dir is set (LoadFor), the write goes to that profile's config.json; otherwise the active Path(). The profile directory (and ~/.gadak / GADAK_HOME when writing the default profile) is created and owner-writable dirs are tightened to 0700 (fsperm.EnsurePrivateDir); chmod failures are logged only.

func (*Config) ServePublicURLs added in v0.23.0

func (c *Config) ServePublicURLs() []string

ServePublicURLs is the stored serve.publicUrls, nil-safe.

func (*Config) SyncFrozen added in v0.17.0

func (c *Config) SyncFrozen() bool

SyncFrozen is the only question the sync gate asks. Deliberately separate from HasCredential: a built-in workspace has a credential by definition (see HasCredential), and writes must keep working here.

func (*Config) TokenExpiryAt added in v0.14.2

func (c *Config) TokenExpiryAt(now time.Time) TokenExpiry

TokenExpiryAt is AssessTokenExpiry against this config and now.

func (*Config) Transport added in v0.19.3

func (c *Config) Transport() string

Transport is TransportLocal or TransportRemote — whether origin calls run in this process or cross the serve API (GDK-1278). Only gadak's own tracker can be local, and only when this machine holds it: pair the same workspace to a serve and the very same origin type becomes remote.

func (*Config) WorkspaceKind added in v0.16.0

func (c *Config) WorkspaceKind() string

WorkspaceKind is KindStandalone or KindConnected. Empty/unknown Kind is connected so an existing config.json is unchanged.

type ConfluenceConfig

type ConfluenceConfig struct {
	Spaces []string `json:"spaces,omitempty"`
}

ConfluenceConfig is the optional wiki-page source. Presence (non-nil) is the on switch; same site/email/token as Jira, REST base under /wiki.

type FieldSpec

type FieldSpec struct {
	Alias string   `json:"alias"`          // stable key: ascii slug of the name, else cf_<id>
	Label string   `json:"label"`          // Jira display name, in the account's language
	IDs   []string `json:"ids"`            // all field ids sharing the name, most-filled first
	Role  string   `json:"role"`           // body | facet | user | plain
	Kind  string   `json:"kind,omitempty"` // editor: option | multi_option | user | version_array | ""
	Auto  bool     `json:"auto,omitempty"` // discovery-owned; regenerated on re-apply
}

FieldSpec is one logical custom field. Jira creates a separate field id per board template for the same concept, so one spec can carry several ids; the sync coalesces the first filled value (measured fact: 57 of 353 custom field names on one large site map to 2+ ids).

type GroupRule

type GroupRule struct {
	Group      string   `json:"group"`
	Projects   []string `json:"projects,omitempty"`
	Labels     []string `json:"labels,omitempty"`
	Components []string `json:"components,omitempty"`
}

GroupRule classifies an issue into a group. Rules are read top-down and the first match wins. Conditions AND together; the list inside one condition ORs. An empty condition is always true. For classification that does not fit these three lists, set GroupQuery instead of growing this struct.

type LinearConfig added in v0.16.1

type LinearConfig struct {
	APIKey  string   `json:"apiKey,omitempty"`
	TeamIDs []string `json:"teamIds,omitempty"`
}

LinearConfig is the optional Linear issue source. Presence (non-nil) is the on switch, matching ConfluenceConfig. TeamIDs are Linear team uuids (never display keys — the same localization/rename hazard as Jira names); empty means every team the key can see.

type Member

type Member struct {
	Email         string `json:"email"`
	Name          string `json:"name,omitempty"`
	DisplayName   string `json:"display_name,omitempty"`
	Group         string `json:"group,omitempty"`
	Department    string `json:"department,omitempty"`
	JobRole       string `json:"job_role,omitempty"`
	JiraAccountID string `json:"jira_account_id,omitempty"`
	AvatarURL     string `json:"avatar_url,omitempty"`
}

Member is one entry of the static member directory injected through settings. It merges into bootstrap's members[], which is what gives an avatar its ring, tooltip, and team preset.

type MemoryConfig added in v0.19.0

type MemoryConfig struct {
	Space string `json:"space,omitempty"`
}

MemoryConfig is the agent-memory space pointer: one space key, the wiki space the memory verbs own. Empty Space means unset — see the Config.Memory field comment for who fills the default and who refuses.

type Product

type Product struct {
	Key   string `json:"key"`
	Label string `json:"label"`
}

Product is the product bucket a group maps to.

type ResolvedActor added in v0.17.0

type ResolvedActor struct {
	Slug   string `json:"slug"`
	Name   string `json:"name,omitempty"`
	Kind   string `json:"kind"`
	Source string `json:"source"`
}

ResolvedActor is the ladder's answer: Slug is the X-Issuetap-Actor value, Name the optional X-Issuetap-Actor-Name, Source which rung produced it, Kind agent or person (never empty once resolved — env, auto-detection, and a kindless config block are agents; only a config block that says person resolves as one, GDK-1973).

func ResolveActor added in v0.17.0

func ResolveActor(cfg *Config) (ResolvedActor, bool)

type RetroConfig added in v0.21.0

type RetroConfig struct {
	SessionGap string `json:"sessionGap,omitempty"`
}

RetroConfig is the retrospective tunables block. SessionGap is the read-gap that splits person reads into sessions, as a Go duration string ("45m"); empty means the 30m default. The parser and its bounds have one owner, retro.ParseSessionGap — every read path parses this value through it, so a stored value this package admitted still cannot split wrongly.

type ServeConfig added in v0.23.0

type ServeConfig struct {
	PublicURLs []string `json:"publicUrls,omitempty"`
}

ServeConfig is the serve-surface block in config.json. PublicURLs lists http(s) origins (scheme://host[:port], no path) whose DNS name this machine's serve answers — the stored half of --public-url, which flags supplement per run. Each name widens the rebinding guard for exactly that one Host; membership is the credential (the tailnet is the audience).

type Setting added in v0.15.2

type Setting struct {
	Path        string
	Root        string
	Description string
	Get         func(*Config) any
	Set         func(*Config, json.RawMessage) error
}

Setting is one dotted path `gadak config` may get or set. Root is the matching PUT /api/settings JSON key so a coverage test can keep the two surfaces on one schema.

func SettingByPath added in v0.15.2

func SettingByPath(path string) (Setting, bool)

SettingByPath looks up one catalog entry. Concrete ui.tokens.<axis>.<name> leaves are not enumerated in the catalog listing (that would add one row per token and bury the rest of the table); they resolve here from the four ui.tokens.<axis>.<name> templates.

func Settings added in v0.15.2

func Settings() []Setting

Settings is the editable-path catalog. Credentials are not on it.

type TerminalConfig added in v0.19.0

type TerminalConfig struct {
	Shell       string `json:"shell,omitempty"`
	WorkingDir  string `json:"workingDir,omitempty"`
	Scrollback  int    `json:"scrollback,omitempty"`
	CursorBlink bool   `json:"cursorBlink,omitempty"`
}

TerminalConfig is the terminal behavior block in config.json (GDK-896). Every zero value is a default: Shell "" = $SHELL, else /bin/sh; WorkingDir "" = the workspace work dir; Scrollback 0 = DefaultTerminalScrollback; CursorBlink false. Scrollback is lines, not bytes — the replay ring in internal/term is byte-backed; this is the pane's visible-history budget the web renderer materializes.

GDK-1078: a Renderer field went with ghostty-web (GDK-1041) — one renderer, nothing to choose. A stored "renderer" key is dropped on load (plain json.Unmarshal, no DisallowUnknownFields), so a config.json written by an older binary keeps loading.

type TokenExpiry added in v0.14.2

type TokenExpiry struct {
	State     string `json:"state"`
	DaysLeft  *int   `json:"days_left,omitempty"`
	ExpiresAt string `json:"expires_at,omitempty"`
	Source    string `json:"source,omitempty"`
	Urgent    bool   `json:"urgent,omitempty"`
	// Message is the one English warning line. Empty when there is nothing
	// to say (ok / unknown).
	Message string `json:"message,omitempty"`
}

TokenExpiry is the computed warning state for a stored API token. DaysLeft is nil when State is unknown.

func AssessTokenExpiry added in v0.14.2

func AssessTokenExpiry(now time.Time, expiresAt, source string) TokenExpiry

AssessTokenExpiry maps (now, stored expiry, source) onto a warning state. Missing or unparseable dates are unknown — there is nothing to warn from.

DaysLeft is remaining/elapsed time in whole 24h periods, truncated toward zero. now >= expiresAt is expired (including a 0-day remaining of exactly now). 15 days is still ok; 14 days is the first warning; 3 days is urgent.

type UIConfig added in v0.17.2

type UIConfig struct {
	Tokens *UITokens `json:"tokens,omitempty"`
	// TokensByTheme overlays Tokens for one palette. Keys are palette ids;
	// ids outside today's catalog are carried with a warning (theme ids are
	// an open set by design — ValidateTheme accepts any [a-z0-9-]+).
	TokensByTheme map[string]*UITokens `json:"tokensByTheme,omitempty"`
	// DataColors is family → key → hex. Families: label, type, status.
	DataColors map[string]map[string]string `json:"dataColors,omitempty"`
}

UIConfig is the `ui` block of config.json. Nil means "nothing overridden" and is not written.

type UITokens added in v0.17.2

type UITokens struct {
	Colors  map[string]string `json:"colors,omitempty"`
	Spacing map[string]string `json:"spacing,omitempty"`
	Layout  map[string]string `json:"layout,omitempty"`
	Type    map[string]string `json:"type,omitempty"`
	Fonts   map[string]string `json:"fonts,omitempty"`
}

UITokens is one token override set. Colors are palette-scoped hex overrides; the dimension axes (spacing, layout, type) are palette-agnostic CSS lengths; fonts is the string axis (GDK-896 R4) — palette-agnostic font stacks whose grammar lives in this file, not in tokencheck. None of the non-color axes ride the per-theme overlay. Values are bare token names ("accent", "row") or CSS variable names ("--color-accent", "--spacing-row") — tokencheck normalizes both for colors/dims, uiFontToken does it for fonts.

type WhoAmI added in v0.22.0

type WhoAmI struct {
	// AccountID is the origin's own id for the person (Jira accountId,
	// Linear user id). Matched first because it never changes.
	AccountID string
	// Email is the credential's email, matched case-insensitively when the
	// id is missing on one side.
	Email string
	// ActorSlug is the built-in tracker's attribution handle (ResolveActor) —
	// the identity a write is stamped with when there is no credential at all.
	ActorSlug string
}

WhoAmI is "who am I in this workspace" — the three keys every surface that answers "is this mine?" already matches on, in one struct.

There is no fourth key and no display name: names localize and collide, the same rule the status/priority columns live under. A field is empty when this workspace cannot answer it — a built-in workspace with no credential has only ActorSlug, a site that hides emails has only AccountID.

func ResolveWhoAmI added in v0.22.0

func ResolveWhoAmI(c *Config) WhoAmI

ResolveWhoAmI is the single owner of "who am I" (GDK-1438). It reads the same fields the web's GET auth/me/ answers from (server.handleMe) plus the actor slug the built-in tracker attributes writes to, so the SQL views, the web client and retro's self-match cannot disagree about the person.

The Members fallback for AccountID is handleMe's: a config written before the /myself call stamped Config.AccountID may still carry the id on the member row for its own email.

func (WhoAmI) Empty added in v0.22.0

func (w WhoAmI) Empty() bool

Empty reports whether this workspace could not answer the question at all. The identity views match nothing in that case, which is the honest answer: with no key, no row is provably mine.

Directories

Path Synopsis
Dimension-token validation (dim-token chunk 1) — the sibling of the color side of this package.
Dimension-token validation (dim-token chunk 1) — the sibling of the color side of this package.

Jump to

Keyboard shortcuts

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