Fix npx startup issue by including dist/ in published package and improving CLI detection#32
Merged
Fix npx startup issue by including dist/ in published package and improving CLI detection#32
Conversation
…tection Co-authored-by: a-25 <6087455+a-25@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Npx does not start
Fix npx startup issue by including dist/ in published package and improving CLI detection
Sep 21, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the npx ios-mcp-code-quality-server startup failure by ensuring compiled JavaScript files are included in published packages and improving CLI detection logic to handle npm binary symlinks correctly.
Key changes:
- Added
filesfield to package.json to include thedist/directory in published packages - Enhanced CLI detection logic to recognize npm binary symlinks
- Added automatic TypeScript compilation before publishing
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| package.json | Added files field to include dist/ in published package and prepublishOnly script for automatic builds |
| src/cli/index.ts | Enhanced CLI detection logic to handle npm binary symlinks and direct execution paths |
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.
The
npx ios-mcp-code-quality-servercommand was failing to start because the compiled JavaScript files were not included in the published npm package. This PR fixes the issue by addressing two key problems:Root Cause Analysis
Missing compiled files: The
package.jsondefined the binary entry point asdist/cli/index.js, but thedist/directory was not being included when the package was published to npm.CLI detection logic failure: When executed via
npxor npm binary symlinks, the CLI detection logic failed to recognize that it should run in CLI mode, causing the command to silently fail.Changes Made
Package Configuration
filesfield topackage.jsonto explicitly include thedist/directory,README.md, andLICENSEin published packagesprepublishOnlyscript to automatically build TypeScript before publishing, ensuring compiled files are always up-to-dateCLI Detection Logic
Enhanced the CLI detection in
src/cli/index.tsto properly handle npm binary symlinks:Testing Results
Both modes now work correctly as specified in the issue:
npx ios-mcp-code-quality-server --helpdisplays usage informationnpx ios-mcp-code-quality-server serverstarts the MCP server and waits for connectionsnpx ios-mcp-code-quality-server(no arguments) starts the MCP server by defaultThe fix ensures that users can successfully run
npx ios-mcp-code-quality-serverfrom any directory without needing to install the package globally.Fixes #31.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.