サンプル
yallist 3.1.1
検証済みサンプル — npm yallist 3.1.1. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: Yallist creates a doubly-linked list from an iterable or arguments
sha256:1b9dba190ab0f7048661c579dda15e3e01b905635770771397abd3df6e1f86ea
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 2
- ビルドした署名鍵
- 1
宣言された環境
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-21 |
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-12 |
ケース
HOW- ゴール
- verify pkg:npm/yallist@3.1.1
- パッケージ
- 環境
- node 22.23.2
- 作成日
- 2026-08-21T15:45:34Z
コントラクト
- Yallist creates a doubly-linked list from an iterable or arguments
- push and unshift insert elements at the tail and head respectively
- pop and shift remove and return elements from the tail and head respectively
- forEach and forEachReverse traverse elements in forward and reverse order
- map and mapReverse create new Yallist instances with transformed elements
- slice and sliceReverse extract sublists in forward and reverse order
- toArray and toArrayReverse convert the linked list to forward and reverse arrays
- pushNode, unshiftNode, and removeNode manipulate Node instances directly
- reverse reverses the linked list elements in place
ファイル
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
ソース
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/yallist@3.1.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/yallist@3.1.1
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- runtime: node@22.23.2
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:34ac765352117d36ea682f7124d313b9c9b8b991fc16c646eee662c310815ca2","constraints":{"executionContext":"node"},"contract":["Yallist creates a doubly-linked list from an iterable or arguments","push and unshift insert elements at the tail and head respectively","pop and shift remove and return elements from the tail and head respectively","forEach and forEachReverse traverse elements in forward and reverse order","map and mapReverse create new Yallist instances with transformed elements","slice and sliceReverse extract sublists in forward and reverse order","toArray and toArrayReverse convert the linked list to forward and reverse arrays","pushNode, unshiftNode, and removeNode manipulate Node instances directly","reverse reverses the linked list elements in place"],"goal":"verify pkg:npm/yallist@3.1.1","kind":"HOW","packages":["pkg:npm/yallist@3.1.1"],"schemaVersion":1},"contractCommand":["node","test/contract.js"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/yallist@3.1.1"],"schemaVersion":1,"subject":"pkg:npm/yallist@3.1.1","verifierAdapter":"node-typescript@1"}
{
"name": "sample-yallist",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-yallist",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"yallist": "3.1.1"
}
},
"node_modules/yallist": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
"license": "ISC"
}
}
}
{
"name": "sample-yallist",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification sample for yallist",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"yallist": "3.1.1"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/yallist@3.1.1",
"kind": "HOW",
"packages": [
"pkg:npm/yallist@3.1.1"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"runtime": "node@22.23.2"
}
}
const Yallist = require('yallist');
function createList(...items) {
if (items.length === 1 && Array.isArray(items[0])) {
return new Yallist(items[0]);
}
return Yallist.create(...items);
}
function pushItems(list, ...items) {
list.push(...items);
return list;
}
function unshiftItems(list, ...items) {
list.unshift(...items);
return list;
}
function popItem(list) {
return list.pop();
}
function shiftItem(list) {
return list.shift();
}
function toArray(list) {
return list.toArray();
}
function toArrayReverse(list) {
return list.toArrayReverse();
}
function mapList(list, fn) {
return list.map(fn);
}
function mapListReverse(list, fn) {
return list.mapReverse(fn);
}
function reduceList(list, fn, initialValue) {
return list.reduce(fn, initialValue);
}
function reverseList(list) {
list.reverse();
return list;
}
module.exports = {
Yallist,
createList,
pushItems,
unshiftItems,
popItem,
shiftItem,
toArray,
toArrayReverse,
mapList,
mapListReverse,
reduceList,
reverseList
};
const assert = require('node:assert');
const Yallist = require('yallist');
const {
createList,
pushItems,
unshiftItems,
popItem,
shiftItem,
toArray,
toArrayReverse,
mapList,
mapListReverse,
reduceList,
reverseList
} = require('../src/index.js');
// 1. Creation from array / arguments / factory
const list1 = new Yallist([1, 2, 3]);
assert.strictEqual(list1.length, 3, 'initial array length should be 3');
assert.deepStrictEqual(list1.toArray(), [1, 2, 3], 'initial array values should match');
const list2 = createList('a', 'b', 'c');
assert.strictEqual(list2.length, 3, 'createList length should be 3');
assert.deepStrictEqual(toArray(list2), ['a', 'b', 'c'], 'createList values should match');
const list3 = createList([10, 20, 30]);
assert.strictEqual(list3.length, 3, 'createList from array length should be 3');
assert.deepStrictEqual(toArray(list3), [10, 20, 30], 'createList array values should match');
// 2. push and unshift
const list = new Yallist();
pushItems(list, 10);
pushItems(list, 20, 30);
assert.strictEqual(list.length, 3, 'length after push should be 3');
assert.deepStrictEqual(toArray(list), [10, 20, 30], 'values after push should match');
unshiftItems(list, 5);
assert.strictEqual(list.length, 4, 'length after unshift should be 4');
assert.deepStrictEqual(toArray(list), [5, 10, 20, 30], 'values after unshift should match');
// 3. pop and shift
assert.strictEqual(popItem(list), 30, 'pop should return last item');
assert.strictEqual(shiftItem(list), 5, 'shift should return first item');
assert.strictEqual(list.length, 2, 'length after pop/shift should be 2');
assert.deepStrictEqual(toArray(list), [10, 20], 'remaining values should match');
// 4. head, tail, get, getReverse
assert.strictEqual(list.head.value, 10, 'head value should be 10');
assert.strictEqual(list.tail.value, 20, 'tail value should be 20');
assert.strictEqual(list.get(0), 10, 'get(0) should be 10');
assert.strictEqual(list.get(1), 20, 'get(1) should be 20');
assert.strictEqual(list.getReverse(0), 20, 'getReverse(0) should be 20');
assert.strictEqual(list.getReverse(1), 10, 'getReverse(1) should be 10');
// 5. forEach and forEachReverse
const fwd = [];
list.forEach((item, index) => {
fwd.push({ item, index });
});
assert.deepStrictEqual(fwd, [
{ item: 10, index: 0 },
{ item: 20, index: 1 }
], 'forEach should traverse forward');
const rev = [];
list.forEachReverse((item, index) => {
rev.push({ item, index });
});
assert.deepStrictEqual(rev, [
{ item: 20, index: 1 },
{ item: 10, index: 0 }
], 'forEachReverse should traverse in reverse');
// 6. map, mapReverse, reduce, reduceReverse
const doubled = mapList(list, x => x * 2);
assert.ok(doubled instanceof Yallist, 'map result should be Yallist instance');
assert.deepStrictEqual(toArray(doubled), [20, 40], 'mapped values should be doubled');
const doubledRev = mapListReverse(list, x => x * 2);
assert.ok(doubledRev instanceof Yallist, 'mapReverse result should be Yallist instance');
assert.deepStrictEqual(toArray(doubledRev), [40, 20], 'mapReverse values should be reversed doubled');
const sum = reduceList(list, (acc, x) => acc + x, 0);
assert.strictEqual(sum, 30, 'reduce sum should be 30');
const strRev = list.reduceReverse((acc, x) => acc + '-' + x, 'start');
assert.strictEqual(strRev, 'start-20-10', 'reduceReverse string concatenation should match');
// 7. slice and sliceReverse
const multiList = new Yallist([1, 2, 3, 4, 5]);
const sliced = multiList.slice(1, 4);
assert.deepStrictEqual(toArray(sliced), [2, 3, 4], 'sliced values should match');
const slicedRev = multiList.sliceReverse(1, 4);
assert.deepStrictEqual(toArray(slicedRev), [4, 3, 2], 'slicedReverse values should match');
// 8. toArray and toArrayReverse
assert.deepStrictEqual(toArrayReverse(list), [20, 10], 'toArrayReverse should return reverse array');
// 9. Node manipulations: pushNode, unshiftNode, removeNode
const node = new Yallist.Node(99);
list.pushNode(node);
assert.strictEqual(list.tail, node, 'pushed node should be tail');
assert.strictEqual(list.tail.value, 99, 'tail value should match node value');
const headNode = new Yallist.Node(0);
list.unshiftNode(headNode);
assert.strictEqual(list.head, headNode, 'unshifted node should be head');
assert.strictEqual(list.head.value, 0, 'head value should match node value');
list.removeNode(node);
assert.strictEqual(list.tail.value, 20, 'tail should revert after node removal');
list.removeNode(headNode);
assert.strictEqual(list.head.value, 10, 'head should revert after head node removal');
// 10. reverse
reverseList(list);
assert.deepStrictEqual(toArray(list), [20, 10], 'reversed list array should match');
console.log('Contract tests passed successfully.');
オリジンシーダー
匿名