@4ge/cli 0.2.3 → 0.2.4

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/dist/base.js +8 -3
  2. package/package.json +1 -1
package/dist/base.js CHANGED
@@ -413,11 +413,16 @@ export class BaseCommand extends Command {
413
413
  this.log(` Payload: ${JSON.stringify(payload, null, 2)}`);
414
414
  }
415
415
  }
416
- // Handle errors in JSON mode output JSON error, otherwise use oclif default
416
+ // Handle errors. In JSON mode emit a structured envelope for unexpected
417
+ // errors, then re-throw so the framework sets the exit code. Intentional
418
+ // exit errors (oclif ExitError, thrown by this.exit()/outputErrorAndExit)
419
+ // are NOT re-emitted in JSON mode — the command has already produced any
420
+ // envelope it intended to, and re-emitting would double-print a trailing
421
+ // {data:null,error:{EEXIT}} envelope (#34). The framework renders
422
+ // ExitError as empty (no output) and exits non-zero, matching pretty mode.
417
423
  async catch(error) {
418
- if (this.isJsonMode) {
424
+ if (this.isJsonMode && error?.code !== 'EEXIT') {
419
425
  this.outputError({ message: error.message, code: error.code || error.constructor.name });
420
- this.exit(1);
421
426
  }
422
427
  throw error;
423
428
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4ge/cli",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "4ge Service Architecture Bridge & CLI",
5
5
  "main": "dist/index.js",
6
6
  "bin": {