Exemple
object-inspect 1.13.4
Échantillon vérifié pour npm object-inspect 1.13.4. Le contrat s'est exécuté sur node 22 · linux alpine/x64 · docker et a réussi.
sha256:d288f274c1109d7a141e8179af8ee2b0d3fc78029569b6bca6562801bf918fb8
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
- 2
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-20 |
| 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-07 |
Cas
HOW- Objectif
- verify pkg:npm/object-inspect@1.13.4
- Paquets
- Environnement
- node 22.23.2
- Créé
- 2026-08-20T13:26:05Z
Contrat
- formatValue returns formatted string representations for objects and primitives
- formatObject safely inspects circular data structures without throwing
- supports depth option to limit inspection depth of nested structures
- supports quoteStyle option for choosing single or double string quotes
- supports maxStringLength option to truncate strings exceeding maximum length
Fichiers
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- 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/object-inspect@1.13.4
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/object-inspect@1.13.4
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:ca4ad612bbf6d228537016f382bdc9b7c71bc6adae6aa20876ae0283effa10e4","constraints":{"executionContext":"node"},"contract":["formatValue returns formatted string representations for objects and primitives","formatObject safely inspects circular data structures without throwing","supports depth option to limit inspection depth of nested structures","supports quoteStyle option for choosing single or double string quotes","supports maxStringLength option to truncate strings exceeding maximum length"],"goal":"verify pkg:npm/object-inspect@1.13.4","kind":"HOW","packages":["pkg:npm/object-inspect@1.13.4"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"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/object-inspect@1.13.4"],"schemaVersion":1,"verifierAdapter":"node-typescript@1"}
{
"name": "sample-object-inspect",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-object-inspect",
"version": "1.0.0",
"dependencies": {
"object-inspect": "1.13.4"
}
},
"node_modules/object-inspect": {
"version": "1.13.4",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
}
}
}
{
"name": "sample-object-inspect",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of object-inspect",
"main": "src/index.js",
"dependencies": {
"object-inspect": "1.13.4"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/object-inspect@1.13.4",
"kind": "HOW",
"packages": [
"pkg:npm/object-inspect@1.13.4"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const inspect = require('object-inspect');
/**
* Format a value or object using object-inspect with optional custom options.
* @param {*} value - The value to inspect
* @param {object} [options] - Options passed to object-inspect
* @returns {string} Formatted string representation
*/
function formatValue(value, options) {
return inspect(value, options);
}
/**
* Format an object safely even with circular references or deep nesting.
* @param {object} obj - Object to format safely
* @param {object} [options] - Options
* @returns {string} Formatted string representation
*/
function formatObject(obj, options = {}) {
return inspect(obj, {
depth: 5,
...options
});
}
module.exports = {
formatValue,
formatObject,
inspect
};
import assert from 'node:assert';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const { formatValue, formatObject, inspect } = require('../src/index.js');
// 1. Export verification
assert.strictEqual(typeof inspect, 'function', 'inspect should be exported as a function');
assert.strictEqual(typeof formatValue, 'function', 'formatValue should be a function');
assert.strictEqual(typeof formatObject, 'function', 'formatObject should be a function');
// 2. Format primitive and object structures
const obj = { name: 'sample', count: 42, active: true };
const objFormatted = formatValue(obj);
assert.strictEqual(objFormatted, "{ name: 'sample', count: 42, active: true }");
const arr = [1, 2, 'three'];
assert.strictEqual(formatValue(arr), "[ 1, 2, 'three' ]");
// 3. Handle circular references safely without throwing
const circular = { id: 1 };
circular.self = circular;
const circularResult = formatObject(circular);
assert.strictEqual(circularResult, '{ id: 1, self: [Circular] }');
// 4. Respect depth option for nested structures
const deep = { level1: { level2: { level3: 'deepValue' } } };
const shallowResult = formatValue(deep, { depth: 1 });
assert.strictEqual(shallowResult, '{ level1: [Object] }');
// 5. Support quoteStyle and maxStringLength options
const doubleQuote = formatValue('hello world', { quoteStyle: 'double' });
assert.strictEqual(doubleQuote, '"hello world"');
const truncated = formatValue('supercalifragilistic', { maxStringLength: 5 });
assert.strictEqual(truncated, "'super'... 15 more characters");
console.log('Contract tests passed successfully.');
Seeder d'origine
anonyme