tessl install tessl/npm-cronstrue@3.2.0Convert 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%
Build a schedule validation and description tool that works with extended cron expressions including both seconds and year fields. The tool should help users understand when their scheduled tasks will run by converting technical cron syntax into human-readable descriptions.
Create a module that:
Validates extended cron expressions: Accept 7-part cron expressions that include both seconds (first field) and year (last field) and validate their format.
Generates human-readable descriptions: Convert valid 7-part cron expressions into clear, human-readable descriptions that explain when the scheduled task will execute.
Provides detailed output: For each cron expression, return an object containing:
valid: boolean indicating if the expression is validdescription: human-readable description (if valid)error: error message (if invalid)Handles multiple expressions: Process an array of cron expressions and return results for each.
Your solution should:
second minute hour day-of-month month day-of-week yearconst validator = require('./cron-validator');
const expressions = [
'0 30 14 * * * 2025',
'*/10 * * * * * 2024-2026',
'0 0 0 1 1 * 2025',
'30 15 10 * * MON 2025-2030'
];
const results = validator.validateCronExpressions(expressions);
console.log(results);File: cron-validator.test.js
const validator = require('./cron-validator');
test('validates and describes cron with specific year', () => {
const results = validator.validateCronExpressions(['0 30 14 * * * 2025']);
expect(results[0].valid).toBe(true);
expect(results[0].description).toBeDefined();
expect(results[0].description.toLowerCase()).toContain('2025');
});File: cron-validator.test.js
const validator = require('./cron-validator');
test('validates and describes cron with year range', () => {
const results = validator.validateCronExpressions(['*/10 * * * * * 2024-2026']);
expect(results[0].valid).toBe(true);
expect(results[0].description).toBeDefined();
expect(results[0].description.toLowerCase()).toContain('2024');
expect(results[0].description.toLowerCase()).toContain('2026');
});File: cron-validator.test.js
const validator = require('./cron-validator');
test('processes multiple cron expressions', () => {
const expressions = [
'0 0 0 1 1 * 2025',
'30 15 10 * * MON 2025-2030'
];
const results = validator.validateCronExpressions(expressions);
expect(results).toHaveLength(2);
expect(results[0].valid).toBe(true);
expect(results[1].valid).toBe(true);
expect(results[0].description).toBeDefined();
expect(results[1].description).toBeDefined();
});Provides cron expression parsing and human-readable description generation.