CodeSampleX

Beispiel

@types/js-yaml 4.0.9: version

Verifiziertes Beispiel für npm @types/js-yaml 4.0.9: version. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand.

sha256:201c6c0b265b7bfffc955af2da954b638aae2d91a242ba7f3b3746523f499c9e

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
2
Signaturschlüssel, die es gebaut haben
1
Deklarierte Umgebung node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
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

Fall

HOW
Ziel
verify @types/js-yaml.version in pkg:npm/%40types/js-yaml@4.0.9
Pakete
Symbole
  • @types/js-yaml.version
Umgebung
node 22.23.2
Erstellt
2026-08-26T12:36:13Z

Contract

  1. @types/js-yaml package.json declares package version 4.0.9 and types entry point index.d.ts
  2. @types/js-yaml exports map exposes root types and ./package.json subpath
  3. @types/js-yaml index.d.ts declares State interface with version property typed as null | number
  4. inspectVersionDefinitions validates package version matching 4.0.9 and declaration structure

Dateien

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.js
  • test/contract.js

Quellartefakt herunterladen (tar.gz)

Quelltext

PROMPT.md
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.
csx.json
{"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"}
package-lock.json
{
  "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"
    }
  }
}
package.json
{
  "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"
}
spec.json
{
  "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"
  ]
}
src/index.js
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
};
test/contract.js
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.');

Ursprungs-Seeder

anonym