CodeSampleX

샘플

@types/debug 4.1.13

검증된 샘플 — npm @types/debug 4.1.13. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: package manifest specifies index.d.ts type declarations and…

sha256:b55501f1c070a4a79f6eece85f8918baf0d045b2ad948e2bb5cf0cbdfcb0726f

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. MIT-0

실행 증거

선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.

증거 기준
서명된 컨트랙트 통과
검증 영수증
1
빌드한 서명 키
1
선언된 환경 linux 24 · ubuntu · glibc 2.39 x64 npm

검증 실행 환경

환경 컨트랙트 단계 실행일
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

케이스

HOW
목표
verify pkg:npm/%40types/debug@4.1.13
패키지
생성일
2026-08-23T13:50:33Z

컨트랙트

  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

파일

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

소스 아티팩트 내려받기 (tar.gz)

소스

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.');

오리진 시더

익명