Sample
semver 7.8.5: compare versions including build metadata with semver.compareBuild
Verified sample for npm semver 7.8.5: compare versions including build metadata with semver.compareBuild. The contract ran on node 22 · linux alpine/x64 …
sha256:89761a13ea0a6acf75bfb216aacb98301ac7af23a5cc0a17da684ecf7bc97d11
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
- 2
Declared environment
windows 11 x64 npm
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-19 |
| 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-09-07 |
Case
HOW- Goal
- compare versions including build metadata with semver.compareBuild
- Packages
- Symbols
-
- compareBuild
- Created
- 2026-08-19T11:10:44Z
Contract
- semver.compareBuild('1.0.0+1', '1.0.0+2') === -1
- semver.compareBuild('1.0.0+2', '1.0.0+1') === 1
- semver.compareBuild('1.0.0+build', '1.0.0+build') === 0
- semver.compareBuild('1.0.0', '1.0.0+build') === -1
- semver.compareBuild('1.0.0+build', '1.0.0') === 1
- semver.compareBuild('1.0.0', '2.0.0') === -1
- semver.compareBuild('1.0.0-alpha', '1.0.0-beta') === -1
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- 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: compare versions including build metadata with semver.compareBuild
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/semver@7.8.5
Demonstrate these symbols/APIs:
- compareBuild
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:4bb581c36a828265dc803ceca6b1314322fd3ab877100076b488880981ebda93","contract":["semver.compareBuild('1.0.0+1', '1.0.0+2') === -1","semver.compareBuild('1.0.0+2', '1.0.0+1') === 1","semver.compareBuild('1.0.0+build', '1.0.0+build') === 0","semver.compareBuild('1.0.0', '1.0.0+build') === -1","semver.compareBuild('1.0.0+build', '1.0.0') === 1","semver.compareBuild('1.0.0', '2.0.0') === -1","semver.compareBuild('1.0.0-alpha', '1.0.0-beta') === -1"],"goal":"compare versions including build metadata with semver.compareBuild","kind":"HOW","packages":["pkg:npm/semver@7.8.5"],"schemaVersion":1,"symbols":["compareBuild"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","ecosystem":"npm","os":"windows","osVersionBucket":"11","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/semver@7.8.5"],"schemaVersion":1,"symbols":["compareBuild"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-semver-compare-build",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-semver-compare-build",
"version": "1.0.0",
"dependencies": {
"semver": "7.8.5"
}
},
"node_modules/semver": {
"version": "7.8.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
"integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
}
}
}
{
"name": "sample-semver-compare-build",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"semver": "7.8.5"
}
}
{
"schemaVersion": 1,
"goal": "compare versions including build metadata with semver.compareBuild",
"kind": "HOW",
"packages": [
"pkg:npm/semver@7.8.5"
],
"symbols": [
"compareBuild"
]
}
import semver from 'semver';
export function compareWithBuild(v1, v2) {
return semver.compareBuild(v1, v2);
}
import assert from 'node:assert/strict';
import semver from 'semver';
import { compareWithBuild } from '../src/index.mjs';
// Exact symbol assertion: semver.compareBuild
assert.equal(typeof semver.compareBuild, 'function');
// Contract: compareBuild differentiates versions with different build metadata
assert.equal(semver.compareBuild('1.0.0+1', '1.0.0+2'), -1);
assert.equal(semver.compareBuild('1.0.0+2', '1.0.0+1'), 1);
assert.equal(semver.compareBuild('1.0.0+build', '1.0.0+build'), 0);
// Contract: compareBuild treats version without build metadata as lower than version with build metadata
assert.equal(semver.compareBuild('1.0.0', '1.0.0+build'), -1);
assert.equal(semver.compareBuild('1.0.0+build', '1.0.0'), 1);
// Contract: compareBuild respects standard major, minor, patch, and prerelease precedence
assert.equal(semver.compareBuild('1.0.0', '2.0.0'), -1);
assert.equal(semver.compareBuild('2.0.0', '1.0.0'), 1);
assert.equal(semver.compareBuild('1.0.0', '1.0.0'), 0);
assert.equal(semver.compareBuild('1.0.0-alpha', '1.0.0-beta'), -1);
// Contract: helper function wraps semver.compareBuild
assert.equal(compareWithBuild('1.0.0+1', '1.0.0+2'), -1);
assert.equal(compareWithBuild('1.0.0+build', '1.0.0+build'), 0);
console.log('Contract passed');
Origin Seeder
anonymous