Adding non-interactive mode to installer and onboard wizard#276
Adding non-interactive mode to installer and onboard wizard#276arpankanwer wants to merge 4 commits intoNVIDIA:mainfrom
Conversation
📝 WalkthroughWalkthroughThis 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
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment Tip CodeRabbit can enforce grammar and style rules using `languagetool`.Configure the |
There was a problem hiding this comment.
🧹 Nitpick comments (3)
install.sh (1)
295-306: Theshiftstatements have no effect in this loop pattern.When using
for arg in "$@", bash captures the positional parameters at the start of the loop. Subsequentshiftcommands 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 theshiftstatements 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
nonInteractiveistrue,useEnvis unconditionally set totrue. Therefore, the condition!useEnv && nonInteractiveon line 314 can never be satisfied—ifnonInteractiveis true, thenuseEnvis also true, making!useEnvfalse.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 innemoclaw/src/commands/onboard.ts(lines 93-100), theollamaendpoint does not require an API key. ListingNEMOCLAW_API_KEYas a required environment variable in the text preceding this example could confuse users setting up Ollama.Consider clarifying that
NEMOCLAW_API_KEYis 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
⛔ Files ignored due to path filters (9)
nemoclaw/dist/cli.d.ts.mapis excluded by!**/dist/**,!**/*.mapnemoclaw/dist/cli.jsis excluded by!**/dist/**nemoclaw/dist/cli.js.mapis excluded by!**/dist/**,!**/*.mapnemoclaw/dist/commands/onboard.d.tsis excluded by!**/dist/**nemoclaw/dist/commands/onboard.d.ts.mapis excluded by!**/dist/**,!**/*.mapnemoclaw/dist/commands/onboard.jsis excluded by!**/dist/**nemoclaw/dist/commands/onboard.js.mapis excluded by!**/dist/**,!**/*.mapnemoclaw/package-lock.jsonis excluded by!**/package-lock.jsonpackage-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
docs/reference/commands.mdinstall.shnemoclaw/src/cli.tsnemoclaw/src/commands/onboard.ts
* 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.
Description
This PR introduces a non-interactive mode to
nemoclaw onboardand 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
nemoclaw onboard): Added a--non-interactiveflag that bypasses prompts and instead reads fromNEMOCLAW_ENDPOINT,NEMOCLAW_MODEL,NEMOCLAW_API_KEY, etc. It fails fast if required configurations are missing.--non-interactiveflag that is passed down to thenemoclaw onboardstep.Validation
nemoclaw onboard --non-interactivewith correctNEMOCLAW_*environment variables completes successfully without prompting.Fixes #250
Summary by CodeRabbit
New Features
--non-interactiveflag or environment variables (NEMOCLAW_NON_INTERACTIVE=1, NEMOCLAW_ENDPOINT, NEMOCLAW_MODEL, NEMOCLAW_API_KEY).Documentation