Beispiel
kleur 3.0.3: red, bold
Verifiziertes Beispiel für npm kleur 3.0.3: red, bold. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand: kleur applies ANSI color codes…
sha256:c0ab2d28bcecb50119911a6d460d4c4014c117b6573a35e88b864bc11bea37f5
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
- 2
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-23 |
| 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-07 |
Fall
HOW- Ziel
- verify pkg:npm/kleur@3.0.3
- Pakete
- Symbole
-
- kleur.red
- kleur.bold
- Umgebung
- node 22.23.2
- Erstellt
- 2026-08-23T16:12:50Z
Contract
- kleur applies ANSI color codes such as red, green, and blue to text when enabled
- kleur applies ANSI style modifiers such as bold, dim, and underline to text
- kleur supports method chaining to combine multiple style modifiers and colors
- kleur supports background colors such as bgRed, bgGreen, and bgBlue
- kleur returns plain unformatted strings without ANSI escapes when enabled is false
- kleur properly handles nested style formatting and close tag replacements
Dateien
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.cjs
Quelltext
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/kleur@3.0.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/kleur@3.0.3
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:ff13450e446419dc2af249f62053e04019e95b09708d72528f0b4140edef5f0a","contract":["kleur applies ANSI color codes such as red, green, and blue to text when enabled","kleur applies ANSI style modifiers such as bold, dim, and underline to text","kleur supports method chaining to combine multiple style modifiers and colors","kleur supports background colors such as bgRed, bgGreen, and bgBlue","kleur returns plain unformatted strings without ANSI escapes when enabled is false","kleur properly handles nested style formatting and close tag replacements"],"goal":"verify pkg:npm/kleur@3.0.3","kind":"HOW","packages":["pkg:npm/kleur@3.0.3"],"schemaVersion":1,"symbols":["kleur.red","kleur.bold"]},"contractCommand":["node","test/contract.cjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","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/kleur@3.0.3"],"schemaVersion":1,"subject":"pkg:npm/kleur@3.0.3","symbols":["kleur.red","kleur.bold"],"verifierAdapter":"node-typescript@1"}
'use strict';
const kleur = require('kleur');
/**
* Format text with red color.
* @param {string} text
* @returns {string}
*/
function red(text) {
return kleur.red(text);
}
/**
* Format text with bold modifier.
* @param {string} text
* @returns {string}
*/
function bold(text) {
return kleur.bold(text);
}
/**
* Format text with chained bold and red styling.
* @param {string} text
* @returns {string}
*/
function boldRed(text) {
return kleur.bold().red(text);
}
/**
* Enable or disable color formatting.
* @param {boolean} flag
*/
function setColorEnabled(flag) {
kleur.enabled = flag;
}
module.exports = {
kleur,
red,
bold,
boldRed,
setColorEnabled
};
{
"name": "sample-kleur",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-kleur",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"kleur": "3.0.3"
}
},
"node_modules/kleur": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz",
"integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==",
"license": "MIT",
"engines": {
"node": ">=6"
}
}
}
}
{
"name": "sample-kleur",
"version": "1.0.0",
"private": true,
"description": "verify pkg:npm/kleur@3.0.3",
"main": "index.js",
"scripts": {
"test": "node test/contract.cjs"
},
"dependencies": {
"kleur": "3.0.3"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/kleur@3.0.3",
"kind": "HOW",
"packages": [
"pkg:npm/kleur@3.0.3"
]
}
'use strict';
const assert = require('node:assert');
const kleur = require('kleur');
const { red, bold, boldRed, setColorEnabled } = require('../index.js');
function testContract() {
const initialEnabled = kleur.enabled;
try {
// Ensure enabled for ANSI code tests
kleur.enabled = true;
// 1. kleur applies ANSI color codes to strings when enabled
assert.strictEqual(kleur.red('sample'), '\x1b[31msample\x1b[39m');
assert.strictEqual(red('sample'), '\x1b[31msample\x1b[39m');
assert.strictEqual(kleur.green('sample'), '\x1b[32msample\x1b[39m');
assert.strictEqual(kleur.yellow('sample'), '\x1b[33msample\x1b[39m');
assert.strictEqual(kleur.blue('sample'), '\x1b[34msample\x1b[39m');
assert.strictEqual(kleur.magenta('sample'), '\x1b[35msample\x1b[39m');
assert.strictEqual(kleur.cyan('sample'), '\x1b[36msample\x1b[39m');
assert.strictEqual(kleur.white('sample'), '\x1b[37msample\x1b[39m');
assert.strictEqual(kleur.gray('sample'), '\x1b[90msample\x1b[39m');
assert.strictEqual(kleur.black('sample'), '\x1b[30msample\x1b[39m');
// 2. kleur applies ANSI style modifiers such as bold, dim, and underline
assert.strictEqual(kleur.bold('sample'), '\x1b[1msample\x1b[22m');
assert.strictEqual(bold('sample'), '\x1b[1msample\x1b[22m');
assert.strictEqual(kleur.dim('sample'), '\x1b[2msample\x1b[22m');
assert.strictEqual(kleur.italic('sample'), '\x1b[3msample\x1b[23m');
assert.strictEqual(kleur.underline('sample'), '\x1b[4msample\x1b[24m');
assert.strictEqual(kleur.inverse('sample'), '\x1b[7msample\x1b[27m');
assert.strictEqual(kleur.hidden('sample'), '\x1b[8msample\x1b[28m');
assert.strictEqual(kleur.strikethrough('sample'), '\x1b[9msample\x1b[29m');
assert.strictEqual(kleur.reset('sample'), '\x1b[0msample\x1b[0m');
// 3. kleur supports method chaining to combine multiple styles and colors
assert.strictEqual(kleur.bold().red('sample'), '\x1b[1m\x1b[31msample\x1b[22m\x1b[39m');
assert.strictEqual(kleur.red().bold('sample'), '\x1b[31m\x1b[1msample\x1b[39m\x1b[22m');
assert.strictEqual(boldRed('sample'), '\x1b[1m\x1b[31msample\x1b[22m\x1b[39m');
assert.strictEqual(kleur.bold().underline().red('sample'), '\x1b[1m\x1b[4m\x1b[31msample\x1b[22m\x1b[24m\x1b[39m');
// 4. kleur supports background colors such as bgRed, bgGreen, and bgBlue
assert.strictEqual(kleur.bgRed('sample'), '\x1b[41msample\x1b[49m');
assert.strictEqual(kleur.bgGreen('sample'), '\x1b[42msample\x1b[49m');
assert.strictEqual(kleur.bgBlue('sample'), '\x1b[44msample\x1b[49m');
assert.strictEqual(kleur.bgYellow('sample'), '\x1b[43msample\x1b[49m');
assert.strictEqual(kleur.bgMagenta('sample'), '\x1b[45msample\x1b[49m');
assert.strictEqual(kleur.bgCyan('sample'), '\x1b[46msample\x1b[49m');
assert.strictEqual(kleur.bgWhite('sample'), '\x1b[47msample\x1b[49m');
assert.strictEqual(kleur.bgBlack('sample'), '\x1b[40msample\x1b[49m');
// 5. kleur returns plain unformatted strings when enabled is set to false
setColorEnabled(false);
assert.strictEqual(kleur.enabled, false);
assert.strictEqual(kleur.red('sample'), 'sample');
assert.strictEqual(kleur.bold('sample'), 'sample');
assert.strictEqual(kleur.bold().red('sample'), 'sample');
assert.strictEqual(red('sample'), 'sample');
assert.strictEqual(boldRed('sample'), 'sample');
// 6. kleur properly handles nested style formatting and close tag replacements
setColorEnabled(true);
const innerBold = kleur.bold('inner');
const nestedBold = kleur.bold(`outer ${innerBold} outer`);
assert.strictEqual(nestedBold, '\x1b[1mouter \x1b[1minner\x1b[22m\x1b[1m outer\x1b[22m');
const innerRed = kleur.red('red text');
const nestedColor = kleur.bold(`bold ${innerRed} bold`);
assert.strictEqual(nestedColor, '\x1b[1mbold \x1b[31mred text\x1b[39m bold\x1b[22m');
console.log('Contract tests passed successfully.');
process.exit(0);
} finally {
kleur.enabled = initialEnabled;
}
}
testContract();
Ursprungs-Seeder
anonym