@jiawang1209/codex-hud 0.1.7 → 0.1.9
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.
- package/CHANGELOG.md +1 -0
- package/README.md +45 -46
- package/dist/native-runner.d.ts +2 -1
- package/dist/native-runner.js +12 -5
- package/dist/native-runner.js.map +1 -1
- package/dist/sources/codex.d.ts +11 -3
- package/dist/sources/codex.js +54 -19
- package/dist/sources/codex.js.map +1 -1
- package/docs/installation.md +94 -17
- package/docs/native-codex-cli-patch.md +12 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
- Add Windows native shim support with `codex.cmd` and `codex-hud.cmd status` for command-backed HUD injection.
|
|
6
6
|
- Use npm's global shim directory as the default Windows shim target, with backup/restore for existing official `codex.cmd` shims.
|
|
7
7
|
- Run command-backed status lines through `cmd.exe /C` on native Windows while keeping `sh -lc` for macOS, Linux, and WSL.
|
|
8
|
+
- Fix Windows `doctor` command detection by using `where.exe`, `cmd.exe /C codex --version`, and `codex.exe` native binary defaults.
|
|
8
9
|
- Document the difference between Codex CLI built-in status-line items and the exact `codex-hud status` renderer.
|
|
9
10
|
|
|
10
11
|
## 0.1.1
|
package/README.md
CHANGED
|
@@ -77,46 +77,32 @@ Install the package:
|
|
|
77
77
|
npm install -g @jiawang1209/codex-hud
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
Then install the native HUD adapter. This is the important step that makes the normal `codex` command use the full Codex HUD footer. `codex-hud setup` is only a fallback and does not install this adapter.
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
codex-hud install
|
|
84
|
-
codex-hud doctor
|
|
85
|
-
codex
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
This is the recommended path on macOS, Linux, and Windows. The command is the same on each platform; `codex-hud install` chooses the right shim internally:
|
|
89
|
-
|
|
90
|
-
| Platform | Shim | Footer command |
|
|
82
|
+
| Environment | Shim | Footer command |
|
|
91
83
|
| --- | --- | --- |
|
|
92
|
-
| macOS/Linux | `codex` | `codex-hud status` |
|
|
93
|
-
| Windows | `codex.cmd` | `codex-hud.cmd status` |
|
|
84
|
+
| macOS/Linux/WSL | `codex` | `codex-hud status` |
|
|
85
|
+
| Windows PowerShell/CMD | `codex.cmd` | `codex-hud.cmd status` |
|
|
94
86
|
|
|
95
|
-
After
|
|
87
|
+
After `codex-hud install`, the bottom footer uses the same renderer as `codex-hud status`, so the style and rate-limit data match across macOS, Linux, WSL, and native Windows.
|
|
96
88
|
|
|
97
|
-
|
|
89
|
+
### macOS or Linux
|
|
98
90
|
|
|
99
|
-
|
|
91
|
+
Install prerequisites:
|
|
100
92
|
|
|
101
|
-
macOS
|
|
93
|
+
macOS:
|
|
102
94
|
|
|
103
95
|
```bash
|
|
104
96
|
brew install git rust tmux
|
|
105
97
|
```
|
|
106
98
|
|
|
107
|
-
Linux, Debian/Ubuntu
|
|
99
|
+
Linux, Debian/Ubuntu:
|
|
108
100
|
|
|
109
101
|
```bash
|
|
110
102
|
sudo apt install -y git cargo tmux
|
|
111
103
|
```
|
|
112
104
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
```powershell
|
|
116
|
-
winget install Git.Git Rustlang.Rustup
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Install and launch:
|
|
105
|
+
Install the native adapter and launch Codex:
|
|
120
106
|
|
|
121
107
|
```bash
|
|
122
108
|
codex-hud install
|
|
@@ -124,50 +110,63 @@ codex-hud doctor
|
|
|
124
110
|
codex
|
|
125
111
|
```
|
|
126
112
|
|
|
127
|
-
If `codex` still resolves to the official binary after install, put
|
|
113
|
+
If `codex` still resolves to the official binary after install, put `~/.local/bin` before the existing Codex binary in `PATH`.
|
|
128
114
|
|
|
129
|
-
|
|
115
|
+
### Windows PowerShell or CMD
|
|
130
116
|
|
|
131
|
-
|
|
117
|
+
Use this path when your prompt shows Windows paths such as `C:\Users\<you>\...`.
|
|
132
118
|
|
|
133
|
-
|
|
119
|
+
Install prerequisites:
|
|
120
|
+
|
|
121
|
+
```powershell
|
|
122
|
+
winget install Git.Git Rustlang.Rustup
|
|
123
|
+
```
|
|
134
124
|
|
|
135
|
-
|
|
125
|
+
Install the native adapter and launch Codex:
|
|
136
126
|
|
|
137
127
|
```powershell
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
codex
|
|
141
|
-
|
|
142
|
-
codex-hud doctor
|
|
143
|
-
codex
|
|
128
|
+
codex-hud.cmd install
|
|
129
|
+
codex-hud.cmd doctor
|
|
130
|
+
where.exe codex
|
|
131
|
+
codex.cmd
|
|
144
132
|
```
|
|
145
133
|
|
|
146
|
-
`where codex` should list the Codex HUD shim first, usually under `C:\Users\<you>\AppData\Roaming\npm\codex.cmd`.
|
|
134
|
+
`where.exe codex` should list the Codex HUD shim first, usually under `C:\Users\<you>\AppData\Roaming\npm\codex.cmd`. `codex-hud install` backs up an existing official `codex.cmd`, installs its own shim, and restores the backup during `codex-hud uninstall-shim`.
|
|
147
135
|
|
|
148
|
-
|
|
136
|
+
Do not use `codex-hud setup` for this goal. `setup` only configures Codex CLI's built-in status line and will not make `codex.cmd` use the full Codex HUD footer.
|
|
137
|
+
|
|
138
|
+
### WSL
|
|
139
|
+
|
|
140
|
+
Use this path when you are inside WSL Ubuntu/Debian and paths look like `/home/<you>/...`. Treat WSL as Linux, not as native Windows.
|
|
141
|
+
|
|
142
|
+
Install prerequisites:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
sudo apt update
|
|
146
|
+
sudo apt install -y git cargo tmux
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Install the native adapter and launch Codex:
|
|
149
150
|
|
|
150
151
|
```bash
|
|
151
|
-
npm install -g @openai/codex
|
|
152
|
-
npm install -g @jiawang1209/codex-hud
|
|
153
152
|
codex-hud install
|
|
154
153
|
which codex
|
|
155
154
|
codex-hud doctor
|
|
156
155
|
codex
|
|
157
156
|
```
|
|
158
157
|
|
|
159
|
-
`which codex` should point to the WSL/Linux shim, usually under `~/.local/bin/codex`. Do not
|
|
158
|
+
`which codex` should point to the WSL/Linux shim, usually under `~/.local/bin/codex`. Do not put the Windows `codex.cmd` path into WSL, and do not use the WSL shim from PowerShell.
|
|
160
159
|
|
|
161
160
|
## Built-In Status Line Fallback
|
|
162
161
|
|
|
163
|
-
|
|
162
|
+
Use this only if you cannot build the native adapter. It does not make `codex` use the full Codex HUD renderer.
|
|
164
163
|
|
|
165
164
|
```bash
|
|
166
165
|
codex-hud setup
|
|
167
166
|
codex
|
|
168
167
|
```
|
|
169
168
|
|
|
170
|
-
This fallback
|
|
169
|
+
This fallback configures Codex CLI's supported native status-line items. It is useful, but the style and rate-limit percentages can differ from `codex-hud status`.
|
|
171
170
|
|
|
172
171
|
## HUD Pane Mode
|
|
173
172
|
|
|
@@ -200,8 +199,8 @@ codex-hud run --terminal terminal
|
|
|
200
199
|
| `codex-hud status` | Print one HUD snapshot. |
|
|
201
200
|
| `codex-hud watch` | Refresh the HUD until interrupted. |
|
|
202
201
|
| `codex-hud run` | Launch Codex with a persistent HUD pane. |
|
|
203
|
-
| `codex-hud
|
|
204
|
-
| `codex-hud
|
|
202
|
+
| `codex-hud install` | Recommended: build the native adapter and make `codex` use the full Codex HUD footer. |
|
|
203
|
+
| `codex-hud setup` | Fallback only: configure Codex CLI's built-in status line without installing the full HUD adapter. |
|
|
205
204
|
| `codex-hud native` | Launch a patched Codex binary with command-backed HUD output. |
|
|
206
205
|
| `codex-hud doctor` | Check Codex, Node.js, shim, native adapter, and config readiness. |
|
|
207
206
|
| `codex-hud config` | Print the effective Codex HUD config. |
|
|
@@ -259,13 +258,13 @@ cd codex-hud
|
|
|
259
258
|
npm install
|
|
260
259
|
npm run build
|
|
261
260
|
npm link
|
|
262
|
-
codex-hud setup
|
|
263
261
|
```
|
|
264
262
|
|
|
265
|
-
|
|
263
|
+
Then follow the same environment-specific native install step as above:
|
|
266
264
|
|
|
267
265
|
```bash
|
|
268
266
|
codex-hud install
|
|
267
|
+
codex-hud doctor
|
|
269
268
|
codex
|
|
270
269
|
```
|
|
271
270
|
|
package/dist/native-runner.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export interface ShimOptions {
|
|
|
7
7
|
binDir?: string;
|
|
8
8
|
codexPath?: string;
|
|
9
9
|
env?: NodeJS.ProcessEnv;
|
|
10
|
+
homeDir?: string;
|
|
10
11
|
platform?: NodeJS.Platform;
|
|
11
12
|
}
|
|
12
13
|
export interface ShimResult {
|
|
@@ -20,7 +21,7 @@ export interface RemoveShimResult {
|
|
|
20
21
|
export declare function parseNativeArgs(args: string[]): NativeOptions;
|
|
21
22
|
export declare function parseShimArgs(args: string[]): ShimOptions;
|
|
22
23
|
export declare function buildNativeCodexArgs(codexArgs: string[], options?: Pick<ShimOptions, "platform">): string[];
|
|
23
|
-
export declare function resolveNativeCodexPath(explicitPath?: string): string;
|
|
24
|
+
export declare function resolveNativeCodexPath(explicitPath?: string, options?: Pick<ShimOptions, "env" | "homeDir" | "platform">): string;
|
|
24
25
|
export declare function runNativeCodex(options: NativeOptions): Promise<number>;
|
|
25
26
|
export declare function defaultShimBinDir(options?: Pick<ShimOptions, "env" | "platform">): string;
|
|
26
27
|
export declare function buildShimScript(options: {
|
package/dist/native-runner.js
CHANGED
|
@@ -47,12 +47,15 @@ export function buildNativeCodexArgs(codexArgs, options = {}) {
|
|
|
47
47
|
const statusLineConfig = isWindows(options.platform) ? WINDOWS_HUD_STATUS_LINE_CONFIG : HUD_STATUS_LINE_CONFIG;
|
|
48
48
|
return ["-c", statusLineConfig, ...codexArgs];
|
|
49
49
|
}
|
|
50
|
-
export function resolveNativeCodexPath(explicitPath) {
|
|
50
|
+
export function resolveNativeCodexPath(explicitPath, options = {}) {
|
|
51
51
|
if (explicitPath)
|
|
52
52
|
return explicitPath;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
const env = options.env ?? process.env;
|
|
54
|
+
if (env.CODEX_HUD_CODEX_PATH)
|
|
55
|
+
return env.CODEX_HUD_CODEX_PATH;
|
|
56
|
+
const platform = options.platform ?? process.platform;
|
|
57
|
+
const codexBinary = platform === "win32" ? "codex.exe" : "codex";
|
|
58
|
+
return path.join(options.homeDir ?? os.homedir(), "Desktop", "Github_repos", "openai-codex", "codex-rs", "target", "debug", codexBinary);
|
|
56
59
|
}
|
|
57
60
|
export async function runNativeCodex(options) {
|
|
58
61
|
const codexPath = resolveNativeCodexPath(options.codexPath);
|
|
@@ -94,7 +97,11 @@ export async function installCodexShim(options = {}) {
|
|
|
94
97
|
const binDir = options.binDir ?? defaultShimBinDir({ env: options.env, platform: options.platform });
|
|
95
98
|
const shimPath = path.join(binDir, isWindows(options.platform) ? "codex.cmd" : "codex");
|
|
96
99
|
const backupPath = backupShimPath(shimPath);
|
|
97
|
-
const codexPath = resolveNativeCodexPath(options.codexPath
|
|
100
|
+
const codexPath = resolveNativeCodexPath(options.codexPath, {
|
|
101
|
+
env: options.env,
|
|
102
|
+
homeDir: options.homeDir,
|
|
103
|
+
platform: options.platform,
|
|
104
|
+
});
|
|
98
105
|
const script = buildShimScript({ codexPath, platform: options.platform });
|
|
99
106
|
await mkdir(binDir, { recursive: true });
|
|
100
107
|
const existing = await readOptionalFile(shimPath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-runner.js","sourceRoot":"","sources":["../src/native-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"native-runner.js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,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,OAAe,EAAE,IAAc,EAAE,MAAyB,OAAO,CAAC,GAAG;IAC3F,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAC9D,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/sources/codex.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export interface DoctorReport {
|
|
|
32
32
|
lines: string[];
|
|
33
33
|
}
|
|
34
34
|
export interface DoctorDeps {
|
|
35
|
+
env?: NodeJS.ProcessEnv;
|
|
36
|
+
platform?: NodeJS.Platform;
|
|
35
37
|
resolveCodexPath?: () => Promise<string | undefined>;
|
|
36
38
|
readCodexVersion?: () => Promise<string | undefined>;
|
|
37
39
|
resolveCodexHudPath?: () => Promise<string | undefined>;
|
|
@@ -42,9 +44,15 @@ export interface DoctorDeps {
|
|
|
42
44
|
}
|
|
43
45
|
export declare function getCodexHome(config?: HudConfig): string;
|
|
44
46
|
export declare function readCodexInfo(config?: HudConfig): Promise<CodexInfo>;
|
|
45
|
-
export
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
export interface CommandInvocation {
|
|
48
|
+
command: string;
|
|
49
|
+
args: string[];
|
|
50
|
+
}
|
|
51
|
+
export declare function resolveCommandArgs(commandName: string, platform?: NodeJS.Platform): CommandInvocation;
|
|
52
|
+
export declare function versionCommandArgs(commandName: string, platform?: NodeJS.Platform): CommandInvocation;
|
|
53
|
+
export declare function resolveCodexPath(platform?: NodeJS.Platform): Promise<string | undefined>;
|
|
54
|
+
export declare function resolveCodexHudPath(platform?: NodeJS.Platform): Promise<string | undefined>;
|
|
55
|
+
export declare function readCodexVersion(platform?: NodeJS.Platform): Promise<string | undefined>;
|
|
48
56
|
export declare function parseCodexVersion(output: string): string | undefined;
|
|
49
57
|
export declare function parseCodexConfigText(text: string): Pick<CodexInfo, "model" | "reasoningEffort">;
|
|
50
58
|
export declare function createDoctorReport(deps?: DoctorDeps): Promise<DoctorReport>;
|
package/dist/sources/codex.js
CHANGED
|
@@ -23,33 +23,53 @@ export async function readCodexInfo(config) {
|
|
|
23
23
|
codexHome,
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
export
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
return stdout.trim() || undefined;
|
|
26
|
+
export function resolveCommandArgs(commandName, platform = process.platform) {
|
|
27
|
+
if (platform === "win32") {
|
|
28
|
+
return {
|
|
29
|
+
command: "where.exe",
|
|
30
|
+
args: [commandName],
|
|
31
|
+
};
|
|
33
32
|
}
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
return {
|
|
34
|
+
command: "sh",
|
|
35
|
+
args: ["-c", `command -v ${shellCommandName(commandName)}`],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export function versionCommandArgs(commandName, platform = process.platform) {
|
|
39
|
+
if (platform === "win32") {
|
|
40
|
+
return {
|
|
41
|
+
command: "cmd.exe",
|
|
42
|
+
args: ["/C", commandName, "--version"],
|
|
43
|
+
};
|
|
36
44
|
}
|
|
45
|
+
return {
|
|
46
|
+
command: commandName,
|
|
47
|
+
args: ["--version"],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export async function resolveCodexPath(platform = process.platform) {
|
|
51
|
+
return await resolveCommandPath("codex", platform);
|
|
52
|
+
}
|
|
53
|
+
export async function resolveCodexHudPath(platform = process.platform) {
|
|
54
|
+
return await resolveCommandPath("codex-hud", platform);
|
|
37
55
|
}
|
|
38
|
-
|
|
56
|
+
async function resolveCommandPath(commandName, platform) {
|
|
57
|
+
const invocation = resolveCommandArgs(commandName, platform);
|
|
39
58
|
try {
|
|
40
|
-
const { stdout } = await execFileAsync(
|
|
59
|
+
const { stdout } = await execFileAsync(invocation.command, invocation.args, {
|
|
41
60
|
timeout: 1000,
|
|
42
61
|
encoding: "utf8",
|
|
43
62
|
});
|
|
44
|
-
return stdout
|
|
63
|
+
return firstOutputLine(stdout);
|
|
45
64
|
}
|
|
46
65
|
catch {
|
|
47
66
|
return undefined;
|
|
48
67
|
}
|
|
49
68
|
}
|
|
50
|
-
export async function readCodexVersion() {
|
|
69
|
+
export async function readCodexVersion(platform = process.platform) {
|
|
70
|
+
const invocation = versionCommandArgs("codex", platform);
|
|
51
71
|
try {
|
|
52
|
-
const { stdout } = await execFileAsync(
|
|
72
|
+
const { stdout } = await execFileAsync(invocation.command, invocation.args, {
|
|
53
73
|
timeout: 1000,
|
|
54
74
|
encoding: "utf8",
|
|
55
75
|
});
|
|
@@ -70,16 +90,19 @@ export function parseCodexConfigText(text) {
|
|
|
70
90
|
};
|
|
71
91
|
}
|
|
72
92
|
export async function createDoctorReport(deps = {}) {
|
|
93
|
+
const platform = deps.platform ?? process.platform;
|
|
94
|
+
const env = deps.env ?? process.env;
|
|
73
95
|
const codexHome = deps.codexHome ?? getCodexHome();
|
|
74
|
-
const codexPath = await (deps.resolveCodexPath ?? resolveCodexPath)();
|
|
75
|
-
const codexHudPath = await (deps.resolveCodexHudPath ?? resolveCodexHudPath)();
|
|
76
|
-
const version = codexPath ? await (deps.readCodexVersion ?? readCodexVersion)() : undefined;
|
|
96
|
+
const codexPath = await (deps.resolveCodexPath ?? (() => resolveCodexPath(platform)))();
|
|
97
|
+
const codexHudPath = await (deps.resolveCodexHudPath ?? (() => resolveCodexHudPath(platform)))();
|
|
98
|
+
const version = codexPath ? await (deps.readCodexVersion ?? (() => readCodexVersion(platform)))() : undefined;
|
|
77
99
|
const exists = deps.pathExists ?? pathExists;
|
|
78
100
|
const homeExists = await exists(codexHome);
|
|
79
|
-
const shimPath = deps.shimPath ?? path.join(defaultShimBinDir(),
|
|
101
|
+
const shimPath = deps.shimPath ?? path.join(defaultShimBinDir({ env, platform }), platform === "win32" ? "codex.cmd" : "codex");
|
|
80
102
|
const shimText = await (deps.readTextFile ?? readOptionalText)(shimPath);
|
|
81
103
|
const shimInstalled = Boolean(shimText?.includes("codex-hud shim"));
|
|
82
|
-
const patchedCodexPath = parseShimCodexPath(shimText)
|
|
104
|
+
const patchedCodexPath = parseShimCodexPath(shimText)
|
|
105
|
+
?? resolveNativeCodexPath(undefined, { env, homeDir: nativeHomeDir(env, platform), platform });
|
|
83
106
|
const patchedCodexFound = await exists(patchedCodexPath);
|
|
84
107
|
const nativeStatusCommandConfigured = Boolean(shimText && /codex-hud(?:\.cmd)?\s+native/.test(shimText));
|
|
85
108
|
const lines = [];
|
|
@@ -155,6 +178,18 @@ function parseShimCodexPath(text) {
|
|
|
155
178
|
const match = text.match(/--codex\s+(?:"([^"]+)"|'([^']+)'|([^\s]+))/);
|
|
156
179
|
return match?.[1] ?? match?.[2] ?? match?.[3];
|
|
157
180
|
}
|
|
181
|
+
function firstOutputLine(text) {
|
|
182
|
+
return text.split(/\r?\n/).map((line) => line.trim()).find(Boolean);
|
|
183
|
+
}
|
|
184
|
+
function shellCommandName(commandName) {
|
|
185
|
+
return commandName.replace(/'/g, "'\\''");
|
|
186
|
+
}
|
|
187
|
+
function nativeHomeDir(env, platform) {
|
|
188
|
+
if (platform === "win32") {
|
|
189
|
+
return env.USERPROFILE;
|
|
190
|
+
}
|
|
191
|
+
return undefined;
|
|
192
|
+
}
|
|
158
193
|
async function readCodexConfigText(codexHome) {
|
|
159
194
|
try {
|
|
160
195
|
return await readFile(path.join(codexHome, "config.toml"), "utf8");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/sources/codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEhF,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/sources/codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEhF,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAgD1C,MAAM,UAAU,YAAY,CAAC,MAAkB;IAC7C,OAAO,MAAM,EAAE,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;AAC1F,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAAkB;IACpD,MAAM,SAAS,GAAG,YAAY,CA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rC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/docs/installation.md
CHANGED
|
@@ -2,52 +2,129 @@
|
|
|
2
2
|
|
|
3
3
|
## Recommended Native HUD
|
|
4
4
|
|
|
5
|
+
Install Codex HUD from npm:
|
|
6
|
+
|
|
5
7
|
```bash
|
|
6
8
|
npm install -g @jiawang1209/codex-hud
|
|
7
|
-
codex-hud install
|
|
8
|
-
codex
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
`codex-hud install`
|
|
11
|
+
Then run `codex-hud install`. This is the step that makes the normal `codex` command use the full Codex HUD footer. `codex-hud setup` is only a fallback and does not install the native adapter.
|
|
12
|
+
|
|
13
|
+
`codex-hud install` prepares the native bundle:
|
|
12
14
|
|
|
13
15
|
- downloads a clean Codex CLI source checkout under `~/.codex-hud/native/openai-codex`
|
|
14
16
|
- applies the bundled command-backed status-line patch
|
|
15
17
|
- builds the patched Codex binary
|
|
16
|
-
- installs a reversible
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
- installs a reversible Codex shim
|
|
19
|
+
|
|
20
|
+
## macOS or Linux
|
|
21
|
+
|
|
22
|
+
Install prerequisites:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# macOS
|
|
26
|
+
brew install git rust tmux
|
|
27
|
+
|
|
28
|
+
# Debian/Ubuntu
|
|
29
|
+
sudo apt update
|
|
30
|
+
sudo apt install -y git cargo tmux
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Install and verify:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
codex-hud install
|
|
37
|
+
codex-hud doctor
|
|
38
|
+
which codex
|
|
39
|
+
codex
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The shim is usually installed at `~/.local/bin/codex`. If `which codex` still points to the official Codex binary, put `~/.local/bin` earlier in `PATH`.
|
|
43
|
+
|
|
44
|
+
## Windows PowerShell or CMD
|
|
45
|
+
|
|
46
|
+
Use this path when your prompt shows Windows paths such as `C:\Users\<you>\...`.
|
|
47
|
+
|
|
48
|
+
Install prerequisites:
|
|
49
|
+
|
|
50
|
+
```powershell
|
|
51
|
+
winget install Git.Git Rustlang.Rustup
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Install and verify:
|
|
55
|
+
|
|
56
|
+
```powershell
|
|
57
|
+
codex-hud.cmd install
|
|
58
|
+
codex-hud.cmd doctor
|
|
59
|
+
where.exe codex
|
|
60
|
+
codex.cmd
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
On native Windows, Codex HUD writes `codex.cmd` in npm's global shim directory under `%APPDATA%\npm`. It injects `codex-hud.cmd status` so PowerShell execution policy does not block npm's `.ps1` shim.
|
|
64
|
+
|
|
65
|
+
`where.exe codex` should list the Codex HUD shim first, usually:
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
C:\Users\<you>\AppData\Roaming\npm\codex.cmd
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
If an official `codex.cmd` already exists there, Codex HUD backs it up before installing its own shim and restores the backup during:
|
|
72
|
+
|
|
73
|
+
```powershell
|
|
74
|
+
codex-hud.cmd uninstall-shim
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Do not use `codex-hud setup` when your goal is to make `codex.cmd` show the full Codex HUD footer. `setup` only configures Codex CLI's built-in status line.
|
|
78
|
+
|
|
79
|
+
## WSL
|
|
80
|
+
|
|
81
|
+
Use this path when you are inside WSL Ubuntu/Debian and paths look like `/home/<you>/...`. Treat WSL as Linux, not native Windows.
|
|
19
82
|
|
|
20
|
-
|
|
83
|
+
Install prerequisites:
|
|
21
84
|
|
|
22
|
-
|
|
85
|
+
```bash
|
|
86
|
+
sudo apt update
|
|
87
|
+
sudo apt install -y git cargo tmux
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Install and verify:
|
|
23
91
|
|
|
24
92
|
```bash
|
|
93
|
+
codex-hud install
|
|
94
|
+
which codex
|
|
25
95
|
codex-hud doctor
|
|
96
|
+
codex
|
|
26
97
|
```
|
|
27
98
|
|
|
28
|
-
The
|
|
99
|
+
The shim is usually installed at `~/.local/bin/codex`. Do not put the Windows `codex.cmd` path into WSL, and do not use the WSL shim from PowerShell.
|
|
29
100
|
|
|
30
101
|
## Custom Paths
|
|
31
102
|
|
|
103
|
+
Use custom paths when you already keep a Codex source checkout somewhere else or need a different shim directory:
|
|
104
|
+
|
|
32
105
|
```bash
|
|
33
106
|
codex-hud install --codex-source ~/src/openai-codex --bin-dir ~/.local/bin
|
|
34
107
|
```
|
|
35
108
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
Windows PowerShell example:
|
|
109
|
+
On Windows PowerShell:
|
|
39
110
|
|
|
40
111
|
```powershell
|
|
41
|
-
codex-hud install
|
|
42
|
-
where codex
|
|
112
|
+
codex-hud.cmd install --codex-source "$env:USERPROFILE\src\openai-codex" --bin-dir "$env:APPDATA\npm"
|
|
43
113
|
```
|
|
44
114
|
|
|
45
|
-
|
|
115
|
+
## Fallbacks
|
|
46
116
|
|
|
47
|
-
|
|
117
|
+
Use `codex-hud run` if you want an external HUD pane and do not need native in-window footer integration:
|
|
48
118
|
|
|
49
119
|
```bash
|
|
50
120
|
codex-hud run
|
|
51
121
|
```
|
|
52
122
|
|
|
53
|
-
|
|
123
|
+
Use `codex-hud setup` only if you cannot build the native adapter and want Codex CLI's built-in status-line items:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
codex-hud setup
|
|
127
|
+
codex
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
This fallback does not use the full Codex HUD renderer, so the style and rate-limit percentages can differ from `codex-hud status`.
|
|
@@ -29,6 +29,12 @@ The patched binary is:
|
|
|
29
29
|
/Users/liuyue/Desktop/Github_repos/openai-codex/codex-rs/target/debug/codex
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
On native Windows, the patched binary is:
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
C:\Users\<you>\Desktop\Github_repos\openai-codex\codex-rs\target\debug\codex.exe
|
|
36
|
+
```
|
|
37
|
+
|
|
32
38
|
## Try it
|
|
33
39
|
|
|
34
40
|
Use a command-backed status line override when launching the patched binary:
|
|
@@ -38,6 +44,12 @@ Use a command-backed status line override when launching the patched binary:
|
|
|
38
44
|
-c 'tui.status_line=["command: codex-hud status"]'
|
|
39
45
|
```
|
|
40
46
|
|
|
47
|
+
On native Windows PowerShell/CMD, use the `.exe` binary and the `.cmd` HUD command:
|
|
48
|
+
|
|
49
|
+
```powershell
|
|
50
|
+
codex.exe -c 'tui.status_line=["command: codex-hud.cmd status"]'
|
|
51
|
+
```
|
|
52
|
+
|
|
41
53
|
For a persistent local test, add this to `~/.codex/config.toml` and launch the patched binary:
|
|
42
54
|
|
|
43
55
|
```toml
|
package/package.json
CHANGED