Ejemplo
@types/js-yaml 4.0.9: version
Muestra verificada para npm @types/js-yaml 4.0.9: version. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó.
sha256:201c6c0b265b7bfffc955af2da954b638aae2d91a242ba7f3b3746523f499c9e
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 2
- Claves de firma que lo compilaron
- 1
Entorno declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| 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 |
Caso
HOW- Objetivo
- verify @types/js-yaml.version in pkg:npm/%40types/js-yaml@4.0.9
- Paquetes
- Símbolos
-
- @types/js-yaml.version
- Entorno
- node 22.23.2
- Creado
- 2026-08-26T12:36:13Z
Contrato
- @types/js-yaml package.json declares package version 4.0.9 and types entry point index.d.ts
- @types/js-yaml exports map exposes root types and ./package.json subpath
- @types/js-yaml index.d.ts declares State interface with version property typed as null | number
- inspectVersionDefinitions validates package version matching 4.0.9 and declaration structure
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
Código fuente
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 @types/js-yaml.version in pkg:npm/%40types/js-yaml@4.0.9
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40types/js-yaml@4.0.9
Demonstrate these symbols/APIs:
- @types/js-yaml.version
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:c72692a72a5622334772f85f517089377a3e8b27e9372452bc8bb4bf4057037d","contract":["@types/js-yaml package.json declares package version 4.0.9 and types entry point index.d.ts","@types/js-yaml exports map exposes root types and ./package.json subpath","@types/js-yaml index.d.ts declares State interface with version property typed as null | number","inspectVersionDefinitions validates package version matching 4.0.9 and declaration structure"],"goal":"verify @types/js-yaml.version in pkg:npm/%40types/js-yaml@4.0.9","kind":"HOW","packages":["pkg:npm/%40types/js-yaml@4.0.9"],"schemaVersion":1,"symbols":["@types/js-yaml.version"]},"contractCommand":["node","test/contract.js"],"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/%40types/js-yaml@4.0.9"],"schemaVersion":1,"subject":"pkg:npm/%40types/js-yaml@4.0.9","symbols":["@types/js-yaml.version"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-types-js-yaml-version",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-types-js-yaml-version",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@types/js-yaml": "4.0.9"
}
},
"node_modules/@types/js-yaml": {
"version": "4.0.9",
"resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz",
"integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==",
"license": "MIT"
}
}
}
{
"name": "sample-types-js-yaml-version",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification sample for @types/js-yaml version",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"@types/js-yaml": "4.0.9"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify @types/js-yaml.version in pkg:npm/%40types/js-yaml@4.0.9",
"kind": "HOW",
"packages": [
"pkg:npm/%40types/js-yaml@4.0.9"
],
"symbols": [
"@types/js-yaml.version"
]
}
const fs = require('node:fs');
const path = require('node:path');
/**
* Resolves the path to the @types/js-yaml package.json file.
* @returns {string} Absolute path to package.json
*/
function getPackageJsonPath() {
return require.resolve('@types/js-yaml/package.json');
}
/**
* Loads the package.json content of @types/js-yaml.
* @returns {object} The parsed package.json manifest
*/
function loadPackageManifest() {
const pkgPath = getPackageJsonPath();
const raw = fs.readFileSync(pkgPath, 'utf8');
return JSON.parse(raw);
}
/**
* Resolves the path to the @types/js-yaml declaration file.
* @returns {string} Absolute path to index.d.ts
*/
function getDeclarationPath() {
const pkgDir = path.dirname(getPackageJsonPath());
return path.join(pkgDir, 'index.d.ts');
}
/**
* Loads the declaration file content from @types/js-yaml.
* @returns {string} The text content of index.d.ts
*/
function loadDeclarationContent() {
const declPath = getDeclarationPath();
return fs.readFileSync(declPath, 'utf8');
}
/**
* Verifies version metadata and declaration constructs for @types/js-yaml.
* @returns {object} Summary of discovered version and type declarations
*/
function inspectVersionDefinitions() {
const manifest = loadPackageManifest();
const content = loadDeclarationContent();
const isVersionMatching = manifest.version === '4.0.9';
const hasTypesField = manifest.types === 'index.d.ts';
const hasExports = Boolean(manifest.exports && manifest.exports['.']);
const hasStateVersionProperty = content.includes('version: null | number;');
const hasNamespace = content.includes('export as namespace jsyaml;');
return {
packageName: manifest.name,
packageVersion: manifest.version,
isVersionMatching,
hasTypesField,
hasExports,
hasStateVersionProperty,
hasNamespace
};
}
module.exports = {
getPackageJsonPath,
loadPackageManifest,
getDeclarationPath,
loadDeclarationContent,
inspectVersionDefinitions
};
const assert = require('node:assert/strict');
const fs = require('node:fs');
const {
getPackageJsonPath,
loadPackageManifest,
getDeclarationPath,
loadDeclarationContent,
inspectVersionDefinitions
} = require('../src/index.js');
// 1. Verify package manifest metadata and version definition
const manifest = loadPackageManifest();
assert.strictEqual(manifest.name, '@types/js-yaml', 'package name should match @types/js-yaml');
assert.strictEqual(manifest.version, '4.0.9', 'package version should match 4.0.9');
assert.strictEqual(manifest.types, 'index.d.ts', 'package types entry should point to index.d.ts');
assert.ok(manifest.exports && manifest.exports['.'], 'exports entry point should be configured');
assert.strictEqual(manifest.exports['./package.json'], './package.json', 'package.json subpath export should be exposed');
// 2. Verify declaration file existence on disk
const declPath = getDeclarationPath();
assert.strictEqual(fs.existsSync(declPath), true, 'index.d.ts should exist on disk');
// 3. Verify declaration content contains namespace and version type in State interface
const content = loadDeclarationContent();
assert.strictEqual(typeof content, 'string', 'declaration content should be a string');
assert.strictEqual(content.includes('export as namespace jsyaml;'), true, 'declaration should declare jsyaml namespace');
assert.strictEqual(
content.includes('version: null | number;'),
true,
'State interface should declare version property as null | number'
);
// 4. Verify inspection helper results
const inspection = inspectVersionDefinitions();
assert.strictEqual(inspection.packageName, '@types/js-yaml', 'inspection packageName must match');
assert.strictEqual(inspection.packageVersion, '4.0.9', 'inspection packageVersion must match 4.0.9');
assert.strictEqual(inspection.isVersionMatching, true, 'isVersionMatching must be true');
assert.strictEqual(inspection.hasTypesField, true, 'hasTypesField must be true');
assert.strictEqual(inspection.hasExports, true, 'hasExports must be true');
assert.strictEqual(inspection.hasStateVersionProperty, true, 'hasStateVersionProperty must be true');
assert.strictEqual(inspection.hasNamespace, true, 'hasNamespace must be true');
console.log('Contract tests passed successfully.');
Seeder de origen
anónimo