Skip to content

feat: add non-interactive mode support to CLI and update README with usage instructions#5

Merged
zahlekhan merged 3 commits intomainfrom
zk/fix/non-int-shell
Feb 8, 2026
Merged

feat: add non-interactive mode support to CLI and update README with usage instructions#5
zahlekhan merged 3 commits intomainfrom
zk/fix/non-int-shell

Conversation

@zahlekhan
Copy link
Contributor

@zahlekhan zahlekhan commented Feb 8, 2026


EntelligenceAI PR Summary

This PR adds non-interactive mode support to enable CLI usage in CI/CD pipelines and automated environments.

  • Added nonInteractive optional boolean property to CLIOptions interface
  • Implemented isNonInteractiveEnvironment() function to detect non-TTY environments and CI variables
  • Modified CreateC1App class to skip interactive prompts (OAuth, project name, template selection) in non-interactive mode
  • Added mandatory --api-key flag requirement with enhanced error handling in non-interactive contexts
  • Updated CLI help text with epilogue containing manual API key instructions and usage examples
  • Documented auto-detection behavior, usage examples, and behavior specifications in README

@entelligence-ai-pr-reviews
Copy link

Walkthrough

This PR implements comprehensive non-interactive mode support for the CLI tool, enabling seamless operation in CI/CD pipelines, automated environments, and AI agent contexts. The implementation includes automatic detection of non-interactive environments through TTY checks and CI environment variables, alongside an explicit --non-interactive flag. When activated, the mode bypasses all interactive prompts (OAuth flows, project name inputs, template selections) in favor of defaults or required flags. Enhanced error handling ensures the API key flag is mandatory in non-interactive mode, with clear error messages and fast-fail behavior. Documentation updates provide usage examples and detailed behavior specifications for both explicit and auto-detected scenarios.

Changes

File(s) Summary
src/types/index.ts Added optional nonInteractive boolean property to the CLIOptions interface to support non-interactive mode configuration.
src/index.ts Implemented non-interactive mode with isNonInteractiveEnvironment() detection function, modified CreateC1App class to conditionally skip interactive prompts, added mandatory --api-key validation in non-interactive contexts, and enhanced CLI help text with epilogue containing API key acquisition instructions and usage examples.
README.md Added comprehensive documentation for --non-interactive flag including auto-detection behavior, usage examples for explicit and auto-detected scenarios, and detailed specifications for required options, defaults, and fast-fail behavior.

Sequence Diagram

This diagram shows the interactions between components:

sequenceDiagram
    actor User
    participant CLI as CLI Parser
    participant App as CreateC1App
    participant Env as isNonInteractiveEnvironment
    participant Auth as Authentication
    participant Logger
    participant Prompts as @inquirer/prompts

    User->>CLI: npx create-c1-app [options]
    CLI->>CLI: Parse command line options
    CLI->>App: new CreateC1App()
    activate App
    App->>App: Initialize config & spinner
    
    CLI->>App: main(options)
    
    App->>Env: isNonInteractiveEnvironment(options.nonInteractive)
    Env->>Env: Check explicit flag
    Env->>Env: Check process.stdin.isTTY
    Env->>Env: Check CI environment variables
    Env-->>App: boolean (true/false)
    
    App->>App: Set this.nonInteractive
    
    alt nonInteractive === true
        App->>Logger: Log "Running in non-interactive mode"
    end
    
    alt hasOptions === false
        App->>Logger: Log AI agent instructions
    end
    
    App->>App: showWelcome()
    
    Note over App,Auth: Step 1: Authentication
    
    alt options.apiKey provided
        App->>Logger: Log "Using provided API key"
        App->>App: Set authResult
    else nonInteractive === true
        App->>App: Throw Error (API key required)
    else Interactive mode
        App->>Auth: Perform OAuth flow
        Auth-->>App: authResult
    end
    
    Note over App,Prompts: Step 2: Collect Configuration
    
    alt projectName === undefined
        alt nonInteractive === true
            App->>App: Use default "my-c1-app"
            App->>Logger: Log default project name
        else Interactive mode
            App->>Prompts: input() for project name
            Prompts-->>User: Prompt user
            User-->>Prompts: Enter project name
            Prompts-->>App: projectName
        end
    end
    
    alt template === undefined
        alt nonInteractive === true
            App->>App: Use default "template-c1-next"
            App->>Logger: Log default template
        else Interactive mode
            App->>Prompts: select() for template
            Prompts-->>User: Show template choices
            User-->>Prompts: Select template
            Prompts-->>App: template
        end
    end
    
    App->>App: Update config with answers
    
    Note over App: Step 3: Create Project
    App->>App: Create project from template
    
    deactivate App
    App-->>User: Project created successfully
Loading

🔗 Cross-Repository Impact Analysis

Enable automatic detection of breaking changes across your dependent repositories. → Set up now

Learn more about Cross-Repository Analysis

What It Does

  • Automatically identifies repositories that depend on this code
  • Analyzes potential breaking changes across your entire codebase
  • Provides risk assessment before merging to prevent cross-repo issues

How to Enable

  1. Visit Settings → Code Management
  2. Configure repository dependencies
  3. Future PRs will automatically include cross-repo impact analysis!

Benefits

  • 🛡️ Prevent breaking changes across repositories
  • 🔍 Catch integration issues before they reach production
  • 📊 Better visibility into your multi-repo architecture

▶️AI Code Reviews for VS Code, Cursor, Windsurf
Install the extension

Note for Windsurf Please change the default marketplace provider to the following in the windsurf settings:

Marketplace Extension Gallery Service URL: https://marketplace.visualstudio.com/_apis/public/gallery

Marketplace Gallery Item URL: https://marketplace.visualstudio.com/items

Entelligence.ai can learn from your feedback. Simply add 👍 / 👎 emojis to teach it your preferences. More shortcuts below

Emoji Descriptions:

  • ⚠️ Potential Issue - May require further investigation.
  • 🔒 Security Vulnerability - Fix to ensure system safety.
  • 💻 Code Improvement - Suggestions to enhance code quality.
  • 🔨 Refactor Suggestion - Recommendations for restructuring code.
  • ℹ️ Others - General comments and information.

Interact with the Bot:

  • Send a message or request using the format:
    @entelligenceai + *your message*
Example: @entelligenceai Can you suggest improvements for this code?
  • Help the Bot learn by providing feedback on its responses.
    @entelligenceai + *feedback*
Example: @entelligenceai Do not comment on `save_auth` function !

Also you can trigger various commands with the bot by doing
@entelligenceai command

The current supported commands are

  1. config - shows the current config
  2. retrigger_review - retriggers the review

More commands to be added soon.

@zahlekhan zahlekhan merged commit 26c03e8 into main Feb 8, 2026
9 checks passed
Comment on lines +90 to +92
if (explicitFlag) return true;
if (!process.stdin.isTTY) return true;
return false;

Choose a reason for hiding this comment

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

Correctness: isNonInteractiveEnvironment: Removing CI environment variable checks breaks the auto-detection of non-interactive mode. This will cause CI pipelines to hang when a TTY is allocated. Restore the ciVars check.

🤖 AI Agent Prompt for Cursor/Windsurf

📋 Copy this prompt to your AI coding assistant (Cursor, Windsurf, etc.) to get help fixing this issue

File: src/index.ts (lines 90-92). The updated isNonInteractiveEnvironment no longer checks CI environment variables, so CI runs with a TTY will be treated as interactive and can hang on prompts. Reintroduce the CI env-var detection (CI, CONTINUOUS_INTEGRATION, BUILD_NUMBER, GITHUB_ACTIONS, GITLAB_CI, JENKINS_URL, CODEBUILD_BUILD_ID) after the TTY check and return true if any are set.

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.

1 participant