codex

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package codex implements the ToolAdapter for OpenAI Codex.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeConfig

func MergeConfig(path string, table map[string]interface{}) error

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

func MergeSection(existingTOML string, section map[string]interface{}) (string, error)

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

func RemoveConfig(path string) error

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

func RemoveSection(existingTOML string) (string, error)

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

func NewAdapter(homeDir string) *Adapter

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.

Jump to

Keyboard shortcuts

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