Ejemplo
bare-stdio 1.0.3
Muestra verificada para npm bare-stdio 1.0.3. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: bare-stdio exports standard I/O streams…
sha256:6f21c06016986b37066c9a0f752b724a05c43c5483eb71e88d0979148ac960cf
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
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@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-27 |
Caso
HOW- Objetivo
- verify pkg:npm/bare-stdio@1.0.3
- Paquetes
- Entorno
- node 22.23.2
- Creado
- 2026-08-27T14:13:53Z
Contrato
- bare-stdio exports standard I/O streams in, out, and err
- stdio.in returns readable TTY, pipe, or file stream for file descriptor 0
- stdio.out returns writable TTY, pipe, or file stream for file descriptor 1
- stdio.err returns writable TTY, pipe, or file stream for file descriptor 2
- stdio stream instances are lazily initialized and cached on repeated access
- stdio streams support event listeners and lifecycle methods
Archivos
- PROMPT.md
- csx.json
- index.cjs
- package-lock.json
- package.json
- spec.json
- test/contract.cjs
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 pkg:npm/bare-stdio@1.0.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/bare-stdio@1.0.3
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.
{"case":{"caseId":"case:sha256:28dbe166119864e9d009c39e12ae618203bc67d75db25ba2b3697e89ee0997b0","constraints":{"executionContext":"node"},"contract":["bare-stdio exports standard I/O streams in, out, and err","stdio.in returns readable TTY, pipe, or file stream for file descriptor 0","stdio.out returns writable TTY, pipe, or file stream for file descriptor 1","stdio.err returns writable TTY, pipe, or file stream for file descriptor 2","stdio stream instances are lazily initialized and cached on repeated access","stdio streams support event listeners and lifecycle methods"],"goal":"verify pkg:npm/bare-stdio@1.0.3","kind":"HOW","packages":["pkg:npm/bare-stdio@1.0.3"],"schemaVersion":1},"contractCommand":["node","test/contract.cjs"],"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/bare-stdio@1.0.3"],"schemaVersion":1,"subject":"pkg:npm/bare-stdio@1.0.3","verifierAdapter":"node-typescript@1"}
'use strict';
const os = require('node:os');
// Bare environment compatibility bootstrap when running in Node.js
if (typeof Bare === 'undefined') {
global.Bare = { platform: process.platform, Addon: { resolve: () => {} } };
}
let currentType = 14; // Default to TTY (14)
const origJsExtension = require.extensions['.js'];
require.extensions['.js'] = function (module, filename) {
if (filename.endsWith('binding.js')) {
if (filename.includes('bare-path')) {
module.exports = {
cwd: () => process.cwd()
};
return;
}
if (filename.includes('bare-stdio')) {
module.exports = {
TTY: 14,
NAMED_PIPE: 7,
FILE: 17,
guessType: (fd) => currentType
};
return;
}
if (filename.includes('bare-tty')) {
module.exports = {
init: () => {},
pause: () => {},
resume: () => {},
setMode: () => 0,
getWindowSize: () => [80, 24],
close: () => {}
};
return;
}
if (filename.includes('bare-pipe')) {
module.exports = {
init: () => {},
open: () => {},
bind: () => {},
connect: () => {},
unref: () => {},
ref: () => {},
close: () => {}
};
return;
}
if (filename.includes('bare-fs')) {
module.exports = {
open: () => {},
close: () => {},
read: () => {},
write: () => {},
fstat: () => ({ size: 0, mode: 0, mtime: 0, atime: 0, ctime: 0 })
};
return;
}
if (filename.includes('bare-signals')) {
module.exports = {
signals: os.constants.signals,
init: () => {},
start: () => {},
stop: () => {},
ref: () => {},
unref: () => {},
close: () => {}
};
return;
}
if (filename.includes('bare-url')) {
module.exports = {
toPath: (url) => url.replace(/^file:\/\//, ''),
fromPath: (path) => 'file://' + path
};
return;
}
module.exports = {};
return;
}
return origJsExtension(module, filename);
};
const stdio = require('bare-stdio');
/**
* Returns the standard I/O instance.
* @returns {object} stdio instance with in, out, err getters
*/
function getStdio() {
return stdio;
}
/**
* Configures the mock handle type for stdio stream creation.
* @param {number} type
*/
function setMockHandleType(type) {
currentType = type;
}
module.exports = {
stdio,
getStdio,
setMockHandleType
};
{
"name": "sample-bare-stdio",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-bare-stdio",
"version": "1.0.0",
"dependencies": {
"bare-stdio": "1.0.3"
}
},
"node_modules/b4a": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/b4a/-/b4a-1.8.1.tgz",
"integrity": "sha512-aiqre1Nr0B/6DgE2N5vwTc+2/oQZ4Wh1t4NznYY4E00y8LCt6NqdRv81so00oo27D8MVKTpUa/MwUUtBLXCoDw==",
"license": "Apache-2.0",
"peerDependencies": {
"react-native-b4a": "*"
},
"peerDependenciesMeta": {
"react-native-b4a": {
"optional": true
}
}
},
"node_modules/bare-events": {
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.9.2.tgz",
"integrity": "sha512-AIPKioV7/Y/8KfZ3AAhjPJxLLbY49S64Ym5DakZlUg75qQiTgUq9hEJoEwa4eUezPUlXRy/i5NpsKvo9jgKmoA==",
"license": "Apache-2.0",
"peerDependencies": {
"bare-abort-controller": "*"
},
"peerDependenciesMeta": {
"bare-abort-controller": {
"optional": true
}
}
},
"node_modules/bare-fs": {
"version": "4.8.1",
"resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-4.8.1.tgz",
"integrity": "sha512-N1nnXdHZAOSstz0XiHikGS4HGMH4CnSwhqWdGQQMqqdvp4Jybm9sE3R1WVnpWVd4SFkc8ryPDBLViNLwiEqECg==",
"license": "Apache-2.0",
"dependencies": {
"bare-events": "^2.5.4",
"bare-path": "^3.0.0",
"bare-stream": "^2.6.4",
"bare-url": "^2.2.2",
"fast-fifo": "^1.3.2"
},
"engines": {
"bare": ">=1.28.0"
},
"peerDependencies": {
"bare-buffer": "*"
},
"peerDependenciesMeta": {
"bare-buffer": {
"optional": true
}
}
},
"node_modules/bare-path": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/bare-path/-/bare-path-3.1.1.tgz",
"integrity": "sha512-JprUlveX3QjApC1cTpsUOiscADftCGVWkzitbHsRqv84hzYwYHw2mbluddsq5TvI8mH/8Ov1f4BiMAdcB0oYnQ==",
"license": "Apache-2.0"
},
"node_modules/bare-pipe": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/bare-pipe/-/bare-pipe-4.2.3.tgz",
"integrity": "sha512-MJYji+Vy8cNMAB2fwg1WQAm1hFIOe5ojw5V9EhEa/wEEYpKT8c36WjHBDwgkgAZfUSX6wQcEFX+Q7wN09SgRow==",
"license": "Apache-2.0",
"dependencies": {
"bare-events": "^2.0.0",
"bare-stream": "^2.0.0"
},
"engines": {
"bare": ">=1.16.0"
}
},
"node_modules/bare-signals": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/bare-signals/-/bare-signals-5.0.0.tgz",
"integrity": "sha512-8Gn8bBFUh2AUCJ9wWWFjSGWIo1HIUSIQnXRJGSm/f7GCDMqsuJhRmR1dT+HtDaDBkeu2l8Koxt2JLurfJ5yHVw==",
"license": "Apache-2.0",
"dependencies": {
"bare-events": "^2.5.3"
},
"engines": {
"bare": ">=1.7.0"
}
},
"node_modules/bare-stdio": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/bare-stdio/-/bare-stdio-1.0.3.tgz",
"integrity": "sha512-8BRMx7RWMWCbBmKhyHgBco62J+Pgss7+EPI21L3R9+w0UpwDYWUUcbE0YTOesGyt7M6N7VtoshYbzwrP0pI52Q==",
"license": "Apache-2.0",
"dependencies": {
"bare-fs": "^4.5.2",
"bare-pipe": "^4.1.5",
"bare-tty": "^5.0.3"
}
},
"node_modules/bare-stream": {
"version": "2.13.4",
"resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.13.4.tgz",
"integrity": "sha512-PcrQ8lVLbiJscNm1Kez+Yp4Gy4AHGcN1lzwjvf5NybWen7VvEgUfyfnXYJ2zNqWnzOfCb1Abq6lH8ti0syQszA==",
"license": "Apache-2.0",
"dependencies": {
"b4a": "^1.8.1",
"streamx": "^2.25.0",
"teex": "^1.0.1"
},
"peerDependencies": {
"bare-abort-controller": "*",
"bare-buffer": "*",
"bare-events": "*"
},
"peerDependenciesMeta": {
"bare-abort-controller": {
"optional": true
},
"bare-buffer": {
"optional": true
},
"bare-events": {
"optional": true
}
}
},
"node_modules/bare-tty": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/bare-tty/-/bare-tty-5.1.2.tgz",
"integrity": "sha512-wDHPU/yVQtrDCUrKVdIVOLmfIw7dFPETz30UayuFlROvgz8Juv2SmISSMhqxYQVO+fVnG/1ZoLcbGh/35eAjDA==",
"license": "Apache-2.0",
"dependencies": {
"bare-events": "^2.2.0",
"bare-signals": "^5.0.0",
"bare-stream": "^2.0.0"
},
"engines": {
"bare": ">=1.16.0"
}
},
"node_modules/bare-url": {
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/bare-url/-/bare-url-2.5.2.tgz",
"integrity": "sha512-L13PCJzKG8RGvx8V1/DdMi12ERhC3tprr7/8a94BxpmnRsFqxh5XZNdhtMxu5HPkRshYOOWRGY8lDP7ZhpG9Cg==",
"license": "Apache-2.0",
"dependencies": {
"bare-path": "^3.0.0"
}
},
"node_modules/events-universal": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/events-universal/-/events-universal-1.0.1.tgz",
"integrity": "sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==",
"license": "Apache-2.0",
"dependencies": {
"bare-events": "^2.7.0"
}
},
"node_modules/fast-fifo": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz",
"integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==",
"license": "MIT"
},
"node_modules/streamx": {
"version": "2.28.1",
"resolved": "https://registry.npmjs.org/streamx/-/streamx-2.28.1.tgz",
"integrity": "sha512-zEzXb0s5Cds7tqMH6rhZ05lcJydCWiQPEwiNngVqzsxCc962vLY4Uw+mW7od8kDH258k2Uz/JrOkdIAAhSh9VA==",
"license": "MIT",
"dependencies": {
"events-universal": "^1.0.0",
"fast-fifo": "^1.3.2",
"text-decoder": "^1.1.0"
}
},
"node_modules/teex": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/teex/-/teex-1.0.1.tgz",
"integrity": "sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg==",
"license": "MIT",
"dependencies": {
"streamx": "^2.12.5"
}
},
"node_modules/text-decoder": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.7.tgz",
"integrity": "sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ==",
"license": "Apache-2.0",
"dependencies": {
"b4a": "^1.6.4"
}
}
}
}
{
"name": "sample-bare-stdio",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of bare-stdio",
"dependencies": {
"bare-stdio": "1.0.3"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/bare-stdio@1.0.3",
"kind": "HOW",
"packages": [
"pkg:npm/bare-stdio@1.0.3"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
'use strict';
const assert = require('node:assert/strict');
const { stdio, getStdio, setMockHandleType } = require('../index.cjs');
// 1. bare-stdio exports standard I/O streams in, out, and err
assert.ok(stdio, 'stdio object must be exported');
assert.equal(typeof stdio, 'object', 'stdio must be an object');
assert.ok('in' in stdio, 'stdio must have "in" property');
assert.ok('out' in stdio, 'stdio must have "out" property');
assert.ok('err' in stdio, 'stdio must have "err" property');
assert.strictEqual(getStdio(), stdio, 'getStdio() must return exported stdio instance');
// 2. stdio.in returns readable TTY, pipe, or file stream for file descriptor 0
const stdin = stdio.in;
assert.ok(stdin, 'stdio.in must return a stream instance');
assert.equal(typeof stdin.on, 'function', 'stdio.in must have event listener method');
assert.equal(stdin._fd, 0, 'stdio.in must wrap file descriptor 0');
assert.equal(typeof stdin.read, 'function', 'stdio.in must have read method');
// 3. stdio.out returns writable TTY, pipe, or file stream for file descriptor 1
const stdout = stdio.out;
assert.ok(stdout, 'stdio.out must return a stream instance');
assert.equal(typeof stdout.write, 'function', 'stdio.out must have write method');
assert.equal(stdout._fd, 1, 'stdio.out must wrap file descriptor 1');
assert.equal(typeof stdout.end, 'function', 'stdio.out must have end method');
// 4. stdio.err returns writable TTY, pipe, or file stream for file descriptor 2
const stderr = stdio.err;
assert.ok(stderr, 'stdio.err must return a stream instance');
assert.equal(typeof stderr.write, 'function', 'stdio.err must have write method');
assert.equal(stderr._fd, 2, 'stdio.err must wrap file descriptor 2');
assert.equal(typeof stderr.end, 'function', 'stdio.err must have end method');
// 5. stdio stream instances are lazily initialized and cached on repeated access
assert.strictEqual(stdio.in, stdin, 'stdio.in must return cached instance');
assert.strictEqual(stdio.out, stdout, 'stdio.out must return cached instance');
assert.strictEqual(stdio.err, stderr, 'stdio.err must return cached instance');
// 6. stdio streams support event listeners and lifecycle methods
let listenerCalled = false;
const dummyListener = () => { listenerCalled = true; };
stdin.on('data', dummyListener);
assert.equal(stdin.listenerCount('data') >= 1, true, 'stdio.in must record event listeners');
stdin.removeListener('data', dummyListener);
console.log('Contract test passed.');
Seeder de origen
anónimo