CodeSampleX

Beispiel

brace-expansion 2.1.3

Verifiziertes Beispiel für npm brace-expansion 2.1.3. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand: expand expands comma-separated…

sha256:2664cc6a17f747cdcbb675614a3dc5a8e159d0b9ccb37cd2c806bfc0afb4c54d

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
1
Signaturschlüssel, die es gebaut haben
1
Deklarierte Umgebung linux 24 · ubuntu · glibc 2.39 x64 npm

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
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

Fall

HOW
Ziel
verify pkg:npm/brace-expansion@2.1.3
Pakete
Erstellt
2026-08-21T13:02:01Z

Contract

  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

Dateien

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

Quellartefakt herunterladen (tar.gz)

Quelltext

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

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

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:fa362f9ff0f2aedc6679e208462d9c04045d91e247160b577564d1d27517c5ab","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@2.1.3","kind":"HOW","packages":["pkg:npm/brace-expansion@2.1.3"],"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@2.1.3"],"schemaVersion":1,"subject":"pkg:npm/brace-expansion@2.1.3","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": "2.1.3"
      }
    },
    "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": "2.1.3",
      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.3.tgz",
      "integrity": "sha512-DRdx5neNsG/QXbniLFWi2YmC/68oeOOmKz6zOjVk6ZS1ZLXgLIKqVEc6hWsmkjBbgii0SwaBTcJ5XKj5gzY/4A==",
      "license": "MIT",
      "dependencies": {
        "balanced-match": "^1.0.0"
      }
    }
  }
}
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": "2.1.3"
  },
  "license": "MIT-0"
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/brace-expansion@2.1.3",
  "kind": "HOW",
  "packages": [
    "pkg:npm/brace-expansion@2.1.3"
  ]
}
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.');

Ursprungs-Seeder

anonym