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 ¶
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
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 ¶
Detect resolves the Codex home directory using, in order of precedence:
- the override argument (the --codex-home CLI flag), when non-empty;
- the CODEX_HOME environment variable, when set;
- <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 ¶
ArchivedSessionsDirExists reports whether the archived sessions directory exists.
func (Home) RootExists ¶
RootExists reports whether the Codex home root directory exists.
func (Home) SessionsDirExists ¶
SessionsDirExists reports whether the active sessions directory exists.