codexhome

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package codexhome resolves the location of the local Codex home directory (~/.codex) and the session storage directories inside it.

cct never modifies Codex's SQLite state DB. This package only locates directories; it does not create or write anything.

Index

Constants

View Source
const (
	// DefaultDirName is the conventional Codex home directory name under the
	// user's home directory.
	DefaultDirName = ".codex"

	// SessionsSubdir matches Codex's SESSIONS_SUBDIR constant.
	SessionsSubdir = "sessions"

	// ArchivedSessionsSubdir matches Codex's ARCHIVED_SESSIONS_SUBDIR constant.
	ArchivedSessionsSubdir = "archived_sessions"
)

Variables

This section is empty.

Functions

func RolloutName added in v0.3.0

func RolloutName(t time.Time, id string) string

RolloutName builds a Codex rollout filename of the form rollout-<YYYY-MM-DDThh-mm-ss>-<id>.jsonl for a given timestamp and session id. It matches the on-disk naming the scanner recognizes, so a synthesized session is discovered like any other.

Types

type Home

type Home struct {
	// Root is the absolute path to the Codex home directory (e.g. ~/.codex).
	Root string
	// SessionsDir is Root/sessions.
	SessionsDir string
	// ArchivedSessionsDir is Root/archived_sessions.
	ArchivedSessionsDir string
	// Source records how Root was resolved: "flag", "env", or "default".
	Source string
}

Home describes a resolved Codex home directory and its session directories. Paths are always populated (computed from Root); use the Exists helpers to check what is actually present on disk.

func Detect

func Detect(override string) (Home, error)

Detect resolves the Codex home directory using, in order of precedence:

  1. the override argument (the --codex-home CLI flag), when non-empty;
  2. the CODEX_HOME environment variable, when set;
  3. <user home>/.codex.

Detect does not require any of the paths to exist; existence reporting is the job of the doctor command. It only fails if it cannot determine a base path at all (e.g. no override, no CODEX_HOME, and no resolvable user home).

func (Home) ArchivedSessionsDirExists

func (h Home) ArchivedSessionsDirExists() bool

ArchivedSessionsDirExists reports whether the archived sessions directory exists.

func (Home) RootExists

func (h Home) RootExists() bool

RootExists reports whether the Codex home root directory exists.

func (Home) SessionsDirExists

func (h Home) SessionsDirExists() bool

SessionsDirExists reports whether the active sessions directory exists.

Jump to

Keyboard shortcuts

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