サンプル
js-yaml 4.3.1
検証済みサンプル — npm js-yaml 4.3.1. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: yaml.load parses YAML string with scalars, arrays, and nested…
sha256:ef6e650d864b6c5772325c8af5827317543f62fd0a78b129d3a24df0f287f856
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
linux 24 · ubuntu · glibc 2.39 x64 npm
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-21 |
ケース
HOW- ゴール
- verify pkg:npm/js-yaml@4.3.1
- パッケージ
- 作成日
- 2026-08-21T08:23:20Z
コントラクト
- yaml.load parses YAML string with scalars, arrays, and nested mappings into JavaScript objects
- yaml.load handles null, boolean, integer, float, and date types accurately
- yaml.load throws YAMLException on invalid YAML syntax
- yaml.loadAll parses multiple documents separated by --- in a single string
- yaml.dump serializes JavaScript objects into valid YAML format
- yaml.dump supports options such as indent and sortKeys
- yaml.load with FAILSAFE_SCHEMA parses all scalars as strings without implicit type casting
- yaml.load and yaml.dump round-trip preserves object structure and data integrity
ファイル
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.cjs
ソース
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/js-yaml@4.3.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/js-yaml@4.3.1
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:e2df9d02588b60d01fb15c8ad9ef68626a1cc6d0316e67f4d027ed1667ae020c","contract":["yaml.load parses YAML string with scalars, arrays, and nested mappings into JavaScript objects","yaml.load handles null, boolean, integer, float, and date types accurately","yaml.load throws YAMLException on invalid YAML syntax","yaml.loadAll parses multiple documents separated by --- in a single string","yaml.dump serializes JavaScript objects into valid YAML format","yaml.dump supports options such as indent and sortKeys","yaml.load with FAILSAFE_SCHEMA parses all scalars as strings without implicit type casting","yaml.load and yaml.dump round-trip preserves object structure and data integrity"],"goal":"verify pkg:npm/js-yaml@4.3.1","kind":"HOW","packages":["pkg:npm/js-yaml@4.3.1"],"schemaVersion":1},"contractCommand":["node","test/contract.cjs"],"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/js-yaml@4.3.1"],"schemaVersion":1,"subject":"pkg:npm/js-yaml@4.3.1","verifierAdapter":"node-typescript@1"}
{
"name": "js-yaml-verification",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "js-yaml-verification",
"version": "1.0.0",
"dependencies": {
"js-yaml": "4.3.1"
}
},
"node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"license": "Python-2.0"
},
"node_modules/js-yaml": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz",
"integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==",
"license": "MIT",
"dependencies": {
"argparse": "^2.0.1"
},
"bin": {
"js-yaml": "bin/js-yaml.js"
}
}
}
}
{
"name": "js-yaml-verification",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification for js-yaml",
"dependencies": {
"js-yaml": "4.3.1"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/js-yaml@4.3.1",
"kind": "HOW",
"packages": [
"pkg:npm/js-yaml@4.3.1"
]
}
const assert = require('node:assert');
const yaml = require('js-yaml');
// 1. yaml.load parses YAML string with scalars, arrays, and nested mappings into JavaScript objects
const doc1 = `
title: CodeSampleX
count: 42
items:
- alpha
- beta
nested:
enabled: true
`;
const parsed1 = yaml.load(doc1);
assert.deepStrictEqual(parsed1, {
title: 'CodeSampleX',
count: 42,
items: ['alpha', 'beta'],
nested: { enabled: true }
});
// 2. yaml.load handles null, boolean, integer, float, and date types accurately
const doc2 = `
nullVal: null
tildeNull: ~
boolTrue: true
boolFalse: false
intVal: 100
floatVal: 3.1415
dateVal: 2026-08-21T00:00:00Z
`;
const parsed2 = yaml.load(doc2);
assert.strictEqual(parsed2.nullVal, null);
assert.strictEqual(parsed2.tildeNull, null);
assert.strictEqual(parsed2.boolTrue, true);
assert.strictEqual(parsed2.boolFalse, false);
assert.strictEqual(parsed2.intVal, 100);
assert.strictEqual(parsed2.floatVal, 3.1415);
assert.ok(parsed2.dateVal instanceof Date);
assert.strictEqual(parsed2.dateVal.toISOString(), '2026-08-21T00:00:00.000Z');
// 3. yaml.load throws YAMLException on invalid YAML syntax
assert.throws(() => {
yaml.load('foo: [bar: baz');
}, yaml.YAMLException);
// 4. yaml.loadAll parses multiple documents separated by --- in a single string
const multiDoc = `
---
doc: 1
---
doc: 2
`;
const docs = [];
yaml.loadAll(multiDoc, (d) => docs.push(d));
assert.deepStrictEqual(docs, [{ doc: 1 }, { doc: 2 }]);
assert.deepStrictEqual(yaml.loadAll(multiDoc), [{ doc: 1 }, { doc: 2 }]);
// 5. yaml.dump serializes JavaScript objects into valid YAML format
const obj = { name: 'test', values: [1, 2, 3] };
const dumped = yaml.dump(obj);
assert.strictEqual(typeof dumped, 'string');
assert.deepStrictEqual(yaml.load(dumped), obj);
// 6. yaml.dump supports options such as indent and sortKeys
const sortObj = { z: 1, a: 2, m: 3 };
const dumpedSorted = yaml.dump(sortObj, { sortKeys: true, indent: 4 });
assert.strictEqual(dumpedSorted, 'a: 2\nm: 3\nz: 1\n');
// 7. yaml.load with FAILSAFE_SCHEMA parses all scalars as strings without implicit type casting
const failsafeDoc = 'number: 123\nflag: true';
const failsafeParsed = yaml.load(failsafeDoc, { schema: yaml.FAILSAFE_SCHEMA });
assert.strictEqual(failsafeParsed.number, '123');
assert.strictEqual(failsafeParsed.flag, 'true');
// 8. yaml.load and yaml.dump round-trip preserves object structure and data integrity
const complexObj = {
service: 'api-server',
port: 8080,
tags: ['web', 'node'],
meta: { active: true, version: 1.5 }
};
const roundTrip = yaml.load(yaml.dump(complexObj));
assert.deepStrictEqual(roundTrip, complexObj);
console.log('Contract passed');
オリジンシーダー
匿名