샘플
yaml 2.9.0: create and modify YAML Document with Document
검증된 샘플 — npm yaml 2.9.0: create and modify YAML Document with Document. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다.
sha256:8b0f97db755aed2ecdba1676d2a29fc99842af547fe48cefffc6654c5cb97784
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
node 22.23 windows 11 x64 node 22.23 javascript npm 10
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-19 |
케이스
HOW- 목표
- create and modify YAML Document with Document
- 패키지
- 심벌
-
- Document
- 환경
- node 22.23.2
- 생성일
- 2026-08-18T19:55:34Z
컨트랙트
- new Document initializes a YAML Document from JavaScript data structures
- doc.set and doc.get read and modify top-level document properties
- doc.toJS converts the Document to a plain JavaScript object
- doc.toString serializes the Document structure to valid YAML string output
파일
- 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: create and modify YAML Document with Document
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/yaml@2.9.0
Demonstrate these symbols/APIs:
- Document
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@11.8.0
- runtime: node@24.13.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:bc92f63edfc7304176af8388781cb3e0922c51af68cc0802e82474ecdfd7bb3a","constraints":{"executionContext":"node"},"contract":["new Document initializes a YAML Document from JavaScript data structures","doc.set and doc.get read and modify top-level document properties","doc.toJS converts the Document to a plain JavaScript object","doc.toString serializes the Document structure to valid YAML string output"],"goal":"create and modify YAML Document with Document","kind":"HOW","packages":["pkg:npm/yaml@2.9.0"],"schemaVersion":1,"symbols":["Document"]},"contractCommand":["node","test/contract.cjs"],"environment":{"arch":"x64","ecosystem":"npm","executionContext":"node","language":"javascript","moduleSystem":"cjs","os":"windows","osVersionBucket":"11","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/yaml@2.9.0"],"schemaVersion":1,"symbols":["Document"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample",
"version": "1.0.0",
"dependencies": {
"yaml": "2.9.0"
}
},
"node_modules/yaml": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.0.tgz",
"integrity": "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==",
"license": "ISC",
"bin": {
"yaml": "bin.mjs"
},
"engines": {
"node": ">= 14.6"
},
"funding": {
"url": "https://github.com/sponsors/eemeli"
}
}
}
}
{
"name": "sample",
"version": "1.0.0",
"private": true,
"dependencies": {
"yaml": "2.9.0"
}
}
{
"schemaVersion": 1,
"goal": "create and modify YAML Document with Document",
"kind": "HOW",
"packages": [
"pkg:npm/yaml@2.9.0"
],
"symbols": [
"Document"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@11.8.0",
"runtime": "node@24.13.1"
}
}
const assert = require('node:assert/strict');
const { Document } = require('yaml');
// Contract 1: new Document initializes a YAML Document from JavaScript data structures
const initialData = {
service: 'order-api',
replicas: 3,
environment: 'staging',
tags: ['ecommerce', 'backend']
};
const doc = new Document(initialData);
assert.equal(doc.contents.items.length, 4);
// Contract 2: doc.set and doc.get read and modify top-level document properties
assert.equal(doc.get('service'), 'order-api');
assert.equal(doc.get('replicas'), 3);
doc.set('replicas', 5);
assert.equal(doc.get('replicas'), 5);
doc.set('region', 'us-east-1');
assert.equal(doc.get('region'), 'us-east-1');
// Contract 3: doc.toJS converts the Document to a plain JavaScript object
const jsResult = doc.toJS();
assert.deepEqual(jsResult, {
service: 'order-api',
replicas: 5,
environment: 'staging',
tags: ['ecommerce', 'backend'],
region: 'us-east-1'
});
// Contract 4: doc.toString serializes the Document structure to valid YAML string output
const yamlOutput = doc.toString();
assert.equal(typeof yamlOutput, 'string');
assert.ok(yamlOutput.includes('service: order-api'));
assert.ok(yamlOutput.includes('replicas: 5'));
assert.ok(yamlOutput.includes('- ecommerce'));
assert.ok(yamlOutput.includes('region: us-east-1'));
console.log('Contract verification passed successfully.');
오리진 시더
익명