CodeSampleX

Sample

loupe 3.2.1

Verified sample for npm loupe 3.2.1. The contract ran on node 22 · linux alpine/x64 · docker and passed: inspect formats primitive values including strings…

sha256:4a4c68b2f6f9a388fb401a3f15388e84b442aec062a5ebe619be0d1b79afc385

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment linux 24 · ubuntu · glibc 2.39 x64 npm

Verification-run environments

Environment Contract Stages Run
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

Case

HOW
Goal
verify pkg:npm/loupe@3.2.1
Packages
Created
2026-08-21T03:30:11Z

Contract

  1. inspect formats primitive values including strings, numbers, booleans, null, undefined, BigInt, and Symbols
  2. inspect formats structured objects, arrays, Sets, and Maps
  3. inspect detects circular references and formats them with [Circular] placeholders
  4. inspect formats RegExp patterns and Error objects
  5. inspect supports configuration options such as truncate length and ANSI color formatting
  6. custom symbol enables user-defined custom inspection methods on objects
  7. registerConstructor registers custom inspector functions for specific class constructors
  8. registerStringTag registers custom inspector functions matching Symbol.toStringTag values

Files

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.mjs
  • test/contract.mjs

Download the source artifact (tar.gz)

Source

PROMPT.md
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.
csx.json
{"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"}
package-lock.json
{
  "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"
    }
  }
}
package.json
{
  "name": "verify-loupe",
  "version": "1.0.0",
  "type": "module",
  "dependencies": {
    "loupe": "3.2.1"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/loupe@3.2.1",
  "kind": "HOW",
  "packages": [
    "pkg:npm/loupe@3.2.1"
  ]
}
src/index.mjs
import { inspect, custom, registerConstructor, registerStringTag } from 'loupe';

export function inspectValue(value, options) {
  return inspect(value, options);
}

export { inspect, custom, registerConstructor, registerStringTag };
export default inspect;
test/contract.mjs
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.');

Origin Seeder

anonymous