feat: add OpenAI Codex segment#7582
Open
Nick2bad4u wants to merge 5 commits into
Open
Conversation
4 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a new OpenAI Codex statusline segment + CLI command, including documentation and schema support.
Changes:
- Introduces
codexsegment implementation with local-session discovery and formatting utilities. - Adds
oh-my-posh codexcommand that can read from stdin or discover local Codex sessions. - Updates docs, sidebar navigation, and JSON schema to expose the new segment/options.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| website/sidebars.js | Adds Codex page to CLI segment docs navigation. |
| website/docs/segments/cli/codex.mdx | New documentation for the Codex segment, payload, and options. |
| website/docs/installation/prompt.mdx | Adds Codex instructions to the “Change your prompt” tab set. |
| themes/schema.json | Registers codex type and its segment options in the config schema. |
| src/shell/constants.go | Adds CODEX shell constant for statusline init. |
| src/segments/codex.go | Implements Codex segment, cache keying, parsing, and formatting. |
| src/segments/codex_status.go | Implements local JSONL session discovery and payload enrichment. |
| src/segments/ai.go | Centralizes shared AI helpers (token formatting + gauge option keys). |
| src/segments/claude.go | Removes duplicated helpers now shared in ai.go. |
| src/segments/codex_test.go | Adds unit tests for Codex parsing/formatting and enabled logic. |
| src/segments/codex_status_test.go | Adds unit tests for local session discovery behavior and errors. |
| src/config/segment_types.go | Registers the new segment type and gob types. |
| src/config/default.go | Adds default statusline config for Codex. |
| src/cli/statusline.go | Extends statusline runner to allow a fallback data source when stdin is empty. |
| src/cli/codex.go | Adds new oh-my-posh codex CLI command + discovery flags. |
| src/cli/codex_status.go | Implements Codex local discovery data source for the CLI command. |
| src/cache/cache.go | Adds a dedicated session cache key for Codex data. |
9cbfad4 to
b988f15
Compare
b988f15 to
3dabf5e
Compare
Comment on lines
+19
to
+23
| ## Sample Configuration | ||
|
|
||
| import Config from "@site/src/components/Config.js"; | ||
|
|
||
| <Config |
Comment on lines
+52
to
+57
| if len(bytes.TrimSpace(stdinData)) == 0 && dataSource != nil { | ||
| stdinData, err = dataSource(cmd) | ||
| if err != nil { | ||
| log.Error(err) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This replaces #7567 with a clean single-commit branch. The old branch accidentally picked up unrelated workflow changes from one of my local scripts, so I opened this fresh PR with only the Codex segment work.
This adds an OpenAI Codex segment and statusline command that can read Codex usage from local session transcripts. The segment supports normal Oh My Posh rendering, cache settings, templates, color/background templates, and configurable display options for model, reasoning, context, tokens, and rate-limit windows.
Validation
go test ./segments -run TestCodexgo test ./...npm run buildfromwebsite/go run . codexgo run . print primary --config <temp codex config> --plain