Skip to content

fix: mirror shims in installer/script paths + extract common module#192

Merged
Sunrisepeak merged 4 commits intomainfrom
fix/project-shim-mirror-common-refactor
Mar 8, 2026
Merged

fix: mirror shims in installer/script paths + extract common module#192
Sunrisepeak merged 4 commits intomainfrom
fix/project-shim-mirror-common-refactor

Conversation

@Sunrisepeak
Copy link
Copy Markdown
Member

Summary

Follow-up to #191. Fixes two issues discovered after the initial merge:

  • installer.cppm and script.cppm bypassed cmd_use()xlings install (workspace-driven) creates shims via the installer path, not through cmd_use(). Shims were only mirrored in cmd_use(), so xlings install in project context still left global subos bin empty.
  • Duplicated mirror logic in 3 files — Extracted common::mirror_shim_to_global_bin() into a new core/common.cppm module, replacing ~30 lines of inline duplication across commands.cppm, installer.cppm, and script.cppm.
  • E2E test rewritten — Now uses xlings install (not install + use) to match real user flow, with proper global subos cleanup before test.

Changes

File Change
core/common.cppm New module with mirror_shim_to_global_bin()
core/xvm/commands.cppm Replace inline mirror logic with common::mirror_shim_to_global_bin()
core/xim/installer.cppm Add mirror call after shim creation
core/xim/libxpkg/types/script.cppm Add mirror call after shim creation
tests/e2e/project_shim_mirror_test.sh Rewrite: use xlings install, clean global subos before test

Test plan

  • E2E test project_shim_mirror_test.sh passes locally
    • Global subos bin cleaned before test (no cache interference)
    • xlings install with .xlings.json workspace triggers shim creation
    • Both project and global shims verified after install
    • npm/npx bindings verified
    • Existing global shims not overwritten
  • CI passes on Linux (E2E-05)
  • CI passes on macOS (E2E-05)

🤖 Generated with Claude Code

Sunrisepeak and others added 4 commits March 8, 2026 18:07
The initial fix only covered cmd_use(), but xlings install triggers
shim creation via installer.cppm and script.cppm which bypass cmd_use.
Also rewrites the e2e test to use `xlings install` (workspace-driven)
with proper global subos cleanup before test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move duplicated shim mirroring logic from commands.cppm, installer.cppm
and script.cppm into a reusable common::mirror_shim_to_global_bin().
Also fix installer and script paths which were missing the mirror call
(xlings install bypasses cmd_use, so shims were not mirrored).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add PowerShell version of the shim mirror test and include it in
Windows CI as E2E-05. Also add fixture index preparation step to
Windows CI workflow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Copy xlings.exe to homeDir\bin\xlings.exe (matching C++ primary
  lookup path on Windows) instead of homeDir\xlings.exe
- Replace PowerShell `trap` with try/finally to avoid spurious
  "system cannot find the path" errors on each pipeline error

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Sunrisepeak Sunrisepeak merged commit ac874b1 into main Mar 8, 2026
3 checks passed
@Sunrisepeak Sunrisepeak deleted the fix/project-shim-mirror-common-refactor branch March 8, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant