Skip to content

Auto-detect non-interactive mode in CI / non-TTY environments#3486

Merged
douglowder merged 4 commits intomainfrom
@evanbacon/eas-cli/more-ci
Mar 12, 2026
Merged

Auto-detect non-interactive mode in CI / non-TTY environments#3486
douglowder merged 4 commits intomainfrom
@evanbacon/eas-cli/more-ci

Conversation

@EvanBacon
Copy link
Copy Markdown
Contributor

Why

eas build -p android prompts for keystore generation and fails in CI or non-TTY environments:

Input is required, but stdin is not readable. Failed to display prompt: Generate a new Android Keystore?

Passing --non-interactive works around this, but it should be auto-detected when CI=1 or stdin is not a TTY.

How

Set a default function on both --non-interactive flag definitions (EasNonInteractiveAndJsonFlags and EASNonInteractiveFlag) in packages/eas-cli/src/commandUtils/flags.ts. The default checks CI env var (via boolish from getenv) and process.stdin.isTTY.

  • oclif evaluates default only when the user does NOT pass --non-interactive on CLI
  • noCacheDefault: true prevents baking the developer's environment into oclif.manifest.json
  • All ~60 commands using these flag definitions automatically get CI/TTY auto-detection with no other changes needed

Test Plan

  • Added 5 unit tests for isNonInteractiveByDefault() covering: TTY without CI (false), CI=1 (true), CI=true (true), non-TTY stdin (true), both CI and non-TTY (true)
  • All existing resolveNonInteractiveAndJsonFlags tests pass unchanged
  • yarn typecheck passes
  • yarn lint passes (0 errors)
PASS src/commandUtils/__tests__/flags-test.ts
  isNonInteractiveByDefault
    ✓ returns false when stdin is a TTY and CI is not set
    ✓ returns true when CI=1
    ✓ returns true when CI=true
    ✓ returns true when stdin is not a TTY
    ✓ returns true when both CI is set and stdin is not a TTY
  resolveNonInteractiveAndJsonFlags
    ✓ returns both false when no flags are set
    ✓ --json implies --non-interactive
    ✓ --non-interactive alone does not enable json
    ✓ both flags explicitly set
    ✓ both flags explicitly false
    ✓ --json false with --non-interactive true

Test Suites: 1 passed, 1 total
Tests:       11 passed, 11 total

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 9, 2026

Subscribed to pull request

File Patterns Mentions
**/* @douglowder

Generated by CodeMention

@douglowder douglowder force-pushed the @evanbacon/eas-cli/more-ci branch from b222341 to 610234a Compare March 10, 2026 01:51
@douglowder
Copy link
Copy Markdown
Contributor

@EvanBacon I fixed merge conflicts, and found a change was needed in Jest setup to fix failing tests.

@douglowder douglowder requested a review from brentvatne March 10, 2026 01:52
@douglowder douglowder force-pushed the @evanbacon/eas-cli/more-ci branch 3 times, most recently from e9c20c2 to 99d82a4 Compare March 10, 2026 02:16
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.58%. Comparing base (d5a3fc0) to head (55b3248).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3486      +/-   ##
==========================================
+ Coverage   53.56%   53.58%   +0.02%     
==========================================
  Files         815      815              
  Lines       34566    34572       +6     
  Branches     7175     7176       +1     
==========================================
+ Hits        18513    18521       +8     
+ Misses      15971    15969       -2     
  Partials       82       82              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@douglowder douglowder force-pushed the @evanbacon/eas-cli/more-ci branch from 99d82a4 to 46a3757 Compare March 12, 2026 01:23
import { boolish } from 'getenv';

export function isNonInteractiveByDefault(): boolean {
return boolish('CI', false) || !process.stdin.isTTY;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

@douglowder douglowder Mar 12, 2026

Choose a reason for hiding this comment

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

That's a good suggestion for the future -- Claude also suggested taking a look at https://www.npmjs.com/package/ci-info for this check.

@douglowder douglowder force-pushed the @evanbacon/eas-cli/more-ci branch from 46a3757 to 55b3248 Compare March 12, 2026 19:23
@github-actions
Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

@douglowder douglowder merged commit 0c17846 into main Mar 12, 2026
7 checks passed
@douglowder douglowder deleted the @evanbacon/eas-cli/more-ci branch March 12, 2026 19:29
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.

3 participants