or run

npx @tessl/cli init
Log in

Version

Files

tile.json

task.mdevals/scenario-8/

Package Release Age Policy Tool

Build a CLI tool that configures a package manager to enforce minimum release age requirements for installed packages.

Problem Statement

Your team wants to avoid installing recently published packages that may contain undiscovered bugs or security issues. Create a tool that configures the package manager to only allow installation of packages that have been published for at least a specified number of days.

Requirements

Create a Node.js CLI tool that:

  1. Accepts command-line arguments:

    • --min-days <number>: Minimum days since package publication (required, must be positive)
    • --project-dir <path>: Project directory path (defaults to current directory)
  2. Sets the package manager configuration to enforce the minimum release age

  3. Validates inputs and handles errors appropriately

Expected Behavior

  • Validate that min-days is a positive integer (greater than 0)
  • Verify the project directory exists
  • Apply the configuration using the package manager's config system
  • Display success confirmation when complete

Test Cases

  • Configuring minimum age of 7 days succeeds and creates appropriate configuration @test
  • Configuring minimum age of 0 days fails with validation error @test
  • Configuring minimum age with negative value fails with validation error @test
  • Configuring with non-existent project directory fails with error @test

Implementation

@generates

API

/**
 * Main CLI entry point that processes command line arguments
 * and configures minimum release age policy
 */
function main() {
  // IMPLEMENTATION HERE
}

/**
 * Configures minimum release age for the package manager
 * @param {number} minDays - Minimum number of days a package must be published
 * @param {string} projectDir - Path to the project directory
 * @returns {Promise<void>}
 * @throws {Error} If configuration fails
 */
async function configureMinimumReleaseAge(minDays, projectDir) {
  // IMPLEMENTATION HERE
}

/**
 * Validates the minimum days parameter
 * @param {number} minDays - The value to validate
 * @returns {boolean} True if valid, false otherwise
 */
function validateMinDays(minDays) {
  // IMPLEMENTATION HERE
}

module.exports = {
  main,
  configureMinimumReleaseAge,
  validateMinDays
};

Dependencies { .dependencies }

pnpm { .dependency }

Fast, disk space efficient package manager with support for minimum release age configuration.

@satisfied-by