Skip to content

Commit cbdacfa

Browse files
committed
🤖 Fix npm CLI bin: Add shebang and default to server mode
- Add shebang to src/main.ts so it's executable as a CLI - Auto-detect execution context: CLI vs Electron - Default to server mode when run via npm/npx (no Electron deps needed) - Preserve Electron desktop mode when launched as Electron app This makes 'npx @coder/cmux' work out of the box without requiring Electron dependencies or 'server' argument. Generated with cmux
1 parent 2ddc193 commit cbdacfa

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1+
#!/usr/bin/env node
12
/**
23
* The main CLI entrypoint for cmux.
4+
*
5+
* When run as a CLI (via npm/npx), defaults to server mode.
6+
* When run as an Electron app, runs desktop mode.
37
*/
48

5-
const isServer = process.argv.length > 2 && process.argv[2] === "server";
9+
// Check if running as CLI or Electron
10+
const isElectron = process.versions && process.versions.electron !== undefined;
11+
12+
// CLI usage: run server by default (unless --desktop flag is passed)
13+
// Electron usage: run desktop
14+
const isServer = !isElectron || process.argv.includes("--server");
615

716
if (isServer) {
817
// eslint-disable-next-line @typescript-eslint/no-require-imports

0 commit comments

Comments
 (0)