Documentation
¶
Overview ¶
Package codex implements the ToolAdapter for OpenAI Codex.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MergeConfig ¶
MergeConfig reads the config.toml at path, merges the [sequoia] table with the provided table data, and writes the result back. A backup of the original file is saved at path+".sequoia-backup-<suffix>" with a unique timestamp suffix to avoid name collisions. A session-tracking file at path+".sequoia-session" records the suffix so RemoveConfig can locate the correct backup during uninstall.
func MergeSection ¶
MergeSection parses existingTOML into a map, sets/replaces the [sequoia] table with section data, and marshals back to a TOML string. All pre-existing keys and sections are preserved. An empty existingTOML is treated as a valid empty document.
func RemoveConfig ¶
RemoveConfig removes the [sequoia] table from the config.toml at path. If a session-tracked backup exists (path+".sequoia-session"), the original content is restored from that backup and both the backup and session files are cleaned up. Falls back to the legacy backup name for backwards compatibility. If the file does not exist, RemoveConfig returns nil.
func RemoveSection ¶
RemoveSection parses existingTOML into a map, deletes the [sequoia] table if present, and marshals back to a TOML string. All other content is preserved. If the [sequoia] table is not present, the original content is returned unchanged.
Types ¶
type Adapter ¶
type Adapter struct {
common.BaseAdapter
}
Adapter implements adapters.ToolAdapter for OpenAI Codex. It embeds common.BaseAdapter for Status and path methods. Install and Uninstall are custom because Codex uses TOML merging instead of the standard markdown/file-replace strategies.
func NewAdapter ¶
NewAdapter creates an Adapter with an overridden home directory.
func (*Adapter) Install ¶
func (a *Adapter) Install(opts adapters.InstallOpts) (err error)
Install installs Sequoia files for OpenAI Codex using TOML merging. Overrides BaseAdapter.Install because Codex uses a custom TOML merge strategy and its template data includes runtime paths.
On failure, the returned error wraps adapters.ErrInstallFailed.
func (*Adapter) Uninstall ¶
func (a *Adapter) Uninstall(opts adapters.InstallOpts) (err error)
Uninstall removes Sequoia files for OpenAI Codex. Overrides BaseAdapter.Uninstall because Codex uses TOML config merging and removes a sequoia/ subdirectory tree.
Errors from individual file removals are collected via errors.Join. On failure, the returned error wraps adapters.ErrUninstallFailed.