grada-run 0.40.9 → 0.40.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grada-run",
3
- "version": "0.40.9",
3
+ "version": "0.40.10",
4
4
  "description": "Provision production-ready AWS infrastructure and CI/CD pipelines in seconds.",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -423,4 +423,18 @@ async function runDoctorMain(input = {}) {
423
423
  } catch {
424
424
  // The checks already printed; losing one event beats crashing.
425
425
  }
426
+
427
+ // Red verdicts fail the command: runCommand maps {ok:false, exitCode}
428
+ // to the process exit, so `doctor && apply` gates correctly. The
429
+ // reason mirrors the telemetry failure props; failedChecks names the
430
+ // red cells for programmatic callers. Green (and warn-grade) runs
431
+ // intentionally return undefined, as before.
432
+ if (!success) {
433
+ return {
434
+ ok: false,
435
+ exitCode: 1,
436
+ reason: failureProps.reason,
437
+ failedChecks,
438
+ };
439
+ }
426
440
  }
@@ -17,7 +17,10 @@ export const ISSUES_URL = 'https://github.com/grada-run/grada/issues';
17
17
  // shape) prints guidance without a stack; everything else prints a
18
18
  // one-liner, the stack (or String(reason) when there is none), and
19
19
  // the report pointer. JSON mode puts the envelope on stdout and the
20
- // human text on stderr so parsers stay safe.
20
+ // human text on stderr so parsers stay safe. Standing requirement:
21
+ // never start a spinner on a --json/MCP path — the handler exits 1,
22
+ // and clack's exit listener prints "Canceled" to stdout for any
23
+ // spinner still active.
21
24
 
22
25
  function firstLine(text) {
23
26
  return String(text).split('\n')[0];
@@ -53,7 +56,7 @@ export function formatLastResortOutput({ kind, reason, isJson }) {
53
56
  if (kind === 'unhandledRejection' && isSmithyHomelessRejection(reason)) {
54
57
  oneLiner = HOMELESS_GUIDANCE;
55
58
  stderrText = `✖ ${HOMELESS_GUIDANCE}\n`
56
- + ' Set the HOME environment variable, or provide credentials via AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.\n';
59
+ + ' Set the HOME environment variable to any directory (it is only used to locate optional config files), then configure credentials.\n';
57
60
  } else if (kind === 'uncaughtException') {
58
61
  oneLiner = `Grada crashed unexpectedly: ${first}`;
59
62
  stderrText = `✖ ${oneLiner}\n${detail}\n Please report this: ${ISSUES_URL}\n`;
@@ -101,7 +104,17 @@ export function createLastResortHandlers({
101
104
  // fall through to the exit below no matter what.
102
105
  }
103
106
  }
104
- exitFn(1);
107
+ try {
108
+ exitFn(1);
109
+ } catch (error) {
110
+ // MCP tool calls stub process.exit to throw InterceptedExit
111
+ // (duck-typed by name: this module must stay dependency-free):
112
+ // the tool's own error path carries the failure, so the
113
+ // backstop's job ends with the printed report. Anything else
114
+ // propagates — swallowing an unknown exit failure could let
115
+ // the loop drain to a silent exit 0.
116
+ if (error?.name !== 'InterceptedExit') throw error;
117
+ }
105
118
  };
106
119
  return {
107
120
  unhandledRejection: handle('unhandledRejection'),