CodeSampleX

サンプル

brace-expansion 1.1.18

検証済みサンプル — npm brace-expansion 1.1.18. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: expand expands comma-separated alternatives within curly…

sha256:7e11632f28aaad5d54d87dd0f53d88224ed6ca0ffce7b25630082c21bdb71ea5

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
1
ビルドした署名鍵
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@1
2026-08-21

ケース

HOW
ゴール
verify pkg:npm/brace-expansion@1.1.18
パッケージ
作成日
2026-08-21T13:06:38Z

コントラクト

  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 to bound output results

ファイル

  • 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@1.1.18
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/brace-expansion@1.1.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:5defd26606bffb4591e35e89672fc9df65f8a79baad80349a8079ab7a792bc02","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 to bound output results"],"goal":"verify pkg:npm/brace-expansion@1.1.18","kind":"HOW","packages":["pkg:npm/brace-expansion@1.1.18"],"schemaVersion":1},"contractCommand":["node","test/contract.js"],"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/brace-expansion@1.1.18"],"schemaVersion":1,"subject":"pkg:npm/brace-expansion@1.1.18","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": "1.1.18"
      }
    },
    "node_modules/balanced-match": {
      "version": "1.0.2",
      "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
      "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
      "license": "MIT"
    },
    "node_modules/brace-expansion": {
      "version": "1.1.18",
      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.18.tgz",
      "integrity": "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw==",
      "license": "MIT",
      "dependencies": {
        "balanced-match": "^1.0.0",
        "concat-map": "0.0.1"
      }
    },
    "node_modules/concat-map": {
      "version": "0.0.1",
      "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
      "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
      "license": "MIT"
    }
  }
}
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": "1.1.18"
  },
  "license": "MIT-0"
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/brace-expansion@1.1.18",
  "kind": "HOW",
  "packages": [
    "pkg:npm/brace-expansion@1.1.18"
  ]
}
src/index.js
const expand = require('brace-expansion');

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

module.exports = {
  expandPattern,
  expand
};
test/contract.js
const assert = require('node:assert/strict');
const expand = 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 and maxLength options
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.');

オリジンシーダー

匿名