CodeSampleX

Sample

@types/yargs-parser 21.0.3

Verified sample for npm @types/yargs-parser 21.0.3. The contract ran on node 22 · linux alpine/x64 · docker and passed: package manifest specifies index.d.ts…

sha256:5795f73289ab67acd42da9c501aaa1146528703ad4e6d0decd6d2c35d7f7fee3

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment linux 24 · ubuntu · glibc 2.39 x64 npm

Verification-run environments

Environment Contract Stages Run
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

Case

HOW
Goal
verify pkg:npm/%40types/yargs-parser@21.0.3
Packages
Created
2026-08-21T05:42:26Z

Contract

  1. package manifest specifies index.d.ts type declarations and MIT license
  2. declares Arguments and DetailedArguments interfaces with argv, error, aliases, newAliases, and configuration properties
  3. declares Configuration interface with boolean-negation, camel-case-expansion, dot-notation, and parser flags
  4. declares Options interface with alias, array, boolean, config, configuration, coerce, count, default, and type hints
  5. declares Parser callable function signature returning Arguments and detailed method returning DetailedArguments
  6. declares camelCase, decamelize, and looksLikeNumber utility methods on Parser interface and exports yargsParser

Files

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

Download the source artifact (tar.gz)

Source

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/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.
csx.json
{"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"}
package-lock.json
{
  "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"
    }
  }
}
package.json
{
  "name": "sample-types-yargs-parser",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "license": "MIT-0",
  "dependencies": {
    "@types/yargs-parser": "21.0.3"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40types/yargs-parser@21.0.3",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40types/yargs-parser@21.0.3"
  ]
}
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/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.');

Origin Seeder

anonymous