mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Detect Codex installs managed by pnpm (#31503)
## Why The Codex JavaScript shim currently distinguishes npm and Bun installs, but a global pnpm install falls back to npm. That causes the native CLI, `codex doctor`, and update flows to report or run npm commands even though pnpm owns the installation. pnpm also allows its global package and bin directories to differ, so `PNPM_HOME` does not reliably identify the package owner. ## What changed - detect pnpm-managed installs by finding pnpm's `node_modules/.modules.yaml` metadata from the launched JavaScript entrypoint - pass a mutually exclusive `CODEX_MANAGED_BY_PNPM` marker into the native CLI - represent pnpm in install context, doctor output, version checks, and TUI update actions without changing the existing public `InstallContext::from_exe` signature - recommend `pnpm add -g @openai/codex` for pnpm-managed installs and snapshot the rendered TUI update notice Validated with the 9-test install-context suite, the focused pnpm TUI snapshot test, and Node's syntax check for the launcher. Closes https://github.com/openai/codex/issues/10294.
This commit is contained in:
1 parent
0bbea86a6a
commit
e212cc95b0
12 files changed
+152
-50
No files matched your search
@@ -797,6 +797,10 @@ fn installation_check(show_details: bool) -> DoctorCheck {
|
||||
"managed by bun: {}",
|
||||
env::var_os("CODEX_MANAGED_BY_BUN").is_some()
|
||||
));
|
||||
details.push(format!(
|
||||
"managed by pnpm: {}",
|
||||
env::var_os("CODEX_MANAGED_BY_PNPM").is_some()
|
||||
));
|
||||
push_env_path_detail(
|
||||
&mut details,
|
||||
"managed package root",
|
||||
@@ -885,6 +889,7 @@ fn doctor_managed_by_npm(current_exe: Option<&Path>) -> bool {
|
||||
fn inherited_managed_env_for_cargo_binary(current_exe: Option<&Path>) -> bool {
|
||||
if env::var_os("CODEX_MANAGED_BY_NPM").is_none()
|
||||
&& env::var_os("CODEX_MANAGED_BY_BUN").is_none()
|
||||
&& env::var_os("CODEX_MANAGED_BY_PNPM").is_none()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -937,6 +942,9 @@ fn describe_install_context(context: &InstallContext) -> String {
|
||||
InstallMethod::Bun => {
|
||||
describe_method_with_package_layout("bun", context.package_layout.as_ref())
|
||||
}
|
||||
InstallMethod::Pnpm => {
|
||||
describe_method_with_package_layout("pnpm", context.package_layout.as_ref())
|
||||
}
|
||||
InstallMethod::Brew => {
|
||||
describe_method_with_package_layout("brew", context.package_layout.as_ref())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user