Conversation
chore: back-merge main into develop (post-readme-sync 2026-05-06)
- spawn npm now uses shell: true on win32 to resolve npm.cmd - assertWithinBricksDir uses path.relative() for cross-platform separator handling Fixes ENOENT and "escapes bricksDir" errors on Windows nvm4w + Codex MCP. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…malization fix(cli): support Windows for bricks:install and brick load
Apply changeset bump for Windows spawn + path normalization fix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
chore(release): apply version bump cli 2.3.1
There was a problem hiding this comment.
Pull request overview
Release sync from develop to main for @focus-mcp/cli v2.3.1, primarily addressing Windows-specific issues in brick installation (npm spawn) and brick path validation.
Changes:
- Update brick path containment checks to use
path.relative()for cross-platform separator handling. - Adjust npm invocation to use
shell: trueon Windows to resolvenpm.cmd. - Apply release metadata updates (version bump + changelog + README wording tweak).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/source/filesystem-source.ts | Switches assertWithinBricksDir() from string prefix checks to path.relative()-based containment detection. |
| src/source/filesystem-source.test.ts | Adds additional tests around assertWithinBricksDir() behavior. |
| src/adapters/npm-installer-adapter.ts | Changes npm spawn options to enable shell on Windows. |
| src/adapters/npm-installer-adapter.test.ts | Adds tests asserting platform-specific shell behavior for npm spawn. |
| README.md | Minor wording tweak (“official bricks”). |
| package.json | Bumps package version to 2.3.1. |
| CHANGELOG.md | Adds 2.3.1 release notes for the Windows fixes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+42
to
44
| const rel = relative(realBricksDir, resolvedPath); | ||
| if (rel !== '' && (rel.startsWith('..') || isAbsolute(rel))) { | ||
| throw new Error(`Resolved path "${resolvedPath}" escapes bricksDir "${realBricksDir}"`); |
Comment on lines
60
to
66
| const child = spawn('npm', args, { | ||
| stdio: ['ignore', 'pipe', 'pipe'], | ||
| shell: false, | ||
| // On Windows, `npm` resolves to `npm.cmd` (a batch script) which | ||
| // requires a shell to execute. On POSIX `npm` is a direct binary, | ||
| // so we keep `shell: false` to avoid shell-spawn overhead. | ||
| shell: process.platform === 'win32', | ||
| }); |
Comment on lines
+271
to
+305
| describe('runNpm cross-platform shell behaviour', () => { | ||
| it('uses shell: true on Windows (resolves npm.cmd batch script)', async () => { | ||
| const platformSpy = vi.spyOn(process, 'platform', 'get').mockReturnValue('win32'); | ||
| vi.mocked(mkdir).mockResolvedValue(undefined); | ||
| vi.mocked(spawn).mockReturnValue( | ||
| makeChildProcess(0) as unknown as ReturnType<typeof spawn>, | ||
| ); | ||
|
|
||
| await adapter.npmInstall('@focus-mcp/brick-echo', '1.0.0'); | ||
|
|
||
| expect(spawn).toHaveBeenCalledWith( | ||
| 'npm', | ||
| expect.any(Array), | ||
| expect.objectContaining({ shell: true }), | ||
| ); | ||
| platformSpy.mockRestore(); | ||
| }); | ||
|
|
||
| it('uses shell: false on Linux (direct binary, no shell overhead)', async () => { | ||
| const platformSpy = vi.spyOn(process, 'platform', 'get').mockReturnValue('linux'); | ||
| vi.mocked(mkdir).mockResolvedValue(undefined); | ||
| vi.mocked(spawn).mockReturnValue( | ||
| makeChildProcess(0) as unknown as ReturnType<typeof spawn>, | ||
| ); | ||
|
|
||
| await adapter.npmInstall('@focus-mcp/brick-echo', '1.0.0'); | ||
|
|
||
| expect(spawn).toHaveBeenCalledWith( | ||
| 'npm', | ||
| expect.any(Array), | ||
| expect.objectContaining({ shell: false }), | ||
| ); | ||
| platformSpy.mockRestore(); | ||
| }); | ||
|
|
3 tasks
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
Release cli@2.3.1 — fix 2 bugs Windows (spawn npm ENOENT + path normalization).
Contenu
Test plan
v2.3.1créé par changesets/actionBug report user
🤖 Generated with Claude Code