CodeSampleX

Beispiel

@types/debug 4.1.13

Verifiziertes Beispiel für npm @types/debug 4.1.13. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand: package manifest specifies…

sha256:b55501f1c070a4a79f6eece85f8918baf0d045b2ad948e2bb5cf0cbdfcb0726f

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
1
Signaturschlüssel, die es gebaut haben
1
Deklarierte Umgebung linux 24 · ubuntu · glibc 2.39 x64 npm

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
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

Fall

HOW
Ziel
verify pkg:npm/%40types/debug@4.1.13
Pakete
Erstellt
2026-08-23T13:50:33Z

Contract

  1. package manifest specifies index.d.ts type declarations and TypeScript version
  2. declares debug export as namespace and callable Debug interface returning Debugger
  3. declares Debug interface methods for enable, disable, enabled, coerce, formatArgs, log, and humanize
  4. declares Debugger interface with namespace, enabled, color, diff, log, destroy, and extend methods
  5. declares Formatters dictionary interface, IDebug and IDebugger type aliases, and inspectOpts configuration

Dateien

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

Quellartefakt herunterladen (tar.gz)

Quelltext

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/%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.
csx.json
{"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"}
package-lock.json
{
  "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"
    }
  }
}
package.json
{
  "name": "sample-types-debug",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "license": "MIT-0",
  "dependencies": {
    "@types/debug": "4.1.13"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40types/debug@4.1.13",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40types/debug@4.1.13"
  ]
}
test/contract.mjs
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.');

Ursprungs-Seeder

anonym