CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-cron

Cron jobs for Node.js applications that enables developers to execute functions or system commands on schedules defined using standard cron syntax

94

1.20x
Overview
Eval results
Files

task.mdevals/scenario-5/

Cron Schedule Inspector

A command-line utility that analyzes cron schedules and provides detailed information about them in multiple formats.

Capabilities

Parse and display cron schedule information

  • Given a valid cron expression, the utility displays the schedule in string format @test
  • Given a cron expression "0 0 * * *", the utility displays "0 0 * * *" as the string representation @test

Convert cron schedule to JSON format

  • Given a cron expression, the utility converts it to JSON array format showing the parsed schedule fields @test
  • Given a cron expression "*/15 * * * *", the JSON output includes an array representation of the parsed schedule @test

Calculate next execution time

  • Given a cron expression, the utility calculates and displays when the schedule will execute next @test
  • The next execution time is displayed in ISO 8601 format @test

Calculate milliseconds until next execution

  • Given a cron expression, the utility calculates the timeout in milliseconds until the next scheduled execution @test
  • The timeout value is a positive number representing milliseconds from now @test

Implementation

@generates

The utility should be invokable from the command line and accept a cron expression as an argument. It should output all four representations:

  1. String representation of the schedule
  2. JSON array representation
  3. Next execution time in ISO format
  4. Milliseconds until next execution

Example usage:

node src/index.js "0 0 * * *"

Example output format:

Schedule: 0 0 * * *
JSON: [array representation]
Next execution: 2025-01-01T00:00:00.000Z
Timeout (ms): 3600000

API

/**
 * Analyzes a cron expression and returns information in multiple formats
 * @param {string} cronExpression - The cron expression to analyze
 * @returns {Object} Object containing string, json, nextExecution, and timeout properties
 */
function analyzeCronSchedule(cronExpression) {
  // IMPLEMENTATION HERE
}

module.exports = { analyzeCronSchedule };

Dependencies { .dependencies }

cron { .dependency }

Provides cron scheduling and time calculation support for Node.js applications.

Install with Tessl CLI

npx tessl i tessl/npm-cron

tile.json