Exemple
@npmcli/promise-spawn 8.0.3: promiseSpawn
Échantillon vérifié pour npm @npmcli/promise-spawn 8.0.3: promiseSpawn. Le contrat s'est exécuté sur node 22 · linux debian/x64 · docker et a réussi.
sha256:87d36a86f2eeb87bbdf4749f5c0cf687cda110997421195de6d237d18a1bb813
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
linux 24 · ubuntu · glibc 2.39 x64 npm
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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-10-18 |
Cas
HOW- Objectif
- verify pkg:npm/%40npmcli/promise-spawn@8.0.3
- Paquets
- Symboles
-
- promiseSpawn
- Créé
- 2026-10-18T01:39:44Z
Contrat
- promiseSpawn(cmd, args, opts, extra) spawns a child process and resolves with { cmd, args, code: 0, signal: null, stdout, stderr, ...extra } where stdout and stderr are trimmed strings by default
- Passing { stdioString: false } in opts returns raw Buffer instances for stdout and stderr without trimming
- The returned Promise exposes .stdin and .process properties referencing the underlying child process streams and handle
- When the child exits with a non-zero code, the promise rejects with Error('command failed') decorated with code, signal, stdout, stderr, and extra properties
Fichiers
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Code source
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/%40npmcli/promise-spawn@8.0.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40npmcli/promise-spawn@8.0.3
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:d7f346821404d0c430de0e568ec785cc561c6d4e7058124a11f3a0006dc1470e","contract":["promiseSpawn(cmd, args, opts, extra) spawns a child process and resolves with { cmd, args, code: 0, signal: null, stdout, stderr, ...extra } where stdout and stderr are trimmed strings by default","Passing { stdioString: false } in opts returns raw Buffer instances for stdout and stderr without trimming","The returned Promise exposes .stdin and .process properties referencing the underlying child process streams and handle","When the child exits with a non-zero code, the promise rejects with Error('command failed') decorated with code, signal, stdout, stderr, and extra properties"],"goal":"verify pkg:npm/%40npmcli/promise-spawn@8.0.3","kind":"HOW","packages":["pkg:npm/%40npmcli/promise-spawn@8.0.3"],"schemaVersion":1,"symbols":["promiseSpawn"]},"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/%40npmcli/promise-spawn@8.0.3"],"schemaVersion":1,"subject":"pkg:npm/%40npmcli/promise-spawn@8.0.3","symbols":["promiseSpawn"],"verifierAdapter":"node-typescript@1"}
{
"name": "verify-promise-spawn",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "verify-promise-spawn",
"version": "1.0.0",
"dependencies": {
"@npmcli/promise-spawn": "8.0.3"
}
},
"node_modules/@npmcli/promise-spawn": {
"version": "8.0.3",
"resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-8.0.3.tgz",
"integrity": "sha512-Yb00SWaL4F8w+K8YGhQ55+xE4RUNdMHV43WZGsiTM92gS+lC0mGsn7I4hLug7pbao035S6bj3Y3w0cUNGLfmkg==",
"license": "ISC",
"dependencies": {
"which": "^5.0.0"
},
"engines": {
"node": "^18.17.0 || >=20.5.0"
}
},
"node_modules/isexe": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.5.tgz",
"integrity": "sha512-6B3tLtFqtQS4ekarvLVMZ+X+VlvQekbe4taUkf/rhVO3d/h0M2rfARm/pXLcPEsjjMsFgrFgSrhQIxcSVrBz8w==",
"license": "BlueOak-1.0.0",
"engines": {
"node": ">=18"
}
},
"node_modules/which": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/which/-/which-5.0.0.tgz",
"integrity": "sha512-JEdGzHwwkrbWoGOlIHqQ5gtprKGOenpDHpxE9zVR1bWbOtYRyPPHMe9FaP6x61CmNaTThSkb0DAJte5jD+DmzQ==",
"license": "ISC",
"dependencies": {
"isexe": "^3.1.1"
},
"bin": {
"node-which": "bin/which.js"
},
"engines": {
"node": "^18.17.0 || >=20.5.0"
}
}
}
}
{
"name": "verify-promise-spawn",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"@npmcli/promise-spawn": "8.0.3"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40npmcli/promise-spawn@8.0.3",
"kind": "HOW",
"packages": [
"pkg:npm/%40npmcli/promise-spawn@8.0.3"
]
}
import assert from 'node:assert/strict'
import promiseSpawn from '@npmcli/promise-spawn'
// 1. Successful execution returns trimmed stdout/stderr strings and extra properties
const ok = await promiseSpawn(
process.execPath,
['-e', 'process.stdout.write(" hello world \\n"); process.stderr.write(" warn \\n")'],
{},
{ tag: 'ok-run' }
)
assert.equal(ok.code, 0)
assert.equal(ok.signal, null)
assert.equal(ok.stdout, 'hello world')
assert.equal(ok.stderr, 'warn')
assert.equal(ok.tag, 'ok-run')
assert.deepEqual(ok.args, ['-e', 'process.stdout.write(" hello world \\n"); process.stderr.write(" warn \\n")'])
// 2. stdioString: false returns raw Buffers without trimming
const raw = await promiseSpawn(
process.execPath,
['-e', 'process.stdout.write("raw\\n")'],
{ stdioString: false }
)
assert.ok(Buffer.isBuffer(raw.stdout))
assert.equal(raw.stdout.toString('utf8'), 'raw\n')
assert.ok(Buffer.isBuffer(raw.stderr))
assert.equal(raw.stderr.length, 0)
// 3. Returned promise exposes .stdin and .process handles
const childPromise = promiseSpawn(
process.execPath,
['-e', 'process.stdin.pipe(process.stdout)']
)
assert.ok(childPromise.stdin)
assert.ok(childPromise.process)
childPromise.stdin.end('piped input\n')
const piped = await childPromise
assert.equal(piped.stdout, 'piped input')
// 4. Non-zero exit code rejects with Error('command failed') decorated with result + extra
await assert.rejects(
() => promiseSpawn(
process.execPath,
['-e', 'process.stderr.write("boom\\n"); process.exit(3)'],
{},
{ context: 'fail-test' }
),
(err) => {
assert.equal(err.message, 'command failed')
assert.equal(err.code, 3)
assert.equal(err.stderr, 'boom')
assert.equal(err.context, 'fail-test')
return true
}
)
Seeder d'origine
anonyme