샘플
yoctocolors-cjs 2.1.3
검증된 샘플 — npm yoctocolors-cjs 2.1.3. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: colors format text with standard ANSI color escape codes when…
sha256:e6d94f3e3308fe32637c09cc5e3df75cc5aaace3a56c354c3e92c75e374e8088
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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-16 |
케이스
HOW- 목표
- verify pkg:npm/yoctocolors-cjs@2.1.3
- 환경
- node 22.23.2
- 생성일
- 2026-09-16T14:13:37Z
컨트랙트
- colors format text with standard ANSI color escape codes when color is enabled
- colors format text with standard ANSI style modifier codes when color is enabled
- bright colors and background colors format text with corresponding ANSI escape codes
- nested color and style formatting properly preserves and reopens outer styling
- non-string input is coerced to string when formatting
- disabled color mode returns input unchanged without ANSI codes
파일
- PROMPT.md
- csx.json
- index.cjs
- package-lock.json
- package.json
- spec.json
- test/contract.cjs
소스
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/yoctocolors-cjs@2.1.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/yoctocolors-cjs@2.1.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:dba3fb1d2c52b2b260a784478de753a495c9d39b810fc423ed4ee5870e2e6b6a","contract":["colors format text with standard ANSI color escape codes when color is enabled","colors format text with standard ANSI style modifier codes when color is enabled","bright colors and background colors format text with corresponding ANSI escape codes","nested color and style formatting properly preserves and reopens outer styling","non-string input is coerced to string when formatting","disabled color mode returns input unchanged without ANSI codes"],"goal":"verify pkg:npm/yoctocolors-cjs@2.1.3","kind":"HOW","packages":["pkg:npm/yoctocolors-cjs@2.1.3"],"schemaVersion":1},"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/yoctocolors-cjs@2.1.3"],"schemaVersion":1,"subject":"pkg:npm/yoctocolors-cjs@2.1.3","verifierAdapter":"node-typescript@1"}
'use strict';
const colors = require('yoctocolors-cjs');
function formatSuccess(message) {
return colors.green(message);
}
function formatError(message) {
return colors.red(message);
}
function formatHighlight(message) {
return colors.bold(colors.cyan(message));
}
module.exports = {
colors,
formatSuccess,
formatError,
formatHighlight
};
{
"name": "sample-yoctocolors-cjs",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-yoctocolors-cjs",
"version": "1.0.0",
"dependencies": {
"yoctocolors-cjs": "2.1.3"
}
},
"node_modules/yoctocolors-cjs": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/yoctocolors-cjs/-/yoctocolors-cjs-2.1.3.tgz",
"integrity": "sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw==",
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
}
}
}
{
"name": "sample-yoctocolors-cjs",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of yoctocolors-cjs",
"dependencies": {
"yoctocolors-cjs": "2.1.3"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/yoctocolors-cjs@2.1.3",
"kind": "HOW",
"packages": [
"pkg:npm/yoctocolors-cjs@2.1.3"
]
}
'use strict';
// Ensure color formatting is active for offline test execution
process.env.FORCE_COLOR = '1';
const assert = require('node:assert/strict');
const colors = require('yoctocolors-cjs');
const { formatSuccess, formatError, formatHighlight } = require('../index.cjs');
// 1. Basic text colors format with standard ANSI escape codes
assert.equal(colors.red('hello'), '\u001B[31mhello\u001B[39m');
assert.equal(colors.green('hello'), '\u001B[32mhello\u001B[39m');
assert.equal(colors.yellow('hello'), '\u001B[33mhello\u001B[39m');
assert.equal(colors.blue('hello'), '\u001B[34mhello\u001B[39m');
assert.equal(colors.magenta('hello'), '\u001B[35mhello\u001B[39m');
assert.equal(colors.cyan('hello'), '\u001B[36mhello\u001B[39m');
assert.equal(colors.white('hello'), '\u001B[37mhello\u001B[39m');
assert.equal(colors.gray('hello'), '\u001B[90mhello\u001B[39m');
assert.equal(colors.black('hello'), '\u001B[30mhello\u001B[39m');
// 2. Modifiers format with corresponding ANSI style codes
assert.equal(colors.bold('text'), '\u001B[1mtext\u001B[22m');
assert.equal(colors.dim('text'), '\u001B[2mtext\u001B[22m');
assert.equal(colors.italic('text'), '\u001B[3mtext\u001B[23m');
assert.equal(colors.underline('text'), '\u001B[4mtext\u001B[24m');
assert.equal(colors.overline('text'), '\u001B[53mtext\u001B[55m');
assert.equal(colors.inverse('text'), '\u001B[7mtext\u001B[27m');
assert.equal(colors.hidden('text'), '\u001B[8mtext\u001B[28m');
assert.equal(colors.strikethrough('text'), '\u001B[9mtext\u001B[29m');
assert.equal(colors.reset('text'), '\u001B[0mtext\u001B[0m');
// 3. Bright colors and background colors format properly
assert.equal(colors.redBright('bright'), '\u001B[91mbright\u001B[39m');
assert.equal(colors.greenBright('bright'), '\u001B[92mbright\u001B[39m');
assert.equal(colors.yellowBright('bright'), '\u001B[93mbright\u001B[39m');
assert.equal(colors.bgRed('bg'), '\u001B[41mbg\u001B[49m');
assert.equal(colors.bgGreen('bg'), '\u001B[42mbg\u001B[49m');
assert.equal(colors.bgBlue('bg'), '\u001B[44mbg\u001B[49m');
assert.equal(colors.bgCyanBright('bg'), '\u001B[106mbg\u001B[49m');
// 4. Nested styling and helper functions
assert.equal(colors.bold(colors.red('alert')), '\u001B[1m\u001B[31malert\u001B[39m\u001B[22m');
assert.equal(colors.dim('a ' + colors.bold('b') + ' c'), '\u001B[2ma \u001B[1mb\u001B[22m\u001B[2m c\u001B[22m');
assert.equal(formatSuccess('ok'), '\u001B[32mok\u001B[39m');
assert.equal(formatError('fail'), '\u001B[31mfail\u001B[39m');
assert.equal(formatHighlight('info'), '\u001B[1m\u001B[36minfo\u001B[39m\u001B[22m');
// 5. Non-string input is coerced to string
assert.equal(colors.blue(42), '\u001B[34m42\u001B[39m');
assert.equal(colors.green(true), '\u001B[32mtrue\u001B[39m');
// 6. Disabled color mode returns input unchanged
delete require.cache[require.resolve('yoctocolors-cjs')];
delete process.env.FORCE_COLOR;
process.env.NO_COLOR = '1';
const disabledColors = require('yoctocolors-cjs');
assert.equal(disabledColors.red('plain'), 'plain');
assert.equal(disabledColors.bold('plain'), 'plain');
assert.equal(disabledColors.bgBlue('plain'), 'plain');
console.log('Contract passed');
오리진 시더
익명