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-2/

CLI Version Checker

Build a command-line tool that checks for updates to itself and notifies users when newer versions are available. The tool should be context-aware and behave appropriately in different execution environments.

Requirements

Your tool should:

  1. Check for available updates when the CLI runs
  2. Display update notifications to users when a newer version is available
  3. Behave appropriately based on the execution context:
    • Should NOT display notifications when running in CI environments
    • Should NOT display notifications when running in test environments
    • Should NOT display notifications when running as part of npm scripts (by default)
    • Should only display notifications in interactive terminal sessions
  4. Respect user preferences for disabling update notifications

Implementation

@generates

Test Cases

  • The tool displays an update notification when a newer version is available in an interactive terminal @test
  • The tool does not display notifications when running in a CI environment @test
  • The tool does not display notifications when NODE_ENV is set to 'test' @test
  • The tool respects the NO_UPDATE_NOTIFIER environment variable to disable notifications @test

API

/**
 * Entry point for the CLI tool
 * Checks for updates and displays notifications based on context
 */
function main() {
  // IMPLEMENTATION HERE
}

module.exports = { main };

Dependencies { .dependencies }

update-notifier { .dependency }

Provides update checking and notification capabilities with context-aware behavior.

Install with Tessl CLI

npx tessl i tessl/npm-update-notifier

tile.json