Sample
glob 13.0.7: escape
Verified sample for npm glob 13.0.7: escape. The contract ran on node 22 · linux debian/x64 · docker and passed: CommonJS require('glob') exposes glob.escape…
sha256:420355085c7e201f800ce2577f8bc62b1bc7e2900edaeaa83710ddeb7850e8ec
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-22 |
Case
HOW- Goal
- verify glob.escape in pkg:npm/glob@13.0.7
- Packages
- Symbols
-
- glob.escape
- Environment
- node 22.23.2
- Created
- 2026-11-22T17:39:05Z
Contract
- CommonJS require('glob') exposes glob.escape as a function identical to the named escape export
- glob.escape(s) with default options backslash-escapes ?, *, (, ), [, ], and \ while leaving {, }, !, @, and + unescaped
- glob.escape(s, { windowsPathsNoEscape: true }) escapes ?, *, (, ), [, ] by wrapping each in [...] and leaves \ unescaped as a path separator
- glob.escape(s, { magicalBraces: true }) additionally escapes { and } using backslashes by default or [{] and [}] when combined with windowsPathsNoEscape: true
- glob.unescape round-trips outputs of glob.escape when passed matching options
- Passing glob.escape(literalName) to glob.sync matches only the exact literal filename containing glob metacharacters and excludes non-literal decoy files
Files
- PROMPT.md
- csx.json
- index.cjs
- package-lock.json
- package.json
- spec.json
- test/contract.cjs
Source
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.escape 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.escape
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.
{"case":{"caseId":"case:sha256:ed136775cbde1a29d992667fae6375d0575c18bdfe6cacd7226ea1e5303d5fce","constraints":{"executionContext":"node"},"contract":["CommonJS require('glob') exposes glob.escape as a function identical to the named escape export","glob.escape(s) with default options backslash-escapes ?, *, (, ), [, ], and \\ while leaving {, }, !, @, and + unescaped","glob.escape(s, { windowsPathsNoEscape: true }) escapes ?, *, (, ), [, ] by wrapping each in [...] and leaves \\ unescaped as a path separator","glob.escape(s, { magicalBraces: true }) additionally escapes { and } using backslashes by default or [{] and [}] when combined with windowsPathsNoEscape: true","glob.unescape round-trips outputs of glob.escape when passed matching options","Passing glob.escape(literalName) to glob.sync matches only the exact literal filename containing glob metacharacters and excludes non-literal decoy files"],"goal":"verify glob.escape in pkg:npm/glob@13.0.7","kind":"HOW","packages":["pkg:npm/glob@13.0.7"],"schemaVersion":1,"symbols":["glob.escape"]},"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.escape"],"verifierAdapter":"node-typescript@1"}
'use strict';
const { glob, globSync } = require('glob');
/**
* Build a literal glob pattern for an exact filename or path using glob.escape.
*
* @param {string} literalPath
* @param {{ windowsPathsNoEscape?: boolean, magicalBraces?: boolean }} [options]
* @returns {string}
*/
function escapeLiteralPattern(literalPath, options) {
return glob.escape(literalPath, options);
}
/**
* Match an exact literal filename inside a directory without wildcard expansion.
*
* @param {string} literalName
* @param {string} cwd
* @returns {string[]}
*/
function findExactFile(literalName, cwd) {
const escaped = glob.escape(literalName);
return globSync(escaped, { cwd });
}
module.exports = {
escapeLiteralPattern,
findExactFile,
};
{
"name": "glob-escape-sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "glob-escape-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"
}
}
}
}
{
"name": "glob-escape-sample",
"version": "1.0.0",
"private": true,
"description": "Minimal sample verifying glob.escape in glob@13.0.7",
"scripts": {
"test": "node test/contract.cjs"
},
"dependencies": {
"glob": "13.0.7"
}
}
{
"schemaVersion": 1,
"goal": "verify glob.escape in pkg:npm/glob@13.0.7",
"kind": "HOW",
"packages": [
"pkg:npm/glob@13.0.7"
],
"symbols": [
"glob.escape"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
'use strict';
const assert = require('node:assert/strict');
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
const { glob, escape } = require('glob');
const { escapeLiteralPattern, findExactFile } = require('../index.cjs');
// 1. Export identity: glob.escape is exposed on the glob namespace and equals named export escape
assert.equal(typeof glob.escape, 'function');
assert.equal(glob.escape, escape);
// 2. Default mode escapes ? * ( ) [ ] \ with backslashes, leaving braces { } and ! @ + unescaped
const rawDefault = 'dir\\file[1]*(a)?{b}!@+.txt';
const escapedDefault = escapeLiteralPattern(rawDefault);
assert.equal(escapedDefault, 'dir\\\\file\\[1\\]\\*\\(a\\)\\?{b}!@+.txt');
assert.equal(glob.unescape(escapedDefault), rawDefault);
// 3. windowsPathsNoEscape wraps ? * ( ) [ ] in character classes and preserves backslashes
const rawWin = 'sub\\file[1]*(a)?.txt';
const escapedWin = escapeLiteralPattern(rawWin, { windowsPathsNoEscape: true });
assert.equal(escapedWin, 'sub\\file[[]1[]][*][(]a[)][?].txt');
assert.equal(glob.unescape(escapedWin, { windowsPathsNoEscape: true }), rawWin);
// 4. magicalBraces additionally escapes { and } in both default and windowsPathsNoEscape modes
const rawBraces = 'set{a,b}[0]*';
const escapedBracesDefault = escapeLiteralPattern(rawBraces, { magicalBraces: true });
assert.equal(escapedBracesDefault, 'set\\{a,b\\}\\[0\\]\\*');
assert.equal(glob.unescape(escapedBracesDefault, { magicalBraces: true }), rawBraces);
const escapedBracesWin = escapeLiteralPattern(rawBraces, {
windowsPathsNoEscape: true,
magicalBraces: true,
});
assert.equal(escapedBracesWin, 'set[{]a,b[}][[]0[]][*]');
assert.equal(
glob.unescape(escapedBracesWin, {
windowsPathsNoEscape: true,
magicalBraces: true,
}),
rawBraces,
);
// 5. Offline filesystem verification: escaped pattern matches only the literal filename
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'glob-escape-contract-'));
try {
const literalFile = 'item[1]*(x)?.txt';
const decoyA = 'item1(x)a.txt';
const decoyB = 'item1.txt';
fs.writeFileSync(path.join(tmpDir, literalFile), 'literal\n', 'utf8');
fs.writeFileSync(path.join(tmpDir, decoyA), 'decoy-a\n', 'utf8');
fs.writeFileSync(path.join(tmpDir, decoyB), 'decoy-b\n', 'utf8');
const unescapedMatches = glob.sync(literalFile, { cwd: tmpDir });
assert.ok(
!unescapedMatches.includes(literalFile),
'unescaped pattern should not match the literal bracketed filename',
);
const escapedMatches = findExactFile(literalFile, tmpDir);
assert.deepEqual(escapedMatches, [literalFile]);
} finally {
fs.rmSync(tmpDir, { recursive: true, force: true });
}
console.log('PASS: glob.escape contract verified');
Origin Seeder
anonymous