CodeSampleX

Пример

brace-expansion 5.0.8

Проверенный пример — npm brace-expansion 5.0.8. Контракт выполнен на node 22 · linux alpine/x64 · docker и пройден: expand expands comma-separated…

sha256:a6b124d45f196833fe8ac5931a3198b11e0dc91bddc7561cd86a7820bfce9ec3

Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла. Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди. 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@1
2026-08-21

Кейс

HOW
Цель
verify pkg:npm/brace-expansion@5.0.8
Пакеты
Окружение
node 22.23.2
Создан
2026-08-21T12:57:42Z

Контракт

  1. expand expands comma-separated alternatives within curly braces into string combinations
  2. expand expands numeric and alphabetic sequences with optional step increments
  3. expand expands nested brace patterns and computes Cartesian products for adjacent brace groups
  4. expand handles numeric sequences with zero-padding and reverse ordering
  5. expand returns an empty array for empty input and preserves literal text when no braces are matched
  6. expand supports max and maxLength options and exports EXPANSION_MAX and EXPANSION_MAX_LENGTH constants

Файлы

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.js
  • test/contract.js

Скачать артефакт с исходным кодом (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/brace-expansion@5.0.8
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/brace-expansion@5.0.8

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:91f6bf1b61748f05461b2e9c17e3b265f11268b4987e01b75dc82336fc38b6b7","contract":["expand expands comma-separated alternatives within curly braces into string combinations","expand expands numeric and alphabetic sequences with optional step increments","expand expands nested brace patterns and computes Cartesian products for adjacent brace groups","expand handles numeric sequences with zero-padding and reverse ordering","expand returns an empty array for empty input and preserves literal text when no braces are matched","expand supports max and maxLength options and exports EXPANSION_MAX and EXPANSION_MAX_LENGTH constants"],"goal":"verify pkg:npm/brace-expansion@5.0.8","kind":"HOW","packages":["pkg:npm/brace-expansion@5.0.8"],"schemaVersion":1},"contractCommand":["node","test/contract.js"],"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/brace-expansion@5.0.8"],"schemaVersion":1,"subject":"pkg:npm/brace-expansion@5.0.8","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-brace-expansion",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-brace-expansion",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "brace-expansion": "5.0.8"
      }
    },
    "node_modules/balanced-match": {
      "version": "4.0.4",
      "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",
      "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==",
      "license": "MIT",
      "engines": {
        "node": "18 || 20 || >=22"
      }
    },
    "node_modules/brace-expansion": {
      "version": "5.0.8",
      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.8.tgz",
      "integrity": "sha512-JZyDyq3D4AUifKTPOB7DELf6XsB3WdPuNxCtob1vFXPsSXhdAiHBWJ/tJ8HAc9aH84BK+5JFZLNkJKx3G9kzQg==",
      "license": "MIT",
      "dependencies": {
        "balanced-match": "^4.0.2"
      },
      "engines": {
        "node": "20 || >=22"
      }
    }
  }
}
package.json
{
  "name": "sample-brace-expansion",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification sample for brace-expansion",
  "main": "src/index.js",
  "scripts": {
    "test": "node test/contract.js"
  },
  "dependencies": {
    "brace-expansion": "5.0.8"
  },
  "license": "MIT-0"
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/brace-expansion@5.0.8",
  "kind": "HOW",
  "packages": [
    "pkg:npm/brace-expansion@5.0.8"
  ]
}
src/index.js
const { expand, EXPANSION_MAX, EXPANSION_MAX_LENGTH } = require('brace-expansion');

function expandPattern(pattern, options) {
  return expand(pattern, options);
}

module.exports = {
  expandPattern,
  expand,
  EXPANSION_MAX,
  EXPANSION_MAX_LENGTH
};
test/contract.js
const assert = require('node:assert/strict');
const { expand, EXPANSION_MAX, EXPANSION_MAX_LENGTH } = require('brace-expansion');
const { expandPattern } = require('../src/index.js');

// 1. Comma-separated alternatives within curly braces
assert.deepStrictEqual(expand('file.{js,ts}'), ['file.js', 'file.ts'], 'should expand comma alternatives');
assert.deepStrictEqual(expand('http://example.com/{foo,bar}'), ['http://example.com/foo', 'http://example.com/bar'], 'should expand URLs');
assert.deepStrictEqual(expandPattern('item-{a,b,c}'), ['item-a', 'item-b', 'item-c'], 'wrapper should expand comma alternatives');

// 2. Numeric and alphabetic sequences with optional step increments
assert.deepStrictEqual(expand('{1..3}'), ['1', '2', '3'], 'should expand ascending numeric sequence');
assert.deepStrictEqual(expand('{a..c}'), ['a', 'b', 'c'], 'should expand ascending alphabetic sequence');
assert.deepStrictEqual(expand('{1..5..2}'), ['1', '3', '5'], 'should expand numeric sequence with step increment');
assert.deepStrictEqual(expand('{a..e..2}'), ['a', 'c', 'e'], 'should expand alphabetic sequence with step increment');

// 3. Nested brace expressions and Cartesian products
assert.deepStrictEqual(expand('a{b,c{d,e}}f'), ['abf', 'acdf', 'acef'], 'should resolve nested brace expressions');
assert.deepStrictEqual(expand('{a,b}{1,2}'), ['a1', 'a2', 'b1', 'b2'], 'should compute Cartesian products of adjacent groups');

// 4. Zero-padding and reverse ordering
assert.deepStrictEqual(expand('{01..03}'), ['01', '02', '03'], 'should preserve zero-padding in numeric sequence');
assert.deepStrictEqual(expand('{3..1}'), ['3', '2', '1'], 'should expand descending numeric sequence');
assert.deepStrictEqual(expand('{c..a}'), ['c', 'b', 'a'], 'should expand descending alphabetic sequence');

// 5. Empty input and literal text without braces
assert.deepStrictEqual(expand(''), [], 'should return empty array for empty string');
assert.deepStrictEqual(expand('plain-text'), ['plain-text'], 'should preserve literal text without braces');

// 6. Max / maxLength options and exported constants
assert.strictEqual(EXPANSION_MAX, 100000, 'EXPANSION_MAX should be 100000');
assert.strictEqual(EXPANSION_MAX_LENGTH, 4000000, 'EXPANSION_MAX_LENGTH should be 4000000');
assert.deepStrictEqual(expand('{1..10}', { max: 3 }), ['1', '2', '3'], 'should respect max expansion option');
assert.deepStrictEqual(expand('{a,b,c}', { maxLength: 2 }), ['a', 'b'], 'should respect maxLength option');

console.log('Contract tests passed successfully.');

Исходный сидер

аноним