builderos-cli 2.0.6 → 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -33,9 +33,9 @@ const VERSION = packageJson.version;
33
33
 
34
34
  // Parse command line arguments
35
35
  const args = process.argv.slice(2);
36
-
37
- // Check for MCP server command first
38
36
  const command = args[0];
37
+
38
+ // Check for MCP server command first (exit early before parsing options)
39
39
  if (command === 'mcp') {
40
40
  // Start MCP server (this will run indefinitely)
41
41
  await startMCPServer().catch((error) => {
@@ -48,12 +48,7 @@ if (command === 'mcp') {
48
48
  process.exit(0);
49
49
  }
50
50
 
51
- // Only execute main() if NOT running MCP server
52
- if (command !== 'mcp') {
53
- main();
54
- }
55
-
56
- // Default options
51
+ // Default options (needed for other commands)
57
52
  const options = {
58
53
  apiUrl: process.env.BUILDEROS_API_URL || 'http://builder-os.test',
59
54
  force: false,
@@ -123,6 +118,9 @@ Examples:
123
118
  process.exit(0);
124
119
  }
125
120
 
121
+ // Execute main for init/update commands
122
+ main();
123
+
126
124
  // Utility: Check if file exists
127
125
  async function fileExists(path) {
128
126
  try {
package/mcp-server.js CHANGED
@@ -143,7 +143,7 @@ export async function startMCPServer() {
143
143
  const server = new Server(
144
144
  {
145
145
  name: 'builderos-cli-mcp',
146
- version: '2.0.6',
146
+ version: '2.0.8',
147
147
  },
148
148
  {
149
149
  capabilities: {
@@ -211,6 +211,19 @@ export async function startMCPServer() {
211
211
 
212
212
  console.error('BuilderOS MCP Server started');
213
213
  console.error(`Connected to: ${API_URL}`);
214
+
215
+ // Keep the server running by waiting for the transport to close
216
+ // This prevents the process from exiting
217
+ return new Promise((resolve, reject) => {
218
+ transport.onclose = () => {
219
+ console.error('BuilderOS MCP Server closed');
220
+ resolve();
221
+ };
222
+ transport.onerror = (error) => {
223
+ console.error('BuilderOS MCP Server error:', error);
224
+ reject(error);
225
+ };
226
+ });
214
227
  }
215
228
 
216
229
  // Run if called directly
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "builderos-cli",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "description": "BuilderOS CLI - Initialize BuilderOS in any project without requiring local code",
5
5
  "type": "module",
6
6
  "main": "index.js",