Skip to content

fix: fixed running app with npx#2

Merged
gitsad merged 2 commits intomainfrom
fix/run-cli-via-npx
Mar 13, 2026
Merged

fix: fixed running app with npx#2
gitsad merged 2 commits intomainfrom
fix/run-cli-via-npx

Conversation

@gitsad
Copy link
Contributor

@gitsad gitsad commented Mar 13, 2026

What does this PR do?

FIxed running via npx

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • CI / tooling

Packages Affected

  • @mobile-reality/mdma-cli

Note

Medium Risk
Replaces the Vite-powered dev server with a custom static HTTP server, which could change routing/asset serving behavior and affect the CLI's web UI startup. Risk is limited to local development/runtime behavior (no backend data/auth changes).

Overview
Fixes running the CLI via npx by removing the Vite dev server dependency at runtime and serving the prebuilt app-dist directly from a Node http server.

The new server includes basic MIME-type handling, SPA index.html fallback for unknown routes, and a simple path-traversal guard, and it opens the browser on startup. Also bumps @mobile-reality/mdma-cli version to 0.1.2.

Written by Cursor Bugbot for commit 16938eb. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

await server.listen();
server.printUrls();
// Keep the process alive
await new Promise(() => {});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never-resolving promise makes caller messages unreachable

Medium Severity

startDevServer ends with await new Promise(() => {}), which never resolves. In createCommand, await startDevServer(port) on line 15 therefore blocks forever, making the "Ready at http://localhost:..." and "Press Ctrl+C to stop" console messages on lines 17–18 completely unreachable. Users will never see feedback that the server is ready.

Fix in Cursor Fix in Web

const filePath = path.join(appRoot, urlPath);

// Prevent path traversal
if (!filePath.startsWith(appRoot)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Path traversal check missing trailing separator

Low Severity

The path traversal guard uses filePath.startsWith(appRoot) without appending a path separator to appRoot. A crafted URL targeting a sibling directory whose name shares the app-dist prefix (e.g., app-dist-secrets) would pass this check, since startsWith performs a pure string-prefix match. Appending path.sep to appRoot in the comparison would close this gap.

Fix in Cursor Fix in Web

@cursor
Copy link

cursor bot commented Mar 13, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@gitsad gitsad merged commit fd7857f into main Mar 13, 2026
1 check passed
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.

2 participants