Ejemplo
cross-spawn 7.0.6: cross-spawn
Muestra verificada para npm cross-spawn 7.0.6: cross-spawn. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó.
sha256:16485ebfe716dd75c9e7351ada1212ac6dff8035da0898f4479e291a67474c32
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 cross-spawn in pkg:npm/cross-spawn@7.0.6
- Paquetes
- Símbolos
-
- cross-spawn
- Creado
- 2026-08-26T10:41:56Z
Contrato
- crossSpawn.sync executes command synchronously and returns status 0 with valid pid
- crossSpawn.sync decodes stdout and stderr as strings when encoding option is provided
- crossSpawn.sync passes arguments and custom environment variables to child process
- crossSpawn.sync captures non-zero exit code and standard error on failure
- crossSpawn.sync reports ENOENT error when binary does not exist
- crossSpawn executes command asynchronously and streams stdout
- crossSpawn pipes stdin to child process
- crossSpawn emits error event with ENOENT for non-existent command
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
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 cross-spawn in pkg:npm/cross-spawn@7.0.6
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/cross-spawn@7.0.6
Demonstrate these symbols/APIs:
- cross-spawn
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:1cc8daf8fd9f26210030a336410d0a881e5ccfbc52d25b7800d5643cc87cb74f","contract":["crossSpawn.sync executes command synchronously and returns status 0 with valid pid","crossSpawn.sync decodes stdout and stderr as strings when encoding option is provided","crossSpawn.sync passes arguments and custom environment variables to child process","crossSpawn.sync captures non-zero exit code and standard error on failure","crossSpawn.sync reports ENOENT error when binary does not exist","crossSpawn executes command asynchronously and streams stdout","crossSpawn pipes stdin to child process","crossSpawn emits error event with ENOENT for non-existent command"],"goal":"verify cross-spawn in pkg:npm/cross-spawn@7.0.6","kind":"HOW","packages":["pkg:npm/cross-spawn@7.0.6"],"schemaVersion":1,"symbols":["cross-spawn"]},"contractCommand":["node","test/contract.mjs"],"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/cross-spawn@7.0.6"],"schemaVersion":1,"subject":"pkg:npm/cross-spawn@7.0.6","symbols":["cross-spawn"],"verifierAdapter":"node-typescript@1"}
{
"name": "cross-spawn-verification",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "cross-spawn-verification",
"version": "1.0.0",
"dependencies": {
"cross-spawn": "7.0.6"
}
},
"node_modules/cross-spawn": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
"license": "MIT",
"dependencies": {
"path-key": "^3.1.0",
"shebang-command": "^2.0.0",
"which": "^2.0.1"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
"license": "ISC"
},
"node_modules/path-key": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
"license": "MIT",
"dependencies": {
"shebang-regex": "^3.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/shebang-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"license": "ISC",
"dependencies": {
"isexe": "^2.0.0"
},
"bin": {
"node-which": "bin/node-which"
},
"engines": {
"node": ">= 8"
}
}
}
}
{
"name": "cross-spawn-verification",
"version": "1.0.0",
"private": true,
"type": "module",
"dependencies": {
"cross-spawn": "7.0.6"
}
}
{
"schemaVersion": 1,
"goal": "verify cross-spawn in pkg:npm/cross-spawn@7.0.6",
"kind": "HOW",
"packages": [
"pkg:npm/cross-spawn@7.0.6"
],
"symbols": [
"cross-spawn"
]
}
import assert from 'node:assert';
import spawn from 'cross-spawn';
// 1. crossSpawn.sync executes command synchronously and returns status 0 with valid pid
const resultSync = spawn.sync('node', ['-e', 'console.log("hello cross-spawn")']);
assert.strictEqual(resultSync.status, 0);
assert.strictEqual(resultSync.signal, null);
assert.strictEqual(resultSync.error, null);
assert.ok(typeof resultSync.pid === 'number' && resultSync.pid > 0);
assert.ok(resultSync.stdout.toString().includes('hello cross-spawn'));
// 2. crossSpawn.sync decodes stdout and stderr as strings when encoding option is provided
const resultEncoded = spawn.sync('node', ['-e', 'console.log("encoded-output")'], {
encoding: 'utf8'
});
assert.strictEqual(resultEncoded.status, 0);
assert.strictEqual(resultEncoded.stdout.trim(), 'encoded-output');
assert.strictEqual(resultEncoded.stderr, '');
// 3. crossSpawn.sync passes arguments and custom environment variables to child process
const resultEnv = spawn.sync('node', ['-e', 'console.log(process.env.TEST_VAR, process.argv[1])', 'arg1'], {
encoding: 'utf8',
env: { ...process.env, TEST_VAR: 'custom_value' }
});
assert.strictEqual(resultEnv.status, 0);
assert.ok(resultEnv.stdout.includes('custom_value arg1'));
// 4. crossSpawn.sync captures non-zero exit code and standard error on failure
const resultFail = spawn.sync('node', ['-e', 'console.error("error occurred"); process.exit(42)'], {
encoding: 'utf8'
});
assert.strictEqual(resultFail.status, 42);
assert.ok(resultFail.stderr.includes('error occurred'));
// 5. crossSpawn.sync reports ENOENT error when binary does not exist
const resultEnoent = spawn.sync('non_existent_command_123456_xyz', ['--test']);
assert.ok(resultEnoent.error !== null && resultEnoent.error !== undefined);
assert.strictEqual(resultEnoent.error.code, 'ENOENT');
// 6. crossSpawn executes command asynchronously and streams stdout
const child = spawn('node', ['-e', 'console.log("async output")']);
let stdoutData = '';
child.stdout.on('data', (chunk) => {
stdoutData += chunk.toString();
});
const [exitCode] = await new Promise((resolve) => {
child.on('close', (code, signal) => {
resolve([code, signal]);
});
});
assert.strictEqual(exitCode, 0);
assert.ok(stdoutData.includes('async output'));
// 7. crossSpawn pipes stdin to child process
const childStdin = spawn('node', ['-e', 'process.stdin.pipe(process.stdout)']);
let pipedOutput = '';
childStdin.stdout.on('data', (chunk) => {
pipedOutput += chunk.toString();
});
childStdin.stdin.write('piped-input-data\n');
childStdin.stdin.end();
const [stdinExitCode] = await new Promise((resolve) => {
childStdin.on('close', (code) => {
resolve([code]);
});
});
assert.strictEqual(stdinExitCode, 0);
assert.strictEqual(pipedOutput.trim(), 'piped-input-data');
// 8. crossSpawn emits error event with ENOENT for non-existent command
const childMissing = spawn('non_existent_binary_xyz_123456', ['--arg']);
const missingError = await new Promise((resolve) => {
childMissing.on('error', (err) => {
resolve(err);
});
});
assert.ok(missingError !== null);
assert.strictEqual(missingError.code, 'ENOENT');
console.log('Contract passed');
Seeder de origen
anónimo