CodeSampleX

샘플

nanoid 3.3.18

검증된 샘플 — npm nanoid 3.3.18. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: nanoid() returns a 21-character URL-friendly string by default

sha256:6e407ee4a8b4b9169317cac50d67c5013f5b5a06fde3a17ad0ed8f724ebb07b2

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. MIT-0

실행 증거

선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.

증거 기준
서명된 컨트랙트 통과
검증 영수증
1
빌드한 서명 키
1
선언된 환경 linux 24 · ubuntu · glibc 2.39 x64 npm

검증 실행 환경

환경 컨트랙트 단계 실행일
node 22 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1
2026-08-20

케이스

HOW
목표
verify pkg:npm/nanoid@3.3.18
패키지
생성일
2026-08-20T02:30:13Z

컨트랙트

  1. nanoid() returns a 21-character URL-friendly string by default
  2. nanoid(size) generates a string with the specified length
  3. customAlphabet(alphabet, size) generates IDs using only the custom alphabet
  4. repeated generations produce unique non-colliding strings

파일

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs

소스 아티팩트 내려받기 (tar.gz)

소스

PROMPT.md
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/nanoid@3.3.18
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/nanoid@3.3.18

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.
csx.json
{"case":{"caseId":"case:sha256:c2395b3b4906e370a8673bcadd44340a7081602a5832e8200c0d5a7d7fcbef73","contract":["nanoid() returns a 21-character URL-friendly string by default","nanoid(size) generates a string with the specified length","customAlphabet(alphabet, size) generates IDs using only the custom alphabet","repeated generations produce unique non-colliding strings"],"goal":"verify pkg:npm/nanoid@3.3.18","kind":"HOW","packages":["pkg:npm/nanoid@3.3.18"],"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/nanoid@3.3.18"],"schemaVersion":1,"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-nanoid",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-nanoid",
      "version": "1.0.0",
      "dependencies": {
        "nanoid": "3.3.18"
      }
    },
    "node_modules/nanoid": {
      "version": "3.3.18",
      "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.18.tgz",
      "integrity": "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==",
      "funding": [
        {
          "type": "github",
          "url": "https://github.com/sponsors/ai"
        }
      ],
      "license": "MIT",
      "bin": {
        "nanoid": "bin/nanoid.cjs"
      },
      "engines": {
        "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
      }
    }
  }
}
package.json
{
  "name": "sample-nanoid",
  "version": "1.0.0",
  "type": "module",
  "private": true,
  "dependencies": {
    "nanoid": "3.3.18"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/nanoid@3.3.18",
  "kind": "HOW",
  "packages": [
    "pkg:npm/nanoid@3.3.18"
  ]
}
test/contract.mjs
import assert from 'node:assert/strict';
import { nanoid, customAlphabet } from 'nanoid';

// 1. Default nanoid() returns a 21-character string
const defaultId = nanoid();
assert.equal(typeof defaultId, 'string');
assert.equal(defaultId.length, 21);
assert.match(defaultId, /^[A-Za-z0-9_-]{21}$/);

// 2. nanoid(size) generates string with the requested custom length
const customLengthId = nanoid(10);
assert.equal(typeof customLengthId, 'string');
assert.equal(customLengthId.length, 10);
assert.match(customLengthId, /^[A-Za-z0-9_-]{10}$/);

// 3. customAlphabet generates string restricted to specified alphabet
const customHex = customAlphabet('0123456789abcdef', 16);
const hexId = customHex();
assert.equal(typeof hexId, 'string');
assert.equal(hexId.length, 16);
assert.match(hexId, /^[0-9a-f]{16}$/);

// 4. Repeated generations produce distinct IDs
const idA = nanoid();
const idB = nanoid();
assert.notEqual(idA, idB);

console.log('Contract verification succeeded.');

오리진 시더

익명