Ejemplo
loupe 3.2.1
Muestra verificada para npm loupe 3.2.1. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: inspect formats primitive values including…
sha256:4a4c68b2f6f9a388fb401a3f15388e84b442aec062a5ebe619be0d1b79afc385
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@1 |
2026-08-21 |
Caso
HOW- Objetivo
- verify pkg:npm/loupe@3.2.1
- Paquetes
- Creado
- 2026-08-21T03:30:11Z
Contrato
- inspect formats primitive values including strings, numbers, booleans, null, undefined, BigInt, and Symbols
- inspect formats structured objects, arrays, Sets, and Maps
- inspect detects circular references and formats them with [Circular] placeholders
- inspect formats RegExp patterns and Error objects
- inspect supports configuration options such as truncate length and ANSI color formatting
- custom symbol enables user-defined custom inspection methods on objects
- registerConstructor registers custom inspector functions for specific class constructors
- registerStringTag registers custom inspector functions matching Symbol.toStringTag values
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- 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 pkg:npm/loupe@3.2.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/loupe@3.2.1
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:9423f73d91cfd26b5fe3e0886210c7bbb3a53650288b40f7b3dbc429bca67e5d","contract":["inspect formats primitive values including strings, numbers, booleans, null, undefined, BigInt, and Symbols","inspect formats structured objects, arrays, Sets, and Maps","inspect detects circular references and formats them with [Circular] placeholders","inspect formats RegExp patterns and Error objects","inspect supports configuration options such as truncate length and ANSI color formatting","custom symbol enables user-defined custom inspection methods on objects","registerConstructor registers custom inspector functions for specific class constructors","registerStringTag registers custom inspector functions matching Symbol.toStringTag values"],"goal":"verify pkg:npm/loupe@3.2.1","kind":"HOW","packages":["pkg:npm/loupe@3.2.1"],"schemaVersion":1},"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/loupe@3.2.1"],"schemaVersion":1,"subject":"pkg:npm/loupe@3.2.1","verifierAdapter":"node-typescript@1"}
{
"name": "verify-loupe",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "verify-loupe",
"version": "1.0.0",
"dependencies": {
"loupe": "3.2.1"
}
},
"node_modules/loupe": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/loupe/-/loupe-3.2.1.tgz",
"integrity": "sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==",
"license": "MIT"
}
}
}
{
"name": "verify-loupe",
"version": "1.0.0",
"type": "module",
"dependencies": {
"loupe": "3.2.1"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/loupe@3.2.1",
"kind": "HOW",
"packages": [
"pkg:npm/loupe@3.2.1"
]
}
import { inspect, custom, registerConstructor, registerStringTag } from 'loupe';
export function inspectValue(value, options) {
return inspect(value, options);
}
export { inspect, custom, registerConstructor, registerStringTag };
export default inspect;
import assert from 'node:assert';
import inspect, { custom, registerConstructor, registerStringTag } from '../src/index.mjs';
// 1. Primitive formatting
assert.strictEqual(inspect(null), 'null', 'inspect must format null correctly');
assert.strictEqual(inspect(undefined), 'undefined', 'inspect must format undefined correctly');
assert.strictEqual(inspect(42), '42', 'inspect must format numbers correctly');
assert.strictEqual(inspect('hello'), "'hello'", 'inspect must format strings with quotes');
assert.strictEqual(inspect(true), 'true', 'inspect must format boolean true correctly');
assert.strictEqual(inspect(false), 'false', 'inspect must format boolean false correctly');
assert.strictEqual(inspect(100n), '100n', 'inspect must format BigInt with n suffix');
assert.strictEqual(inspect(Symbol('test')), 'Symbol(test)', 'inspect must format Symbol correctly');
// 2. Structured objects, arrays, Sets, and Maps
assert.strictEqual(inspect([1, 2, 3]), '[ 1, 2, 3 ]', 'inspect must format arrays correctly');
assert.strictEqual(inspect({ a: 1, b: 'two' }), "{ a: 1, b: 'two' }", 'inspect must format object properties correctly');
assert.strictEqual(inspect(new Set([1, 2])), 'Set{ 1, 2 }', 'inspect must format Set elements');
assert.strictEqual(inspect(new Map([['key', 'val']])), "Map{ 'key' => 'val' }", 'inspect must format Map entries');
// 3. Circular reference detection
const circular = { name: 'cycle' };
circular.self = circular;
assert.strictEqual(inspect(circular), "{ name: 'cycle', self: [Circular] }", 'inspect must detect circular references and print [Circular]');
// 4. Built-ins: RegExp, Date, Error
assert.strictEqual(inspect(/^abc$/i), '/^abc$/i', 'inspect must format RegExp literals');
const testError = new Error('loupe test error');
assert.ok(inspect(testError).includes('Error: loupe test error'), 'inspect must format Error objects with message');
// 5. Options: truncate and colors
const longText = 'a very long string that should be truncated by loupe';
const truncated = inspect(longText, { truncate: 15 });
assert.ok(truncated.length <= 15, 'truncate option must limit string length');
assert.ok(truncated.includes('…'), 'truncated string must contain ellipsis');
const colored = inspect(123, { colors: true });
assert.ok(colored.includes('\x1B['), 'colors option must apply ANSI escape codes');
// 6. Custom inspect symbol
class Box {
constructor(val) {
this.val = val;
}
[custom]() {
return `<Box: ${this.val}>`;
}
}
assert.strictEqual(inspect(new Box(42)), '<Box: 42>', 'inspect must use custom inspect symbol method');
assert.strictEqual(inspect(new Box(42), { customInspect: false }), 'Box{ val: 42 }', 'customInspect: false must bypass custom inspect method');
// 7. registerConstructor
class SpecialWidget {
constructor(id) {
this.id = id;
}
}
const regCtorResult = registerConstructor(SpecialWidget, (val) => `Widget#${val.id}`);
assert.strictEqual(regCtorResult, true, 'registerConstructor must return true on successful registration');
assert.strictEqual(inspect(new SpecialWidget(99)), 'Widget#99', 'registered constructor inspector must format instances');
// 8. registerStringTag
class CustomTagged {
get [Symbol.toStringTag]() {
return 'CustomWidgetTag';
}
}
const regTagResult = registerStringTag('CustomWidgetTag', () => '<CustomTaggedInstance>');
assert.strictEqual(regTagResult, true, 'registerStringTag must return true on successful registration');
assert.strictEqual(inspect(new CustomTagged()), '<CustomTaggedInstance>', 'registered string tag inspector must format instances');
console.log('Contract tests passed successfully.');
Seeder de origen
anónimo