Skip to content

feat(cli): add self-update command#641

Closed
vasanth53 wants to merge 5 commits into
NVIDIA:mainfrom
vasanth53:feat/self-update
Closed

feat(cli): add self-update command#641
vasanth53 wants to merge 5 commits into
NVIDIA:mainfrom
vasanth53:feat/self-update

Conversation

@vasanth53

@vasanth53 vasanth53 commented Mar 22, 2026

Copy link
Copy Markdown

Summary

  • Add nemoclaw update command to check for CLI updates
  • Add nemoclaw update --yes to automatically update to latest version
  • Add nemoclaw update --force to force update even if already current
  • Detects running from source and suggests git pull instead
  • Fetches latest version from npm registry and GitHub releases

Usage

nemoclaw update          # Check for updates
nemoclaw update --yes    # Update to latest (non-interactive)
nemoclaw update --force  # Force update even if current

Testing

  • ✅ Help text shows new update command
  • ✅ Version check works correctly
  • ✅ Source detection works (suggests git pull)

Closes #642

Summary by CodeRabbit

New Features

  • Added nemoclaw update command to check and install the latest CLI updates from npm and GitHub releases
  • Added nemoclaw completion command to generate shell completion scripts for Bash, Zsh, and Fish
  • New --yes flag enables non-interactive updates without user confirmation
  • New --force flag allows re-checking for updates even when already on the latest version
  • Source-based installations receive instructions to use alternative update methods

Add completion command supporting bash, zsh, and fish shells.
Completes issue NVIDIA#155.
- Add 'nemoclaw update' command to check for updates
- Add 'nemoclaw update --yes' to update without prompting
- Add 'nemoclaw update --force' to force update even if current
- Fetches latest version from npm registry and GitHub releases
- Detects running from source and suggests 'git pull' instead
- Adds shell completion support for new commands
@coderabbitai

coderabbitai Bot commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

A new self-update mechanism is being added to the NemoClaw CLI. The implementation includes a dedicated update module that checks version availability from npm and GitHub releases, a new update command integrated into the CLI dispatcher, and documentation describing the command's behavior and flags.

Changes

Cohort / File(s) Summary
Update Module
bin/lib/update.js
New module implementing version checking from npm and GitHub, semantic version comparison, and automatic installation via downloaded install.sh script with error handling and temporary file cleanup.
CLI Integration
bin/nemoclaw.js
Added global update and completion commands with dispatcher logic; update parses --force/--yes flags and invokes the update module; completion generates shell-specific completion scripts. Note: Help text contains unresolved merge marker (<<<<<<< HEAD).
Documentation
docs/reference/commands.md
Added reference documentation for nemoclaw update command covering behavior, flags (--yes, --force), example invocations, and special handling for source-based installs.

Sequence Diagram

sequenceDiagram
    actor User
    participant CLI as nemoclaw CLI
    participant UpdateMod as Update Module
    participant npm as npm Registry
    participant gh as GitHub Releases
    participant Install as install.sh Script

    User->>CLI: nemoclaw update [--force] [--yes]
    CLI->>UpdateMod: runUpdate({force, yes})
    
    UpdateMod->>UpdateMod: getCurrentVersion()
    UpdateMod->>npm: fetch latest version
    npm-->>UpdateMod: version info
    UpdateMod->>gh: fetch latest release
    gh-->>UpdateMod: version info
    
    UpdateMod->>UpdateMod: compare versions
    
    alt Update Available
        alt --yes flag present
            UpdateMod->>Install: download install.sh
            Install-->>UpdateMod: script received
        else Interactive
            UpdateMod->>User: prompt for confirmation
            User-->>UpdateMod: confirm
            UpdateMod->>Install: download install.sh
            Install-->>UpdateMod: script received
        end
        
        UpdateMod->>Install: execute via bash
        Install->>Install: install new version
        Install-->>UpdateMod: completion status
        UpdateMod->>UpdateMod: cleanup temp files
    else No Update Available
        UpdateMod->>User: display current/latest versions
    end
    
    UpdateMod-->>CLI: success/failure
    CLI-->>User: output result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A CLI that updates itself with grace,
No manual installs to chase!
From npm or GitHub it fetches the new,
With --yes or --force to help you through.
Self-updating hops, no standing still—
The CLI keeps pace, by rabbit's will!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 76.92% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'feat(cli): add self-update command' accurately and concisely summarizes the main change—adding a new self-update command to the CLI.
Linked Issues check ✅ Passed The PR implementation addresses all coding requirements from issue #642: adds 'nemoclaw update' command with --yes and --force flags, compares versions from npm/GitHub, detects source installations, uses built-in http/https modules, and includes shell completion support.
Out of Scope Changes check ✅ Passed All changes are directly aligned with the linked issue #642 objectives. The addition of the completion command is a natural, supporting feature for the new update command and CLI infrastructure.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@vasanth53 vasanth53 closed this Mar 22, 2026
@wscurran wscurran added the feature PR adds or expands user-visible functionality label Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature PR adds or expands user-visible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cli): add self-update command for automatic CLI updates

2 participants