Skip to content

fix: resolve CLI path for tier-check conformance subprocess#175

Open
DePasqualeOrg wants to merge 1 commit intomodelcontextprotocol:mainfrom
DePasqualeOrg:fix/tier-check-npx-compat
Open

fix: resolve CLI path for tier-check conformance subprocess#175
DePasqualeOrg wants to merge 1 commit intomodelcontextprotocol:mainfrom
DePasqualeOrg:fix/tier-check-npx-compat

Conversation

@DePasqualeOrg
Copy link

Problem

tier-check shells out to run conformance tests using a relative path:

execSync(`node dist/index.js server --url ${options.serverUrl} -o ${outputDir}`, {
  cwd: process.cwd(),
  ...
});

When invoked via npx (or from any directory other than the conformance package root), process.cwd() points to the user's working directory, not the package directory. dist/index.js doesn't exist there, so the command fails silently (the error is caught on the next line), the output directory is empty, and reconcileWithExpected counts every expected scenario as a failure — producing 0% conformance scores.

Fix

Replace node dist/index.js with node "${process.argv[1]}", which resolves to the absolute path of the currently running CLI entry point regardless of working directory. Also removes the now-unnecessary cwd: process.cwd().

Testing

Ran tier-check from /tmp against my Swift SDK's conformance server.

Related

PR #168 addresses a similar issue on Windows (single-quote quoting in execSync) but retains the relative dist/index.js path, so the npx problem would persist even after that fix.

Breaking Changes

None

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling (n.a.)
  • I have added or updated documentation as needed (n.a.)

Use process.argv[1] instead of relative dist/index.js so tier-check
works when invoked via npx or from outside the package directory.
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