Skip to content

Adding non-interactive mode to installer and onboard wizard#276

Closed
arpankanwer wants to merge 4 commits intoNVIDIA:mainfrom
arpankanwer:non-interactive
Closed

Adding non-interactive mode to installer and onboard wizard#276
arpankanwer wants to merge 4 commits intoNVIDIA:mainfrom
arpankanwer:non-interactive

Conversation

@arpankanwer
Copy link
Copy Markdown

@arpankanwer arpankanwer commented Mar 18, 2026

Description

This PR introduces a non-interactive mode to nemoclaw onboard and install.sh, allowing all onboarding configuration to be supplied upfront via environment variables or CLI flags without blocking on interactive prompts.

This makes NemoClaw compatible with automated deployments (CI/CD pipelines, VM provisioning, etc.).

Changes

  • CLI (nemoclaw onboard): Added a --non-interactive flag that bypasses prompts and instead reads from NEMOCLAW_ENDPOINT, NEMOCLAW_MODEL, NEMOCLAW_API_KEY, etc. It fails fast if required configurations are missing.
  • Installer (install.sh): Added a --non-interactive flag that is passed down to the nemoclaw onboard step.
  • Documentation: Updated docs/reference/commands.md with instructions on how to use the new non-interactive mode.

Validation

  • Verified that running nemoclaw onboard --non-interactive with correct NEMOCLAW_* environment variables completes successfully without prompting.
  • Verified that missing required environment variables correctly throws an error and exits immediately.
  • Verified that running without the flag preserves the original interactive wizard behavior.

Fixes #250

Summary by CodeRabbit

  • New Features

    • Added non-interactive mode for NemoClaw onboarding, supporting automation via --non-interactive flag or environment variables (NEMOCLAW_NON_INTERACTIVE=1, NEMOCLAW_ENDPOINT, NEMOCLAW_MODEL, NEMOCLAW_API_KEY).
  • Documentation

    • Added documentation for non-interactive onboarding with required environment variables and usage examples.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 18, 2026

📝 Walkthrough

Walkthrough

This pull request implements a non-interactive mode for NemoClaw's onboarding process. Configuration can now be supplied via environment variables (NEMOCLAW_ENDPOINT, NEMOCLAW_API_KEY, NEMOCLAW_MODEL) and CLI flags (--non-interactive) instead of interactive prompts, enabling automated deployment scenarios like CI/CD pipelines and cloud provisioning.

Changes

Cohort / File(s) Summary
Documentation
docs/reference/commands.md
Adds documentation describing the non-interactive mode, including flag syntax (--non-interactive), environment variable alternative (NEMOCLAW_NON_INTERACTIVE=1), and required environment variables with example usage.
Installation Script
install.sh
Adds global argument parsing for --non-interactive flag that sets NON_INTERACTIVE variable. Constructs onboard command dynamically using an array and conditionally appends the flag based on NON_INTERACTIVE or NEMOCLAW_NON_INTERACTIVE environment variable.
CLI and Onboarding Command
nemoclaw/src/cli.ts, nemoclaw/src/commands/onboard.ts
Adds --non-interactive CLI flag to onboard subcommand. Extends OnboardOptions interface with nonInteractive boolean field. Refactors onboard command logic to support environment variable fallbacks for all required inputs (endpoint, API key, model) and conditionally skips interactive prompts when non-interactive mode is active, with early validation and clear error messages for missing required data.

Sequence Diagram

sequenceDiagram
    participant User
    participant InstallScript as install.sh
    participant CLI as CLI Layer
    participant OnboardCmd as Onboard Command
    participant Env as Environment

    User->>InstallScript: ./install.sh --non-interactive
    InstallScript->>InstallScript: Parse --non-interactive flag
    InstallScript->>Env: Set NON_INTERACTIVE=1
    InstallScript->>CLI: Execute nemoclaw onboard --non-interactive
    
    CLI->>OnboardCmd: Call cliOnboard(nonInteractive: true)
    
    OnboardCmd->>Env: Check NEMOCLAW_ENDPOINT
    alt Endpoint provided via env/arg
        OnboardCmd->>OnboardCmd: Use provided endpoint
    else Non-interactive & missing
        OnboardCmd->>User: Error: endpoint required
    else Interactive & missing
        OnboardCmd->>User: Prompt for endpoint
    end
    
    OnboardCmd->>Env: Check NEMOCLAW_API_KEY
    alt API key provided
        OnboardCmd->>OnboardCmd: Validate and use key
    else Non-interactive & missing
        OnboardCmd->>User: Error: API key required
    else Interactive & missing
        OnboardCmd->>User: Prompt for API key
    end
    
    OnboardCmd->>Env: Check NEMOCLAW_MODEL
    alt Model provided
        OnboardCmd->>OnboardCmd: Use provided model
    else Non-interactive & missing
        OnboardCmd->>User: Error: model required
    else Interactive & missing
        OnboardCmd->>User: Prompt for model
    end
    
    OnboardCmd->>User: Onboarding complete
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hop along now, no prompts in sight!
Environment variables set things just right,
CI/CD pipelines dance without a care,
Non-interactive magic floating through the air! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Adding non-interactive mode to installer and onboard wizard' clearly and concisely summarizes the main changes across the pull request, which focus on introducing non-interactive mode functionality.
Linked Issues check ✅ Passed The PR fully implements all coding requirements from issue #250: non-interactive flag support via CLI and environment variables, configuration through env vars (NEMOCLAW_ENDPOINT, NEMOCLAW_MODEL, NEMOCLAW_API_KEY), fail-fast error handling, and preservation of existing interactive behavior.
Out of Scope Changes check ✅ Passed All changes are directly within scope of the objectives: CLI flag addition, installer script modifications, environment variable handling, and documentation updates for non-interactive mode.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can enforce grammar and style rules using `languagetool`.

Configure the reviews.tools.languagetool setting to enable/disable rules and categories. Refer to the LanguageTool Community to learn more.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (3)
install.sh (1)

295-306: The shift statements have no effect in this loop pattern.

When using for arg in "$@", bash captures the positional parameters at the start of the loop. Subsequent shift commands modify $@ but don't affect the loop iteration. The loop will process all original arguments regardless of the shifts.

The code works correctly for setting NON_INTERACTIVE, but the shift statements are dead code.

🔧 Suggested cleanup
 main() {
   NON_INTERACTIVE=0
   for arg in "$@"; do
     case $arg in
       --non-interactive)
         NON_INTERACTIVE=1
-        shift
-        ;;
-      *)
-        shift
         ;;
     esac
   done
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@install.sh` around lines 295 - 306, The loop using "for arg in \"$@\"" sets
NON_INTERACTIVE correctly but contains ineffective shift calls that do nothing;
change the loop to iterate over positional parameters properly (replace "for arg
in \"$@\"" with a while loop that checks "$#" and uses "$1" in the case) or
simply remove the shift statements so they aren't dead code; update references
to NON_INTERACTIVE and the case pattern (--non-interactive) accordingly and
ensure shifts are applied only when using the while "$#" construct.
nemoclaw/src/commands/onboard.ts (1)

314-317: This code block is unreachable.

On line 313, when nonInteractive is true, useEnv is unconditionally set to true. Therefore, the condition !useEnv && nonInteractive on line 314 can never be satisfied—if nonInteractive is true, then useEnv is also true, making !useEnv false.

This appears to be defensive code that became unreachable after the ternary was introduced. Consider removing the dead block for clarity.

🔧 Suggested cleanup
       if (envKey) {
         logger.info(`Detected NVIDIA_API_KEY in environment (${maskApiKey(envKey)})`);
         const useEnv = nonInteractive ? true : await promptConfirm("Use this key?");
-        if (!useEnv && nonInteractive) {
-           logger.error("Cannot prompt for API key in non-interactive mode.");
-           return;
-        }
-        apiKey = useEnv ? envKey : await promptInput("Enter your NVIDIA API key");
+        apiKey = useEnv ? envKey : await promptInput("Enter your NVIDIA API key");
       } else {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@nemoclaw/src/commands/onboard.ts` around lines 314 - 317, The conditional if
(!useEnv && nonInteractive) { logger.error("Cannot prompt for API key in
non-interactive mode."); return; } is unreachable because nonInteractive forces
useEnv true; remove this dead block to simplify logic (delete the conditional
and its logger.error/return), or if you intended different behavior, adjust the
earlier ternary/assignment that sets useEnv based on nonInteractive instead of
removing — locate the useEnv and nonInteractive handling in onboard.ts to apply
the change.
docs/reference/commands.md (1)

117-121: Documentation example may be misleading about required environment variables.

The example uses NEMOCLAW_ENDPOINT=ollama, but according to the implementation in nemoclaw/src/commands/onboard.ts (lines 93-100), the ollama endpoint does not require an API key. Listing NEMOCLAW_API_KEY as a required environment variable in the text preceding this example could confuse users setting up Ollama.

Consider clarifying that NEMOCLAW_API_KEY is only required for certain endpoints (e.g., build, ncp, nim-local, custom) or use an example that actually requires all three variables.

Additionally, the static analysis tool flagged line 120 for using a $ sign without showing command output (MD014). This is a minor style consideration.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/reference/commands.md` around lines 117 - 121, Update the docs so the
non-interactive example and preceding text accurately reflect which env vars are
required: clarify that NEMOCLAW_API_KEY is only required for certain endpoints
(e.g., build, ncp, nim-local, custom) and not for ollama, or replace the example
with an endpoint that actually needs NEMOCLAW_API_KEY (so the list
NEMOCLAW_ENDPOINT, NEMOCLAW_MODEL, NEMOCLAW_API_KEY is correct); reference the
onboarding logic in onboard.ts (the endpoint handling around the ollama case) to
ensure alignment, and resolve the MD014 style flag by removing the leading "$"
or showing command output consistently in the example.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@docs/reference/commands.md`:
- Around line 117-121: Update the docs so the non-interactive example and
preceding text accurately reflect which env vars are required: clarify that
NEMOCLAW_API_KEY is only required for certain endpoints (e.g., build, ncp,
nim-local, custom) and not for ollama, or replace the example with an endpoint
that actually needs NEMOCLAW_API_KEY (so the list NEMOCLAW_ENDPOINT,
NEMOCLAW_MODEL, NEMOCLAW_API_KEY is correct); reference the onboarding logic in
onboard.ts (the endpoint handling around the ollama case) to ensure alignment,
and resolve the MD014 style flag by removing the leading "$" or showing command
output consistently in the example.

In `@install.sh`:
- Around line 295-306: The loop using "for arg in \"$@\"" sets NON_INTERACTIVE
correctly but contains ineffective shift calls that do nothing; change the loop
to iterate over positional parameters properly (replace "for arg in \"$@\"" with
a while loop that checks "$#" and uses "$1" in the case) or simply remove the
shift statements so they aren't dead code; update references to NON_INTERACTIVE
and the case pattern (--non-interactive) accordingly and ensure shifts are
applied only when using the while "$#" construct.

In `@nemoclaw/src/commands/onboard.ts`:
- Around line 314-317: The conditional if (!useEnv && nonInteractive) {
logger.error("Cannot prompt for API key in non-interactive mode."); return; } is
unreachable because nonInteractive forces useEnv true; remove this dead block to
simplify logic (delete the conditional and its logger.error/return), or if you
intended different behavior, adjust the earlier ternary/assignment that sets
useEnv based on nonInteractive instead of removing — locate the useEnv and
nonInteractive handling in onboard.ts to apply the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ed8a8dc3-21b9-4053-9351-d0b0286c1208

📥 Commits

Reviewing files that changed from the base of the PR and between 1e23347 and 7426a5a.

⛔ Files ignored due to path filters (9)
  • nemoclaw/dist/cli.d.ts.map is excluded by !**/dist/**, !**/*.map
  • nemoclaw/dist/cli.js is excluded by !**/dist/**
  • nemoclaw/dist/cli.js.map is excluded by !**/dist/**, !**/*.map
  • nemoclaw/dist/commands/onboard.d.ts is excluded by !**/dist/**
  • nemoclaw/dist/commands/onboard.d.ts.map is excluded by !**/dist/**, !**/*.map
  • nemoclaw/dist/commands/onboard.js is excluded by !**/dist/**
  • nemoclaw/dist/commands/onboard.js.map is excluded by !**/dist/**, !**/*.map
  • nemoclaw/package-lock.json is excluded by !**/package-lock.json
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • docs/reference/commands.md
  • install.sh
  • nemoclaw/src/cli.ts
  • nemoclaw/src/commands/onboard.ts

@wscurran wscurran added Getting Started Use this label to identify setup, installation, or onboarding issues. CI/CD Use this label to identify issues with NemoClaw CI/CD pipeline or GitHub Actions. labels Mar 18, 2026
@wscurran wscurran added the enhancement: feature Use this label to identify requests for new capabilities in NemoClaw. label Mar 23, 2026
mafueee pushed a commit to mafueee/NemoClaw that referenced this pull request Mar 28, 2026
* feat(tui): add log copy and visual selection mode

Add clipboard support for the TUI log viewer using OSC 52 escape
sequences. Users can copy individual log lines (y), the visible
viewport (Y), or enter visual selection mode (v) to select a range
of lines with j/k and yank with y.

- Add clipboard module with OSC 52 base64 encoding
- Add format_log_line_plain() for plain-text log rendering
- Add visual selection mode with highlight styling and status bar
- Context-switch nav bar hints between normal and visual modes
- Add 7 unit tests for plain-text log formatting

Closes NVIDIA#274

* fix(tui): write OSC 52 to /dev/tty instead of stdout

ratatui owns stdout via the alternate screen buffer, so OSC 52
escape sequences written to stdout are swallowed by the backend.
Write directly to /dev/tty to bypass the buffer and reach the
terminal emulator.
@arpankanwer arpankanwer closed this Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD Use this label to identify issues with NemoClaw CI/CD pipeline or GitHub Actions. enhancement: feature Use this label to identify requests for new capabilities in NemoClaw. Getting Started Use this label to identify setup, installation, or onboarding issues.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Non-Interactive Installation Mode

3 participants