Sample
at-least-node 1.0.0: verify node version meets minimum requirement with at-least-node
Verified sample for npm at-least-node 1.0.0: verify node version meets minimum requirement with at-least-node. The contract ran on node 22 · linux alpine/x64…
sha256:50f3874a1f035e31de85007158f8f8c9dadabd25f15f167efa37629a4c1577fd
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 2
- Signing keys that built it
- 1
Declared environment
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-26 |
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-07 |
Case
HOW- Goal
- verify node version meets minimum requirement with at-least-node
- Packages
- Environment
- node 22.23.2
- Created
- 2026-08-26T09:24:51Z
Contract
- atLeastNode is a callable function accepting a target version string
- returns true when current node version is greater than the required major version
- returns true when current node version equals the required version string
- returns false when current node version is less than the required major version
- handles semantic version strings with major minor and patch numbers correctly
- helper function checks minimum version requirement for runtime feature gating
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
Source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify node version meets minimum requirement with at-least-node
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/at-least-node@1.0.0
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:bb376e77ba80b0b8f72ba43302a63ae56eac810670a74663d91f049e7da42440","constraints":{"executionContext":"node"},"contract":["atLeastNode is a callable function accepting a target version string","returns true when current node version is greater than the required major version","returns true when current node version equals the required version string","returns false when current node version is less than the required major version","handles semantic version strings with major minor and patch numbers correctly","helper function checks minimum version requirement for runtime feature gating"],"goal":"verify node version meets minimum requirement with at-least-node","kind":"HOW","packages":["pkg:npm/at-least-node@1.0.0"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/at-least-node@1.0.0"],"schemaVersion":1,"subject":"pkg:npm/at-least-node@1.0.0","verifierAdapter":"node-typescript@1"}
{
"name": "sample-at-least-node",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-at-least-node",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"at-least-node": "1.0.0"
}
},
"node_modules/at-least-node": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",
"integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==",
"license": "ISC",
"engines": {
"node": ">= 4.0.0"
}
}
}
}
{
"name": "sample-at-least-node",
"version": "1.0.0",
"private": true,
"description": "Clean-room code sample for at-least-node@1.0.0",
"main": "src/index.js",
"license": "MIT-0",
"dependencies": {
"at-least-node": "1.0.0"
}
}
{
"schemaVersion": 1,
"goal": "verify node version meets minimum requirement with at-least-node",
"kind": "HOW",
"packages": [
"pkg:npm/at-least-node@1.0.0"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const atLeastNode = require('at-least-node');
/**
* Checks if the current Node.js runtime version is at least the specified minimum version.
*
* @param {string} minVersion - The target minimum version (e.g. '10.0.0', '18.0.0', '22.0.0').
* @returns {boolean} True if current node version is greater than or equal to minVersion.
*/
function isNodeAtLeast(minVersion) {
return atLeastNode(minVersion);
}
/**
* Checks if a specific feature requiring a minimum Node.js version is supported by the current runtime.
*
* @param {string} requiredVersion - The minimum version required by the feature.
* @returns {{ supported: boolean, currentVersion: string, requiredVersion: string }}
*/
function checkFeatureSupport(requiredVersion) {
return {
supported: atLeastNode(requiredVersion),
currentVersion: process.versions.node,
requiredVersion
};
}
module.exports = {
atLeastNode,
isNodeAtLeast,
checkFeatureSupport
};
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
atLeastNode,
isNodeAtLeast,
checkFeatureSupport
} = require('../src/index.js');
async function testAll() {
const currentVersion = process.versions.node;
const [currentMajor, currentMinor, currentPatch] = currentVersion.split('.').map(Number);
// 1. atLeastNode is a callable function accepting a target version string
assert.equal(typeof atLeastNode, 'function', 'atLeastNode should be a function');
assert.equal(typeof isNodeAtLeast, 'function', 'isNodeAtLeast should be a function');
assert.equal(typeof checkFeatureSupport, 'function', 'checkFeatureSupport should be a function');
// 2. returns true when current node version is greater than the required major version
const olderMajor = `${Math.max(1, currentMajor - 5)}.0.0`;
assert.equal(atLeastNode(olderMajor), true, `should return true for older major version ${olderMajor}`);
assert.equal(isNodeAtLeast(olderMajor), true, `helper should return true for older major version ${olderMajor}`);
// 3. returns true when current node version equals the required version string
assert.equal(atLeastNode(currentVersion), true, `should return true when matching exact current version ${currentVersion}`);
assert.equal(isNodeAtLeast(currentVersion), true, `helper should return true when matching exact current version`);
// 4. returns false when current node version is less than the required major version
const futureMajor = `${currentMajor + 10}.0.0`;
assert.equal(atLeastNode(futureMajor), false, `should return false for future major version ${futureMajor}`);
assert.equal(isNodeAtLeast(futureMajor), false, `helper should return false for future major version ${futureMajor}`);
// 5. handles semantic version strings with major minor and patch numbers correctly
const sameMajorOlderMinor = `${currentMajor}.${Math.max(0, currentMinor - 1)}.0`;
assert.equal(atLeastNode(sameMajorOlderMinor), true, `should return true for older minor version within same major`);
const sameMajorFutureMinor = `${currentMajor}.${currentMinor + 5}.0`;
assert.equal(atLeastNode(sameMajorFutureMinor), false, `should return false for future minor version within same major`);
// 6. helper function checks minimum version requirement for runtime feature gating
const supportOlder = checkFeatureSupport(olderMajor);
assert.deepEqual(supportOlder, {
supported: true,
currentVersion,
requiredVersion: olderMajor
});
const supportFuture = checkFeatureSupport(futureMajor);
assert.deepEqual(supportFuture, {
supported: false,
currentVersion,
requiredVersion: futureMajor
});
console.log('All at-least-node contract tests passed successfully.');
}
testAll().catch((err) => {
console.error('Contract test failure:', err);
process.exit(1);
});
Origin Seeder
anonymous