샘플
strip-ansi 7.2.0
검증된 샘플 — npm strip-ansi 7.2.0. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: stripAnsi removes 3-bit and 4-bit standard ANSI color codes
sha256:5ead9969f871279a798e3d1123943781d59da1d42ea8e6a68420c21d26cd8ebb
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
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@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-23 |
케이스
HOW- 목표
- verify pkg:npm/strip-ansi@7.2.0
- 패키지
- 환경
- node 22.23.2
- 생성일
- 2026-08-23T08:09:52Z
컨트랙트
- stripAnsi removes 3-bit and 4-bit standard ANSI color codes
- stripAnsi removes 8-bit (256 color) ANSI color sequences
- stripAnsi removes 24-bit (RGB) ANSI color sequences
- stripAnsi removes text styling such as bold, italic, and underline
- stripAnsi removes terminal cursor and line clear control sequences
- stripAnsi preserves strings without ANSI escape codes
- stripAnsi throws TypeError when given non-string input
- stripAnsiCodes wrapper removes ANSI formatting correctly
- hasAnsiCodes detects whether a string contains ANSI escape codes
- stripAnsiFromLines cleans an array of formatted strings
파일
- 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 pkg:npm/strip-ansi@7.2.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/strip-ansi@7.2.0
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- 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:3a0bc29c7abad45384f394cd33b66df5561bfa67adfa127db8ae0a3f77c0f955","constraints":{"executionContext":"node"},"contract":["stripAnsi removes 3-bit and 4-bit standard ANSI color codes","stripAnsi removes 8-bit (256 color) ANSI color sequences","stripAnsi removes 24-bit (RGB) ANSI color sequences","stripAnsi removes text styling such as bold, italic, and underline","stripAnsi removes terminal cursor and line clear control sequences","stripAnsi preserves strings without ANSI escape codes","stripAnsi throws TypeError when given non-string input","stripAnsiCodes wrapper removes ANSI formatting correctly","hasAnsiCodes detects whether a string contains ANSI escape codes","stripAnsiFromLines cleans an array of formatted strings"],"goal":"verify pkg:npm/strip-ansi@7.2.0","kind":"HOW","packages":["pkg:npm/strip-ansi@7.2.0"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"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/strip-ansi@7.2.0"],"schemaVersion":1,"subject":"pkg:npm/strip-ansi@7.2.0","verifierAdapter":"node-typescript@1"}
const stripAnsiModule = require('strip-ansi');
const stripAnsi = stripAnsiModule.default || stripAnsiModule;
function stripAnsiCodes(text) {
return stripAnsi(text);
}
function hasAnsiCodes(text) {
if (typeof text !== 'string') {
throw new TypeError(`Expected a string, got ${typeof text}`);
}
return text !== stripAnsi(text);
}
function stripAnsiFromLines(lines) {
if (!Array.isArray(lines)) {
throw new TypeError('Expected an array of strings');
}
return lines.map((line) => stripAnsi(line));
}
module.exports = {
stripAnsiCodes,
hasAnsiCodes,
stripAnsiFromLines,
};
{
"name": "sample-strip-ansi",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-strip-ansi",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"strip-ansi": "7.2.0"
}
},
"node_modules/ansi-regex": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.3.0.tgz",
"integrity": "sha512-WpDfL7NO6j7tH88IDBNVdUJxDh9nmCteAVW9dsep846XdwF4naCBK+/tGLX3KJgcpgMRXCFlTM2hKGoK9FsdrQ==",
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/ansi-regex?sponsor=1"
}
},
"node_modules/strip-ansi": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz",
"integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==",
"license": "MIT",
"dependencies": {
"ansi-regex": "^6.2.2"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/strip-ansi?sponsor=1"
}
}
}
}
{
"name": "sample-strip-ansi",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification sample for strip-ansi 7.2.0",
"main": "index.js",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"strip-ansi": "7.2.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/strip-ansi@7.2.0",
"kind": "HOW",
"packages": [
"pkg:npm/strip-ansi@7.2.0"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import assert from 'node:assert/strict';
import stripAnsi from 'strip-ansi';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const { stripAnsiCodes, hasAnsiCodes, stripAnsiFromLines } = require('../index.js');
// 1. stripAnsi removes 3-bit and 4-bit standard ANSI color codes
assert.equal(stripAnsi('\u001B[31mRed Text\u001B[39m'), 'Red Text');
assert.equal(stripAnsi('\u001B[42mGreen Background\u001B[49m'), 'Green Background');
assert.equal(stripAnsi('\u001B[93mBright Yellow\u001B[39m'), 'Bright Yellow');
// 2. stripAnsi removes 8-bit (256 color) ANSI color sequences
assert.equal(stripAnsi('\u001B[38;5;196m256 Color Text\u001B[0m'), '256 Color Text');
assert.equal(stripAnsi('\u001B[48;5;27m256 Background\u001B[0m'), '256 Background');
// 3. stripAnsi removes 24-bit (RGB) ANSI color sequences
assert.equal(stripAnsi('\u001B[38;2;255;100;50mRGB Color\u001B[0m'), 'RGB Color');
assert.equal(stripAnsi('\u001B[48;2;0;128;255mRGB Background\u001B[0m'), 'RGB Background');
// 4. stripAnsi removes text styling such as bold, italic, and underline
assert.equal(stripAnsi('\u001B[1mBold\u001B[22m \u001B[3mItalic\u001B[23m \u001B[4mUnderline\u001B[24m'), 'Bold Italic Underline');
assert.equal(stripAnsi('\u001B[2mDim\u001B[22m \u001B[9mStrikethrough\u001B[29m'), 'Dim Strikethrough');
// 5. stripAnsi removes terminal cursor and line clear control sequences
assert.equal(stripAnsi('\u001B[2K\u001B[1GCleared Line\u001B[0J'), 'Cleared Line');
// 6. stripAnsi preserves strings without ANSI escape codes
assert.equal(stripAnsi('Plain text without ANSI escape codes'), 'Plain text without ANSI escape codes');
assert.equal(stripAnsi(''), '');
// 7. stripAnsi throws TypeError when given non-string input
assert.throws(() => stripAnsi(123), { name: 'TypeError' });
assert.throws(() => stripAnsi(null), { name: 'TypeError' });
assert.throws(() => stripAnsi(undefined), { name: 'TypeError' });
assert.throws(() => stripAnsi({}), { name: 'TypeError' });
// 8. stripAnsiCodes wrapper removes ANSI formatting correctly
assert.equal(stripAnsiCodes('\u001B[34mWrapped Hello\u001B[0m'), 'Wrapped Hello');
// 9. hasAnsiCodes detects whether a string contains ANSI escape codes
assert.equal(hasAnsiCodes('\u001B[31mError\u001B[0m'), true);
assert.equal(hasAnsiCodes('Normal text'), false);
assert.throws(() => hasAnsiCodes(123), { name: 'TypeError' });
// 10. stripAnsiFromLines cleans an array of formatted strings
const rawLines = ['\u001B[32mLine 1\u001B[0m', '\u001B[33mLine 2\u001B[0m', 'Plain Line 3'];
const expectedLines = ['Line 1', 'Line 2', 'Plain Line 3'];
assert.deepEqual(stripAnsiFromLines(rawLines), expectedLines);
assert.throws(() => stripAnsiFromLines('not an array'), { name: 'TypeError' });
console.log('All contract assertions passed successfully.');
오리진 시더
익명