Documentation
¶
Index ¶
- Constants
- func RegisterRoutes(router *swagger.RouteGroup, handler *Handler)
- type ApplyClaudeConfigRequest
- type ApplyCodexConfigRequest
- type ApplyCodexConfigResponse
- type ApplyConfigResponse
- type ApplyOpenCodeConfigResponse
- type ClaudeConfigResponse
- type CodexConfigPreviewResponse
- type CodexConfigResponse
- type HTTPTransportConfigUpdate
- type Handler
- func (h *Handler) ApplyClaudeConfig(c *gin.Context)
- func (h *Handler) ApplyCodexConfigFromState(c *gin.Context)
- func (h *Handler) ApplyOpenCodeConfigFromState(c *gin.Context)
- func (h *Handler) GetClaudeConfig(c *gin.Context)
- func (h *Handler) GetCodexConfig(c *gin.Context)
- func (h *Handler) GetCodexConfigPreview(c *gin.Context)
- func (h *Handler) GetConfig(c *gin.Context)
- func (h *Handler) GetOpenCodeConfigPreview(c *gin.Context)
- func (h *Handler) RestoreClaudeConfig(c *gin.Context)
- func (h *Handler) RestoreCodexConfig(c *gin.Context)
- func (h *Handler) RestoreOpenCodeConfig(c *gin.Context)
- func (h *Handler) UpdateConfig(c *gin.Context)
- type OpenCodeConfigPreviewResponse
- type RestoreConfigResponse
Constants ¶
const DefaultClaudeCodeDefaultMode = agent.DefaultClaudeCodeDefaultMode
Variables ¶
This section is empty.
Functions ¶
func RegisterRoutes ¶
func RegisterRoutes(router *swagger.RouteGroup, handler *Handler)
RegisterRoutes registers all config apply routes with swagger documentation
Types ¶
type ApplyClaudeConfigRequest ¶ added in v0.260531.1
type ApplyClaudeConfigRequest struct {
InstallStatusLine bool `json:"installStatusLine,omitempty"`
Preferences *agent.ClaudeCodePrefs `json:"preferences"`
DefaultMode string `json:"defaultMode,omitempty"`
}
ApplyClaudeConfigRequest is the request body for ApplyClaudeConfig.
`preferences` is the source of truth: each field's JSON tag is the Claude Code env var it controls, and ToEnv emits exactly the map written under "env" in ~/.claude/settings.json. `installStatusLine` is orthogonal — it just toggles the statusLine stanza in settings.json.
type ApplyCodexConfigRequest ¶ added in v0.260531.1
type ApplyCodexConfigRequest struct {
Preferences *config.CodexPrefs `json:"preferences"`
WriteCatalog *bool `json:"writeCatalog"`
// AuthMode selects how ~/.codex/auth.json and the gateway credential are
// wired:
// - "" / "apikey": gateway routing, key written to auth.json (OPENAI_API_KEY).
// - "chatgpt": no gateway; exports the OAuth tokens of OAuthProviderUUID
// to auth.json so codex CLI talks directly to OpenAI. tingly-box stops
// managing the tokens after apply — codex CLI owns refresh from then on.
// - "hybrid": gateway routing WITH the key kept in config.toml's provider
// stanza (experimental_bearer_token), leaving auth.json free to hold a
// native ChatGPT login so Codex App still sees the official account.
AuthMode string `json:"authMode,omitempty"`
// OAuthProviderUUID identifies the Codex OAuth provider whose tokens
// should be exported to auth.json. Required when AuthMode == "chatgpt";
// optional when "hybrid" (omit to leave any existing auth.json untouched).
OAuthProviderUUID string `json:"oauthProviderUuid,omitempty"`
}
ApplyCodexConfigRequest is the request body for the Codex apply and preview endpoints. `preferences` is the typed, whitelisted set of Codex config.toml keys (see config.CodexPrefs). nil means "use built-in defaults". `writeCatalog` controls whether ~/.codex/tingly-model-catalog.json is written and model_catalog_json is set in config.toml. nil defaults to true.
type ApplyCodexConfigResponse ¶ added in v0.260514.1
type ApplyCodexConfigResponse struct {
Success bool `json:"success"`
ConfigResult config.ApplyResult `json:"configResult"`
AuthResult config.ApplyResult `json:"authResult"`
CatalogWritten bool `json:"catalogWritten"`
Models []string `json:"models"`
Message string `json:"message,omitempty"`
}
ApplyCodexConfigResponse is the response for ApplyCodexConfigFromState.
type ApplyConfigResponse ¶
type ApplyConfigResponse struct {
Success bool `json:"success"`
SettingsResult config.ApplyResult `json:"settingsResult"`
OnboardingResult config.ApplyResult `json:"onboardingResult"`
CreatedFiles []string `json:"createdFiles"`
UpdatedFiles []string `json:"updatedFiles"`
BackupPaths []string `json:"backupPaths"`
}
ApplyConfigResponse is the response for ApplyClaudeConfig
type ApplyOpenCodeConfigResponse ¶
type ApplyOpenCodeConfigResponse struct {
config.ApplyResult
}
ApplyOpenCodeConfigResponse is the response for ApplyOpenCodeConfigFromState
type ClaudeConfigResponse ¶ added in v0.260723.1
type ClaudeConfigResponse struct {
Success bool `json:"success"`
Exists bool `json:"exists"`
Preferences agent.ClaudeCodePrefs `json:"preferences"`
DefaultMode string `json:"defaultMode"`
InstallStatusLine bool `json:"installStatusLine"`
}
ClaudeConfigResponse returns the typed values currently persisted in the user's main ~/.claude/settings.json so the frontend can restore Apply state.
type CodexConfigPreviewResponse ¶ added in v0.260514.1
type CodexConfigPreviewResponse struct {
Success bool `json:"success"`
ConfigToml string `json:"configToml"`
AuthJson string `json:"authJson"`
CatalogJson string `json:"catalogJson,omitempty"`
Models []string `json:"models"`
Message string `json:"message,omitempty"`
}
CodexConfigPreviewResponse is the response for GetCodexConfigPreview.
type CodexConfigResponse ¶ added in v0.260801.1
type CodexConfigResponse struct {
Success bool `json:"success"`
Exists bool `json:"exists"`
Preferences config.CodexPrefs `json:"preferences"`
WriteCatalog bool `json:"writeCatalog"`
}
CodexConfigResponse returns the typed values currently persisted in the user's ~/.codex/config.toml so the frontend can restore Apply state on reopen. Routing/auth-owned fields (model, model_provider, the gateway token) are NOT returned — same safety stance as ClaudeConfigResponse. writeCatalog is inferred from the presence of model_catalog_json in config.toml.
type HTTPTransportConfigUpdate ¶ added in v0.260409.1540
type HTTPTransportConfigUpdate struct {
RespectEnvProxy *bool `json:"respect_env_proxy"` // nil = no change
GlobalProxyURL *string `json:"global_proxy_url"` // nil = no change; "" = clear
}
HTTPTransportConfigUpdate represents the update request for HTTP transport settings
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles config apply HTTP requests
func NewHandler ¶
NewHandler creates a new configapply handler
func (*Handler) ApplyClaudeConfig ¶
ApplyClaudeConfig generates and applies Claude Code configuration from system state
func (*Handler) ApplyCodexConfigFromState ¶ added in v0.260514.1
ApplyCodexConfigFromState applies the Codex CLI configuration derived from the active Codex scenario rules. Mirrors the OpenCode endpoint: it does NOT touch routing rules — those are managed via the rules UI.
func (*Handler) ApplyOpenCodeConfigFromState ¶
ApplyOpenCodeConfig generates and applies OpenCode configuration from system state
func (*Handler) GetClaudeConfig ¶ added in v0.260723.1
GetClaudeConfig reads the values previously applied to the user's main Claude Code settings so reopening the editor restores durable state.
func (*Handler) GetCodexConfig ¶ added in v0.260801.1
GetCodexConfig reads the values previously applied to the user's ~/.codex/config.toml so reopening the editor restores durable state. Routing/auth fields are not returned (see CodexConfigResponse).
func (*Handler) GetCodexConfigPreview ¶ added in v0.260514.1
GetCodexConfigPreview returns the TOML/JSON that ApplyCodexConfigFromState would write to a fresh file. The real apply still merges into any existing ~/.codex/config.toml; this preview just shows the managed slice.
func (*Handler) GetConfig ¶ added in v0.260409.1540
GetConfig returns the current system configuration Only returns settings that are safe to expose to the UI
func (*Handler) GetOpenCodeConfigPreview ¶
GetOpenCodeConfigPreview generates OpenCode configuration preview from system state This endpoint returns the config JSON for display purposes without applying it
func (*Handler) RestoreClaudeConfig ¶ added in v0.260507.1
RestoreClaudeConfig rolls back Claude Code config files to their most recent backup. Mirrors the CLI 'agent restore claude-code' flow.
func (*Handler) RestoreCodexConfig ¶ added in v0.260514.1
RestoreCodexConfig rolls back Codex config files to their most recent backup.
func (*Handler) RestoreOpenCodeConfig ¶ added in v0.260507.1
RestoreOpenCodeConfig rolls back OpenCode config files to their most recent backup. Mirrors the CLI 'agent restore opencode' flow.
func (*Handler) UpdateConfig ¶ added in v0.260409.1540
UpdateConfig updates the system configuration Only allows updating specific safe fields
type OpenCodeConfigPreviewResponse ¶
type OpenCodeConfigPreviewResponse struct {
Success bool `json:"success"`
ConfigJSON string `json:"configJson"`
ScriptWin string `json:"scriptWindows"`
ScriptUnix string `json:"scriptUnix"`
Message string `json:"message,omitempty"`
}
OpenCodeConfigPreviewResponse is the response for GetOpenCodeConfigPreview
type RestoreConfigResponse ¶ added in v0.260507.1
type RestoreConfigResponse struct {
Success bool `json:"success"`
AgentType string `json:"agentType"`
RestoredFiles []string `json:"restoredFiles"`
PreRestoreBackups []string `json:"preRestoreBackups"`
Failures []string `json:"failures,omitempty"`
Message string `json:"message"`
}
RestoreConfigResponse is the response for the restore endpoints. It mirrors the agent.RestoreAgentResult so callers can drive UI from the same data the CLI prints.