Documentation
¶
Overview ¶
Package registry loads the desired-state TOML (accounts, profiles, projects), validates it and syncs it into the database.
Index ¶
Constants ¶
const ( PushNone = "none" // nobody: otag never pushes PushCoordinator = "coordinator" // the project's coordinator and the human (default) PushChild = "child" // also the task's own child run )
Push policies (projects.push): who may run `otag task push`.
const FakeHarness = "fake"
FakeHarness is the scripted test/demo harness (internal/adapter/fake). It is valid in the registry but is not a CLI that doctor looks for.
Variables ¶
var Harnesses = []string{"claude", "codex", "opencode"}
Harnesses supported by otag.
var PushPolicies = []string{PushNone, PushCoordinator, PushChild}
PushPolicies lists the push values.
Functions ¶
func ValidHarness ¶
ValidHarness reports whether h may be used by an account.
Types ¶
type Account ¶
type Account struct {
Harness string `toml:"harness" json:"harness"`
ConfigDir string `toml:"config_dir" json:"config_dir,omitempty"`
Command string `toml:"command" json:"command,omitempty"`
Env map[string]string `toml:"env" json:"env,omitempty"`
// Quota tunes the quota collectors (internal/quota); nil = defaults.
Quota *AccountQuota `toml:"quota" json:"quota,omitempty"`
}
Account is a harness login/config directory; quota lives here.
type AccountQuota ¶
type AccountQuota struct {
Disabled bool `toml:"disabled" json:"disabled,omitempty"`
// OAuthUsage (claude) polls the undocumented OAuth usage endpoint with the token
// Claude Code keeps in the Keychain (read-only, never refreshed). Off by default.
OAuthUsage bool `toml:"oauth_usage" json:"oauth_usage,omitempty"`
// LiteLLMProvider (opencode) names the provider in opencode.json whose /key/info is
// read; default "litellm" or the only provider mentioning LiteLLM.
LiteLLMProvider string `toml:"litellm_provider" json:"litellm_provider,omitempty"`
}
AccountQuota is the optional [accounts.<name>.quota] table.
type Config ¶
type Config struct {
Dir string `toml:"-"`
Accounts map[string]Account `toml:"accounts"`
Profiles map[string]Profile `toml:"profiles"`
Projects []Project `toml:"-"`
// Warnings are non-fatal findings (unknown keys, missing project dirs).
Warnings []string `toml:"-"`
}
Config is the full desired state.
type Counts ¶
type Counts struct {
Added int `json:"added"`
Updated int `json:"updated"`
Unchanged int `json:"unchanged"`
Retired int `json:"retired"`
}
Counts summarizes what sync did to one table.
type Profile ¶
type Profile struct {
Account string `toml:"account" json:"account"`
Model string `toml:"model" json:"model,omitempty"`
Effort string `toml:"effort" json:"effort,omitempty"`
Mode string `toml:"mode" json:"mode"`
Tags []string `toml:"tags" json:"tags,omitempty"`
Fallback []string `toml:"fallback" json:"fallback,omitempty"`
Env map[string]string `toml:"env" json:"env,omitempty"`
Args []string `toml:"args" json:"args,omitempty"`
Description string `toml:"description" json:"description,omitempty"`
// EnvPassthrough names variables of otag's own environment a run of this profile
// gets (a trailing * matches a prefix), e.g. a LiteLLM key an OpenCode config
// reads with {env:VAR}. Runs start with a clean environment otherwise.
EnvPassthrough []string `toml:"env_passthrough" json:"env_passthrough,omitempty"`
}
Profile is account + model + effort + env + mode, with an ordered fallback list.
type ProfileRow ¶
type ProfileRow struct {
Name string `json:"name"`
Account string `json:"account"`
Harness string `json:"harness"`
Model string `json:"model"`
Effort string `json:"effort"`
Mode string `json:"mode"`
Tags []string `json:"tags"`
Fallback []string `json:"fallback"`
Description string `json:"description"`
ConfigHash string `json:"config_hash"`
}
ProfileRow is an active profile as stored in the database.
func ListProfiles ¶
ListProfiles returns active profiles, optionally only those carrying tag.
type Project ¶
type Project struct {
Name string `toml:"name"`
Path string `toml:"path"`
Prefix string `toml:"prefix"`
CoordinatorProfile string `toml:"coordinator_profile"`
DefaultProfile string `toml:"default_profile"`
ReviewProfile string `toml:"review_profile"`
Workspace string `toml:"workspace"`
Deny []string `toml:"deny"`
// Guard is the guard level of the project's runs: light (default) | strict
// (internal/guard, docs/ADAPTERS.md "Threat model").
Guard string `toml:"guard"`
// Base is the ref new task branches start from ("" = the project's HEAD); a
// remote-tracking ref (origin/dev) is fetched first.
Base string `toml:"base"`
// BranchPrefix starts every new task branch: <branch_prefix><task>. Unset:
// workspace.DefaultBranchPrefix; "" is allowed (the task id alone).
BranchPrefix string `toml:"branch_prefix"`
// Remote is where `otag task push` pushes ("" = the remote of a remote-tracking
// base, else origin).
Remote string `toml:"remote"`
// Push is who may run `otag task push`: none | coordinator (default; and the
// human) | child (also the task's own run).
Push string `toml:"push"`
// Raw holds every key of the file, including extra ones, for the config column.
Raw map[string]any `toml:"-"`
File string `toml:"-"`
}
Project is one projects/<name>.toml file.
type ProjectRow ¶
type ProjectRow struct {
ID int64 `json:"-"`
Name string `json:"name"`
Path string `json:"path"`
Prefix string `json:"prefix"`
CoordinatorProfile string `json:"coordinator_profile"`
DefaultProfile string `json:"default_profile"`
ReviewProfile string `json:"review_profile"`
WorkspaceMode string `json:"workspace_mode"`
Deny []string `json:"deny"`
Guard string `json:"guard"` // light | strict
Base string `json:"base"` // "" = the project's HEAD
BranchPrefix string `json:"branch_prefix"`
Remote string `json:"remote"` // "" = the base's remote, else origin
Push string `json:"push"` // none | coordinator | child
}
ProjectRow is an active project as stored in the database.
func ListProjects ¶
ListProjects returns active projects ordered by name.