Ejemplo
ci-info 3.9.0
Muestra verificada para npm ci-info 3.9.0. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: isCI exports a boolean indicating whether…
sha256:5dad303a1b160590413794b5626b09245e4a8d259c93b69a396dd93d77cdc10b
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
- 2
- 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@1 |
2026-08-21 |
| 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-09-08 |
Caso
HOW- Objetivo
- verify pkg:npm/ci-info@3.9.0
- Paquetes
- Creado
- 2026-08-21T11:58:29Z
Contrato
- isCI exports a boolean indicating whether execution is within a continuous integration environment
- name exports a string or null indicating the detected continuous integration vendor name
- isPR exports a boolean or null indicating if a pull request is being tested
- vendor constants export boolean flags for specific CI providers including GITHUB_ACTIONS, TRAVIS, CIRCLE, and GITLAB
- _vendors exports an array of supported vendor constant identifiers
- evaluates environment variables dynamically on load to detect CI presence and vendor name
Archivos
- PROMPT.md
- csx.json
- index.js
- 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/ci-info@3.9.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/ci-info@3.9.0
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:89ba24dbffa9727da183019ee65dbfff6494a46c47d7a409f81fb7de8f0e3faf","contract":["isCI exports a boolean indicating whether execution is within a continuous integration environment","name exports a string or null indicating the detected continuous integration vendor name","isPR exports a boolean or null indicating if a pull request is being tested","vendor constants export boolean flags for specific CI providers including GITHUB_ACTIONS, TRAVIS, CIRCLE, and GITLAB","_vendors exports an array of supported vendor constant identifiers","evaluates environment variables dynamically on load to detect CI presence and vendor name"],"goal":"verify pkg:npm/ci-info@3.9.0","kind":"HOW","packages":["pkg:npm/ci-info@3.9.0"],"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/ci-info@3.9.0"],"schemaVersion":1,"subject":"pkg:npm/ci-info@3.9.0","verifierAdapter":"node-typescript@1"}
'use strict';
const ci = require('ci-info');
function isContinuousIntegration() {
return ci.isCI;
}
function getCIName() {
return ci.name;
}
function isPullRequest() {
return ci.isPR;
}
function getSupportedVendors() {
return ci._vendors || [];
}
module.exports = {
isCI: ci.isCI,
name: ci.name,
isPR: ci.isPR,
isContinuousIntegration,
getCIName,
isPullRequest,
getSupportedVendors,
ci
};
{
"name": "sample-ci-info",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-ci-info",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"ci-info": "3.9.0"
}
},
"node_modules/ci-info": {
"version": "3.9.0",
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz",
"integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==",
"license": "MIT",
"engines": {
"node": ">=8"
}
}
}
}
{
"name": "sample-ci-info",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification sample for ci-info",
"main": "index.js",
"scripts": {
"test": "node test/contract.cjs"
},
"dependencies": {
"ci-info": "3.9.0"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/ci-info@3.9.0",
"kind": "HOW",
"packages": [
"pkg:npm/ci-info@3.9.0"
]
}
'use strict';
const assert = require('node:assert');
const ci = require('ci-info');
const {
isContinuousIntegration,
getCIName,
isPullRequest,
getSupportedVendors,
ci: exportedCI
} = require('../index.js');
// 1. isCI returns a boolean indicating CI environment detection
assert.strictEqual(typeof ci.isCI, 'boolean', 'isCI must be a boolean');
assert.strictEqual(typeof isContinuousIntegration(), 'boolean', 'helper isContinuousIntegration must return a boolean');
// 2. name returns a string or null indicating the detected CI vendor
assert.ok(
ci.name === null || typeof ci.name === 'string',
'name must be null or a string'
);
assert.ok(
getCIName() === null || typeof getCIName() === 'string',
'helper getCIName must return null or a string'
);
// 3. isPR returns a boolean or null indicating pull request status
assert.ok(
ci.isPR === null || typeof ci.isPR === 'boolean',
'isPR must be null or a boolean'
);
assert.ok(
isPullRequest() === null || typeof isPullRequest() === 'boolean',
'helper isPullRequest must return null or a boolean'
);
// 4. vendor constants are boolean flags for supported CI services
assert.strictEqual(typeof ci.GITHUB_ACTIONS, 'boolean', 'GITHUB_ACTIONS flag must be boolean');
assert.strictEqual(typeof ci.TRAVIS, 'boolean', 'TRAVIS flag must be boolean');
assert.strictEqual(typeof ci.CIRCLE, 'boolean', 'CIRCLE flag must be boolean');
assert.strictEqual(typeof ci.GITLAB, 'boolean', 'GITLAB flag must be boolean');
// 5. _vendors exports an array containing supported vendor constant identifiers
const vendors = getSupportedVendors();
assert.ok(Array.isArray(vendors), '_vendors must be an array');
assert.ok(vendors.includes('GITHUB_ACTIONS'), '_vendors must include GITHUB_ACTIONS');
assert.ok(vendors.includes('TRAVIS'), '_vendors must include TRAVIS');
assert.ok(vendors.includes('CIRCLE'), '_vendors must include CIRCLE');
assert.ok(vendors.includes('GITLAB'), '_vendors must include GITLAB');
// 6. Dynamic resolution: Simulating environment variables detects corresponding CI vendor
const ciPath = require.resolve('ci-info');
const origEnv = { ...process.env };
try {
// Test GitHub Actions simulation
delete require.cache[ciPath];
process.env = { ...origEnv, CI: 'true', GITHUB_ACTIONS: 'true' };
const ciGA = require(ciPath);
assert.strictEqual(ciGA.isCI, true, 'isCI should be true when CI and GITHUB_ACTIONS are set');
assert.strictEqual(ciGA.GITHUB_ACTIONS, true, 'GITHUB_ACTIONS should be true');
assert.strictEqual(ciGA.name, 'GitHub Actions', 'name should be GitHub Actions');
// Test non-CI environment simulation when CI is explicitly false
delete require.cache[ciPath];
const cleanEnv = {};
for (const k in origEnv) {
if (!k.includes('CI') && !k.includes('BUILD') && !k.includes('ACTION')) {
cleanEnv[k] = origEnv[k];
}
}
cleanEnv.CI = 'false';
process.env = cleanEnv;
const ciFalse = require(ciPath);
assert.strictEqual(ciFalse.isCI, false, 'isCI should be false when CI is set to false');
} finally {
process.env = origEnv;
delete require.cache[ciPath];
}
console.log('Contract tests passed successfully.');
Seeder de origen
anónimo