Fix npx MCP entrypoint - #2
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR introduces an ChangesCLI Entrypoint Detection Release
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/cli.test.ts (1)
1-1: ⚡ Quick winClean up temporary test artifacts in a
finallyblock.The test creates a temp directory/symlink but never removes it. Add deterministic cleanup to keep local and CI runs hygienic.
Proposed patch
-import { mkdtempSync, symlinkSync, writeFileSync } from 'node:fs'; +import { mkdtempSync, rmSync, symlinkSync, writeFileSync } from 'node:fs'; @@ it('recognizes npm bin symlinks as the CLI entrypoint', () => { const tempDir = mkdtempSync(join(tmpdir(), 'influship-mcp-')); const cliPath = join(tempDir, 'cli.js'); const binPath = join(tempDir, 'influship-mcp'); - writeFileSync(cliPath, ''); - symlinkSync(cliPath, binPath); - - expect(isCliEntrypoint(pathToFileURL(cliPath).href, binPath)).toBe(true); + try { + writeFileSync(cliPath, ''); + symlinkSync(cliPath, binPath); + expect(isCliEntrypoint(pathToFileURL(cliPath).href, binPath)).toBe(true); + } finally { + rmSync(tempDir, { recursive: true, force: true }); + } }); });Also applies to: 43-51
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/cli.test.ts` at line 1, The test in src/cli.test.ts creates temporary artifacts using mkdtempSync, symlinkSync, and writeFileSync but never removes them—wrap the setup and assertions inside a try/finally and in the finally block synchronously remove the symlink, files, and temp directory (use appropriate fs unlinkSync/rmdirSync or rmSync calls) to guarantee deterministic cleanup after the test; reference the temp dir variable returned by mkdtempSync and the path used with symlinkSync/writeFileSync when performing the removals.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/cli.test.ts`:
- Line 1: The test in src/cli.test.ts creates temporary artifacts using
mkdtempSync, symlinkSync, and writeFileSync but never removes them—wrap the
setup and assertions inside a try/finally and in the finally block synchronously
remove the symlink, files, and temp directory (use appropriate fs
unlinkSync/rmdirSync or rmSync calls) to guarantee deterministic cleanup after
the test; reference the temp dir variable returned by mkdtempSync and the path
used with symlinkSync/writeFileSync when performing the removals.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 01da1933-60c1-45e3-a7d5-c71571a45319
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (5)
glama.jsonpackage.jsonserver.jsonsrc/cli.test.tssrc/cli.ts
Summary
Verification
Publish note
npm publish is blocked from this local shell by npm scope permissions: registry returned 404 / no permission for @influship/mcp@0.1.2.