Ejemplo
@types/debug 4.1.13
Muestra verificada para npm @types/debug 4.1.13. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: package manifest specifies index.d.ts…
sha256:b55501f1c070a4a79f6eece85f8918baf0d045b2ad948e2bb5cf0cbdfcb0726f
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@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-23 |
Caso
HOW- Objetivo
- verify pkg:npm/%40types/debug@4.1.13
- Paquetes
- Creado
- 2026-08-23T13:50:33Z
Contrato
- package manifest specifies index.d.ts type declarations and TypeScript version
- declares debug export as namespace and callable Debug interface returning Debugger
- declares Debug interface methods for enable, disable, enabled, coerce, formatArgs, log, and humanize
- declares Debugger interface with namespace, enabled, color, diff, log, destroy, and extend methods
- declares Formatters dictionary interface, IDebug and IDebugger type aliases, and inspectOpts configuration
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- 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/%40types/debug@4.1.13
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40types/debug@4.1.13
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:dc722cb8ed292cfb3774446a9a74e8f6a21c6542cc2c819a4027db9fda574d4d","contract":["package manifest specifies index.d.ts type declarations and TypeScript version","declares debug export as namespace and callable Debug interface returning Debugger","declares Debug interface methods for enable, disable, enabled, coerce, formatArgs, log, and humanize","declares Debugger interface with namespace, enabled, color, diff, log, destroy, and extend methods","declares Formatters dictionary interface, IDebug and IDebugger type aliases, and inspectOpts configuration"],"goal":"verify pkg:npm/%40types/debug@4.1.13","kind":"HOW","packages":["pkg:npm/%40types/debug@4.1.13"],"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/%40types/debug@4.1.13"],"schemaVersion":1,"subject":"pkg:npm/%40types/debug@4.1.13","verifierAdapter":"node-typescript@1"}
{
"name": "sample-types-debug",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-types-debug",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@types/debug": "4.1.13"
}
},
"node_modules/@types/debug": {
"version": "4.1.13",
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz",
"integrity": "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==",
"license": "MIT",
"dependencies": {
"@types/ms": "*"
}
},
"node_modules/@types/ms": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz",
"integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==",
"license": "MIT"
}
}
}
{
"name": "sample-types-debug",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"@types/debug": "4.1.13"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40types/debug@4.1.13",
"kind": "HOW",
"packages": [
"pkg:npm/%40types/debug@4.1.13"
]
}
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
import fs from 'node:fs';
import path from 'node:path';
const require = createRequire(import.meta.url);
// 1. Resolve @types/debug package manifest and verify type declaration entry points
const pkgPath = require.resolve('@types/debug/package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
assert.equal(pkg.name, '@types/debug', 'Package name must be @types/debug');
assert.equal(pkg.version, '4.1.13', 'Package version must be 4.1.13');
assert.equal(pkg.types, 'index.d.ts', 'Package types entry must point to index.d.ts');
assert.equal(pkg.typeScriptVersion, '5.2', 'TypeScript version must be 5.2');
const typesDir = path.dirname(pkgPath);
const dtsContent = fs.readFileSync(path.join(typesDir, 'index.d.ts'), 'utf8');
// 2. Verify debug export and namespace declarations
assert.ok(
dtsContent.includes('declare var debug: debug.Debug & { debug: debug.Debug; default: debug.Debug };'),
'debug variable declaration must combine Debug interface with debug and default properties'
);
assert.ok(
dtsContent.includes('export = debug;') && dtsContent.includes('export as namespace debug;'),
'export = debug and export as namespace debug must be declared'
);
// 3. Verify Debug interface methods and properties
assert.ok(
dtsContent.includes('interface Debug {') &&
dtsContent.includes('(namespace: string): Debugger;') &&
dtsContent.includes('coerce: (val: any) => any;') &&
dtsContent.includes('disable: () => string;') &&
dtsContent.includes('enable: (namespaces: string) => void;') &&
dtsContent.includes('enabled: (namespaces: string) => boolean;') &&
dtsContent.includes('formatArgs: (this: Debugger, args: any[]) => void;') &&
dtsContent.includes('log: (...args: any[]) => any;') &&
dtsContent.includes('selectColor: (namespace: string) => string | number;') &&
dtsContent.includes('humanize: typeof import("ms");'),
'Debug interface must declare callable signature and management methods'
);
assert.ok(
dtsContent.includes('names: string[];') &&
dtsContent.includes('skips: string[];') &&
dtsContent.includes('formatters: Formatters;'),
'Debug interface must declare names, skips, and formatters'
);
// 4. Verify Debugger interface methods and properties
assert.ok(
dtsContent.includes('interface Debugger {') &&
dtsContent.includes('(formatter: any, ...args: any[]): void;') &&
dtsContent.includes('color: string;') &&
dtsContent.includes('diff: number;') &&
dtsContent.includes('enabled: boolean;') &&
dtsContent.includes('log: (...args: any[]) => any;') &&
dtsContent.includes('namespace: string;') &&
dtsContent.includes('destroy: () => boolean;') &&
dtsContent.includes('extend: (namespace: string, delimiter?: string) => Debugger;'),
'Debugger interface must declare invocation, formatting, lifecycle, and namespace extension'
);
// 5. Verify Formatters interface, type aliases, and inspectOpts
assert.ok(
dtsContent.includes('interface Formatters {') &&
dtsContent.includes('[formatter: string]: (v: any) => string;'),
'Formatters interface must map string keys to formatter functions'
);
assert.ok(
dtsContent.includes('type IDebug = Debug;') &&
dtsContent.includes('type IDebugger = Debugger;'),
'IDebug and IDebugger type aliases must be declared'
);
assert.ok(
dtsContent.includes('inspectOpts?: {') &&
dtsContent.includes('hideDate?: boolean | number | null;') &&
dtsContent.includes('colors?: boolean | number | null;') &&
dtsContent.includes('depth?: boolean | number | null;') &&
dtsContent.includes('showHidden?: boolean | number | null;'),
'inspectOpts configuration must be declared in Debug namespace'
);
console.log('Contract tests passed successfully.');
Seeder de origen
anónimo