CodeSampleX

Sample

is-glob 4.0.3

Verified sample for npm is-glob 4.0.3. The contract ran on node 22 · linux alpine/x64 · docker and passed: isGlob returns true for wildcard patterns…

sha256:19819cff979bee3199c7f5e9de3cf1868868bbdb32bb5799191a5cf981f4ee2b

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Verification-run environments

Environment Contract Stages Run
node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1
2026-08-20

Case

HOW
Goal
verify pkg:npm/is-glob@4.0.3
Packages
Environment
node 22.23.2
Created
2026-08-20T12:58:12Z

Contract

  1. isGlob returns true for wildcard patterns containing * and **
  2. isGlob returns true for character sets and brace expansion patterns
  3. isGlob returns true for extended glob patterns with prefix operators
  4. isGlob returns false for plain literal paths and non-glob strings
  5. isGlob with strict false detects lone glob characters in unclosed brackets, braces or question marks
  6. isGlob returns false for invalid non-string inputs and empty strings

Files

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

Download the source artifact (tar.gz)

Source

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/is-glob@4.0.3
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/is-glob@4.0.3
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - packageManager: npm@10.9.8
  - runtime: node@22.23.2

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:06817e48dc0299e5ee526826f03f541681f7143615b3327eefc81dc19767d477","constraints":{"executionContext":"node"},"contract":["isGlob returns true for wildcard patterns containing * and **","isGlob returns true for character sets and brace expansion patterns","isGlob returns true for extended glob patterns with prefix operators","isGlob returns false for plain literal paths and non-glob strings","isGlob with strict false detects lone glob characters in unclosed brackets, braces or question marks","isGlob returns false for invalid non-string inputs and empty strings"],"goal":"verify pkg:npm/is-glob@4.0.3","kind":"HOW","packages":["pkg:npm/is-glob@4.0.3"],"schemaVersion":1},"contractCommand":["node","test/contract.cjs"],"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/is-glob@4.0.3"],"schemaVersion":1,"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "is-glob-sample",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "is-glob-sample",
      "version": "1.0.0",
      "dependencies": {
        "is-glob": "4.0.3"
      }
    },
    "node_modules/is-extglob": {
      "version": "2.1.1",
      "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
      "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
      "license": "MIT",
      "engines": {
        "node": ">=0.10.0"
      }
    },
    "node_modules/is-glob": {
      "version": "4.0.3",
      "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
      "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
      "license": "MIT",
      "dependencies": {
        "is-extglob": "^2.1.1"
      },
      "engines": {
        "node": ">=0.10.0"
      }
    }
  }
}
package.json
{
  "name": "is-glob-sample",
  "version": "1.0.0",
  "description": "Minimal sample verifying is-glob",
  "main": "src/index.js",
  "scripts": {
    "test": "node test/contract.cjs"
  },
  "dependencies": {
    "is-glob": "4.0.3"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/is-glob@4.0.3",
  "kind": "HOW",
  "packages": [
    "pkg:npm/is-glob@4.0.3"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
src/index.js
const isGlob = require('is-glob');

/**
 * Checks whether the given input is a glob pattern.
 *
 * @param {any} pattern - Input value to test.
 * @param {object} [options] - Options passed to is-glob.
 * @returns {boolean} - True if pattern is a glob, false otherwise.
 */
function checkIsGlob(pattern, options) {
  return isGlob(pattern, options);
}

/**
 * Filters an array of string paths to only include glob patterns.
 *
 * @param {string[]} patterns - Array of patterns to filter.
 * @param {object} [options] - Options passed to is-glob.
 * @returns {string[]} - Filtered array of glob patterns.
 */
function filterGlobPatterns(patterns, options) {
  if (!Array.isArray(patterns)) {
    return [];
  }
  return patterns.filter((p) => isGlob(p, options));
}

/**
 * Checks whether the given string is a strictly valid glob pattern.
 *
 * @param {string} pattern - Input string.
 * @returns {boolean} - True if valid glob in strict mode.
 */
function isStrictGlob(pattern) {
  return isGlob(pattern, { strict: true });
}

/**
 * Checks whether the given string contains any glob characters loosely.
 *
 * @param {string} pattern - Input string.
 * @returns {boolean} - True if contains glob characters.
 */
function isLooseGlob(pattern) {
  return isGlob(pattern, { strict: false });
}

module.exports = {
  checkIsGlob,
  filterGlobPatterns,
  isStrictGlob,
  isLooseGlob,
  isGlob,
};
test/contract.cjs
const assert = require('node:assert/strict');
const isGlob = require('is-glob');
const {
  checkIsGlob,
  filterGlobPatterns,
  isStrictGlob,
  isLooseGlob,
} = require('../src/index.js');

async function main() {
  // Contract 1: isGlob returns true for wildcard patterns containing * and **
  {
    assert.strictEqual(isGlob('*.js'), true);
    assert.strictEqual(isGlob('src/**/*.ts'), true);
    assert.strictEqual(isGlob('!test.js'), true);
    assert.strictEqual(checkIsGlob('*.js'), true);
    assert.strictEqual(checkIsGlob('src/**/*.ts'), true);
  }

  // Contract 2: isGlob returns true for character sets and brace expansion patterns
  {
    assert.strictEqual(isGlob('file[0-9].txt'), true);
    assert.strictEqual(isGlob('file[abc].js'), true);
    assert.strictEqual(isGlob('src/{components,utils}/*.js'), true);
    assert.strictEqual(checkIsGlob('file[0-9].txt'), true);
    assert.strictEqual(checkIsGlob('src/{components,utils}/*.js'), true);
  }

  // Contract 3: isGlob returns true for extended glob patterns with prefix operators
  {
    assert.strictEqual(isGlob('src/@(foo|bar).js'), true);
    assert.strictEqual(isGlob('src/!(temp).js'), true);
    assert.strictEqual(isGlob('src/+(a|b).js'), true);
    assert.strictEqual(isGlob('src/*(a|b).js'), true);
    assert.strictEqual(isGlob('src/?(a|b).js'), true);
    assert.strictEqual(checkIsGlob('src/@(foo|bar).js'), true);
  }

  // Contract 4: isGlob returns false for plain literal paths and non-glob strings
  {
    assert.strictEqual(isGlob('index.js'), false);
    assert.strictEqual(isGlob('src/components/button.jsx'), false);
    assert.strictEqual(isGlob('a/b/c/d.txt'), false);
    assert.strictEqual(checkIsGlob('index.js'), false);
    assert.strictEqual(isStrictGlob('src/components/button.jsx'), false);

    const paths = ['index.js', '*.js', 'docs/readme.md', 'src/**/*.ts'];
    assert.deepStrictEqual(filterGlobPatterns(paths), ['*.js', 'src/**/*.ts']);
  }

  // Contract 5: isGlob with strict false detects lone glob characters in unclosed brackets, braces or question marks
  {
    assert.strictEqual(isGlob('abc[123', { strict: true }), false);
    assert.strictEqual(isGlob('abc[123', { strict: false }), true);
    assert.strictEqual(isGlob('abc{123', { strict: true }), false);
    assert.strictEqual(isGlob('abc{123', { strict: false }), true);
    assert.strictEqual(isGlob('file?.txt', { strict: true }), false);
    assert.strictEqual(isGlob('file?.txt', { strict: false }), true);
    assert.strictEqual(isLooseGlob('abc[123'), true);
    assert.strictEqual(isStrictGlob('abc[123'), false);
  }

  // Contract 6: isGlob returns false for invalid non-string inputs and empty strings
  {
    assert.strictEqual(isGlob(''), false);
    assert.strictEqual(isGlob(null), false);
    assert.strictEqual(isGlob(undefined), false);
    assert.strictEqual(isGlob(123), false);
    assert.strictEqual(isGlob({}), false);
    assert.strictEqual(isGlob([]), false);
    assert.strictEqual(checkIsGlob(''), false);
    assert.strictEqual(checkIsGlob(null), false);
  }

  console.log('All contracts verified successfully.');
}

main().catch((err) => {
  console.error(err);
  process.exit(1);
});

Origin Seeder

anonymous