Beispiel
@types/ms 2.1.0
Verifiziertes Beispiel für npm @types/ms 2.1.0. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand: @types/ms package.json declares type…
sha256:8f40547eea5883dcc7bce981ed0057b19f7e637b281b6280631095167e443b5e
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
linux 24 · ubuntu · glibc 2.39 x64 npm
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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 |
Fall
HOW- Ziel
- verify pkg:npm/%40types/ms@2.1.0
- Pakete
- Erstellt
- 2026-08-23T13:55:28Z
Contract
- @types/ms package.json declares type definitions entry point index.d.ts and version 2.1.0
- @types/ms index.d.ts declares overloaded function ms for formatting numbers and parsing StringValue
- @types/ms index.d.ts declares namespace ms with Unit, UnitAnyCase, and StringValue types
- @types/ms index.d.ts exports ms function using export assignment
Dateien
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
Quelltext
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/ms@2.1.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40types/ms@2.1.0
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:e9329bc4a762aea34fd2b0f7f0747d4d40d6a235bef54bf6366b3adedc3618f7","contract":["@types/ms package.json declares type definitions entry point index.d.ts and version 2.1.0","@types/ms index.d.ts declares overloaded function ms for formatting numbers and parsing StringValue","@types/ms index.d.ts declares namespace ms with Unit, UnitAnyCase, and StringValue types","@types/ms index.d.ts exports ms function using export assignment"],"goal":"verify pkg:npm/%40types/ms@2.1.0","kind":"HOW","packages":["pkg:npm/%40types/ms@2.1.0"],"schemaVersion":1},"contractCommand":["node","test/contract.js"],"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/ms@2.1.0"],"schemaVersion":1,"subject":"pkg:npm/%40types/ms@2.1.0","verifierAdapter":"node-typescript@1"}
{
"name": "sample-ms-types",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-ms-types",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@types/ms": "2.1.0"
}
},
"node_modules/@types/ms": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz",
"integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==",
"license": "MIT"
}
}
}
{
"name": "sample-ms-types",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification sample for @types/ms",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"@types/ms": "2.1.0"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40types/ms@2.1.0",
"kind": "HOW",
"packages": [
"pkg:npm/%40types/ms@2.1.0"
]
}
const fs = require('node:fs');
const path = require('node:path');
/**
* Resolves the path to the @types/ms declaration file.
* @returns {string} Absolute path to index.d.ts
*/
function getDeclarationPath() {
const pkgJsonPath = require.resolve('@types/ms/package.json');
const pkgDir = path.dirname(pkgJsonPath);
return path.join(pkgDir, 'index.d.ts');
}
/**
* Loads the declaration file content from @types/ms.
* @returns {string} The text content of index.d.ts
*/
function loadDeclarationContent() {
const declPath = getDeclarationPath();
return fs.readFileSync(declPath, 'utf8');
}
/**
* Validates that the declaration file defines expected TypeScript constructs and signatures.
* @returns {object} Summary of discovered type declarations
*/
function inspectTypeDefinitions() {
const content = loadDeclarationContent();
const hasFormatOverload = content.includes('declare function ms(value: number, options?: { long: boolean }): string;');
const hasParseOverload = content.includes('declare function ms(value: ms.StringValue): number;');
const hasNamespace = content.includes('declare namespace ms');
const hasUnitType = content.includes('type Unit =');
const hasUnitAnyCaseType = content.includes('type UnitAnyCase = Unit | Uppercase<Unit> | Lowercase<Unit>;');
const hasStringValueType = content.includes('type StringValue =');
const hasExportAssignment = content.includes('export = ms;');
return {
hasFormatOverload,
hasParseOverload,
hasNamespace,
hasUnitType,
hasUnitAnyCaseType,
hasStringValueType,
hasExportAssignment
};
}
module.exports = {
getDeclarationPath,
loadDeclarationContent,
inspectTypeDefinitions
};
const assert = require('node:assert');
const fs = require('node:fs');
const path = require('node:path');
const { getDeclarationPath, loadDeclarationContent, inspectTypeDefinitions } = require('../src/index.js');
// 1. Verify package manifest exports and metadata
const pkgJson = require('@types/ms/package.json');
assert.strictEqual(pkgJson.name, '@types/ms', 'package name should match @types/ms');
assert.strictEqual(pkgJson.version, '2.1.0', 'package version should match 2.1.0');
assert.strictEqual(pkgJson.types, 'index.d.ts', 'package types entry should point to index.d.ts');
// 2. Verify declaration file existence
const declPath = getDeclarationPath();
assert.strictEqual(fs.existsSync(declPath), true, 'index.d.ts should exist on disk');
// 3. Verify declaration content and structure
const content = loadDeclarationContent();
assert.strictEqual(typeof content, 'string', 'declaration content should be a string');
// 4. Verify function overload signatures
assert.strictEqual(
content.includes('declare function ms(value: number, options?: { long: boolean }): string;'),
true,
'index.d.ts must declare number formatting overload with optional long boolean option'
);
assert.strictEqual(
content.includes('declare function ms(value: ms.StringValue): number;'),
true,
'index.d.ts must declare string duration parsing overload returning number'
);
// 5. Verify namespace and type aliases
assert.strictEqual(content.includes('declare namespace ms'), true, 'index.d.ts must declare ms namespace');
assert.strictEqual(content.includes('type Unit ='), true, 'index.d.ts must declare Unit type alias');
assert.strictEqual(content.includes('"Milliseconds"'), true, 'Unit type must include Milliseconds');
assert.strictEqual(content.includes('"Seconds"'), true, 'Unit type must include Seconds');
assert.strictEqual(content.includes('"Minutes"'), true, 'Unit type must include Minutes');
assert.strictEqual(content.includes('"Hours"'), true, 'Unit type must include Hours');
assert.strictEqual(content.includes('"Days"'), true, 'Unit type must include Days');
assert.strictEqual(
content.includes('type UnitAnyCase = Unit | Uppercase<Unit> | Lowercase<Unit>;'),
true,
'index.d.ts must declare UnitAnyCase type'
);
assert.strictEqual(
content.includes('type StringValue ='),
true,
'index.d.ts must declare StringValue type template literals'
);
// 6. Verify export assignment
assert.strictEqual(content.includes('export = ms;'), true, 'index.d.ts must export ms function via export = ms');
// 7. Verify helper module inspection
const inspection = inspectTypeDefinitions();
assert.strictEqual(inspection.hasFormatOverload, true, 'inspection should confirm format overload');
assert.strictEqual(inspection.hasParseOverload, true, 'inspection should confirm parse overload');
assert.strictEqual(inspection.hasNamespace, true, 'inspection should confirm namespace');
assert.strictEqual(inspection.hasUnitType, true, 'inspection should confirm Unit type');
assert.strictEqual(inspection.hasUnitAnyCaseType, true, 'inspection should confirm UnitAnyCase type');
assert.strictEqual(inspection.hasStringValueType, true, 'inspection should confirm StringValue type');
assert.strictEqual(inspection.hasExportAssignment, true, 'inspection should confirm export assignment');
console.log('Contract tests passed successfully.');
Ursprungs-Seeder
anonym