Exemple
@types/fs-extra 9.0.13
Échantillon vérifié pour npm @types/fs-extra 9.0.13. Le contrat s'est exécuté sur node 22 · linux alpine/x64 · docker et a réussi.
sha256:e8fca7d6273fac5a1ecae24d471ec4d2c2f91755eeb421678f00a11e864ccfa0
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
linux 24 · ubuntu · glibc 2.39 x64 npm
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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 |
Cas
HOW- Objectif
- verify pkg:npm/%40types/fs-extra@9.0.13
- Paquets
- Créé
- 2026-08-23T13:53:19Z
Contrat
- package manifest specifies index.d.ts type declarations and TypeScript version 3.9
- declares copy, move, and remove helper functions with Promise and callback signatures
- declares outputFile, outputJson, writeJson, and readJson helper functions with sync and async overloads
- declares ensureDir, ensureFile, ensureLink, ensureSymlink, and emptyDir directory utility functions
- declares CopyOptions, MoveOptions, EnsureOptions, ReadOptions, and WriteOptions type definitions
- re-exports all standard fs module members and extends Node file system method declarations
Fichiers
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Code source
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/fs-extra@9.0.13
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40types/fs-extra@9.0.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:c1be42e09292131d9c0bd55ebeffd20abcea4ba4d9ab732e8dd7933f1d94596a","contract":["package manifest specifies index.d.ts type declarations and TypeScript version 3.9","declares copy, move, and remove helper functions with Promise and callback signatures","declares outputFile, outputJson, writeJson, and readJson helper functions with sync and async overloads","declares ensureDir, ensureFile, ensureLink, ensureSymlink, and emptyDir directory utility functions","declares CopyOptions, MoveOptions, EnsureOptions, ReadOptions, and WriteOptions type definitions","re-exports all standard fs module members and extends Node file system method declarations"],"goal":"verify pkg:npm/%40types/fs-extra@9.0.13","kind":"HOW","packages":["pkg:npm/%40types/fs-extra@9.0.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/fs-extra@9.0.13"],"schemaVersion":1,"subject":"pkg:npm/%40types/fs-extra@9.0.13","verifierAdapter":"node-typescript@1"}
{
"name": "sample-types-fs-extra",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-types-fs-extra",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@types/fs-extra": "9.0.13"
}
},
"node_modules/@types/fs-extra": {
"version": "9.0.13",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz",
"integrity": "sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==",
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/node": {
"version": "26.2.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-26.2.0.tgz",
"integrity": "sha512-5IviulTZeRNp2vAJ514cc/HUlY5nZ9fCbq9DMyC52BrhFZACo3nI0R7qBxhQmo/d27NFe96ur/b7Wwxklda+kg==",
"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-fs-extra",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"@types/fs-extra": "9.0.13"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40types/fs-extra@9.0.13",
"kind": "HOW",
"packages": [
"pkg:npm/%40types/fs-extra@9.0.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/fs-extra package manifest and verify type declaration entry points
const pkgPath = require.resolve('@types/fs-extra/package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
assert.equal(pkg.name, '@types/fs-extra', 'Package name must be @types/fs-extra');
assert.equal(pkg.version, '9.0.13', 'Package version must be 9.0.13');
assert.equal(pkg.types, 'index.d.ts', 'Package types entry must point to index.d.ts');
assert.equal(pkg.typeScriptVersion, '3.9', 'TypeScript version must be 3.9');
const typesDir = path.dirname(pkgPath);
const dtsContent = fs.readFileSync(path.join(typesDir, 'index.d.ts'), 'utf8');
// 2. Verify declarations for copy, move, and remove helper functions
assert.ok(
dtsContent.includes('export function copy(src: string, dest: string, options?: CopyOptions): Promise<void>;') &&
dtsContent.includes('export function copySync(src: string, dest: string, options?: CopyOptionsSync): void;'),
'copy and copySync function overloads must be declared'
);
assert.ok(
dtsContent.includes('export function move(src: string, dest: string, options?: MoveOptions): Promise<void>;') &&
dtsContent.includes('export function moveSync(src: string, dest: string, options?: MoveOptions): void;'),
'move and moveSync function overloads must be declared'
);
assert.ok(
dtsContent.includes('export function remove(dir: string, callback?: (err: Error) => void): Promise<void>;') &&
dtsContent.includes('export function removeSync(dir: string): void;'),
'remove and removeSync function overloads must be declared'
);
// 3. Verify declarations for outputFile, outputJson, writeJson, and readJson helpers
assert.ok(
dtsContent.includes('export function outputFile(') &&
dtsContent.includes('export function outputFileSync(file: string, data: any, options?: WriteFileOptions | BufferEncoding | string): void;'),
'outputFile and outputFileSync functions must be declared'
);
assert.ok(
dtsContent.includes('export function outputJson(') &&
dtsContent.includes('export function outputJsonSync(file: string, data: any, options?: WriteOptions | BufferEncoding | string): void;') &&
dtsContent.includes('export function outputJSON('),
'outputJson and outputJSON functions must be declared'
);
assert.ok(
dtsContent.includes('export function writeJson(') &&
dtsContent.includes('export function writeJsonSync(file: string, object: any, options?: WriteOptions | BufferEncoding | string): void;') &&
dtsContent.includes('export function writeJSON('),
'writeJson and writeJSON functions must be declared'
);
assert.ok(
dtsContent.includes('export function readJson(file: string, options?: ReadOptions | BufferEncoding | string): Promise<any>;') &&
dtsContent.includes('export function readJsonSync(file: string, options?: ReadOptions | BufferEncoding | string): any;') &&
dtsContent.includes('export function readJSON('),
'readJson and readJSON functions must be declared'
);
// 4. Verify directory and file utilities: ensureDir, ensureFile, ensureLink, ensureSymlink, emptyDir, pathExists
assert.ok(
dtsContent.includes('export function ensureDir(path: string, options?: EnsureOptions | number): Promise<void>;') &&
dtsContent.includes('export function ensureDirSync(path: string, options?: EnsureOptions | number): void;') &&
dtsContent.includes('export function mkdirp(') &&
dtsContent.includes('export function mkdirs('),
'ensureDir, mkdirp, and mkdirs functions must be declared'
);
assert.ok(
dtsContent.includes('export function ensureFile(path: string): Promise<void>;') &&
dtsContent.includes('export function ensureFileSync(path: string): void;') &&
dtsContent.includes('export function createFile('),
'ensureFile and createFile functions must be declared'
);
assert.ok(
dtsContent.includes('export function ensureLink(src: string, dest: string): Promise<void>;') &&
dtsContent.includes('export function ensureLinkSync(src: string, dest: string): void;') &&
dtsContent.includes('export function ensureSymlink(src: string, dest: string, type?: SymlinkType): Promise<void>;') &&
dtsContent.includes('export function ensureSymlinkSync(src: string, dest: string, type?: SymlinkType): void;'),
'ensureLink and ensureSymlink functions must be declared'
);
assert.ok(
dtsContent.includes('export function emptyDir(path: string): Promise<void>;') &&
dtsContent.includes('export function emptyDirSync(path: string): void;') &&
dtsContent.includes('export const emptydir: typeof emptyDir;') &&
dtsContent.includes('export function pathExists(path: string): Promise<boolean>;') &&
dtsContent.includes('export function pathExistsSync(path: string): boolean;'),
'emptyDir and pathExists functions must be declared'
);
// 5. Verify option interfaces and types: CopyOptions, MoveOptions, EnsureOptions, ReadOptions, WriteOptions
assert.ok(
dtsContent.includes('export interface CopyOptions {') &&
dtsContent.includes('dereference?: boolean | undefined;') &&
dtsContent.includes('overwrite?: boolean | undefined;') &&
dtsContent.includes('preserveTimestamps?: boolean | undefined;') &&
dtsContent.includes('export interface CopyOptionsSync extends CopyOptions {'),
'CopyOptions and CopyOptionsSync interfaces must be declared'
);
assert.ok(
dtsContent.includes('export interface MoveOptions {') &&
dtsContent.includes('export interface EnsureOptions {') &&
dtsContent.includes('export interface ReadOptions {') &&
dtsContent.includes('export interface WriteFileOptions {') &&
dtsContent.includes('export interface WriteOptions extends WriteFileOptions {') &&
dtsContent.includes('export interface WritevResult {') &&
dtsContent.includes('export type SymlinkType = \'dir\' | \'file\' | \'junction\';'),
'MoveOptions, EnsureOptions, ReadOptions, WriteOptions, and SymlinkType types must be declared'
);
// 6. Verify standard fs re-exports and extended async signatures
assert.ok(
dtsContent.includes('export * from \'fs\';'),
'Must re-export all standard fs module declarations'
);
assert.ok(
dtsContent.includes('export function readFile(file: PathLike | number): Promise<Buffer>;') &&
dtsContent.includes('export function writeFile(') &&
dtsContent.includes('export function readdir(') &&
dtsContent.includes('export function stat(path: PathLike): Promise<Stats>;'),
'Extended async signatures returning Promise must be declared'
);
console.log('Contract tests passed successfully.');
Seeder d'origine
anonyme