Exemple
luxon 3.6.1: Info
Échantillon vérifié pour npm luxon 3.6.1: Info. Le contrat s'est exécuté sur node 22 · linux alpine/x64 · docker et a réussi.
sha256:565c62b3f299afcc86b437452aa2f52ce2c3ad914cccb7a3e6dcd72762184fb8
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 luxon.Info in pkg:npm/luxon@3.6.1
- Paquets
- Symboles
-
- luxon.Info
- Créé
- 2026-08-27T23:48:10Z
Contrat
- Info.months returns localized month names for specified length formats
- Info.weekdays returns localized weekday names starting on Monday
- Info.eras and Info.meridiems return localized era and meridiem strings
- Info.features reports runtime capabilities for relative and localeWeek formatting
- Info.isValidIANAZone validates standard and invalid IANA time zone identifiers
- Info.normalizeZone converts string identifiers into Zone objects and handles default zones
- Info.hasDST identifies whether a given time zone observes daylight saving time
Fichiers
- PROMPT.md
- csx.json
- index.mjs
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Code source
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 luxon.Info in pkg:npm/luxon@3.6.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/luxon@3.6.1
Demonstrate these symbols/APIs:
- luxon.Info
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:cef74cb4497598bafe23f9dc227e62dcf9201ddf353df52dd849f38e897a7bf7","contract":["Info.months returns localized month names for specified length formats","Info.weekdays returns localized weekday names starting on Monday","Info.eras and Info.meridiems return localized era and meridiem strings","Info.features reports runtime capabilities for relative and localeWeek formatting","Info.isValidIANAZone validates standard and invalid IANA time zone identifiers","Info.normalizeZone converts string identifiers into Zone objects and handles default zones","Info.hasDST identifies whether a given time zone observes daylight saving time"],"goal":"verify luxon.Info in pkg:npm/luxon@3.6.1","kind":"HOW","packages":["pkg:npm/luxon@3.6.1"],"schemaVersion":1,"symbols":["luxon.Info"]},"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/luxon@3.6.1"],"schemaVersion":1,"subject":"pkg:npm/luxon@3.6.1","symbols":["luxon.Info"],"verifierAdapter":"node-typescript@1"}
import { Info } from 'luxon';
export { Info };
/**
* Returns formatted month names for a given format and options.
*
* @param {string} [format='long'] - 'long', 'short', 'narrow', 'numeric', '2-digit'
* @param {object} [options={}] - Options including locale and numberingSystem
* @returns {string[]} Array of month names
*/
export function getMonths(format = 'long', options = {}) {
return Info.months(format, options);
}
/**
* Returns formatted weekday names for a given format and options.
*
* @param {string} [format='long'] - 'long', 'short', 'narrow', 'numeric'
* @param {object} [options={}] - Options including locale and numberingSystem
* @returns {string[]} Array of weekday names (Monday to Sunday)
*/
export function getWeekdays(format = 'long', options = {}) {
return Info.weekdays(format, options);
}
/**
* Returns era names for a given format and options.
*
* @param {string} [format='short'] - 'long', 'short', 'narrow'
* @param {object} [options={}] - Options including locale
* @returns {string[]} Array of era names
*/
export function getEras(format = 'short', options = {}) {
return Info.eras(format, options);
}
/**
* Returns meridiem tokens for a given locale.
*
* @param {object} [options={}] - Options including locale
* @returns {string[]} Array of meridiem strings (e.g. ['AM', 'PM'])
*/
export function getMeridiems(options = {}) {
return Info.meridiems(options);
}
/**
* Returns available feature flags in the current environment.
*
* @returns {object} Feature flags object
*/
export function getFeatures() {
return Info.features();
}
/**
* Checks if a zone identifier is a valid IANA time zone.
*
* @param {string} zone - IANA time zone identifier
* @returns {boolean} True if valid IANA zone
*/
export function isIANAZone(zone) {
return Info.isValidIANAZone(zone);
}
/**
* Normalizes a time zone identifier or Zone object into a Zone instance.
*
* @param {string|object} zone - Zone identifier or Zone object
* @returns {object} Normalized Zone instance
*/
export function normalizeZone(zone) {
return Info.normalizeZone(zone);
}
/**
* Checks if a time zone observes Daylight Saving Time (DST).
*
* @param {string} [zone='system'] - Zone identifier
* @returns {boolean} True if the zone observes DST
*/
export function hasDST(zone = 'system') {
return Info.hasDST(zone);
}
export default {
Info,
getMonths,
getWeekdays,
getEras,
getMeridiems,
getFeatures,
isIANAZone,
normalizeZone,
hasDST,
};
{
"name": "sample-luxon-info",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-luxon-info",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"luxon": "3.6.1"
}
},
"node_modules/luxon": {
"version": "3.6.1",
"resolved": "https://registry.npmjs.org/luxon/-/luxon-3.6.1.tgz",
"integrity": "sha512-tJLxrKJhO2ukZ5z0gyjY1zPh3Rh88Ej9P7jNrZiHMUXHae1yvI2imgOZtL1TO8TW6biMMKfTtAOoEJANgtWBMQ==",
"license": "MIT",
"engines": {
"node": ">=12"
}
}
}
}
{
"name": "sample-luxon-info",
"version": "1.0.0",
"type": "module",
"private": true,
"license": "MIT-0",
"dependencies": {
"luxon": "3.6.1"
}
}
{
"schemaVersion": 1,
"goal": "verify luxon.Info in pkg:npm/luxon@3.6.1",
"kind": "HOW",
"packages": [
"pkg:npm/luxon@3.6.1"
],
"symbols": [
"luxon.Info"
]
}
import assert from 'node:assert/strict';
import {
Info,
getMonths,
getWeekdays,
getEras,
getMeridiems,
getFeatures,
isIANAZone,
normalizeZone,
hasDST,
} from '../index.mjs';
// Contract 1: Info.months returns localized month names for specified length formats
{
const longMonths = getMonths('long', { locale: 'en' });
assert.strictEqual(Array.isArray(longMonths), true);
assert.strictEqual(longMonths.length, 12);
assert.strictEqual(longMonths[0], 'January');
assert.strictEqual(longMonths[11], 'December');
const shortMonths = getMonths('short', { locale: 'en' });
assert.strictEqual(shortMonths.length, 12);
assert.strictEqual(shortMonths[0], 'Jan');
assert.strictEqual(shortMonths[6], 'Jul');
const numericMonths = getMonths('numeric', { locale: 'en' });
assert.strictEqual(numericMonths.length, 12);
assert.strictEqual(numericMonths[0], '1');
assert.strictEqual(numericMonths[11], '12');
}
// Contract 2: Info.weekdays returns localized weekday names starting on Monday
{
const longWeekdays = getWeekdays('long', { locale: 'en' });
assert.strictEqual(Array.isArray(longWeekdays), true);
assert.strictEqual(longWeekdays.length, 7);
assert.strictEqual(longWeekdays[0], 'Monday');
assert.strictEqual(longWeekdays[6], 'Sunday');
const shortWeekdays = getWeekdays('short', { locale: 'en' });
assert.strictEqual(shortWeekdays.length, 7);
assert.strictEqual(shortWeekdays[0], 'Mon');
assert.strictEqual(shortWeekdays[4], 'Fri');
assert.strictEqual(shortWeekdays[6], 'Sun');
}
// Contract 3: Info.eras and Info.meridiems return localized era and meridiem strings
{
const eras = getEras('short', { locale: 'en' });
assert.strictEqual(Array.isArray(eras), true);
assert.strictEqual(eras.length, 2);
assert.strictEqual(eras[0], 'BC');
assert.strictEqual(eras[1], 'AD');
const meridiems = getMeridiems({ locale: 'en' });
assert.strictEqual(Array.isArray(meridiems), true);
assert.strictEqual(meridiems.length, 2);
assert.strictEqual(meridiems[0], 'AM');
assert.strictEqual(meridiems[1], 'PM');
}
// Contract 4: Info.features reports runtime capabilities for relative and localeWeek formatting
{
const features = getFeatures();
assert.strictEqual(typeof features, 'object');
assert.strictEqual(typeof features.relative, 'boolean');
assert.strictEqual(typeof features.localeWeek, 'boolean');
assert.strictEqual(features.relative, true);
}
// Contract 5: Info.isValidIANAZone validates standard and invalid IANA time zone identifiers
{
assert.strictEqual(isIANAZone('UTC'), true);
assert.strictEqual(isIANAZone('America/New_York'), true);
assert.strictEqual(isIANAZone('Europe/London'), true);
assert.strictEqual(isIANAZone('Asia/Tokyo'), true);
assert.strictEqual(isIANAZone('Invalid/Zone_Name'), false);
assert.strictEqual(isIANAZone(''), false);
assert.strictEqual(isIANAZone(null), false);
}
// Contract 6: Info.normalizeZone converts string identifiers into Zone objects and handles default zones
{
const utcZone = normalizeZone('UTC');
assert.strictEqual(typeof utcZone, 'object');
assert.strictEqual(utcZone.name, 'UTC');
assert.strictEqual(utcZone.isValid, true);
const systemZone = normalizeZone('system');
assert.strictEqual(typeof systemZone, 'object');
assert.strictEqual(systemZone.isValid, true);
const defaultZone = normalizeZone(null);
assert.strictEqual(typeof defaultZone, 'object');
assert.strictEqual(defaultZone.isValid, true);
}
// Contract 7: Info.hasDST identifies whether a given time zone observes daylight saving time
{
assert.strictEqual(hasDST('UTC'), false);
assert.strictEqual(hasDST('America/New_York'), true);
}
console.log('Contract tests passed successfully.');
Seeder d'origine
anonyme