Skip to content

fix(cli): disable ora spinner in non-interactive environments#5376

Merged
agusayerza merged 1 commit intomasterfrom
agus/NAN-4585/fix-ora-on-non-interactive-terminals
Feb 4, 2026
Merged

fix(cli): disable ora spinner in non-interactive environments#5376
agusayerza merged 1 commit intomasterfrom
agus/NAN-4585/fix-ora-on-non-interactive-terminals

Conversation

@agusayerza
Copy link
Copy Markdown
Contributor

@agusayerza agusayerza commented Feb 4, 2026

Issue

nango compile hangs indefinitely when run via pre-commit hooks due to an upstream bug in ora's stdin-discarder dependency (#5207). This is blocking a customer's CI/CD workflow.

Root cause

The bug was fixed in stdin-discarder@0.3.1, but ora@9.1.0 (latest) still depends on stdin-discarder@^0.2.2 and hasn't released a patched version yet.

Fix

Added a createSpinner() wrapper that returns a no-op spinner when running in non-interactive environments (CI, pre-commit hooks, piped output, or when --no-interactive flag is passed). The real ora spinner is only used when both interactive=true AND process.stdout.isTTY is true.

This workaround should be removed once ora releases a patched version

I have opened a PR to actually bump the stdin-discarder version on the ora repo (sindresorhus/ora#251)

Closes #5207


Add resilient spinner wrapper and propagate non-interactive handling across CLI

Introduces a centralized Spinner utility that wraps ora, falls back to text-based logging when either stdin/stdout is non-TTY, and is wired through compile, dev, deploy, migrations, init, clone, and test generation flows. Global CLI options now auto-disable interactivity in CI environments (isCI or --no-interactive), ensuring commands invoked from hooks or piped executions no longer hang, while also updating ora to 9.2.0 and related dependencies (e.g., stdin-discarder@0.3.1).

Key Changes

• Created packages/cli/lib/utils/spinner.ts implementing a Proxy-based Spinner class that mirrors the Ora interface and prints textual status when process.stdin or stdout is non-TTY.
• Replaced direct ora usage across CLI commands (compile, dev, deploy, zero-yaml migrations, init, clone, tests, etc.) with the new Spinner, adding interactive parameters where needed.
• Updated packages/cli/lib/index.ts global option handling to default to interactive mode, automatically disable it under CI, and pass the flag through to all commands.
• Bumped ora to 9.2.0 in packages/cli/package.json and lockfile, pulling in the fixed stdin-discarder@0.3.1 plus new transitive dependencies.

Affected Areas

• packages/cli/lib/utils/spinner.ts
• packages/cli/lib/zeroYaml/* (compile, dev, deploy, migrations, init, check)
• packages/cli/lib/services/{clone,test}.service.ts
• packages/cli/lib/index.ts
• packages/cli/package.json & package-lock.json


This summary was automatically generated by @propel-code-bot

@agusayerza agusayerza requested a review from a team February 4, 2026 00:06
@linear
Copy link
Copy Markdown

linear bot commented Feb 4, 2026

@agusayerza agusayerza force-pushed the agus/NAN-4585/fix-ora-on-non-interactive-terminals branch from bd32214 to 4dbd9b3 Compare February 4, 2026 11:28
}
return this;
}
} as Ora;
Copy link
Copy Markdown
Collaborator

@TBonnin TBonnin Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't Ora supporting more methods? Would it makes sense to wrap it into a Proxy to catch any undefined methods and avoid runtime crash?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is what I'm actually doing locally, as well as replacing other ora usages on other CLI commands

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you went into supported all known methods. I would have done something simpler just to avoid crash without supporting everything we don't use (yet). ex:

const safeSpinner = new Proxy(new Spinner(), {
  get(target, prop) {
    if (typeof target[prop] === 'function') return target[prop].bind(target);
    if (prop in target) return target[prop];
    return (...args) => {
      console.warn(`Method "${prop}" not found, called with:`, args);
      return undefined;
    };
  }
});

@agusayerza agusayerza force-pushed the agus/NAN-4585/fix-ora-on-non-interactive-terminals branch from 4dbd9b3 to f37ccdc Compare February 4, 2026 18:55
@agusayerza agusayerza force-pushed the agus/NAN-4585/fix-ora-on-non-interactive-terminals branch from f37ccdc to bf7ecd8 Compare February 4, 2026 19:02
@agusayerza agusayerza added this pull request to the merge queue Feb 4, 2026
Merged via the queue into master with commit 0513ace Feb 4, 2026
24 checks passed
@agusayerza agusayerza deleted the agus/NAN-4585/fix-ora-on-non-interactive-terminals branch February 4, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ora via nango compile is causing an issue with CI/CD tooling.

2 participants