This repository was archived by the owner on Sep 30, 2026. It is now read-only.
Repository navigation
feat: add target marker to sh shims - #51
Merged
Merged
Conversation
Append a `# cmd-shim-target=<normalized-path>` comment to every generated sh shim. This lets consumers detect whether an existing shim already points at the correct target without parsing the script content. Export `isShimPointingAt(shimContent, src)` so callers can check the marker reliably, with normalized separators and full-path matching (no subdirectory false positives).
There was a problem hiding this comment.
Pull request overview
This PR adds a stable “target marker” comment to generated POSIX sh shims and exposes a helper API to detect whether an existing shim already points at a given target, enabling consumers (like pnpm) to avoid reparsing shim scripts.
Changes:
- Append
# cmd-shim-target=<normalized-path>\nto generatedshshim content. - Export
cmdShim.isShimPointingAt(shimContent, src)to check the marker. - Add unit tests for
isShimPointingAtand update existing snapshots to include the marker line.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/index.ts |
Adds marker emission to generateShShim and exports isShimPointingAt. |
test/test.js |
Adds new tests covering marker matching behavior and prefix safety. |
test/__snapshots__/test.js.snap |
Updates snapshots to include the appended marker line. |
pnpm-lock.yaml |
Updates lockfile content (currently introduces an invalid duplicated YAML document). |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
zkochan
force-pushed
the
feat/shim-target-marker
branch
from
March 26, 2026 00:34
8924459 to
2746f4a
Compare
Append a `# cmd-shim-target=<normalized-path>` comment to every generated sh shim. This lets consumers detect whether an existing shim already points at the correct target without parsing the script content. Export `isShimPointingAt(shimContent, src)` so callers can check the marker reliably, with normalized separators and full-path matching (no subdirectory false positives).
zkochan
force-pushed
the
feat/shim-target-marker
branch
from
March 26, 2026 00:37
2746f4a to
7bdf064
Compare
4 tasks done
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
# cmd-shim-target=<normalized-path>comment to every generated sh shimisShimPointingAt(shimContent, src)to check the markerThis lets consumers (e.g. pnpm's
link-bins) detect whether an existing shim already points at the correct target without parsing the script content. Path separators are normalized to/and the trailing newline ensures full-path matching (no subdirectory false positives).Needed by pnpm/pnpm#11069.
Test plan
isShimPointingAt: correct target, wrong target, subdirectory prefix