샘플
kleur 4.1.5: bgGreen
검증된 샘플 — npm kleur 4.1.5: bgGreen. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: kleur.bgGreen wraps a string in ANSI background green escape…
sha256:7c5c59ae59a9c70df35bc33c7a558740597dbdc90eab63a0c07d08617a0936e4
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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-27 |
케이스
HOW- 목표
- verify kleur.bgGreen in pkg:npm/kleur@4.1.5
- 패키지
- 심벌
-
- kleur.bgGreen
- 생성일
- 2026-08-27T12:03:21Z
컨트랙트
- kleur.bgGreen wraps a string in ANSI background green escape codes \u001b[42m and \u001b[49m
- kleur.bgGreen returns a chainable formatter when called with no arguments
- kleur.bgGreen coerces numeric and non-string inputs into styled strings
- kleur.bgGreen handles empty strings by wrapping them in open and close ANSI codes
- setting kleur.enabled to false disables styling and returns the input as plain text
파일
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
소스
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 kleur.bgGreen in pkg:npm/kleur@4.1.5
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/kleur@4.1.5
Demonstrate these symbols/APIs:
- kleur.bgGreen
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:c9978dd71308004585136282f83a9590ab1f45c81b1658457f2818d51683528b","contract":["kleur.bgGreen wraps a string in ANSI background green escape codes \\u001b[42m and \\u001b[49m","kleur.bgGreen returns a chainable formatter when called with no arguments","kleur.bgGreen coerces numeric and non-string inputs into styled strings","kleur.bgGreen handles empty strings by wrapping them in open and close ANSI codes","setting kleur.enabled to false disables styling and returns the input as plain text"],"goal":"verify kleur.bgGreen in pkg:npm/kleur@4.1.5","kind":"HOW","packages":["pkg:npm/kleur@4.1.5"],"schemaVersion":1,"symbols":["kleur.bgGreen"]},"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/kleur@4.1.5"],"schemaVersion":1,"subject":"pkg:npm/kleur@4.1.5","symbols":["kleur.bgGreen"],"verifierAdapter":"node-typescript@1"}
import kleur from 'kleur';
/**
* Formats text with green background ANSI styling.
* @param {string|number|boolean} text
* @returns {string}
*/
export function formatSuccessBadge(text) {
return kleur.bgGreen().white().bold(` ${text} `);
}
/**
* Applies green background directly using kleur.bgGreen.
* @param {string|number|boolean} text
* @returns {string}
*/
export function applyBgGreen(text) {
return kleur.bgGreen(text);
}
export { kleur };
{
"name": "verify-kleur-bggreen",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "verify-kleur-bggreen",
"version": "1.0.0",
"dependencies": {
"kleur": "4.1.5"
}
},
"node_modules/kleur": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz",
"integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==",
"license": "MIT",
"engines": {
"node": ">=6"
}
}
}
}
{
"name": "verify-kleur-bggreen",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification sample for kleur.bgGreen in kleur@4.1.5",
"type": "module",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"kleur": "4.1.5"
}
}
{
"schemaVersion": 1,
"goal": "verify kleur.bgGreen in pkg:npm/kleur@4.1.5",
"kind": "HOW",
"packages": [
"pkg:npm/kleur@4.1.5"
],
"symbols": [
"kleur.bgGreen"
]
}
import assert from 'node:assert/strict';
import { kleur, applyBgGreen, formatSuccessBadge } from '../index.js';
// Ensure predictable styling behavior in non-interactive / CI environments
kleur.enabled = true;
// Contract 1: kleur.bgGreen wraps a string in ANSI background green escape codes (\u001b[42m and \u001b[49m).
const basic = kleur.bgGreen('SUCCESS');
assert.equal(basic, '\u001b[42mSUCCESS\u001b[49m');
assert.equal(applyBgGreen('PASS'), '\u001b[42mPASS\u001b[49m');
// Contract 2: kleur.bgGreen returns a chainable formatter when called with no arguments.
const chained = kleur.bgGreen().bold('HIGHLIGHT');
assert.equal(chained, '\u001b[42m\u001b[1mHIGHLIGHT\u001b[49m\u001b[22m');
const badge = formatSuccessBadge('OK');
assert.equal(badge, '\u001b[42m\u001b[37m\u001b[1m OK \u001b[49m\u001b[39m\u001b[22m');
// Contract 3: kleur.bgGreen coerces numeric and non-string inputs into styled strings.
const num = kleur.bgGreen(200);
assert.equal(num, '\u001b[42m200\u001b[49m');
// Contract 4: kleur.bgGreen handles empty strings by wrapping them in open and close ANSI codes.
const empty = kleur.bgGreen('');
assert.equal(empty, '\u001b[42m\u001b[49m');
// Contract 5: setting kleur.enabled to false disables styling and returns the input as plain text.
kleur.enabled = false;
assert.equal(kleur.bgGreen('NO_COLOR'), 'NO_COLOR');
assert.equal(applyBgGreen('PLAIN'), 'PLAIN');
assert.equal(formatSuccessBadge('DISABLED'), ' DISABLED ');
// Restore enabled state
kleur.enabled = true;
console.log('All kleur.bgGreen contract tests passed.');
오리진 시더
익명