CodeSampleX

Beispiel

crelt 1.0.7

Verifiziertes Beispiel für npm crelt 1.0.7. Der Vertrag lief auf node 22 · linux debian/x64 · docker und bestand: crelt creates DOM elements with tag name…

sha256:2902cc1bf29dd63c3581db82b693179d589b8a0b16753ca116abd0c63c5860c5

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
1
Signaturschlüssel, die es gebaut haben
1
Deklarierte Umgebung linux 24 · ubuntu · glibc 2.39 x64 npm

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
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-15

Fall

HOW
Ziel
verify pkg:npm/crelt@1.0.7
Pakete
Erstellt
2026-09-15T05:14:34Z

Contract

  1. crelt creates DOM elements with tag name and attributes
  2. crelt wraps existing DOM elements when passed as first argument
  3. crelt appends string children as text nodes
  4. crelt appends element and node children
  5. crelt handles nested arrays of children flattening them recursively
  6. crelt ignores null and undefined children
  7. crelt throws RangeError for unsupported child node types

Dateien

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs

Quellartefakt herunterladen (tar.gz)

Quelltext

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/crelt@1.0.7
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/crelt@1.0.7

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:f3e046d0d45a0614977073cebfd46498b5660b76c94958c6314b0823b3ef0579","contract":["crelt creates DOM elements with tag name and attributes","crelt wraps existing DOM elements when passed as first argument","crelt appends string children as text nodes","crelt appends element and node children","crelt handles nested arrays of children flattening them recursively","crelt ignores null and undefined children","crelt throws RangeError for unsupported child node types"],"goal":"verify pkg:npm/crelt@1.0.7","kind":"HOW","packages":["pkg:npm/crelt@1.0.7"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"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/crelt@1.0.7"],"schemaVersion":1,"subject":"pkg:npm/crelt@1.0.7","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "crelt-sample",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "crelt-sample",
      "version": "1.0.0",
      "dependencies": {
        "crelt": "1.0.7"
      }
    },
    "node_modules/crelt": {
      "version": "1.0.7",
      "resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.7.tgz",
      "integrity": "sha512-aK6BbWfhf4U/wCcLHKPJl/xa6VkVstRaPywWtMKGwuOLc/wZTyQYuoxgvZnNsBvv7Kg3YTBQYYBCggcviQczuA==",
      "license": "MIT"
    }
  }
}
package.json
{
  "name": "crelt-sample",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification for crelt",
  "dependencies": {
    "crelt": "1.0.7"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/crelt@1.0.7",
  "kind": "HOW",
  "packages": [
    "pkg:npm/crelt@1.0.7"
  ]
}
test/contract.mjs
import assert from 'node:assert';

// Minimal DOM mock for Node.js environment
class MockElement {
  constructor(tagName) {
    this.tagName = tagName.toUpperCase();
    this.nodeType = 1;
    this.attributes = {};
    this.childNodes = [];
  }

  setAttribute(name, value) {
    this.attributes[name] = String(value);
  }

  getAttribute(name) {
    return Object.prototype.hasOwnProperty.call(this.attributes, name) ? this.attributes[name] : null;
  }

  appendChild(child) {
    this.childNodes.push(child);
    return child;
  }
}

class MockTextNode {
  constructor(text) {
    this.nodeValue = String(text);
    this.nodeType = 3;
  }
}

globalThis.document = {
  createElement(tag) {
    return new MockElement(tag);
  },
  createTextNode(text) {
    return new MockTextNode(text);
  }
};

import crelt from 'crelt';

// 1. crelt creates DOM elements with tag name and attributes
const el1 = crelt('div', { id: 'test-id', class: 'container', tabIndex: 0 });
assert.strictEqual(el1.tagName, 'DIV');
assert.strictEqual(el1.getAttribute('id'), 'test-id');
assert.strictEqual(el1.getAttribute('class'), 'container');
assert.strictEqual(el1.tabIndex, 0);

// 2. crelt wraps existing DOM elements when passed as first argument
const existing = globalThis.document.createElement('section');
const el2 = crelt(existing, { 'data-mode': 'active' });
assert.strictEqual(el2, existing);
assert.strictEqual(el2.tagName, 'SECTION');
assert.strictEqual(el2.getAttribute('data-mode'), 'active');

// 3. crelt appends string children as text nodes
const el3 = crelt('p', null, 'hello', ' ', 'world');
assert.strictEqual(el3.childNodes.length, 3);
assert.strictEqual(el3.childNodes[0].nodeType, 3);
assert.strictEqual(el3.childNodes[0].nodeValue, 'hello');
assert.strictEqual(el3.childNodes[1].nodeValue, ' ');
assert.strictEqual(el3.childNodes[2].nodeValue, 'world');

// 4. crelt appends element and node children
const childSpan = crelt('span', null, 'inner');
const el4 = crelt('div', null, childSpan);
assert.strictEqual(el4.childNodes.length, 1);
assert.strictEqual(el4.childNodes[0], childSpan);
assert.strictEqual(el4.childNodes[0].childNodes[0].nodeValue, 'inner');

// 5. crelt handles nested arrays of children flattening them recursively
const el5 = crelt('ul', null, [
  crelt('li', null, 'item 1'),
  [crelt('li', null, 'item 2'), [crelt('li', null, 'item 3')]]
]);
assert.strictEqual(el5.childNodes.length, 3);
assert.strictEqual(el5.childNodes[0].childNodes[0].nodeValue, 'item 1');
assert.strictEqual(el5.childNodes[1].childNodes[0].nodeValue, 'item 2');
assert.strictEqual(el5.childNodes[2].childNodes[0].nodeValue, 'item 3');

// 6. crelt ignores null and undefined children
const el6 = crelt('div', null, null, 'valid', undefined);
assert.strictEqual(el6.childNodes.length, 1);
assert.strictEqual(el6.childNodes[0].nodeValue, 'valid');

// 7. crelt throws RangeError for unsupported child node types
assert.throws(
  () => {
    crelt('div', null, 42);
  },
  (err) => {
    return err instanceof RangeError && err.message.includes('Unsupported child node: 42');
  }
);

assert.throws(
  () => {
    crelt('div', null, { some: 'object' });
  },
  (err) => {
    return err instanceof RangeError && err.message.includes('Unsupported child node:');
  }
);

console.log('Contract passed');

Ursprungs-Seeder

anonym