Пример
@types/graceful-fs 4.1.9: gracefulify
Проверенный пример — npm @types/graceful-fs 4.1.9: gracefulify. Контракт выполнен на node 22 · linux alpine/x64 · docker и пройден.
sha256:ddc319ace51338f86e9dc8d06c628e28997aea146942233e08d6ee0fc6e8e399
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
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-27 |
Кейс
HOW- Цель
- verify pkg:npm/%40types/graceful-fs@4.1.9
- Пакеты
- Символы
-
- gracefulify
- Создан
- 2026-08-27T23:00:03Z
Контракт
- package manifest specifies index.d.ts type declarations and TypeScript 4.5 minimum version
- declares node type dependency reference for Node.js fs module types
- re-exports all types and members from the fs module
- declares generic gracefulify function signature accepting and returning fsModule T
- documents gracefulify JSDoc annotations and parameter description
Файлы
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Исходный код
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/graceful-fs@4.1.9
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40types/graceful-fs@4.1.9
Demonstrate these symbols/APIs:
- gracefulify
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:1eeee5e7b804650b00bd69ef75c57b2efee5f58c7f97912ec792f35eb8b4659b","contract":["package manifest specifies index.d.ts type declarations and TypeScript 4.5 minimum version","declares node type dependency reference for Node.js fs module types","re-exports all types and members from the fs module","declares generic gracefulify function signature accepting and returning fsModule T","documents gracefulify JSDoc annotations and parameter description"],"goal":"verify pkg:npm/%40types/graceful-fs@4.1.9","kind":"HOW","packages":["pkg:npm/%40types/graceful-fs@4.1.9"],"schemaVersion":1,"symbols":["gracefulify"]},"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/graceful-fs@4.1.9"],"schemaVersion":1,"subject":"pkg:npm/%40types/graceful-fs@4.1.9","symbols":["gracefulify"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-types-graceful-fs",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-types-graceful-fs",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@types/graceful-fs": "4.1.9"
}
},
"node_modules/@types/graceful-fs": {
"version": "4.1.9",
"resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz",
"integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==",
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/node": {
"version": "26.4.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-26.4.0.tgz",
"integrity": "sha512-faiGnoIrLH/V8cibOMEAZ8pMw6oXqSukl29ra4mN8GdaB2ZewzeaLj+INpV5N+Z1eKWzY+IzaIZH2EIR6YZRNQ==",
"license": "MIT",
"dependencies": {
"undici-types": "~8.3.0"
}
},
"node_modules/undici-types": {
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz",
"integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==",
"license": "MIT"
}
}
}
{
"name": "sample-types-graceful-fs",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"@types/graceful-fs": "4.1.9"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40types/graceful-fs@4.1.9",
"kind": "HOW",
"packages": [
"pkg:npm/%40types/graceful-fs@4.1.9"
],
"symbols": [
"gracefulify"
]
}
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/graceful-fs package manifest and verify type declaration entry points
const pkgPath = require.resolve('@types/graceful-fs/package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
assert.equal(pkg.name, '@types/graceful-fs', 'Package name must be @types/graceful-fs');
assert.equal(pkg.version, '4.1.9', 'Package version must be 4.1.9');
assert.equal(pkg.types, 'index.d.ts', 'Package types entry must point to index.d.ts');
assert.equal(pkg.typeScriptVersion, '4.5', 'TypeScript version must be 4.5');
assert.ok(pkg.dependencies && pkg.dependencies['@types/node'], 'Package must declare dependency on @types/node');
const typesDir = path.dirname(pkgPath);
const dtsContent = fs.readFileSync(path.join(typesDir, 'index.d.ts'), 'utf8');
// 2. Verify triple-slash reference to node types
assert.ok(
dtsContent.includes('/// <reference types="node" />'),
'index.d.ts must reference node types'
);
// 3. Verify re-export of fs module members
assert.ok(
dtsContent.includes('export * from "fs";'),
'index.d.ts must re-export all members from fs'
);
// 4. Verify generic gracefulify function declaration
assert.ok(
dtsContent.includes('export function gracefulify<T>(fsModule: T): T;'),
'index.d.ts must declare generic gracefulify<T>(fsModule: T): T'
);
// 5. Verify JSDoc documentation annotations for gracefulify
assert.ok(
dtsContent.includes('Use this method to patch the global fs module (or any other fs-like module).'),
'index.d.ts must include JSDoc explanation for gracefulify'
);
assert.ok(
dtsContent.includes('@param fsModule The reference to the fs module or an fs-like module.'),
'index.d.ts must document the fsModule parameter'
);
console.log('Contract tests passed successfully.');
Исходный сидер
аноним