Ejemplo
@types/yargs 17.0.35
Muestra verificada para npm @types/yargs 17.0.35. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: package manifest specifies index.d.ts…
sha256:5eeae4f175cb4b0de600b97a1b540c2d3669daf409ffbd57ba759d5a4a949e7b
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@1 |
2026-08-21 |
Caso
HOW- Objetivo
- verify pkg:npm/%40types/yargs@17.0.35
- Paquetes
- Creado
- 2026-08-21T05:39:56Z
Contrato
- package manifest specifies index.d.ts type declarations and TypeScript version
- declares Argv interface with alias, command, option, positional, parse, and middleware methods
- declares CommandModule interface with aliases, builder, command, describe, and handler
- declares Options and PositionalOptions interfaces with type and validation settings
- declares helper functions and export entry points in helpers and yargs submodules
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/yargs@17.0.35
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40types/yargs@17.0.35
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:d1e6d8138a56c0cfde6c71b4586c5a595f18e3ee14cd04577359d9391160fa68","contract":["package manifest specifies index.d.ts type declarations and TypeScript version","declares Argv interface with alias, command, option, positional, parse, and middleware methods","declares CommandModule interface with aliases, builder, command, describe, and handler","declares Options and PositionalOptions interfaces with type and validation settings","declares helper functions and export entry points in helpers and yargs submodules"],"goal":"verify pkg:npm/%40types/yargs@17.0.35","kind":"HOW","packages":["pkg:npm/%40types/yargs@17.0.35"],"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/yargs@17.0.35"],"schemaVersion":1,"subject":"pkg:npm/%40types/yargs@17.0.35","verifierAdapter":"node-typescript@1"}
{
"name": "sample-types-yargs",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-types-yargs",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@types/yargs": "17.0.35"
}
},
"node_modules/@types/yargs": {
"version": "17.0.35",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.35.tgz",
"integrity": "sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg==",
"license": "MIT",
"dependencies": {
"@types/yargs-parser": "*"
}
},
"node_modules/@types/yargs-parser": {
"version": "21.0.3",
"resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz",
"integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==",
"license": "MIT"
}
}
}
{
"name": "sample-types-yargs",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"@types/yargs": "17.0.35"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40types/yargs@17.0.35",
"kind": "HOW",
"packages": [
"pkg:npm/%40types/yargs@17.0.35"
]
}
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/yargs package manifest and verify type declaration entry points
const pkgPath = require.resolve('@types/yargs/package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
assert.equal(pkg.name, '@types/yargs', 'Package name must be @types/yargs');
assert.equal(pkg.version, '17.0.35', 'Package version must be 17.0.35');
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');
assert.ok(pkg.exports, 'Package exports must be defined');
assert.equal(pkg.exports['.'].types.default, './index.d.ts', 'Root default export types must point to ./index.d.ts');
assert.equal(pkg.exports['.'].types.import, './index.d.mts', 'Root import export types must point to ./index.d.mts');
assert.equal(pkg.exports['./helpers'].types.default, './helpers.d.ts', 'helpers default export types must point to ./helpers.d.ts');
assert.equal(pkg.exports['./yargs'].types.default, './yargs.d.ts', 'yargs default export types must point to ./yargs.d.ts');
const typesDir = path.dirname(pkgPath);
const dtsContent = fs.readFileSync(path.join(typesDir, 'index.d.ts'), 'utf8');
// 2. Verify Argv interface declarations and core CLI configuration methods
assert.ok(
dtsContent.includes('interface Argv<T = {}> {'),
'Argv interface must be declared'
);
assert.ok(
dtsContent.includes('alias<K1 extends keyof T, K2 extends string>(') &&
dtsContent.includes('command<U = T>(') &&
dtsContent.includes('option<K extends keyof T, O extends Options>(') &&
dtsContent.includes('positional<K extends keyof T, O extends PositionalOptions>(') &&
dtsContent.includes('parse():') &&
dtsContent.includes('parseSync(') &&
dtsContent.includes('parseAsync(') &&
dtsContent.includes('middleware(') &&
dtsContent.includes('strict(): Argv<T>;'),
'Argv interface must declare alias, command, option, positional, parse, middleware, and strict methods'
);
// 3. Verify CommandModule interface and CommandBuilder type
assert.ok(
dtsContent.includes('interface CommandModule<T = {}, U = {}> {'),
'CommandModule interface must be declared'
);
assert.ok(
dtsContent.includes('aliases?: readonly string[] | string | undefined;') &&
dtsContent.includes('builder?: CommandBuilder<T, U> | undefined;') &&
dtsContent.includes('command?: readonly string[] | string | undefined;') &&
dtsContent.includes('describe?: string | false | undefined;') &&
dtsContent.includes('handler: (args: ArgumentsCamelCase<U>) => void | Promise<void>;'),
'CommandModule must declare aliases, builder, command, describe, and handler properties'
);
// 4. Verify Options and PositionalOptions interfaces
assert.ok(
dtsContent.includes('interface Options {') &&
dtsContent.includes('alias?: string | readonly string[] | undefined;') &&
dtsContent.includes('choices?: Choices | undefined;') &&
dtsContent.includes('coerce?: ((arg: any) => any) | undefined;') &&
dtsContent.includes('default?: any;') &&
dtsContent.includes('demandOption?: boolean | string | undefined;') &&
dtsContent.includes('type?: "array" | "count" | PositionalOptionsType | undefined;'),
'Options interface must declare alias, choices, coerce, default, demandOption, and type fields'
);
assert.ok(
dtsContent.includes('interface PositionalOptions {') &&
dtsContent.includes('type?: PositionalOptionsType | undefined;'),
'PositionalOptions interface must be declared with type field'
);
// 5. Verify submodule declaration files: helpers, yargs, and ESM wrapper
const helpersDts = fs.readFileSync(path.join(typesDir, 'helpers.d.ts'), 'utf8');
assert.ok(
helpersDts.includes('export function applyExtends(config: Record<string, any>, cwd: string, mergeExtends: boolean): Record<string, any>;') &&
helpersDts.includes('export function hideBin(argv: string[]): string[];'),
'helpers.d.ts must export applyExtends and hideBin functions'
);
const yargsDts = fs.readFileSync(path.join(typesDir, 'yargs.d.ts'), 'utf8');
assert.ok(
yargsDts.includes('declare function Yargs(') &&
yargsDts.includes('export = Yargs;'),
'yargs.d.ts must declare and export Yargs constructor function'
);
const indexMts = fs.readFileSync(path.join(typesDir, 'index.d.mts'), 'utf8');
assert.ok(
indexMts.includes('export default _instanceFactory;') &&
indexMts.includes('ArgumentsCamelCase,') &&
indexMts.includes('CommandModule,'),
'index.d.mts must export default instance factory and type definitions'
);
console.log('Contract tests passed successfully.');
Seeder de origen
anónimo