CodeSampleX

Ejemplo

@esbuild/netbsd-x64 0.21.5

Muestra verificada para npm @esbuild/netbsd-x64 0.21.5. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: assert package resolution…

sha256:927dd13762cae375369141fb002fc2d63ed34cca228627f27ab401cb94309c06

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
1
Claves de firma que lo compilaron
1
Entorno declarado linux 24 · ubuntu · glibc 2.39 x64 npm

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

Caso

HOW
Objetivo
verify pkg:npm/%40esbuild/netbsd-x64@0.21.5
Paquetes
Creado
2026-08-26T07:42:22Z

Contrato

  1. assert package resolution locates @esbuild/netbsd-x64 manifest and binary
  2. assert package manifest specifies os netbsd, cpu x64, and node >= 12
  3. assert binary header contains 64-bit little-endian ELF magic and EM_X86_64 architecture code 62
  4. assert executing netbsd x64 native binary on mismatched host fails

Archivos

  • .npmrc
  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.cjs

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

Código fuente

.npmrc
force = true
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/%40esbuild/netbsd-x64@0.21.5
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40esbuild/netbsd-x64@0.21.5

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:7b955c78004b45aaf335378f4b6b00ee4d275a2dada8cf52a49faf7922352295","contract":["assert package resolution locates @esbuild/netbsd-x64 manifest and binary","assert package manifest specifies os netbsd, cpu x64, and node \u003e= 12","assert binary header contains 64-bit little-endian ELF magic and EM_X86_64 architecture code 62","assert executing netbsd x64 native binary on mismatched host fails"],"goal":"verify pkg:npm/%40esbuild/netbsd-x64@0.21.5","kind":"HOW","packages":["pkg:npm/%40esbuild/netbsd-x64@0.21.5"],"schemaVersion":1},"contractCommand":["node","test/contract.cjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40esbuild/netbsd-x64@0.21.5"],"schemaVersion":1,"subject":"pkg:npm/%40esbuild/netbsd-x64@0.21.5","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-esbuild-netbsd-x64",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-esbuild-netbsd-x64",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@esbuild/netbsd-x64": "0.21.5"
      }
    },
    "node_modules/@esbuild/netbsd-x64": {
      "version": "0.21.5",
      "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz",
      "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==",
      "cpu": [
        "x64"
      ],
      "license": "MIT",
      "os": [
        "netbsd"
      ],
      "engines": {
        "node": ">=12"
      }
    }
  }
}
package.json
{
  "name": "sample-esbuild-netbsd-x64",
  "version": "1.0.0",
  "private": true,
  "license": "MIT-0",
  "dependencies": {
    "@esbuild/netbsd-x64": "0.21.5"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40esbuild/netbsd-x64@0.21.5",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40esbuild/netbsd-x64@0.21.5"
  ]
}
test/contract.cjs
const assert = require("node:assert");
const fs = require("node:fs");
const path = require("node:path");
const cp = require("node:child_process");

// 1. Assert package resolution locates @esbuild/netbsd-x64 manifest and binary
const pkgJsonPath = require.resolve("@esbuild/netbsd-x64/package.json");
const pkgDir = path.dirname(pkgJsonPath);
const binPath = path.join(pkgDir, "bin", "esbuild");

assert(fs.existsSync(binPath), "bin/esbuild binary exists");
const stat = fs.statSync(binPath);
assert((stat.mode & 0o111) !== 0, "bin/esbuild is marked executable");

// 2. Assert package manifest specifies os netbsd, cpu x64, and node >= 12
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8"));
assert.strictEqual(pkgJson.name, "@esbuild/netbsd-x64");
assert.strictEqual(pkgJson.version, "0.21.5");
assert.deepStrictEqual(pkgJson.os, ["netbsd"]);
assert.deepStrictEqual(pkgJson.cpu, ["x64"]);
assert.deepStrictEqual(pkgJson.engines.node, ">=12");

// 3. Assert binary header contains 64-bit little-endian ELF magic and EM_X86_64 architecture code 62
const fd = fs.openSync(binPath, "r");
const header = Buffer.alloc(20);
fs.readSync(fd, header, 0, 20, 0);
fs.closeSync(fd);

// ELF Magic: 0x7f, "E", "L", "F"
assert.strictEqual(header[0], 0x7f, "ELF magic byte 0");
assert.strictEqual(header[1], 0x45, "ELF magic byte 1 ('E')");
assert.strictEqual(header[2], 0x4c, "ELF magic byte 2 ('L')");
assert.strictEqual(header[3], 0x46, "ELF magic byte 3 ('F')");

// ELF Class: 2 = 64-bit
assert.strictEqual(header[4], 2, "ELF class is 64-bit (ELFCLASS64)");

// ELF Data: 1 = Little-endian
assert.strictEqual(header[5], 1, "ELF data encoding is 2's complement, little endian");

// ELF Machine: 62 = EM_X86_64
const eMachine = header.readUInt16LE(18);
assert.strictEqual(eMachine, 62, "ELF machine is EM_X86_64");

// 4. Assert executing netbsd x64 native binary on mismatched host fails
if (process.platform !== "netbsd") {
  const res = cp.spawnSync(binPath, ["--version"]);
  assert(
    res.status !== 0 || res.signal !== null || res.error !== undefined,
    "executing netbsd x64 binary on mismatched host fails with non-zero exit code, signal, or spawn error"
  );
}

Seeder de origen

anónimo