Repository navigation
Conversation
imbajin
force-pushed
the
fix/symlink-cli-entrypoint
branch
from
September 23, 2026 14:02
ce881e2 to
e2c631d
Compare
In environments where execution paths or script directories involve symbolic links (e.g. macOS /tmp -> /private/tmp, /var -> /private/var, or symlinked plugin directories), path.resolve(process.argv[1]) does not match fileURLToPath(import.meta.url), causing CLI commands to silently exit. Changes: 1. Encapsulate robust isDirectCall(entryUrl, argv1 = process.argv[1]) supporting file URLs, URL objects, and raw file paths with null safety. 2. Fast-path check with path.resolve, falling back to realpathSync to resolve canonical physical paths across nested symlinks and --preserve-symlinks. 3. Added comprehensive test coverage for symlink execution, nested symlinks, and cross-platform error safety.
imbajin
force-pushed
the
fix/symlink-cli-entrypoint
branch
from
September 23, 2026 14:02
e2c631d to
80b800e
Compare
imbajin
force-pushed
the
fix/symlink-cli-entrypoint
branch
from
September 23, 2026 14:10
0e5d6d6 to
80b800e
Compare
This branch has not been deployed
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Note
Symlinked CLI paths now resolve to the same file before entrypoint detection, so
doctorexecutes instead of silently exiting.Running
guard.mjsthrough a symlink could exit successfully without doing anything. For example, on macOS the CLI path can contain/tmp, while Node resolves the module to/private/tmp. The old entrypoint check compared these path strings, skippedmain(), and produced no output.isDirectCall()keeps the direct-path fast path, then comparesrealpathSync()results when the strings differ. Symlinked invocations now reachmain();doctorreturns its JSON result.Changes
falsefor missing arguments or path-resolution errors.doctorthrough symlinks and chained symlinks, including--preserve-symlinks.Validation
npm testincodex-plugin/modeltrace-guard: 172 passed, 0 failed, 0 skipped on macOS with Node.js v22.21.1 (code commit80b800e).--preserve-symlinks-mainwere not validated in this run.