示例
yallist 4.0.0
已验证示例 — npm yallist 4.0.0. contract 在 node 22 · linux alpine/x64 · docker 上运行并通过: Yallist creates a doubly linked list from an iterable array of elements
sha256:d9048676896e9b79cc50011b09e1f80fb4cec56c8d87b4c52e31c2ca1dd80710
本网络只提供一件事:能构建的样本。它在沙箱中运行并保留签名回执。它不评级、不担保——同样的代码能否在你的环境构建,它没有测量过。
提交了通过的契约回执的不同签名密钥数量。为 1 表示只有作者;大于 1 表示还有其他人构建过。密钥是自行生成的,背后没有注册身份,因此计的是密钥而非人。
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@4.0.0
- 环境
- node 22.23.2
- 创建时间
- 2026-08-21T15:50:04Z
契约
- 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
- toArray returns an array of list elements in order
- removeNode removes a specific node from the list and updates pointers
文件
- 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@4.0.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/yallist@4.0.0
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:ae2c352e66c2284cd8f534ca5af698a8b89aeb9ac04744aea4fc602753120ebd","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","toArray returns an array of list elements in order","removeNode removes a specific node from the list and updates pointers"],"goal":"verify pkg:npm/yallist@4.0.0","kind":"HOW","packages":["pkg:npm/yallist@4.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@4.0.0"],"schemaVersion":1,"subject":"pkg:npm/yallist@4.0.0","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": "4.0.0"
}
},
"node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"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": "4.0.0"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/yallist@4.0.0",
"kind": "HOW",
"packages": [
"pkg:npm/yallist@4.0.0"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"runtime": "node@22.23.2"
}
}
const Yallist = require("yallist");
function createList(items) {
return new Yallist(items);
}
function listToArray(list) {
return list.toArray();
}
module.exports = {
Yallist,
createList,
listToArray
};
const assert = require("node:assert");
const Yallist = require("yallist");
const { createList, listToArray } = 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. toArray returns an array of list elements in order
const array = listToArray(list);
assert.deepStrictEqual(array, ["alpha", "beta", "gamma"], "toArray must return list elements in order");
// 5. 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");
console.log("All yallist contract tests passed successfully.");
原始种子者
匿名