Exemplo
compress-commons 4.1.2
Amostra verificada para npm compress-commons 4.1.2. O contrato rodou em node 22 · linux alpine/x64 · docker e passou: ZipArchiveOutputStream instantiates an…
sha256:cf8ab602e545393b67e95e415af5f8c7469cc04fc0850d8a01add0b0a20477d4
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| 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-28 |
Caso
HOW- Objetivo
- verify pkg:npm/compress-commons@4.1.2
- Pacotes
- Ambiente
- node 22.23.2
- Criado
- 2026-08-28T07:19:05Z
Contrato
- ZipArchiveOutputStream instantiates an archive output stream with custom options
- ZipArchiveEntry sets and gets entry metadata including name, timestamp, unix permissions, and comments
- ZipArchiveOutputStream.entry writes buffer payload into the zip stream with CRC32 and size calculation
- ZipArchiveOutputStream.entry creates directory entry without data payload
- ZipArchiveOutputStream.entry pipes data asynchronously from a Readable stream
- ZipArchiveOutputStream.finish finalizes the archive with valid zip header and central directory end signature
Arquivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
Código-fonte
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/compress-commons@4.1.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/compress-commons@4.1.2
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:f178ada1e4aaad99e2531c31bf1bac324a51e8eeffe99afc2dbc019db63072d2","constraints":{"executionContext":"node"},"contract":["ZipArchiveOutputStream instantiates an archive output stream with custom options","ZipArchiveEntry sets and gets entry metadata including name, timestamp, unix permissions, and comments","ZipArchiveOutputStream.entry writes buffer payload into the zip stream with CRC32 and size calculation","ZipArchiveOutputStream.entry creates directory entry without data payload","ZipArchiveOutputStream.entry pipes data asynchronously from a Readable stream","ZipArchiveOutputStream.finish finalizes the archive with valid zip header and central directory end signature"],"goal":"verify pkg:npm/compress-commons@4.1.2","kind":"HOW","packages":["pkg:npm/compress-commons@4.1.2"],"schemaVersion":1},"contractCommand":["node","test/contract.js"],"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/compress-commons@4.1.2"],"schemaVersion":1,"subject":"pkg:npm/compress-commons@4.1.2","verifierAdapter":"node-typescript@1"}
{
"name": "sample-compress-commons",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-compress-commons",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"compress-commons": "4.1.2"
}
},
"node_modules/buffer-crc32": {
"version": "0.2.13",
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
"integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==",
"license": "MIT",
"engines": {
"node": "*"
}
},
"node_modules/compress-commons": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-4.1.2.tgz",
"integrity": "sha512-D3uMHtGc/fcO1Gt1/L7i1e33VOvD4A9hfQLP+6ewd+BvG/gQ84Yh4oftEhAdjSMgBgwGL+jsppT7JYNpo6MHHg==",
"license": "MIT",
"dependencies": {
"buffer-crc32": "^0.2.13",
"crc32-stream": "^4.0.2",
"normalize-path": "^3.0.0",
"readable-stream": "^3.6.0"
},
"engines": {
"node": ">= 10"
}
},
"node_modules/crc-32": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",
"integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
"license": "Apache-2.0",
"bin": {
"crc32": "bin/crc32.njs"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/crc32-stream": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-4.0.3.tgz",
"integrity": "sha512-NT7w2JVU7DFroFdYkeq8cywxrgjPHWkdX1wjpRQXPX5Asews3tA+Ght6lddQO5Mkumffp3X7GEqku3epj2toIw==",
"license": "MIT",
"dependencies": {
"crc-32": "^1.2.0",
"readable-stream": "^3.4.0"
},
"engines": {
"node": ">= 10"
}
},
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"license": "ISC"
},
"node_modules/normalize-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/readable-stream": {
"version": "3.6.2",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
"license": "MIT",
"dependencies": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
"util-deprecate": "^1.0.1"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/string_decoder": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
"license": "MIT",
"dependencies": {
"safe-buffer": "~5.2.0"
}
},
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"license": "MIT"
}
}
}
{
"name": "sample-compress-commons",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification sample for compress-commons",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"compress-commons": "4.1.2"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/compress-commons@4.1.2",
"kind": "HOW",
"packages": [
"pkg:npm/compress-commons@4.1.2"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const { Readable } = require('node:stream');
const { ZipArchiveOutputStream, ZipArchiveEntry } = require('compress-commons');
function createArchiveStream(options = {}) {
const archive = new ZipArchiveOutputStream(options);
if (options.comment) {
archive.setComment(options.comment);
}
return archive;
}
function appendBufferEntry(archive, entryName, data, options = {}) {
return new Promise((resolve, reject) => {
const entry = new ZipArchiveEntry(entryName);
if (options.time) {
entry.setTime(options.time);
}
if (options.comment) {
entry.setComment(options.comment);
}
if (options.mode !== undefined) {
entry.setUnixMode(options.mode);
}
archive.entry(entry, data, (err, writtenEntry) => {
if (err) return reject(err);
resolve(writtenEntry);
});
});
}
function appendStreamEntry(archive, entryName, stream, options = {}) {
return new Promise((resolve, reject) => {
const entry = new ZipArchiveEntry(entryName);
if (options.time) {
entry.setTime(options.time);
}
if (options.comment) {
entry.setComment(options.comment);
}
if (options.mode !== undefined) {
entry.setUnixMode(options.mode);
}
archive.entry(entry, stream, (err, writtenEntry) => {
if (err) return reject(err);
resolve(writtenEntry);
});
});
}
function collectStream(stream) {
return new Promise((resolve, reject) => {
const chunks = [];
stream.on('data', chunk => chunks.push(chunk));
stream.on('end', () => resolve(Buffer.concat(chunks)));
stream.on('error', reject);
});
}
module.exports = {
createArchiveStream,
appendBufferEntry,
appendStreamEntry,
collectStream,
ZipArchiveOutputStream,
ZipArchiveEntry
};
const assert = require('node:assert');
const { Readable } = require('node:stream');
const {
createArchiveStream,
appendBufferEntry,
appendStreamEntry,
collectStream,
ZipArchiveOutputStream,
ZipArchiveEntry
} = require('../src/index.js');
async function main() {
// 1. ZipArchiveOutputStream instantiates an archive output stream with custom options
const archive1 = createArchiveStream({ comment: 'Archive header comment' });
assert.ok(archive1 instanceof ZipArchiveOutputStream, 'must be ZipArchiveOutputStream');
assert.strictEqual(archive1.getComment(), 'Archive header comment');
assert.strictEqual(typeof archive1.entry, 'function');
assert.strictEqual(typeof archive1.finish, 'function');
// 2. ZipArchiveEntry sets and gets entry metadata including name, timestamp, unix permissions, and comments
const entry = new ZipArchiveEntry('docs/readme.txt');
const modDate = new Date('2025-01-01T00:00:00.000Z');
entry.setTime(modDate);
entry.setComment('Readme documentation');
entry.setUnixMode(0o644);
assert.strictEqual(entry.getName(), 'docs/readme.txt');
assert.strictEqual(entry.getComment(), 'Readme documentation');
assert.strictEqual(entry.isDirectory(), false);
assert.strictEqual(entry.getUnixMode() & 0o777, 0o644);
// 3. ZipArchiveOutputStream.entry writes buffer payload into the zip stream with CRC32 and size calculation
const archive2 = createArchiveStream();
const outputPromise = collectStream(archive2);
const payload = 'Sample text content for compress-commons';
const writtenBufferEntry = await appendBufferEntry(archive2, 'hello.txt', payload, {
time: modDate,
comment: 'Greeting'
});
assert.strictEqual(writtenBufferEntry.getName(), 'hello.txt');
assert.strictEqual(writtenBufferEntry.getSize(), Buffer.byteLength(payload, 'utf8'));
assert.ok(writtenBufferEntry.getCrc() > 0, 'CRC should be calculated');
// 4. ZipArchiveOutputStream.entry creates directory entry without data payload
const writtenDirEntry = await appendBufferEntry(archive2, 'nested/', null, {
time: modDate
});
assert.strictEqual(writtenDirEntry.isDirectory(), true);
assert.strictEqual(writtenDirEntry.getName(), 'nested/');
// 5. ZipArchiveOutputStream.entry pipes data asynchronously from a Readable stream
const chunks = ['First stream chunk\n', 'Second stream chunk\n'];
const fullContent = chunks.join('');
const sourceStream = Readable.from(chunks);
const writtenStreamEntry = await appendStreamEntry(archive2, 'nested/stream.txt', sourceStream, {
time: modDate
});
assert.strictEqual(writtenStreamEntry.getName(), 'nested/stream.txt');
assert.strictEqual(writtenStreamEntry.getSize(), Buffer.byteLength(fullContent, 'utf8'));
// 6. ZipArchiveOutputStream.finish finalizes the archive with valid zip header and central directory end signature
archive2.finish();
const zipBuffer = await outputPromise;
assert.ok(Buffer.isBuffer(zipBuffer), 'output must be Buffer');
assert.ok(zipBuffer.length > 0, 'zip output must not be empty');
assert.strictEqual(archive2.getBytesWritten(), zipBuffer.length);
// ZIP local file header signature 0x04034b50 -> Buffer [0x50, 0x4b, 0x03, 0x04]
assert.ok(
zipBuffer.subarray(0, 4).equals(Buffer.from([0x50, 0x4b, 0x03, 0x04])),
'Zip buffer should start with PK0304 signature'
);
console.log('Contract assertions passed.');
}
main().catch(err => {
console.error('Contract test failed:', err);
process.exit(1);
});
Seeder de origem
anônimo