CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-update-notifier

Update notifications for your CLI app

Overall
score

97%

Overview
Eval results
Files

task.mdevals/scenario-9/

CLI Update Status Reporter

Build a command-line tool that programmatically checks for updates and provides detailed reporting about available updates for a package.

Requirements

Your tool should accept command-line arguments to check for package updates and display different types of information based on the arguments provided.

Command-Line Interface

The tool should support the following command structure:

node index.js --check-updates

When run with the --check-updates flag, the tool should:

  1. Programmatically check if updates are available for the package
  2. Display update information in a formatted report
  3. Include details about the current version, latest available version, and update type

Update Report Format

The update report should display:

  • Current version of the package
  • Latest available version
  • Type of update (e.g., major, minor, patch)
  • A recommendation message based on the update type

If no update is available, display a message indicating the package is up to date.

Error Handling

The tool should handle errors gracefully:

  • If the update check fails, display an appropriate error message
  • Exit with the correct status code (0 for success, 1 for errors)

Test Cases

  • When an update is available, the tool displays the current version, latest version, and update type @test
  • When no update is available, the tool displays a message indicating the package is current @test
  • When the update check encounters an error, the tool displays an error message @test

Implementation

@generates

API

// Main entry point - processes command-line arguments and displays update information
function main() {
  // IMPLEMENTATION HERE
}

// Entry point execution
if (require.main === module) {
  main().catch(console.error);
}

Dependencies { .dependencies }

update-notifier { .dependency }

Provides programmatic update checking capabilities for the package.

Install with Tessl CLI

npx tessl i tessl/npm-update-notifier

tile.json