CodeSampleX

샘플

yallist 5.0.0

검증된 샘플 — npm yallist 5.0.0. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: Yallist creates a doubly linked list from an iterable array of…

sha256:856a6c1268357b806026bd4ae50e23201cf414e7dc7f5a6cc3f270df0570be40

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. MIT-0

실행 증거

선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.

증거 기준
서명된 컨트랙트 통과
검증 영수증
1
빌드한 서명 키
1
선언된 환경 node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

검증 실행 환경

환경 컨트랙트 단계 실행일
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

케이스

HOW
목표
verify pkg:npm/yallist@5.0.0
패키지
환경
node 22.23.2
생성일
2026-08-21T15:52:35Z

컨트랙트

  1. Yallist creates a doubly linked list from an iterable array of elements
  2. push and unshift insert elements at tail and head updating length
  3. pop and shift remove elements from tail and head returning their values
  4. forEach and forEachReverse iterate through elements in forward and reverse order
  5. map and mapReverse create new Yallist instances with transformed elements
  6. toArray and toArrayReverse convert the linked list to forward and reverse arrays
  7. removeNode removes a specific node from the list and updates pointers
  8. 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

소스 아티팩트 내려받기 (tar.gz)

소스

PROMPT.md
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@5.0.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/yallist@5.0.0
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - packageManager: npm@10.9.8
  - 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.
csx.json
{"case":{"caseId":"case:sha256:96d9b404753faa13baad08e11047e7a7f10561c04c863e65f991c60725013229","constraints":{"executionContext":"node"},"contract":["Yallist creates a doubly linked list from an iterable array of elements","push and unshift insert elements at tail and head updating length","pop and shift remove elements from tail and head returning their values","forEach and forEachReverse iterate through elements in forward and reverse order","map and mapReverse create new Yallist instances with transformed elements","toArray and toArrayReverse convert the linked list to forward and reverse arrays","removeNode removes a specific node from the list and updates pointers","reverse reverses the linked list elements in place"],"goal":"verify pkg:npm/yallist@5.0.0","kind":"HOW","packages":["pkg:npm/yallist@5.0.0"],"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","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/yallist@5.0.0"],"schemaVersion":1,"subject":"pkg:npm/yallist@5.0.0","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-yallist",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-yallist",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "yallist": "5.0.0"
      }
    },
    "node_modules/yallist": {
      "version": "5.0.0",
      "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",
      "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==",
      "license": "BlueOak-1.0.0",
      "engines": {
        "node": ">=18"
      }
    }
  }
}
package.json
{
  "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": "5.0.0"
  },
  "license": "MIT-0"
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/yallist@5.0.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/yallist@5.0.0"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
src/index.js
const { Yallist, Node } = require("yallist");

function createList(items) {
  return new Yallist(items);
}

function listToArray(list) {
  return list.toArray();
}

function listToArrayReverse(list) {
  return list.toArrayReverse();
}

function mapList(list, fn) {
  return list.map(fn);
}

module.exports = {
  Yallist,
  Node,
  createList,
  listToArray,
  listToArrayReverse,
  mapList
};
test/contract.js
const assert = require("node:assert");
const { Yallist, Node } = require("yallist");
const {
  createList,
  listToArray,
  listToArrayReverse,
  mapList
} = require("../src/index.js");

// 1. Yallist creates a doubly linked list from an iterable array of elements
const list = createList(["alpha", "beta", "gamma"]);
assert.strictEqual(list instanceof Yallist, true, "list must be an instance of Yallist");
assert.strictEqual(list.length, 3, "initial length should be 3");
assert.strictEqual(list.head.value, "alpha", "head node value should be alpha");
assert.strictEqual(list.tail.value, "gamma", "tail node value should be gamma");
assert.strictEqual(list.head.next.value, "beta", "second element should be beta");
assert.strictEqual(list.tail.prev.value, "beta", "previous element of tail should be beta");

// 2. push and unshift insert elements at tail and head updating length
list.push("delta");
assert.strictEqual(list.length, 4, "length should be 4 after push");
assert.strictEqual(list.tail.value, "delta", "tail should be delta");

list.unshift("first");
assert.strictEqual(list.length, 5, "length should be 5 after unshift");
assert.strictEqual(list.head.value, "first", "head should be first");

// 3. pop and shift remove elements from tail and head returning their values
const popped = list.pop();
assert.strictEqual(popped, "delta", "pop should return the removed tail value");
assert.strictEqual(list.length, 4, "length should be 4 after pop");

const shifted = list.shift();
assert.strictEqual(shifted, "first", "shift should return the removed head value");
assert.strictEqual(list.length, 3, "length should be 3 after shift");

// 4. forEach and forEachReverse iterate through elements in forward and reverse order
const forward = [];
list.forEach((val) => forward.push(val));
assert.deepStrictEqual(forward, ["alpha", "beta", "gamma"], "forEach must iterate in forward order");

const backward = [];
list.forEachReverse((val) => backward.push(val));
assert.deepStrictEqual(backward, ["gamma", "beta", "alpha"], "forEachReverse must iterate in reverse order");

// 5. map and mapReverse create new Yallist instances with transformed elements
const mapped = mapList(list, (val) => val.toUpperCase());
assert.strictEqual(mapped instanceof Yallist, true, "map result must be Yallist");
assert.deepStrictEqual(mapped.toArray(), ["ALPHA", "BETA", "GAMMA"], "mapped list values must match");

const mappedReverse = list.mapReverse((val) => val.toUpperCase());
assert.deepStrictEqual(mappedReverse.toArray(), ["GAMMA", "BETA", "ALPHA"], "mapReverse values must match reverse order");

// 6. toArray and toArrayReverse convert the linked list to forward and reverse arrays
assert.deepStrictEqual(listToArray(list), ["alpha", "beta", "gamma"], "toArray must return list elements in order");
assert.deepStrictEqual(listToArrayReverse(list), ["gamma", "beta", "alpha"], "toArrayReverse must return list elements in reverse order");

// 7. removeNode removes a specific node from the list and updates pointers
const middleNode = list.head.next;
list.removeNode(middleNode);
assert.strictEqual(list.length, 2, "length should be 2 after removing middle node");
assert.strictEqual(list.head.next, list.tail, "head next should now point directly to tail");
assert.strictEqual(list.tail.prev, list.head, "tail prev should now point directly to head");
assert.deepStrictEqual(list.toArray(), ["alpha", "gamma"], "remaining elements should be alpha and gamma");

// 8. reverse reverses the linked list elements in place
list.reverse();
assert.deepStrictEqual(list.toArray(), ["gamma", "alpha"], "reverse should reverse elements in place");
assert.strictEqual(list.head.value, "gamma", "head after reverse should be gamma");
assert.strictEqual(list.tail.value, "alpha", "tail after reverse should be alpha");

console.log("All yallist contract tests passed successfully.");

오리진 시더

익명