CodeSampleX

Sample

glob 13.0.7: globSync

Verified sample for npm glob 13.0.7: globSync. The contract ran on node 22 · linux debian/x64 · docker and passed: require('glob').globSync is a function and…

sha256:c96402dd92b8a10a8faa95bf2219fa0e1f4be8ca8fb8dced1305aa540d549be8

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 debian/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2…
2026-11-23

Case

HOW
Goal
verify glob.globSync in pkg:npm/glob@13.0.7
Packages
Symbols
  • glob.globSync
Environment
node 22.23.2
Created
2026-11-23T15:02:31Z

Contract

  1. require('glob').globSync is a function and equals require('glob').glob.globSync in CommonJS
  2. glob.globSync('**/*.js', { cwd, posix: true }) returns matching relative string paths and excludes dotfiles by default
  3. glob.globSync(['**/*.js', '**/*.json'], { cwd, ignore: ['excluded/**'], posix: true }) accepts an array of patterns and excludes ignored subtrees
  4. glob.globSync('**/*.js', { cwd, dot: true, ignore: ['excluded/**'], posix: true }) includes dotfiles and files under dot-directories
  5. glob.globSync('**/*', { cwd, nodir: true }) returns only files, while mark: true appends a trailing '/' to matched directories
  6. glob.globSync('*', { cwd, withFileTypes: true }) returns Path objects implementing isFile(), isDirectory(), name, and relative()
  7. glob.globSync('*.js', { cwd: fileURL, absolute: true }) accepts a file:// URL for cwd and returns absolute filesystem paths
  8. glob.globSync throws synchronously for conflicting options: { withFileTypes: true, absolute: true } throws Error ('cannot set absolute and withFileTypes') and { noglobstar: true, matchBase: true } throws TypeError ('base matching requires globstar')

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 glob.globSync in pkg:npm/glob@13.0.7
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/glob@13.0.7
Demonstrate these symbols/APIs:
  - glob.globSync
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:bd9d61cbe55b6c3552b26b6da44732a6eb544964768eaed12897d270a640eac0","constraints":{"executionContext":"node"},"contract":["require('glob').globSync is a function and equals require('glob').glob.globSync in CommonJS","glob.globSync('**/*.js', { cwd, posix: true }) returns matching relative string paths and excludes dotfiles by default","glob.globSync(['**/*.js', '**/*.json'], { cwd, ignore: ['excluded/**'], posix: true }) accepts an array of patterns and excludes ignored subtrees","glob.globSync('**/*.js', { cwd, dot: true, ignore: ['excluded/**'], posix: true }) includes dotfiles and files under dot-directories","glob.globSync('**/*', { cwd, nodir: true }) returns only files, while mark: true appends a trailing '/' to matched directories","glob.globSync('*', { cwd, withFileTypes: true }) returns Path objects implementing isFile(), isDirectory(), name, and relative()","glob.globSync('*.js', { cwd: fileURL, absolute: true }) accepts a file:// URL for cwd and returns absolute filesystem paths","glob.globSync throws synchronously for conflicting options: { withFileTypes: true, absolute: true } throws Error ('cannot set absolute and withFileTypes') and { noglobstar: true, matchBase: true } throws TypeError ('base matching requires globstar')"],"goal":"verify glob.globSync in pkg:npm/glob@13.0.7","kind":"HOW","packages":["pkg:npm/glob@13.0.7"],"schemaVersion":1,"symbols":["glob.globSync"]},"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/glob@13.0.7"],"schemaVersion":1,"subject":"pkg:npm/glob@13.0.7","symbols":["glob.globSync"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "glob-sync-sample",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "glob-sync-sample",
      "version": "1.0.0",
      "dependencies": {
        "glob": "13.0.7"
      }
    },
    "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.13",
      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.13.tgz",
      "integrity": "sha512-Vh3dmFbc4wZeox7M9I/0L9GfFd83Su4+yCck/OF9Gi/P/dAHn0RT7X4K9R7gMNMhDck3DvhR6QXsnQdjjgwNvQ==",
      "license": "MIT",
      "dependencies": {
        "balanced-match": "^4.0.2"
      },
      "engines": {
        "node": "20 || >=22"
      }
    },
    "node_modules/glob": {
      "version": "13.0.7",
      "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.7.tgz",
      "integrity": "sha512-wfsFgXQ8A3SEI9XGf7Nl3Y9l7ffSrGh7SUCT7vU/2CzYPep9kjxAn1S40F9OPKxAMGCVl7HtNlJhrCJUeUq83g==",
      "license": "BlueOak-1.0.0",
      "dependencies": {
        "minimatch": "^10.2.2",
        "minipass": "^7.1.3",
        "path-scurry": "^2.0.2"
      },
      "engines": {
        "node": "18 || 20 || >=22"
      },
      "funding": {
        "url": "https://github.com/sponsors/isaacs"
      }
    },
    "node_modules/lru-cache": {
      "version": "11.5.3",
      "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz",
      "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==",
      "license": "BlueOak-1.0.0",
      "engines": {
        "node": "20 || >=22"
      }
    },
    "node_modules/minimatch": {
      "version": "10.2.6",
      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz",
      "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==",
      "license": "BlueOak-1.0.0",
      "dependencies": {
        "brace-expansion": "^5.0.8"
      },
      "engines": {
        "node": "18 || 20 || >=22"
      },
      "funding": {
        "url": "https://github.com/sponsors/isaacs"
      }
    },
    "node_modules/minipass": {
      "version": "7.1.3",
      "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz",
      "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==",
      "license": "BlueOak-1.0.0",
      "engines": {
        "node": ">=16 || 14 >=14.17"
      }
    },
    "node_modules/path-scurry": {
      "version": "2.0.2",
      "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz",
      "integrity": "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==",
      "license": "BlueOak-1.0.0",
      "dependencies": {
        "lru-cache": "^11.0.0",
        "minipass": "^7.1.2"
      },
      "engines": {
        "node": "18 || 20 || >=22"
      },
      "funding": {
        "url": "https://github.com/sponsors/isaacs"
      }
    }
  }
}
package.json
{
  "name": "glob-sync-sample",
  "version": "1.0.0",
  "private": true,
  "main": "src/index.js",
  "scripts": {
    "test": "node test/contract.cjs"
  },
  "dependencies": {
    "glob": "13.0.7"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify glob.globSync in pkg:npm/glob@13.0.7",
  "kind": "HOW",
  "packages": [
    "pkg:npm/glob@13.0.7"
  ],
  "symbols": [
    "glob.globSync"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
src/index.js
'use strict';

const glob = require('glob');

function listFilesSync(pattern, options = {}) {
  return glob.globSync(pattern, options);
}

function listEntriesWithTypesSync(pattern, options = {}) {
  return glob.globSync(pattern, { ...options, withFileTypes: true });
}

module.exports = {
  listFilesSync,
  listEntriesWithTypesSync,
};
test/contract.cjs
'use strict';

const assert = require('node:assert/strict');
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
const { pathToFileURL } = require('node:url');
const glob = require('glob');
const { listFilesSync, listEntriesWithTypesSync } = require('../src/index.js');

function createFixtureTree() {
  const root = fs.mkdtempSync(path.join(os.tmpdir(), 'glob-sync-contract-'));
  const files = [
    'alpha.js',
    'nested/beta.js',
    'nested/data.json',
    '.dotfile.js',
    '.hidden/gamma.js',
    'excluded/skip.js',
  ];
  for (const rel of files) {
    const full = path.join(root, rel);
    fs.mkdirSync(path.dirname(full), { recursive: true });
    fs.writeFileSync(full, `// ${rel}\n`, 'utf8');
  }
  return root;
}

function sorted(list) {
  return [...list].sort();
}

const fixtureDir = createFixtureTree();

try {
  // 1. Verify CJS export shape for glob.globSync
  assert.equal(typeof glob.globSync, 'function');
  assert.equal(glob.glob.globSync, glob.globSync);

  // 2. Single string pattern with default options (relative paths, dotfiles excluded)
  const jsFiles = sorted(listFilesSync('**/*.js', { cwd: fixtureDir, posix: true }));
  assert.deepEqual(jsFiles, ['alpha.js', 'excluded/skip.js', 'nested/beta.js']);

  // 3. Array of patterns with ignore option
  const combined = sorted(
    listFilesSync(['**/*.js', '**/*.json'], {
      cwd: fixtureDir,
      ignore: ['excluded/**'],
      posix: true,
    })
  );
  assert.deepEqual(combined, ['alpha.js', 'nested/beta.js', 'nested/data.json']);

  // 4. dot: true includes dotfiles and dot-directories
  const withDots = sorted(
    listFilesSync('**/*.js', {
      cwd: fixtureDir,
      dot: true,
      ignore: ['excluded/**'],
      posix: true,
    })
  );
  assert.deepEqual(withDots, ['.dotfile.js', '.hidden/gamma.js', 'alpha.js', 'nested/beta.js']);

  // 5. nodir: true omits directories; mark: true appends '/' to directories
  const onlyFiles = sorted(
    listFilesSync('**/*', {
      cwd: fixtureDir,
      nodir: true,
      ignore: ['excluded/**'],
      posix: true,
    })
  );
  assert.deepEqual(onlyFiles, ['alpha.js', 'nested/beta.js', 'nested/data.json']);

  const topMarked = sorted(listFilesSync('*', { cwd: fixtureDir, mark: true, posix: true }));
  assert.deepEqual(topMarked, ['alpha.js', 'excluded/', 'nested/']);

  // 6. withFileTypes: true returns Path objects with isFile/isDirectory/name/relative
  const entries = listEntriesWithTypesSync('*', { cwd: fixtureDir });
  assert.equal(entries.length, 3);
  const byName = new Map(entries.map((entry) => [entry.name, entry]));
  assert.equal(byName.get('alpha.js').isFile(), true);
  assert.equal(byName.get('alpha.js').isDirectory(), false);
  assert.equal(byName.get('nested').isDirectory(), true);
  assert.equal(byName.get('nested').relative(), 'nested');

  // 7. cwd accepts a file:// URL and absolute: true returns absolute paths
  const absMatches = sorted(
    glob.globSync('*.js', {
      cwd: pathToFileURL(fixtureDir),
      absolute: true,
    })
  );
  assert.deepEqual(absMatches, [path.join(fixtureDir, 'alpha.js')]);

  // 8. Conflicting option combinations throw synchronously
  assert.throws(
    () => glob.globSync('*.js', { cwd: fixtureDir, withFileTypes: true, absolute: true }),
    /cannot set absolute and withFileTypes/i
  );
  assert.throws(
    () => glob.globSync('*.js', { cwd: fixtureDir, noglobstar: true, matchBase: true }),
    { name: 'TypeError', message: /base matching requires globstar/ }
  );

  console.log('glob.globSync contract passed');
} finally {
  fs.rmSync(fixtureDir, { recursive: true, force: true });
}

Origin Seeder

anonymous