CodeSampleX

Ejemplo

bun 1.3.14

Muestra verificada para npm bun 1.3.14. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: getPackageManifest returns valid package…

sha256:1f2a4b58ba481ab0e5ea5306306824b52f699653f6f4bcf3681c619c10c97b88

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@1
2026-08-21
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 pkg:npm/bun@1.3.14
Paquetes
Entorno
node 22.23.2
Creado
2026-08-21T03:59:03Z

Contrato

  1. getPackageManifest returns valid package metadata for bun version 1.3.14 with MIT license
  2. getPackageStructure confirms CLI binary definitions and absence of Node library entry points
  3. getSupportedPlatforms confirms broad multi-OS and multi-architecture target declarations
  4. getOptionalDependencies maps all native platform distributions to pinned 1.3.14 version
  5. inspectPostinstallScript verifies existence and platform-detection logic of install.js
  6. inspectExecutableStubs verifies bin/bun.exe and bin/bunx.exe stubs exist with postinstall message
  7. verifyNodeImportThrows confirms that requiring bun directly in Node environment throws MODULE_NOT_FOUND

Archivos

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

Descargar el artefacto de código fuente (tar.gz)

Código fuente

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 pkg:npm/bun@1.3.14
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/bun@1.3.14
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.
csx.json
{"case":{"caseId":"case:sha256:2aeb85fcec586d522c7c2fe3075b4ff592820ee689fd27c7925a2088477b67c3","constraints":{"executionContext":"node"},"contract":["getPackageManifest returns valid package metadata for bun version 1.3.14 with MIT license","getPackageStructure confirms CLI binary definitions and absence of Node library entry points","getSupportedPlatforms confirms broad multi-OS and multi-architecture target declarations","getOptionalDependencies maps all native platform distributions to pinned 1.3.14 version","inspectPostinstallScript verifies existence and platform-detection logic of install.js","inspectExecutableStubs verifies bin/bun.exe and bin/bunx.exe stubs exist with postinstall message","verifyNodeImportThrows confirms that requiring bun directly in Node environment throws MODULE_NOT_FOUND"],"goal":"verify pkg:npm/bun@1.3.14","kind":"HOW","packages":["pkg:npm/bun@1.3.14"],"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/bun@1.3.14"],"schemaVersion":1,"subject":"pkg:npm/bun@1.3.14","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-bun",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-bun",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "bun": "1.3.14"
      }
    },
    "node_modules/@oven/bun-darwin-aarch64": {
      "version": "1.3.14",
      "resolved": "https://registry.npmjs.org/@oven/bun-darwin-aarch64/-/bun-darwin-aarch64-1.3.14.tgz",
      "integrity": "sha512-Omj20SuiHBOUjUBIyqtkNjSUIjOtEOJwmbix/ZyFH4BaQ6OZTaaRWIR4TjHVz0yadHgli6lLTiAh1uarnvD49A==",
      "cpu": [
        "arm64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "darwin"
      ]
    },
    "node_modules/@oven/bun-darwin-x64": {
      "version": "1.3.14",
      "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64/-/bun-darwin-x64-1.3.14.tgz",
      "integrity": "sha512-FFj3QdU/OhlDyZOJ8CWfN5eWLpRlT4qjZg7lMQi7jA6GuoY5ajlO1zWLP/MuHYRSbXQUvV52RejNi8DVnAp13w==",
      "cpu": [
        "x64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "darwin"
      ]
    },
    "node_modules/@oven/bun-darwin-x64-baseline": {
      "version": "1.3.14",
      "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64-baseline/-/bun-darwin-x64-baseline-1.3.14.tgz",
      "integrity": "sha512-OSfsTZstc898HHElhU4NccaBGOSSDn5VfahiVTnidZ9B/+wb7WTyfZJaBeJcfjwJ9H2W9uTh2TGtl3UfcXgV9g==",
      "cpu": [
        "x64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "darwin"
      ]
    },
    "node_modules/@oven/bun-freebsd-aarch64": {
      "version": "1.3.14",
      "resolved": "https://registry.npmjs.org/@oven/bun-freebsd-aarch64/-/bun-freebsd-aarch64-1.3.14.tgz",
      "integrity": "sha512-LIKrXaFxAHybVO5Pf+9XP2FHUj/5APvXTUKk9dqHm5iFz4oH+W24cmhjkJirNujh9hKeTyrpWSe3no9JZKowIw==",
      "cpu": [
        "arm64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "freebsd"
      ]
    },
    "node_modules/@oven/bun-freebsd-x64": {
      "version": "1.3.14",
      "resolved": "https://registry.npmjs.org/@oven/bun-freebsd-x64/-/bun-freebsd-x64-1.3.14.tgz",
      "integrity": "sha512-uwD+fGUH1ADpIF3B1U2jWzzb20QwRLZfj5QZ28GUCGrAJ/nTmWrD6YYGsblCY1wuhldRez3lU40AyuvSCyLYmw==",
      "cpu": [
        "x64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "freebsd"
      ]
    },
    "node_modules/@oven/bun-linux-aarch64": {
      "version": "1.3.14",
      "resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64/-/bun-linux-aarch64-1.3.14.tgz",
      "integrity": "sha512-X5SsPZHs+iYO8R/efIcRtc7gT2Q2DgPfliCxEkx4cXBumwkw0c/EsHMNwH3EgGpCDaZ7IYVPhpCG/xBOQHEwZw==",
      "cpu": [
        "arm64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "linux"
      ]
    },
    "node_modules/@oven/bun-linux-aarch64-android": {
      "version": "1.3.14",
      "resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64-android/-/bun-linux-aarch64-android-1.3.14.tgz",
      "integrity": "sha512-y4kq5b85lsrmFb9Xvi4w9mA5IEFJkLMrSmYn06q24KjL9rUWDWO3VFZEtteZxUN5+ec3Zm5S8OnJw1umaCbVjA==",
      "cpu": [
        "arm64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "android"
      ]
    },
    "node_modules/@oven/bun-linux-aarch64-musl": {
      "version": "1.3.14",
      "resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64-musl/-/bun-linux-aarch64-musl-1.3.14.tgz",
      "integrity": "sha512-jmqOA92Cd1NL/1XBd4bFkJLxQ86K0RW7ohxS2qzzAvuitO4JiIxjjTeCspoU44zCozH72HpfZfUE2On31OjnWA==",
      "cpu": [
        "arm64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "linux"
      ]
    },
    "node_modules/@oven/bun-linux-x64": {
      "version": "1.3.14",
      "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64/-/bun-linux-x64-1.3.14.tgz",
      "integrity": "sha512-7OVTAKvwfPmSbIV1HpdOoVVx5VRc427GuPPne93N6vk4eQBPId9nXmZDh9/zGaKPdbVjVtQSZafWQoUjx38Utw==",
      "cpu": [
        "x64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "linux"
      ]
    },
    "node_modules/@oven/bun-linux-x64-android": {
      "version": "1.3.14",
      "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-android/-/bun-linux-x64-android-1.3.14.tgz",
      "integrity": "sha512-qe9e1d+3VAEU7nAA2ol9Jvmy/o99PVMSgZhHn7Q/9O3YcDrfEqyQ8zm4zoe5qTEo8HZH0dN03Le0Ys2eQPs7eg==",
      "cpu": [
        "x64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "android"
      ]
    },
    "node_modules/@oven/bun-linux-x64-baseline": {
      "version": "1.3.14",
      "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-baseline/-/bun-linux-x64-baseline-1.3.14.tgz",
      "integrity": "sha512-q/8EdOC0yUE8FPeoOVq8/Pw5I9/tJaYmUfO/uDUAREx8IUnOJH1RJ5A3BjFqre8pvJoiZA9AovPJq5FnNNjSxA==",
      "cpu": [
        "x64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "linux"
      ]
    },
    "node_modules/@oven/bun-linux-x64-musl": {
      "version": "1.3.14",
      "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-musl/-/bun-linux-x64-musl-1.3.14.tgz",
      "integrity": "sha512-GBCB/k/sIqcr06eTNgg7g46qiUv35Jasx4XiccJ/n7RGqrE4RWUD/XJBbWFprVPjvqd59+QtSnS99XGqvftHfg==",
      "cpu": [
        "x64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "linux"
      ]
    },
    "node_modules/@oven/bun-linux-x64-musl-baseline": {
      "version": "1.3.14",
      "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-musl-baseline/-/bun-linux-x64-musl-baseline-1.3.14.tgz",
      "integrity": "sha512-n6iE71G4lQE4XkrZhQQcL5YUlxDbnq6nqV7zeQi33PMsLT/0kYE+RvHOtBWZ3w0wMdXZfINmp63hIb9ijUBGtw==",
      "cpu": [
        "x64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "linux"
      ]
    },
    "node_modules/@oven/bun-windows-aarch64": {
      "version": "1.3.14",
      "resolved": "https://registry.npmjs.org/@oven/bun-windows-aarch64/-/bun-windows-aarch64-1.3.14.tgz",
      "integrity": "sha512-T7s3x/BsVKQObGU6QDkZeI6wKynzqGbBH1yI77jrrj5siElclxr3DQrDIk8CV4G5/SJq2HHq4kpLyYY2DKCSmA==",
      "cpu": [
        "arm64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "win32"
      ]
    },
    "node_modules/@oven/bun-windows-x64": {
      "version": "1.3.14",
      "resolved": "https://registry.npmjs.org/@oven/bun-windows-x64/-/bun-windows-x64-1.3.14.tgz",
      "integrity": "sha512-mUFWL3BoYkNpjd8e9PqROiFF/1Xeotq20mABJsiQH62jM1g5zqWh4khw1RZ6bX8Q8fWvlPaxG1PjofkmjUi3vg==",
      "cpu": [
        "x64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "win32"
      ]
    },
    "node_modules/@oven/bun-windows-x64-baseline": {
      "version": "1.3.14",
      "resolved": "https://registry.npmjs.org/@oven/bun-windows-x64-baseline/-/bun-windows-x64-baseline-1.3.14.tgz",
      "integrity": "sha512-uIjLUC1S9DWgICzuoMba7vurBJnBruE4S5CxnvmZkdqWVXRzx1Rgu636HoH+k0qeaQCFh3jeG3JQ1y6fRHv0sw==",
      "cpu": [
        "x64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "win32"
      ]
    },
    "node_modules/bun": {
      "version": "1.3.14",
      "resolved": "https://registry.npmjs.org/bun/-/bun-1.3.14.tgz",
      "integrity": "sha512-aB6GVd42x1Y5ie1K16SF+oLGtgSkwX9hgoDdIW88pjvfTccU8F1vfpoOt34QLv0dZ1v3XimtaxPlZUG81Gx9Zg==",
      "cpu": [
        "arm64",
        "x64"
      ],
      "hasInstallScript": true,
      "license": "MIT",
      "os": [
        "darwin",
        "linux",
        "android",
        "freebsd",
        "win32"
      ],
      "bin": {
        "bun": "bin/bun.exe",
        "bunx": "bin/bunx.exe"
      },
      "optionalDependencies": {
        "@oven/bun-darwin-aarch64": "1.3.14",
        "@oven/bun-darwin-x64": "1.3.14",
        "@oven/bun-darwin-x64-baseline": "1.3.14",
        "@oven/bun-freebsd-aarch64": "1.3.14",
        "@oven/bun-freebsd-x64": "1.3.14",
        "@oven/bun-linux-aarch64": "1.3.14",
        "@oven/bun-linux-aarch64-android": "1.3.14",
        "@oven/bun-linux-aarch64-musl": "1.3.14",
        "@oven/bun-linux-x64": "1.3.14",
        "@oven/bun-linux-x64-android": "1.3.14",
        "@oven/bun-linux-x64-baseline": "1.3.14",
        "@oven/bun-linux-x64-musl": "1.3.14",
        "@oven/bun-linux-x64-musl-baseline": "1.3.14",
        "@oven/bun-windows-aarch64": "1.3.14",
        "@oven/bun-windows-x64": "1.3.14",
        "@oven/bun-windows-x64-baseline": "1.3.14"
      }
    }
  }
}
package.json
{
  "name": "sample-bun",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification of bun",
  "main": "src/index.js",
  "license": "MIT-0",
  "dependencies": {
    "bun": "1.3.14"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/bun@1.3.14",
  "kind": "HOW",
  "packages": [
    "pkg:npm/bun@1.3.14"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
src/index.js
const fs = require('fs');
const path = require('path');

function getPackageManifest() {
  const manifestPath = require.resolve('bun/package.json');
  return JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
}

function getPackageRoot() {
  return path.dirname(require.resolve('bun/package.json'));
}

function getPackageStructure() {
  const manifest = getPackageManifest();
  return {
    name: manifest.name,
    version: manifest.version,
    license: manifest.license,
    hasMain: manifest.main !== undefined,
    hasExports: manifest.exports !== undefined,
    hasTypes: manifest.types !== undefined,
    postinstallScript: manifest.scripts?.postinstall,
    binEntries: manifest.bin || {},
  };
}

function getSupportedPlatforms() {
  const manifest = getPackageManifest();
  return {
    os: manifest.os || [],
    cpu: manifest.cpu || [],
  };
}

function getOptionalDependencies() {
  const manifest = getPackageManifest();
  return manifest.optionalDependencies || {};
}

function inspectPostinstallScript() {
  const root = getPackageRoot();
  const installPath = path.join(root, 'install.js');
  const exists = fs.existsSync(installPath);
  const content = exists ? fs.readFileSync(installPath, 'utf8') : '';
  return {
    exists,
    length: content.length,
    hasPlatformLogic: content.includes('darwin') && content.includes('linux') && content.includes('win32'),
  };
}

function inspectExecutableStubs() {
  const root = getPackageRoot();
  const bunStubPath = path.join(root, 'bin', 'bun.exe');
  const bunxStubPath = path.join(root, 'bin', 'bunx.exe');
  const readmePath = path.join(root, 'bin', 'README.txt');

  return {
    bunStubExists: fs.existsSync(bunStubPath),
    bunxStubExists: fs.existsSync(bunxStubPath),
    readmeExists: fs.existsSync(readmePath),
    bunStubContent: fs.existsSync(bunStubPath) ? fs.readFileSync(bunStubPath, 'utf8') : '',
  };
}

function verifyNodeImportThrows() {
  try {
    require('bun');
    return { threw: false, code: null };
  } catch (err) {
    return { threw: true, code: err.code };
  }
}

module.exports = {
  getPackageManifest,
  getPackageRoot,
  getPackageStructure,
  getSupportedPlatforms,
  getOptionalDependencies,
  inspectPostinstallScript,
  inspectExecutableStubs,
  verifyNodeImportThrows,
};
test/contract.mjs
import assert from 'node:assert';
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);
const {
  getPackageManifest,
  getPackageRoot,
  getPackageStructure,
  getSupportedPlatforms,
  getOptionalDependencies,
  inspectPostinstallScript,
  inspectExecutableStubs,
  verifyNodeImportThrows,
} = require('../src/index.js');

async function runContract() {
  // 1. getPackageManifest returns valid package metadata for bun version 1.3.14 with MIT license
  const manifest = getPackageManifest();
  assert.strictEqual(manifest.name, 'bun', 'Package name must be bun');
  assert.strictEqual(manifest.version, '1.3.14', 'Package version must be 1.3.14');
  assert.strictEqual(manifest.license, 'MIT', 'Package license must be MIT');

  // 2. getPackageStructure confirms CLI binary definitions and absence of Node library entry points
  const structure = getPackageStructure();
  assert.strictEqual(structure.hasMain, false, 'Package must not define main entry point');
  assert.strictEqual(structure.hasExports, false, 'Package must not define exports field');
  assert.strictEqual(structure.hasTypes, false, 'Package must not define types field');
  assert.strictEqual(structure.postinstallScript, 'node install.js', 'Postinstall script must be node install.js');
  assert.deepStrictEqual(structure.binEntries, { bun: 'bin/bun.exe', bunx: 'bin/bunx.exe' }, 'Bin entries must match expected executables');

  // 3. getSupportedPlatforms confirms broad multi-OS and multi-architecture target declarations
  const platforms = getSupportedPlatforms();
  assert.deepStrictEqual(platforms.os, ['darwin', 'linux', 'android', 'freebsd', 'win32'], 'Declared OS targets must match');
  assert.deepStrictEqual(platforms.cpu, ['arm64', 'x64'], 'Declared CPU targets must match');

  // 4. getOptionalDependencies maps all native platform distributions to pinned 1.3.14 version
  const optDeps = getOptionalDependencies();
  const requiredTargets = [
    '@oven/bun-linux-x64',
    '@oven/bun-linux-x64-musl',
    '@oven/bun-linux-aarch64',
    '@oven/bun-darwin-aarch64',
    '@oven/bun-darwin-x64',
    '@oven/bun-windows-x64',
  ];
  for (const target of requiredTargets) {
    assert.strictEqual(optDeps[target], '1.3.14', `Optional dependency ${target} must be pinned to 1.3.14`);
  }

  // 5. inspectPostinstallScript verifies existence and platform-detection logic of install.js
  const postinstallInfo = inspectPostinstallScript();
  assert.strictEqual(postinstallInfo.exists, true, 'install.js must exist in package root');
  assert(postinstallInfo.length > 1000, 'install.js must contain full postinstall implementation');
  assert.strictEqual(postinstallInfo.hasPlatformLogic, true, 'install.js must contain multi-platform detection logic');

  // 6. inspectExecutableStubs verifies bin/bun.exe and bin/bunx.exe stubs exist with postinstall message
  const stubsInfo = inspectExecutableStubs();
  assert.strictEqual(stubsInfo.bunStubExists, true, 'bin/bun.exe stub must exist');
  assert.strictEqual(stubsInfo.bunxStubExists, true, 'bin/bunx.exe stub must exist');
  assert.strictEqual(stubsInfo.readmeExists, true, 'bin/README.txt must exist');
  assert(stubsInfo.bunStubContent.includes('postinstall'), 'bun.exe stub must reference postinstall script');

  // 7. verifyNodeImportThrows confirms that requiring bun directly in Node environment throws MODULE_NOT_FOUND
  const importResult = verifyNodeImportThrows();
  assert.strictEqual(importResult.threw, true, 'Requiring bun in Node must throw');
  assert.strictEqual(importResult.code, 'MODULE_NOT_FOUND', 'Thrown error code must be MODULE_NOT_FOUND');

  console.log('Contract tests passed successfully.');
}

runContract().catch((err) => {
  console.error('Contract test failed:', err);
  process.exit(1);
});

Seeder de origen

anónimo