Ejemplo
@types/yargs-parser 21.0.3
Muestra verificada para npm @types/yargs-parser 21.0.3. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: package manifest specifies…
sha256:5795f73289ab67acd42da9c501aaa1146528703ad4e6d0decd6d2c35d7f7fee3
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-parser@21.0.3
- Paquetes
- Creado
- 2026-08-21T05:42:26Z
Contrato
- package manifest specifies index.d.ts type declarations and MIT license
- declares Arguments and DetailedArguments interfaces with argv, error, aliases, newAliases, and configuration properties
- declares Configuration interface with boolean-negation, camel-case-expansion, dot-notation, and parser flags
- declares Options interface with alias, array, boolean, config, configuration, coerce, count, default, and type hints
- declares Parser callable function signature returning Arguments and detailed method returning DetailedArguments
- declares camelCase, decamelize, and looksLikeNumber utility methods on Parser interface and exports yargsParser
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-parser@21.0.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40types/yargs-parser@21.0.3
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:a69db0af5ec1c5771270a5c80b5913d2a458ffc0e97e0cab6a0c8b045dbb7788","contract":["package manifest specifies index.d.ts type declarations and MIT license","declares Arguments and DetailedArguments interfaces with argv, error, aliases, newAliases, and configuration properties","declares Configuration interface with boolean-negation, camel-case-expansion, dot-notation, and parser flags","declares Options interface with alias, array, boolean, config, configuration, coerce, count, default, and type hints","declares Parser callable function signature returning Arguments and detailed method returning DetailedArguments","declares camelCase, decamelize, and looksLikeNumber utility methods on Parser interface and exports yargsParser"],"goal":"verify pkg:npm/%40types/yargs-parser@21.0.3","kind":"HOW","packages":["pkg:npm/%40types/yargs-parser@21.0.3"],"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-parser@21.0.3"],"schemaVersion":1,"subject":"pkg:npm/%40types/yargs-parser@21.0.3","verifierAdapter":"node-typescript@1"}
{
"name": "sample-types-yargs-parser",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-types-yargs-parser",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@types/yargs-parser": "21.0.3"
}
},
"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-parser",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"@types/yargs-parser": "21.0.3"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40types/yargs-parser@21.0.3",
"kind": "HOW",
"packages": [
"pkg:npm/%40types/yargs-parser@21.0.3"
]
}
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-parser package manifest and verify type declaration entry points
const pkgPath = require.resolve('@types/yargs-parser/package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
assert.equal(pkg.name, '@types/yargs-parser', 'Package name must be @types/yargs-parser');
assert.equal(pkg.version, '21.0.3', 'Package version must be 21.0.3');
assert.equal(pkg.types, 'index.d.ts', 'Package types entry must point to index.d.ts');
assert.equal(pkg.license, 'MIT', 'Package license must be MIT');
const typesDir = path.dirname(pkgPath);
const indexDts = fs.readFileSync(path.join(typesDir, 'index.d.ts'), 'utf8');
// 2. Verify Arguments and DetailedArguments interfaces
assert.ok(
indexDts.includes('interface Arguments {') &&
indexDts.includes('_: Array<string | number>;') &&
indexDts.includes('"--"?: Array<string | number>;') &&
indexDts.includes('[argName: string]: any;'),
'index.d.ts must declare Arguments interface with _, --, and index signature'
);
assert.ok(
indexDts.includes('interface DetailedArguments {') &&
indexDts.includes('argv: Arguments;') &&
indexDts.includes('error: Error | null;') &&
indexDts.includes('aliases: { [alias: string]: string[] };') &&
indexDts.includes('newAliases: { [alias: string]: boolean };') &&
indexDts.includes('configuration: Configuration;'),
'index.d.ts must declare DetailedArguments interface with argv, error, aliases, newAliases, configuration'
);
// 3. Verify Configuration interface
assert.ok(
indexDts.includes('interface Configuration {') &&
indexDts.includes('"boolean-negation": boolean;') &&
indexDts.includes('"camel-case-expansion": boolean;') &&
indexDts.includes('"combine-arrays": boolean;') &&
indexDts.includes('"dot-notation": boolean;') &&
indexDts.includes('"duplicate-arguments-array": boolean;') &&
indexDts.includes('"flatten-duplicate-arrays": boolean;') &&
indexDts.includes('"greedy-arrays": boolean;') &&
indexDts.includes('"nargs-eats-options": boolean;') &&
indexDts.includes('"halt-at-non-option": boolean;') &&
indexDts.includes('"negation-prefix": string;') &&
indexDts.includes('"parse-numbers": boolean;') &&
indexDts.includes('"parse-positional-numbers": boolean;') &&
indexDts.includes('"populate--": boolean;') &&
indexDts.includes('"set-placeholder-key": boolean;') &&
indexDts.includes('"short-option-groups": boolean;') &&
indexDts.includes('"strip-aliased": boolean;') &&
indexDts.includes('"strip-dashed": boolean;') &&
indexDts.includes('"unknown-options-as-args": boolean;'),
'index.d.ts must declare Configuration interface with all parser configuration flags'
);
// 4. Verify Options interface
assert.ok(
indexDts.includes('interface Options {') &&
indexDts.includes('alias?: { [key: string]: string | string[] } | undefined;') &&
indexDts.includes('array?:') &&
indexDts.includes('boolean?: string[] | undefined;') &&
indexDts.includes('config?: string | string[] | { [key: string]: boolean } | undefined;') &&
indexDts.includes('configuration?: Partial<Configuration> | undefined;') &&
indexDts.includes('coerce?: { [key: string]: (arg: any) => any } | undefined;') &&
indexDts.includes('count?: string[] | undefined;') &&
indexDts.includes('default?: { [key: string]: any } | undefined;') &&
indexDts.includes('envPrefix?: string | undefined;') &&
indexDts.includes('narg?: { [key: string]: number } | undefined;') &&
indexDts.includes('normalize?: string[] | undefined;') &&
indexDts.includes('string?: string[] | undefined;') &&
indexDts.includes('number?: string[] | undefined;'),
'index.d.ts must declare Options interface with alias, array, boolean, config, coerce, and other parsing options'
);
// 5. Verify Parser callable signature and detailed method
assert.ok(
indexDts.includes('interface Parser {') &&
indexDts.includes('(argv: string | string[], opts?: Options): Arguments;') &&
indexDts.includes('detailed(argv: string | string[], opts?: Options): DetailedArguments;'),
'Parser interface must declare callable call signature and detailed method'
);
// 6. Verify utility methods on Parser interface and top-level export
assert.ok(
indexDts.includes('camelCase(str: string): string;') &&
indexDts.includes('decamelize(str: string, joinString?: string): string;') &&
indexDts.includes('looksLikeNumber(value: string | number | null | undefined): boolean;'),
'Parser interface must declare camelCase, decamelize, and looksLikeNumber methods'
);
assert.ok(
indexDts.includes('declare var yargsParser: yargsParser.Parser;') &&
indexDts.includes('export = yargsParser;'),
'index.d.ts must declare var yargsParser and export it as CommonJS module'
);
console.log('Contract tests passed successfully.');
Seeder de origen
anónimo