Documentation
¶
Index ¶
Constants ¶
const ( EnvToken = "DOCSGPT_TOKEN" // personal access token (dgpt_pat_…) EnvURL = "DOCSGPT_URL" // API base URL )
Environment variables consulted by the resolvers below. They let CI jobs run the CLI without a config file.
const ( TokenSourceFlag = "--token flag" TokenSourceEnv = EnvToken + " environment variable" TokenSourceConfig = "config file" )
Token sources reported by ResolveToken.
const DefaultBaseURL = "https://gptcloud.arc53.com"
const TokenPrefix = "dgpt_pat_"
TokenPrefix is the fixed prefix of a DocsGPT personal access token.
Variables ¶
This section is empty.
Functions ¶
func MigrateIfNeeded ¶
func MigrateIfNeeded() error
MigrateIfNeeded checks for old config files and migrates them.
func RedactToken ¶
RedactToken renders a credential safely for display: the first 15 characters (the dgpt_pat_ prefix plus the 6 characters the server also shows to tell tokens apart) followed by an ellipsis. Short values are fully hidden.
Types ¶
type Config ¶
type Config struct {
BaseURL string `json:"base_url"`
DefaultKey string `json:"default_key"`
Keys map[string]string `json:"keys"`
// Token is a personal access token (dgpt_pat_…) used by the account-level
// commands (whoami, agents, sources, prompts, tools) and bench agent_id
// runs. Stored by `login`, removed by `logout`.
Token string `json:"token,omitempty"`
Settings Settings `json:"settings"`
}
func DefaultConfig ¶
func DefaultConfig() Config
func (*Config) ResolveKey ¶
ResolveKey returns the API key value, with a named override taking precedence.
func (*Config) ResolveToken ¶
ResolveToken returns the personal access token and where it came from: override (the --token flag) > DOCSGPT_TOKEN > config file. Both are empty when no token is configured.
func (*Config) ResolveURL ¶
ResolveURL returns the base URL: override (the --url flag) > DOCSGPT_URL > config file > built-in default.
type Settings ¶
type Settings struct {
SendCurrentDirectory bool `json:"send_current_directory"`
SendDirectoryContents bool `json:"send_directory_contents"`
SendLastCommands bool `json:"send_last_commands"`
NumberOfLastCommands int `json:"number_of_last_commands"`
Theme string `json:"theme,omitempty"` // "auto", "dark", "light"
Banner string `json:"banner,omitempty"` // "always", "once", "never"
AutoUpdate string `json:"auto_update,omitempty"` // "on", "notify", "off"
DisableUpdateCheck bool `json:"disable_update_check,omitempty"` // legacy, superseded by auto_update
}
func (Settings) AutoUpdateMode ¶
AutoUpdateMode resolves the effective auto-update mode: "on" (stage and apply updates automatically, the default), "notify" (print a notice only), or "off". The legacy disable_update_check flag maps to "off".