@shetty4l/core 0.1.15 → 0.1.16

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli.ts +10 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shetty4l/core",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "Shared infrastructure primitives for Bun/TypeScript services",
5
5
  "repository": {
6
6
  "type": "git",
package/src/cli.ts CHANGED
@@ -62,7 +62,8 @@ export interface RunCliOpts {
62
62
  * Run the CLI: parse process.argv, dispatch to the matching command handler.
63
63
  *
64
64
  * Handles --help/-h, --version/-v, and unknown commands automatically.
65
- * Calls `process.exit(0)` after successful command execution.
65
+ * If the handler returns a number, exits with that code.
66
+ * If the handler returns void, the process stays alive (for long-running servers).
66
67
  */
67
68
  export async function runCli(opts: RunCliOpts): Promise<void> {
68
69
  const rawArgs = process.argv.slice(2);
@@ -104,6 +105,12 @@ export async function runCli(opts: RunCliOpts): Promise<void> {
104
105
  process.exit(1);
105
106
  }
106
107
 
107
- const exitCode = (await handler(args, json)) ?? 0;
108
- process.exit(exitCode);
108
+ const result = await handler(args, json);
109
+
110
+ // If the handler returned a number, exit with that code.
111
+ // If it returned void/undefined, the command is long-running (e.g. serve)
112
+ // and the process should stay alive.
113
+ if (typeof result === "number") {
114
+ process.exit(result);
115
+ }
109
116
  }