サンプル
picocolors 1.1.1
検証済みサンプル — npm picocolors 1.1.1. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: createColors(true).red formats text with red ANSI escape codes
sha256:ac0bc21fcbbee9deeb1a9c89089a71ab23dd2007cd9cbc66c47f5be93e932ec1
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 2
- ビルドした署名鍵
- 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-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-08 |
ケース
HOW- ゴール
- verify pkg:npm/picocolors@1.1.1
- パッケージ
- 作成日
- 2026-08-23T06:41:57Z
コントラクト
- createColors(true).red formats text with red ANSI escape codes
- createColors(true).green formats text with green ANSI escape codes
- createColors(true).bold formats text with bold ANSI escape codes
- createColors(true).bgBlue formats text with blue background ANSI escape codes
- createColors(false) disables color formatting and returns input unchanged
ファイル
- PROMPT.md
- csx.json
- index.mjs
- 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/picocolors@1.1.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/picocolors@1.1.1
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:53d714c534c9d567fa2246b74d4244d81338020d7b2d6c716560228e596d8c07","contract":["createColors(true).red formats text with red ANSI escape codes","createColors(true).green formats text with green ANSI escape codes","createColors(true).bold formats text with bold ANSI escape codes","createColors(true).bgBlue formats text with blue background ANSI escape codes","createColors(false) disables color formatting and returns input unchanged"],"goal":"verify pkg:npm/picocolors@1.1.1","kind":"HOW","packages":["pkg:npm/picocolors@1.1.1"],"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/picocolors@1.1.1"],"schemaVersion":1,"subject":"pkg:npm/picocolors@1.1.1","verifierAdapter":"node-typescript@1"}
import pc from "picocolors";
export function formatMessage(level, message) {
const colors = pc.createColors(true);
switch (level) {
case "error":
return colors.red(`[ERROR] ${message}`);
case "warn":
return colors.yellow(`[WARN] ${message}`);
case "info":
return colors.cyan(`[INFO] ${message}`);
default:
return colors.green(`[OK] ${message}`);
}
}
export function formatHeading(title) {
const colors = pc.createColors(true);
return colors.bold(colors.underline(title));
}
{
"name": "sample-picocolors",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-picocolors",
"version": "1.0.0",
"dependencies": {
"picocolors": "1.1.1"
}
},
"node_modules/picocolors": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
"license": "ISC"
}
}
}
{
"name": "sample-picocolors",
"version": "1.0.0",
"private": true,
"type": "module",
"dependencies": {
"picocolors": "1.1.1"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/picocolors@1.1.1",
"kind": "HOW",
"packages": [
"pkg:npm/picocolors@1.1.1"
]
}
import assert from "node:assert/strict";
import pc from "picocolors";
// 1. Verify forced color formatting with createColors(true)
const colors = pc.createColors(true);
assert.equal(colors.isColorSupported, true, "isColorSupported should be true when enabled");
// Color functions produce expected ANSI escape sequences
assert.equal(colors.red("error"), "\x1b[31merror\x1b[39m");
assert.equal(colors.green("ok"), "\x1b[32mok\x1b[39m");
assert.equal(colors.yellow("warning"), "\x1b[33mwarning\x1b[39m");
assert.equal(colors.blue("info"), "\x1b[34minfo\x1b[39m");
assert.equal(colors.magenta("highlight"), "\x1b[35mhighlight\x1b[39m");
assert.equal(colors.cyan("link"), "\x1b[36mlink\x1b[39m");
assert.equal(colors.white("text"), "\x1b[37mtext\x1b[39m");
assert.equal(colors.gray("dimmed"), "\x1b[90mdimmed\x1b[39m");
// Modifiers
assert.equal(colors.bold("bold text"), "\x1b[1mbold text\x1b[22m");
assert.equal(colors.dim("dim text"), "\x1b[2mdim text\x1b[22m");
assert.equal(colors.italic("italic text"), "\x1b[3mitalic text\x1b[23m");
assert.equal(colors.underline("underlined"), "\x1b[4munderlined\x1b[24m");
assert.equal(colors.inverse("inverted"), "\x1b[7minverted\x1b[27m");
assert.equal(colors.strikethrough("strike"), "\x1b[9mstrike\x1b[29m");
assert.equal(colors.reset("reset"), "\x1b[0mreset\x1b[0m");
// Background colors
assert.equal(colors.bgBlack("black"), "\x1b[40mblack\x1b[49m");
assert.equal(colors.bgRed("red"), "\x1b[41mred\x1b[49m");
assert.equal(colors.bgGreen("green"), "\x1b[42mgreen\x1b[49m");
assert.equal(colors.bgYellow("yellow"), "\x1b[43myellow\x1b[49m");
assert.equal(colors.bgBlue("blue"), "\x1b[44mblue\x1b[49m");
assert.equal(colors.bgMagenta("magenta"), "\x1b[45mmagenta\x1b[49m");
assert.equal(colors.bgCyan("cyan"), "\x1b[46mcyan\x1b[49m");
assert.equal(colors.bgWhite("white"), "\x1b[47mwhite\x1b[49m");
// 2. Verify disabled color mode with createColors(false)
const disabled = pc.createColors(false);
assert.equal(disabled.isColorSupported, false, "isColorSupported should be false when disabled");
assert.equal(disabled.red("error"), "error");
assert.equal(disabled.green("ok"), "ok");
assert.equal(disabled.bold("bold text"), "bold text");
assert.equal(disabled.bgBlue("blue"), "blue");
// 3. Verify function nesting
assert.equal(colors.bold(colors.red("alert")), "\x1b[1m\x1b[31malert\x1b[39m\x1b[22m");
console.log("All contract tests passed successfully.");
オリジンシーダー
匿名