codex

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package codex runs the official Codex CLI as a child process.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI

type CLI struct {
	Path string
}

CLI is a located codex executable.

func Find

func Find() (*CLI, error)

Find locates codex in PATH.

func (*CLI) Login

func (c *CLI) Login(home string, opts LoginOptions, stdio Stdio) error

Login runs `codex login` with home as its CODEX_HOME, so the login cannot touch the user's real Codex directory.

func (*CLI) Logout added in v0.2.0

func (c *CLI) Logout(home string, stdio Stdio) error

Logout runs `codex logout` with home as its CODEX_HOME. The caller places the credentials to revoke in that directory, so the user's real Codex directory is never touched.

func (*CLI) RestartDaemon added in v0.2.1

func (c *CLI) RestartDaemon(home string, stdio Stdio) error

RestartDaemon runs `codex app-server daemon restart` for the daemon of the Codex home at home, which is the only supported way to make it reload auth.json. It interrupts every session running on the daemon. Codex starts a daemon if none is running, so the caller must first check that one is.

type LoginOptions

type LoginOptions struct {
	DeviceAuth  bool
	APIKey      bool
	AccessToken bool
}

LoginOptions selects the `codex login` method. At most one may be set; the zero value is the default browser login.

type Stdio

type Stdio struct {
	In  io.Reader
	Out io.Writer
	Err io.Writer
}

Stdio is what the child process is attached to.

Jump to

Keyboard shortcuts

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