feat: add proxyVarSubDir option to path extenders#26
Conversation
Allow specifying a subdirectory of the proxy variable to add to PATH, e.g. PNPM_HOME/bin instead of PNPM_HOME. Supports posix (bash, fish, nushell) and windows shells. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Drop support for Node.js 16, 18, 20, and 21. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The pnpm.builder scope has been removed from Bit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Previously resolved transitively through the removed policy component. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR extends the PATH manipulation utilities to support adding a subdirectory of a proxy environment variable (e.g. $PNPM_HOME/bin / %PNPM_HOME%\bin) across POSIX shells and Windows, and wires the option through the shared addDirToEnvPath entrypoint.
Changes:
- Add a new
proxyVarSubDiroption to POSIX + Windows path extender option types and implementations. - Update POSIX shell rendering (bash/zsh/ksh/sh, fish, nushell) and Windows registry PATH entry construction to use the proxy var subdirectory when set.
- Update tests for POSIX bash path extender output with
proxyVarSubDir: 'bin'.
Reviewed changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
os/env/path-extender/path-extender.ts |
Passes the new proxyVarSubDir option through to the Windows implementation. |
os/env/path-extender-posix/path-extender-posix.ts |
Adds proxyVarSubDir and uses it when generating PATH updates for sh-compatible shells, fish, and nushell. |
os/env/path-extender-windows/path-extender-windows.ts |
Adds proxyVarSubDir and builds a %VAR%\subdir PATH entry when set. |
os/env/path-extender-posix/path-extender-posix.spec.ts |
Adds a bash coverage test for the new $PNPM_HOME/bin behavior. |
.github/workflows/ci.yml |
Changes CI Node.js matrix to only 22 and 24. |
.bitmap + builder/policy/* deletions |
Removes the builder/policy Bit component from the workspace. |
pnpm-lock.yaml |
Large lockfile rewrite, including new deprecation notices (e.g. basic-ftp@5.0.5, puppeteer@24.3.0). |
.gitignore |
Adds .claude to ignored files. |
Comments suppressed due to low confidence (1)
os/env/path-extender-posix/path-extender-posix.ts:24
- The public options interface now includes
proxyVarSubDir, but the package docs/examples (e.g.path-extender-posix.docs.mdx/path-extender-windows.docs.mdx) don’t describe this new option or its effect on PATH entries. Please update the documentation to include the new option and an example (like$PNPM_HOME/bin).
export interface AddDirToPosixEnvPathOpts {
proxyVarName?: string
proxyVarSubDir?: string
overwrite?: boolean
position?: AddingPosition
configSectionName: string
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const pathEntry = opts.proxyVarSubDir | ||
| ? `%${opts.proxyVarName}%${path.sep}${opts.proxyVarSubDir}` | ||
| : `%${opts.proxyVarName}%` | ||
| changes.push(await addToPath(registryOutput, pathEntry, opts.position)) |
There was a problem hiding this comment.
New Windows behavior (proxyVarSubDir) is introduced here but isn't covered by path-extender-windows.spec.ts. Please add a unit test asserting the Path entry becomes something like %PNPM_HOME%\\bin when proxyVarSubDir: 'bin' is provided, including both prepend/append positions.
There was a problem hiding this comment.
Windows path extender tests require registry access and can only run on Windows. Skipping for now.
There was a problem hiding this comment.
Added Windows test for proxyVarSubDir.
- Validate proxyVarSubDir to reject dangerous values (leading slashes, .., shell metacharacters) in both posix and windows path extenders - Quote pathRef in Fish shell string match when using proxyVarSubDir - Add Fish and Nushell tests for proxyVarSubDir Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
proxyVarSubDiroption to posix, windows, and main path extender interfaces$PNPM_HOME/bininstead of$PNPM_HOME)proxyVarSubDirto reject unsafe values (leading slashes,.., shell metacharacters)pnpm.builder/policycomponent (scope has been removed from Bit)@teambit/builderas explicit workspace dependencyTest plan
proxyVarSubDirproxyVarSubDirproxyVarSubDirproxyVarSubDiroption🤖 Generated with Claude Code