Exemple
semver 6.3.2
Échantillon vérifié pour npm semver 6.3.2. Le contrat s'est exécuté sur node 22 · linux debian/x64 · docker et a réussi : assert semver.parse and…
sha256:0028b5444d6e744c50d3b64e823ff1dd89bb3301aa1c3f39c2e0aaab1e788155
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
node linux 24 · ubuntu · glibc 2.39 x64 node javascript npm
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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-11-08 |
Cas
HOW- Objectif
- verify pkg:npm/semver@6.3.2
- Paquets
- Environnement
- node
- Créé
- 2026-11-08T07:07:54Z
Contrat
- assert semver.parse and semver.clean parse and normalize semantic version strings or return null on invalid input
- assert semver.inc increments major, minor, patch, and prerelease components
- assert semver.satisfies, semver.maxSatisfying, semver.minSatisfying, and semver.minVersion evaluate range constraints
- assert semver.coerce extracts valid SemVer instances from partial or dirty strings with standard and rtl options
- assert semver.intersects and semver.sort verify overlapping range sets and ascending version ordering
Fichiers
- PROMPT.md
- csx.json
- index.mjs
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Code 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 pkg:npm/semver@6.3.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/semver@6.3.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:d007ed7f025a680015c534fbc655fa4a70c32abdfc5d2750953fc98a1f903c9d","contract":["assert semver.parse and semver.clean parse and normalize semantic version strings or return null on invalid input","assert semver.inc increments major, minor, patch, and prerelease components","assert semver.satisfies, semver.maxSatisfying, semver.minSatisfying, and semver.minVersion evaluate range constraints","assert semver.coerce extracts valid SemVer instances from partial or dirty strings with standard and rtl options","assert semver.intersects and semver.sort verify overlapping range sets and ascending version ordering"],"goal":"verify pkg:npm/semver@6.3.2","kind":"HOW","packages":["pkg:npm/semver@6.3.2"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","os":"linux","osVersionBucket":"24","packageManager":"npm","runtime":"node","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/semver@6.3.2"],"schemaVersion":1,"subject":"pkg:npm/semver@6.3.2","verifierAdapter":"node-typescript@1"}
import semver from 'semver';
export function parseVersion(version, options = {}) {
return semver.parse(version, options);
}
export function cleanVersion(version, options = {}) {
return semver.clean(version, options);
}
export function incrementVersion(version, release, options = {}, identifier = undefined) {
return semver.inc(version, release, options, identifier);
}
export function checkSatisfies(version, range, options = {}) {
return semver.satisfies(version, range, options);
}
export function findMaxSatisfying(versions, range, options = {}) {
return semver.maxSatisfying(versions, range, options);
}
export function findMinSatisfying(versions, range, options = {}) {
return semver.minSatisfying(versions, range, options);
}
export function getMinVersion(range, loose = false) {
return semver.minVersion(range, loose);
}
export function coerceVersion(version, options = {}) {
return semver.coerce(version, options);
}
export function rangesIntersect(r1, r2, options = {}) {
return semver.intersects(r1, r2, options);
}
export function sortVersions(versions, options = {}) {
return semver.sort(versions, options);
}
{
"name": "sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample",
"version": "1.0.0",
"dependencies": {
"semver": "6.3.2"
}
},
"node_modules/semver": {
"version": "6.3.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.2.tgz",
"integrity": "sha512-GYrCADwpu6yV5OAvchkQ27Z5wwMxWAEMg5NNWjyHh/5DboFFqbdbvYNIvZouQpxXyeMPoTOh0vdPYKlf0ZswdQ==",
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
}
}
}
}
{
"name": "sample",
"version": "1.0.0",
"type": "module",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"semver": "6.3.2"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/semver@6.3.2",
"kind": "HOW",
"packages": [
"pkg:npm/semver@6.3.2"
]
}
import assert from 'node:assert/strict';
import semver from 'semver';
import {
parseVersion,
cleanVersion,
incrementVersion,
checkSatisfies,
findMaxSatisfying,
findMinSatisfying,
getMinVersion,
coerceVersion,
rangesIntersect,
sortVersions
} from '../index.mjs';
// 1. assert semver.parse and semver.clean parse and normalize semantic version strings or return null on invalid input
{
const parsed = parseVersion('v2.4.6-beta.3+exp.sha.5114f85');
assert.notEqual(parsed, null);
assert.equal(parsed.major, 2);
assert.equal(parsed.minor, 4);
assert.equal(parsed.patch, 6);
assert.deepEqual(parsed.prerelease, ['beta', 3]);
assert.deepEqual(parsed.build, ['exp', 'sha', '5114f85']);
assert.equal(parsed.version, '2.4.6-beta.3');
assert.equal(parsed instanceof semver.SemVer, true);
assert.equal(parseVersion('invalid-semver'), null);
assert.equal(cleanVersion(' =v1.2.3 '), '1.2.3');
assert.equal(cleanVersion('not-valid'), null);
}
// 2. assert semver.inc increments major, minor, patch, and prerelease components
{
assert.equal(incrementVersion('1.2.3', 'major'), '2.0.0');
assert.equal(incrementVersion('1.2.3', 'minor'), '1.3.0');
assert.equal(incrementVersion('1.2.3', 'patch'), '1.2.4');
assert.equal(incrementVersion('1.2.3', 'prerelease', {}, 'alpha'), '1.2.4-alpha.0');
assert.equal(incrementVersion('1.2.4-alpha.0', 'prerelease', {}, 'alpha'), '1.2.4-alpha.1');
assert.equal(incrementVersion('invalid', 'patch'), null);
}
// 3. assert semver.satisfies, semver.maxSatisfying, semver.minSatisfying, and semver.minVersion evaluate range constraints
{
assert.equal(checkSatisfies('1.5.0', '^1.2.0 <1.6.0'), true);
assert.equal(checkSatisfies('1.6.0', '^1.2.0 <1.6.0'), false);
assert.equal(checkSatisfies('1.3.0-alpha.1', '^1.2.0', { includePrerelease: true }), true);
assert.equal(checkSatisfies('1.3.0-alpha.1', '^1.2.0', { includePrerelease: false }), false);
const candidates = ['1.0.0', '1.2.0', '1.2.5', '1.5.2', '2.0.0'];
assert.equal(findMaxSatisfying(candidates, '~1.2.0'), '1.2.5');
assert.equal(findMinSatisfying(candidates, '>=1.2.0 <2.0.0'), '1.2.0');
assert.equal(findMaxSatisfying(candidates, '>=3.0.0'), null);
const minVer = getMinVersion('^1.2.3');
assert.notEqual(minVer, null);
assert.equal(minVer.version, '1.2.3');
}
// 4. assert semver.coerce extracts valid SemVer instances from partial or dirty strings with standard and rtl options
{
const std = coerceVersion('v42.6.7.9.3-alpha');
assert.notEqual(std, null);
assert.equal(std.version, '42.6.7');
const rtl = coerceVersion('v42.6.7.9.3-alpha', { rtl: true });
assert.notEqual(rtl, null);
assert.equal(rtl.version, '7.9.3');
assert.equal(coerceVersion('no-digits-here'), null);
}
// 5. assert semver.intersects and semver.sort verify overlapping range sets and ascending version ordering
{
assert.equal(rangesIntersect('^1.2.0', '~1.5.0'), true);
assert.equal(rangesIntersect('^1.2.0', '>=2.0.0'), false);
const list = ['2.0.0', '1.0.0', '1.0.0-alpha.1', '1.10.0', '1.2.0'];
const sorted = sortVersions(list);
assert.deepEqual(sorted, ['1.0.0-alpha.1', '1.0.0', '1.2.0', '1.10.0', '2.0.0']);
}
console.log('PASS: all semver@6.3.2 contract assertions passed');
Seeder d'origine
anonyme