CodeSampleX

Exemple

@types/yargs-parser 21.0.3: yargsParser.detailed

Échantillon vérifié pour npm @types/yargs-parser 21.0.3: yargsParser.detailed. Le contrat s'est exécuté sur node 22 · linux alpine/x64 · docker et a réussi.

sha256:ffd6e0576ae439ccedbea906029b1fd438e403fece28bf41228d115c71f0f429

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-27

Cas

HOW
Objectif
verify yargsParser.detailed in pkg:npm/%40types/yargs-parser@21.0.3
Paquets
Symboles
  • yargsParser.detailed
Créé
2026-08-27T15:03:49Z

Contrat

  1. declares detailed method signature on Parser interface taking string or string array argv and optional Options returning DetailedArguments
  2. declares DetailedArguments interface with argv, error, aliases, newAliases, and configuration fields
  3. declares Arguments interface on DetailedArguments.argv with positional array _, end-of-options array --, and string index signature
  4. declares Configuration interface on DetailedArguments.configuration with all boolean and string parser flags
  5. declares Options parameter interface supporting alias map and partial Configuration for detailed calls

Fichiers

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

Télécharger l’artefact source (tar.gz)

Code 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 yargsParser.detailed in 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
Demonstrate these symbols/APIs:
  - yargsParser.detailed

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:71a5c6709df1a04375e8d4979aaa5dbe385aad4c848797f979ea6bece4432628","contract":["declares detailed method signature on Parser interface taking string or string array argv and optional Options returning DetailedArguments","declares DetailedArguments interface with argv, error, aliases, newAliases, and configuration fields","declares Arguments interface on DetailedArguments.argv with positional array _, end-of-options array --, and string index signature","declares Configuration interface on DetailedArguments.configuration with all boolean and string parser flags","declares Options parameter interface supporting alias map and partial Configuration for detailed calls"],"goal":"verify yargsParser.detailed in pkg:npm/%40types/yargs-parser@21.0.3","kind":"HOW","packages":["pkg:npm/%40types/yargs-parser@21.0.3"],"schemaVersion":1,"symbols":["yargsParser.detailed"]},"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","symbols":["yargsParser.detailed"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-yargs-parser-detailed",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-yargs-parser-detailed",
      "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-yargs-parser-detailed",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "license": "MIT-0",
  "dependencies": {
    "@types/yargs-parser": "21.0.3"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify yargsParser.detailed in pkg:npm/%40types/yargs-parser@21.0.3",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40types/yargs-parser@21.0.3"
  ],
  "symbols": [
    "yargsParser.detailed"
  ]
}
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);

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');

const typesDir = path.dirname(pkgPath);
const indexDts = fs.readFileSync(path.join(typesDir, 'index.d.ts'), 'utf8');

// 1. declares detailed method signature on Parser interface taking string or string array argv and optional Options returning DetailedArguments
assert.ok(
  indexDts.includes('detailed(argv: string | string[], opts?: Options): DetailedArguments;'),
  'Parser interface must declare detailed method taking string | string[] argv and optional Options returning DetailedArguments'
);

// 2. declares DetailedArguments interface with argv, error, aliases, newAliases, and configuration fields
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;'),
  'DetailedArguments interface must declare argv, error, aliases, newAliases, and configuration properties'
);

// 3. declares Arguments interface on DetailedArguments.argv with positional array _, end-of-options array --, and string index signature
assert.ok(
  indexDts.includes('interface Arguments {') &&
  indexDts.includes('_: Array<string | number>;') &&
  indexDts.includes('"--"?: Array<string | number>;') &&
  indexDts.includes('[argName: string]: any;'),
  'Arguments interface on DetailedArguments.argv must declare _, --, and index signature'
);

// 4. declares Configuration interface on DetailedArguments.configuration with all boolean and string parser flags
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;'),
  'Configuration interface must declare all boolean and string parser configuration options'
);

// 5. declares Options parameter interface supporting alias map and partial Configuration for detailed calls
assert.ok(
  indexDts.includes('interface Options {') &&
  indexDts.includes('alias?: { [key: string]: string | string[] } | undefined;') &&
  indexDts.includes('configuration?: Partial<Configuration> | undefined;'),
  'Options interface must support alias map and partial Configuration options'
);

console.log('Contract for yargsParser.detailed passed successfully.');

Seeder d'origine

anonyme