CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-cronstrue

tessl install tessl/npm-cronstrue@3.2.0

Convert cron expressions into human readable descriptions

Agent Success

Agent success rate when using this tile

100%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.12x

Baseline

Agent success rate without this tile

89%

task.mdevals/scenario-2/

Cron Schedule Validator

Build a system that validates and describes cron expressions with specific focus on range-based schedules.

Requirements

Implement a module that provides the following functionality:

Validation

Create a function that validates whether a cron expression uses range syntax correctly:

  • Accept a standard 5-part cron expression as input
  • Return true if the expression is valid and uses at least one range (hyphen-separated values)
  • Return false if the expression is invalid or contains no ranges
  • A valid range includes patterns like 1-5, MON-FRI, JAN-MAR

Description

Create a function that converts cron expressions containing ranges into human-readable descriptions:

  • Accept a valid cron expression string as input
  • Return a human-readable description of when the cron job will execute
  • Handle range syntax in any of the five cron fields (minute, hour, day-of-month, month, day-of-week)
  • Support both numeric ranges (e.g., 1-5) and named ranges (e.g., MON-FRI, JAN-MAR)

Test Cases

  • Given "0 9-17 * * *", it returns a description indicating execution every hour between 9 AM and 5 PM @test
  • Given "30 11 * * MON-FRI", it returns a description indicating execution at 11:30 AM Monday through Friday @test
  • Given "0 0 1 JAN-MAR *", it returns a description indicating execution at midnight on the 1st of the month, January through March @test
  • Given "0-10 9 * * *", it validates as true since it contains a range and returns a description for minutes 0-10 at 9 AM @test

Implementation

@generates

API

/**
 * Validates if a cron expression uses range syntax correctly
 * @param {string} expression - A 5-part cron expression
 * @returns {boolean} True if valid and contains at least one range, false otherwise
 */
function hasRanges(expression) {
  // IMPLEMENTATION HERE
}

/**
 * Converts a cron expression with ranges to human-readable description
 * @param {string} expression - A cron expression containing range syntax
 * @returns {string} Human-readable description of the schedule
 */
function describeSchedule(expression) {
  // IMPLEMENTATION HERE
}

module.exports = {
  hasRanges,
  describeSchedule
};

Dependencies { .dependencies }

cronstrue { .dependency }

Provides cron expression parsing and human-readable conversion functionality.

@satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/cronstrue@3.2.x
tile.json