CodeSampleX

Beispiel

@isaacs/brace-expansion 5.0.1

Verifiziertes Beispiel für npm @isaacs/brace-expansion 5.0.1. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand.

sha256:f51dad786aecd7e18a9f30e9c49f2841b904bab8f58ba4cc4198e2fc6c7395df

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@1node:22-alpine@sha256:c610fcdfb1d5…
2026-08-28

Fall

HOW
Ziel
verify pkg:npm/%40isaacs/brace-expansion@5.0.1
Pakete
Erstellt
2026-08-28T07:11:21Z

Contract

  1. expand expands comma-separated lists within curly braces into string arrays
  2. expand expands numeric and alphabetical ranges including reverse and stepped sequences
  3. expand supports nested brace expressions and Cartesian product combinations
  4. expand handles zero-padded numeric sequences and custom max expansion limits
  5. expand returns empty array for empty inputs and exports EXPANSION_MAX constant

Dateien

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

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/%40isaacs/brace-expansion@5.0.1
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40isaacs/brace-expansion@5.0.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.
csx.json
{"case":{"caseId":"case:sha256:3552edaab03ba12ad3d0c9af2e8f482f42b14c23e8372c82266abb2e4275f7f5","contract":["expand expands comma-separated lists within curly braces into string arrays","expand expands numeric and alphabetical ranges including reverse and stepped sequences","expand supports nested brace expressions and Cartesian product combinations","expand handles zero-padded numeric sequences and custom max expansion limits","expand returns empty array for empty inputs and exports EXPANSION_MAX constant"],"goal":"verify pkg:npm/%40isaacs/brace-expansion@5.0.1","kind":"HOW","packages":["pkg:npm/%40isaacs/brace-expansion@5.0.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/%40isaacs/brace-expansion@5.0.1"],"schemaVersion":1,"subject":"pkg:npm/%40isaacs/brace-expansion@5.0.1","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": {
        "@isaacs/brace-expansion": "5.0.1"
      }
    },
    "node_modules/@isaacs/balanced-match": {
      "version": "4.0.1",
      "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz",
      "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==",
      "license": "MIT",
      "engines": {
        "node": "20 || >=22"
      }
    },
    "node_modules/@isaacs/brace-expansion": {
      "version": "5.0.1",
      "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.1.tgz",
      "integrity": "sha512-WMz71T1JS624nWj2n2fnYAuPovhv7EUhk69R6i9dsVyzxt5eM3bjwvgk9L+APE1TRscGysAVMANkB0jh0LQZrQ==",
      "license": "MIT",
      "dependencies": {
        "@isaacs/balanced-match": "^4.0.1"
      },
      "engines": {
        "node": "20 || >=22"
      }
    }
  }
}
package.json
{
  "name": "sample-brace-expansion",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification of @isaacs/brace-expansion",
  "main": "src/index.js",
  "license": "MIT-0",
  "dependencies": {
    "@isaacs/brace-expansion": "5.0.1"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40isaacs/brace-expansion@5.0.1",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40isaacs/brace-expansion@5.0.1"
  ]
}
src/index.js
const { expand, EXPANSION_MAX } = require('@isaacs/brace-expansion');

/**
 * Expand a brace pattern into an array of string combinations.
 * @param {string} pattern - The bash-style brace expansion pattern
 * @param {object} [options] - Optional settings (e.g. { max: number })
 * @returns {string[]} Array of expanded strings
 */
function expandBracePattern(pattern, options) {
  return expand(pattern, options);
}

/**
 * Return the default maximum expansion limit constant.
 * @returns {number} Default expansion maximum (100000)
 */
function getExpansionLimit() {
  return EXPANSION_MAX;
}

module.exports = {
  expand,
  EXPANSION_MAX,
  expandBracePattern,
  getExpansionLimit,
};
test/contract.mjs
import assert from 'node:assert';
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);
const {
  expand,
  EXPANSION_MAX,
  expandBracePattern,
  getExpansionLimit,
} = require('../src/index.js');

// 1. Export contract checks
assert.strictEqual(typeof expand, 'function', 'expand should be a function');
assert.strictEqual(typeof EXPANSION_MAX, 'number', 'EXPANSION_MAX should be a number');
assert.strictEqual(EXPANSION_MAX, 100000, 'EXPANSION_MAX should equal 100000');
assert.strictEqual(typeof expandBracePattern, 'function', 'expandBracePattern should be a function');
assert.strictEqual(typeof getExpansionLimit, 'function', 'getExpansionLimit should be a function');
assert.strictEqual(getExpansionLimit(), 100000, 'getExpansionLimit should return 100000');

// 2. Empty string returns empty array
assert.deepStrictEqual(expand(''), [], 'expand("") should return []');
assert.deepStrictEqual(expandBracePattern(''), [], 'expandBracePattern("") should return []');

// 3. Comma-separated list expansion
assert.deepStrictEqual(
  expand('file.{js,ts,mjs}'),
  ['file.js', 'file.ts', 'file.mjs'],
  'expand should expand comma-separated lists'
);
assert.deepStrictEqual(
  expandBracePattern('image.{png,jpeg,webp}'),
  ['image.png', 'image.jpeg', 'image.webp'],
  'expandBracePattern should expand comma-separated lists'
);

// 4. Numeric range expansion (forward, backward, step, padding)
assert.deepStrictEqual(
  expand('{1..4}'),
  ['1', '2', '3', '4'],
  'expand should expand ascending numeric range'
);
assert.deepStrictEqual(
  expand('{4..1}'),
  ['4', '3', '2', '1'],
  'expand should expand descending numeric range'
);
assert.deepStrictEqual(
  expand('{0..6..2}'),
  ['0', '2', '4', '6'],
  'expand should expand numeric range with step'
);
assert.deepStrictEqual(
  expand('{01..03}'),
  ['01', '02', '03'],
  'expand should preserve zero-padding in numeric range'
);

// 5. Alphabetic range expansion (forward, backward, step)
assert.deepStrictEqual(
  expand('{a..c}'),
  ['a', 'b', 'c'],
  'expand should expand ascending alphabetic range'
);
assert.deepStrictEqual(
  expand('{c..a}'),
  ['c', 'b', 'a'],
  'expand should expand descending alphabetic range'
);
assert.deepStrictEqual(
  expand('{a..e..2}'),
  ['a', 'c', 'e'],
  'expand should expand alphabetic range with step'
);

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

// 7. Escaping and max options limit
assert.deepStrictEqual(
  expand('a\\{b,c\\}d'),
  ['a{b,c}d'],
  'expand should handle escaped brace characters'
);
assert.deepStrictEqual(
  expand('{1..10}', { max: 3 }),
  ['1', '2', '3'],
  'expand should limit output items when max option is provided'
);

console.log('All contract tests passed.');

Ursprungs-Seeder

anonym