@jiawang1209/codex-hud 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/.codex-plugin/plugin.json +41 -0
  2. package/CHANGELOG.md +9 -0
  3. package/LICENSE +21 -0
  4. package/README.md +342 -0
  5. package/dist/cli.d.ts +2 -0
  6. package/dist/cli.js +206 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/codex-statusline.d.ts +9 -0
  9. package/dist/codex-statusline.js +96 -0
  10. package/dist/codex-statusline.js.map +1 -0
  11. package/dist/config.d.ts +62 -0
  12. package/dist/config.js +199 -0
  13. package/dist/config.js.map +1 -0
  14. package/dist/index.d.ts +2 -0
  15. package/dist/index.js +5 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/installer.d.ts +17 -0
  18. package/dist/installer.js +125 -0
  19. package/dist/installer.js.map +1 -0
  20. package/dist/native-runner.d.ts +28 -0
  21. package/dist/native-runner.js +122 -0
  22. package/dist/native-runner.js.map +1 -0
  23. package/dist/render.d.ts +11 -0
  24. package/dist/render.js +149 -0
  25. package/dist/render.js.map +1 -0
  26. package/dist/snapshot.d.ts +12 -0
  27. package/dist/snapshot.js +32 -0
  28. package/dist/snapshot.js.map +1 -0
  29. package/dist/sources/codex.d.ts +50 -0
  30. package/dist/sources/codex.js +182 -0
  31. package/dist/sources/codex.js.map +1 -0
  32. package/dist/sources/git.d.ts +2 -0
  33. package/dist/sources/git.js +37 -0
  34. package/dist/sources/git.js.map +1 -0
  35. package/dist/sources/session.d.ts +14 -0
  36. package/dist/sources/session.js +278 -0
  37. package/dist/sources/session.js.map +1 -0
  38. package/dist/tmux-runner.d.ts +26 -0
  39. package/dist/tmux-runner.js +203 -0
  40. package/dist/tmux-runner.js.map +1 -0
  41. package/dist/types.d.ts +42 -0
  42. package/dist/types.js +2 -0
  43. package/dist/types.js.map +1 -0
  44. package/docs/installation.md +42 -0
  45. package/docs/native-codex-cli-patch.md +55 -0
  46. package/docs/plugin-marketplace.md +42 -0
  47. package/docs/release.md +35 -0
  48. package/docs/superpowers/plans/2026-05-23-codex-hud-mvp.md +234 -0
  49. package/docs/superpowers/plans/2026-05-23-productized-native-bundle.md +431 -0
  50. package/docs/superpowers/specs/2026-05-23-codex-hud-design.md +197 -0
  51. package/docs/upstream/codex-command-backed-statusline.md +101 -0
  52. package/package.json +49 -0
  53. package/patches/codex-cli-command-statusline.patch +459 -0
  54. package/plugins/codex-hud/.codex-plugin/plugin.json +41 -0
  55. package/plugins/codex-hud/skills/codex-hud/SKILL.md +153 -0
  56. package/skills/codex-hud/SKILL.md +153 -0
@@ -0,0 +1,55 @@
1
+ # Native Codex CLI patch
2
+
3
+ `codex-hud run` can simulate a HUD in a split terminal, but a true in-window HUD needs Codex CLI itself to execute and render command-backed status output.
4
+
5
+ This repository currently tracks a local proof-of-concept patch against OpenAI Codex CLI `rust-v0.131.0` in:
6
+
7
+ ```sh
8
+ /Users/liuyue/Desktop/Github_repos/openai-codex
9
+ ```
10
+
11
+ The patch adds support for a `command:` item in `tui.status_line`. When present, Codex runs the command from the current session directory and renders stdout in the native bottom footer. Multi-line stdout is preserved, so `codex-hud status` can appear as a lower native HUD:
12
+
13
+ ```text
14
+ [gpt-5.5 medium] │ codex-hud git:(feat/codex-hud-mvp*)
15
+ Context ███░░░░░░░ 31% │ Usage ░░░░░░░░░░ 0% (0m / 5h)
16
+ Todos 0/4 │ Stdin x5, Exec active
17
+ ```
18
+
19
+ ## Build
20
+
21
+ ```sh
22
+ cd /Users/liuyue/Desktop/Github_repos/openai-codex/codex-rs
23
+ cargo build -p codex-cli
24
+ ```
25
+
26
+ The patched binary is:
27
+
28
+ ```sh
29
+ /Users/liuyue/Desktop/Github_repos/openai-codex/codex-rs/target/debug/codex
30
+ ```
31
+
32
+ ## Try it
33
+
34
+ Use a command-backed status line override when launching the patched binary:
35
+
36
+ ```sh
37
+ /Users/liuyue/Desktop/Github_repos/openai-codex/codex-rs/target/debug/codex \
38
+ -c 'tui.status_line=["command: codex-hud status"]'
39
+ ```
40
+
41
+ For a persistent local test, add this to `~/.codex/config.toml` and launch the patched binary:
42
+
43
+ ```toml
44
+ [tui]
45
+ status_line = ["command: codex-hud status"]
46
+ ```
47
+
48
+ ## Current state
49
+
50
+ - Implemented: command-backed native status line.
51
+ - Implemented: multi-line command stdout in the native bottom footer.
52
+ - Verified: `cargo test -p codex-tui status_line --lib`.
53
+ - Verified: `cargo build -p codex-cli`.
54
+
55
+ This is still a local fork patch, not an upstream Codex CLI feature. The next step is to turn the patch into a clean upstream PR proposal and keep `codex-hud run` as the fallback for users on stock Codex CLI.
@@ -0,0 +1,42 @@
1
+ # Codex Plugin Marketplace
2
+
3
+ Codex HUD ships both as an npm CLI package and as a Codex plugin wrapper. The plugin teaches Codex how to inspect, configure, and run the HUD workflow.
4
+
5
+ ## Local Marketplace
6
+
7
+ From this repository:
8
+
9
+ ```bash
10
+ python3 /Users/liuyue/.codex/skills/.system/plugin-creator/scripts/validate_plugin.py plugins/codex-hud
11
+ codex plugin marketplace add /path/to/codex-hud
12
+ codex plugin add codex-hud@codex-hud-marketplace
13
+ ```
14
+
15
+ The marketplace entry points at:
16
+
17
+ ```text
18
+ ./plugins/codex-hud
19
+ ```
20
+
21
+ ## Repository Marketplace
22
+
23
+ When this repository is published, users should be able to add the marketplace from the GitHub repository:
24
+
25
+ ```bash
26
+ codex plugin marketplace add Jiawang1209/codex-hud --ref main
27
+ codex plugin add codex-hud@codex-hud-marketplace
28
+ ```
29
+
30
+ Adjust `Jiawang1209/codex-hud` if the final GitHub owner or repository name changes.
31
+
32
+ ## Product Install From Plugin
33
+
34
+ The plugin does not replace the CLI package. It guides the user to install the product runtime:
35
+
36
+ ```bash
37
+ npm install -g @jiawang1209/codex-hud
38
+ codex-hud install
39
+ codex
40
+ ```
41
+
42
+ This keeps the executable HUD, native Codex adapter, patch, and shim in the npm product while exposing setup and diagnostics through Codex's plugin marketplace.
@@ -0,0 +1,35 @@
1
+ # Release
2
+
3
+ ## Checks
4
+
5
+ ```bash
6
+ npm run pack:check
7
+ python3 /Users/liuyue/.codex/skills/.system/plugin-creator/scripts/validate_plugin.py plugins/codex-hud
8
+ ```
9
+
10
+ The npm dry run should include:
11
+
12
+ - `dist/`
13
+ - `patches/codex-cli-command-statusline.patch`
14
+ - `.codex-plugin/`
15
+ - `plugins/codex-hud/`
16
+ - `skills/codex-hud/`
17
+ - `docs/`
18
+
19
+ ## Publish
20
+
21
+ ```bash
22
+ npm publish --access public
23
+ ```
24
+
25
+ ## After Publish
26
+
27
+ Install from the registry and verify the native bundle:
28
+
29
+ ```bash
30
+ npm install -g @jiawang1209/codex-hud
31
+ codex-hud install --dry-run
32
+ codex-hud doctor
33
+ ```
34
+
35
+ Run a real install on a clean machine before announcing the first public version.
@@ -0,0 +1,234 @@
1
+ # Codex HUD MVP Implementation Plan
2
+
3
+ > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
+
5
+ **Goal:** Build the first usable Codex HUD CLI plus a Codex plugin wrapper.
6
+
7
+ **Architecture:** The CLI collects local Codex, git, and workspace signals into a normalized `HudSnapshot`, then renders compact or expanded terminal output. The plugin wrapper packages setup guidance while the CLI remains usable independently and ready for future native statusline integration.
8
+
9
+ **Tech Stack:** TypeScript, Node.js 18+, Node built-in test runner, npm package scripts, Codex plugin manifest.
10
+
11
+ ---
12
+
13
+ ## File Structure
14
+
15
+ - `package.json`: package metadata, bin entry, build/test scripts.
16
+ - `tsconfig.json`: strict TypeScript settings targeting Node 18 ESM.
17
+ - `src/types.ts`: shared normalized HUD state interfaces.
18
+ - `src/config.ts`: defaults, config loading, validation, merge logic.
19
+ - `src/sources/git.ts`: git status collection.
20
+ - `src/sources/codex.ts`: Codex CLI/config/version detection.
21
+ - `src/snapshot.ts`: compose source data into `HudSnapshot`.
22
+ - `src/render.ts`: compact and expanded HUD renderers.
23
+ - `src/cli.ts`: command parsing and command implementations.
24
+ - `src/index.ts`: executable entrypoint.
25
+ - `tests/*.test.js`: Node test runner coverage against compiled `dist`.
26
+ - `.codex-plugin/plugin.json`: Codex plugin metadata.
27
+ - `skills/codex-hud/SKILL.md`: plugin-facing user guidance.
28
+ - `README.md`: user-facing project overview and commands.
29
+
30
+ ## Task 1: TypeScript Package Skeleton
31
+
32
+ **Files:**
33
+ - Create: `package.json`
34
+ - Create: `tsconfig.json`
35
+ - Create: `src/index.ts`
36
+ - Create: `src/cli.ts`
37
+ - Test: `tests/cli.test.js`
38
+
39
+ - [ ] **Step 1: Write the failing CLI help test**
40
+
41
+ ```js
42
+ import { test } from "node:test";
43
+ import assert from "node:assert/strict";
44
+ import { spawnSync } from "node:child_process";
45
+
46
+ test("codex-hud --help prints available commands", () => {
47
+ const result = spawnSync(process.execPath, ["dist/index.js", "--help"], {
48
+ encoding: "utf8",
49
+ });
50
+
51
+ assert.equal(result.status, 0);
52
+ assert.match(result.stdout, /codex-hud/);
53
+ assert.match(result.stdout, /status/);
54
+ assert.match(result.stdout, /doctor/);
55
+ assert.match(result.stdout, /watch/);
56
+ });
57
+ ```
58
+
59
+ - [ ] **Step 2: Run test to verify it fails**
60
+
61
+ Run: `npm test -- tests/cli.test.js`
62
+
63
+ Expected: FAIL because package scripts and `dist/index.js` do not exist yet.
64
+
65
+ - [ ] **Step 3: Add minimal package and CLI help implementation**
66
+
67
+ Create `package.json`, `tsconfig.json`, `src/index.ts`, and `src/cli.ts` with a Node ESM CLI that recognizes `--help`.
68
+
69
+ - [ ] **Step 4: Run test to verify it passes**
70
+
71
+ Run: `npm test -- tests/cli.test.js`
72
+
73
+ Expected: PASS.
74
+
75
+ - [ ] **Step 5: Commit**
76
+
77
+ ```bash
78
+ git add package.json tsconfig.json src/index.ts src/cli.ts tests/cli.test.js
79
+ git commit -m "feat: scaffold codex hud cli"
80
+ ```
81
+
82
+ ## Task 2: Config Loading
83
+
84
+ **Files:**
85
+ - Create: `src/config.ts`
86
+ - Modify: `src/cli.ts`
87
+ - Test: `tests/config.test.js`
88
+
89
+ - [ ] **Step 1: Write failing config tests**
90
+
91
+ Test defaults, invalid JSON fallback, and explicit config values for `layout`, `refreshIntervalMs`, `pathLevels`, and display toggles.
92
+
93
+ - [ ] **Step 2: Run test to verify it fails**
94
+
95
+ Run: `npm test -- tests/config.test.js`
96
+
97
+ Expected: FAIL because `dist/config.js` does not exist.
98
+
99
+ - [ ] **Step 3: Implement config defaults and validation**
100
+
101
+ Implement `DEFAULT_CONFIG`, `mergeConfig`, `loadConfig`, and `resolveConfigPath`.
102
+
103
+ - [ ] **Step 4: Run test to verify it passes**
104
+
105
+ Run: `npm test -- tests/config.test.js`
106
+
107
+ Expected: PASS.
108
+
109
+ - [ ] **Step 5: Commit**
110
+
111
+ ```bash
112
+ git add src/config.ts src/cli.ts tests/config.test.js
113
+ git commit -m "feat: add hud config loading"
114
+ ```
115
+
116
+ ## Task 3: Git Source and Renderer
117
+
118
+ **Files:**
119
+ - Create: `src/types.ts`
120
+ - Create: `src/sources/git.ts`
121
+ - Create: `src/render.ts`
122
+ - Test: `tests/render.test.js`
123
+
124
+ - [ ] **Step 1: Write failing render tests**
125
+
126
+ Test compact rendering with model, reasoning effort, project name, dirty git branch, context percentage, todo progress, and active tools.
127
+
128
+ - [ ] **Step 2: Run test to verify it fails**
129
+
130
+ Run: `npm test -- tests/render.test.js`
131
+
132
+ Expected: FAIL because renderer and types do not exist.
133
+
134
+ - [ ] **Step 3: Implement normalized types, git source, and renderer**
135
+
136
+ Create small focused modules. The renderer must accept `HudSnapshot` and not read files directly.
137
+
138
+ - [ ] **Step 4: Run test to verify it passes**
139
+
140
+ Run: `npm test -- tests/render.test.js`
141
+
142
+ Expected: PASS.
143
+
144
+ - [ ] **Step 5: Commit**
145
+
146
+ ```bash
147
+ git add src/types.ts src/sources/git.ts src/render.ts tests/render.test.js
148
+ git commit -m "feat: render codex hud snapshots"
149
+ ```
150
+
151
+ ## Task 4: Codex Source, Snapshot, Status, and Doctor
152
+
153
+ **Files:**
154
+ - Create: `src/sources/codex.ts`
155
+ - Create: `src/snapshot.ts`
156
+ - Modify: `src/cli.ts`
157
+ - Test: `tests/snapshot.test.js`
158
+ - Test: `tests/doctor.test.js`
159
+
160
+ - [ ] **Step 1: Write failing snapshot and doctor tests**
161
+
162
+ Test model/reasoning extraction from sample config text, Codex version parsing, missing Codex diagnostics, and fallback snapshot behavior.
163
+
164
+ - [ ] **Step 2: Run tests to verify they fail**
165
+
166
+ Run: `npm test -- tests/snapshot.test.js tests/doctor.test.js`
167
+
168
+ Expected: FAIL because Codex source and snapshot modules do not exist.
169
+
170
+ - [ ] **Step 3: Implement Codex source and CLI commands**
171
+
172
+ Implement `status`, `doctor`, and `config` commands. `status` should print one compact HUD line by default.
173
+
174
+ - [ ] **Step 4: Run tests to verify they pass**
175
+
176
+ Run: `npm test -- tests/snapshot.test.js tests/doctor.test.js`
177
+
178
+ Expected: PASS.
179
+
180
+ - [ ] **Step 5: Commit**
181
+
182
+ ```bash
183
+ git add src/sources/codex.ts src/snapshot.ts src/cli.ts tests/snapshot.test.js tests/doctor.test.js
184
+ git commit -m "feat: add codex status and doctor sources"
185
+ ```
186
+
187
+ ## Task 5: Watch Mode and Plugin Wrapper
188
+
189
+ **Files:**
190
+ - Modify: `src/cli.ts`
191
+ - Create: `.codex-plugin/plugin.json`
192
+ - Create: `skills/codex-hud/SKILL.md`
193
+ - Modify: `README.md`
194
+ - Test: `tests/cli.test.js`
195
+
196
+ - [ ] **Step 1: Write failing CLI tests for unknown command and config output**
197
+
198
+ Extend CLI tests to verify unknown commands exit non-zero and `config` prints JSON.
199
+
200
+ - [ ] **Step 2: Run tests to verify they fail**
201
+
202
+ Run: `npm test -- tests/cli.test.js`
203
+
204
+ Expected: FAIL until command handling is complete.
205
+
206
+ - [ ] **Step 3: Implement watch command and plugin wrapper files**
207
+
208
+ Add interval-based watch rendering with Ctrl-C cleanup. Add plugin metadata and setup skill guidance.
209
+
210
+ - [ ] **Step 4: Run full verification**
211
+
212
+ Run:
213
+
214
+ ```bash
215
+ npm test
216
+ npm run build
217
+ node dist/index.js doctor
218
+ node dist/index.js status
219
+ ```
220
+
221
+ Expected: tests pass, build succeeds, doctor prints environment diagnostics, status prints one HUD line.
222
+
223
+ - [ ] **Step 5: Commit**
224
+
225
+ ```bash
226
+ git add src/cli.ts .codex-plugin/plugin.json skills/codex-hud/SKILL.md README.md tests/cli.test.js
227
+ git commit -m "feat: add watch mode and codex plugin wrapper"
228
+ ```
229
+
230
+ ## Self-Review
231
+
232
+ - Spec coverage: CLI commands, config, normalized snapshot, rendering, diagnostics, plugin wrapper, tests, and docs are covered.
233
+ - Intentional deferral: Deep Codex session JSONL parsing is not in MVP Task 1-5; the first version leaves the source boundary ready for that work after the basic CLI is verified.
234
+ - Placeholder scan: no task depends on an undefined future API.