Ejemplo
minimatch 10.2.6
Muestra verificada para npm minimatch 10.2.6. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: new Minimatch(pattern, options) compiles…
sha256:8036f7dd653241c1a0c64af08c74731db815034b48cd25b88c4bc21cdb2b49d5
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 1
- Claves de firma que lo compilaron
- 1
Entorno declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-20 |
Caso
HOW- Objetivo
- verify pkg:npm/minimatch@10.2.6
- Paquetes
- Entorno
- node 22.23.2
- Creado
- 2026-08-20T07:58:50Z
Contrato
- new Minimatch(pattern, options) compiles a glob pattern into a reusable matcher instance with pattern and options properties
- Minimatch.prototype.match tests whether a file path matches the compiled glob pattern
- Minimatch.prototype.makeRe returns the compiled regular expression representing the glob pattern
- Minimatch instances correctly parse negate, comment, and empty pattern flags
- Minimatch.prototype.slashSplit splits path strings by forward slash ignoring redundant separators
- Minimatch.prototype.matchOne evaluates tokenized path segments against parsed pattern sets including GLOBSTAR symbols
Archivos
- PROMPT.md
- csx.json
- npm-shrinkwrap.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
Código fuente
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/minimatch@10.2.6
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/minimatch@10.2.6
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:a9194c71d10ac368949a64817f4f529e29620802eed88057f23476be135b1dc9","constraints":{"executionContext":"node"},"contract":["new Minimatch(pattern, options) compiles a glob pattern into a reusable matcher instance with pattern and options properties","Minimatch.prototype.match tests whether a file path matches the compiled glob pattern","Minimatch.prototype.makeRe returns the compiled regular expression representing the glob pattern","Minimatch instances correctly parse negate, comment, and empty pattern flags","Minimatch.prototype.slashSplit splits path strings by forward slash ignoring redundant separators","Minimatch.prototype.matchOne evaluates tokenized path segments against parsed pattern sets including GLOBSTAR symbols"],"goal":"verify pkg:npm/minimatch@10.2.6","kind":"HOW","packages":["pkg:npm/minimatch@10.2.6"],"schemaVersion":1},"contractCommand":["node","test/contract.js"],"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/minimatch@10.2.6"],"schemaVersion":1,"verifierAdapter":"node-typescript@1"}
{
"name": "minimatch-sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "minimatch-sample",
"version": "1.0.0",
"dependencies": {
"minimatch": "10.2.6"
}
},
"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.9",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz",
"integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==",
"license": "MIT",
"dependencies": {
"balanced-match": "^4.0.2"
},
"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"
}
}
}
}
{
"name": "minimatch-sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "minimatch-sample",
"version": "1.0.0",
"dependencies": {
"minimatch": "10.2.6"
}
},
"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.9",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz",
"integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==",
"license": "MIT",
"dependencies": {
"balanced-match": "^4.0.2"
},
"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"
}
}
}
}
{
"name": "minimatch-sample",
"version": "1.0.0",
"dependencies": {
"minimatch": "10.2.6"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/minimatch@10.2.6",
"kind": "HOW",
"packages": [
"pkg:npm/minimatch@10.2.6"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const { Minimatch, GLOBSTAR, sep } = require('minimatch');
/**
* Creates a new Minimatch instance.
*
* @param {string} pattern - Glob pattern.
* @param {object} [options] - Minimatch options.
* @returns {Minimatch} Compiled Minimatch instance.
*/
function createMatcher(pattern, options) {
return new Minimatch(pattern, options);
}
/**
* Matches a file path against a Minimatch instance.
*
* @param {Minimatch} matcher - Minimatch instance.
* @param {string} filePath - Path to test.
* @returns {boolean} True if matched, false otherwise.
*/
function matchWithMatcher(matcher, filePath) {
return matcher.match(filePath);
}
/**
* Compiles a Minimatch instance into a regular expression.
*
* @param {Minimatch} matcher - Minimatch instance.
* @returns {RegExp|false} Compiled RegExp instance.
*/
function getMatcherRegExp(matcher) {
return matcher.makeRe();
}
/**
* Inspects pattern flags (negate, comment, empty) for a given pattern.
*
* @param {string} pattern - Glob pattern.
* @param {object} [options] - Minimatch options.
* @returns {{negate: boolean, comment: boolean, empty: boolean}} Parsed flags.
*/
function getPatternFlags(pattern, options) {
const matcher = new Minimatch(pattern, options);
return {
negate: Boolean(matcher.negate),
comment: Boolean(matcher.comment),
empty: Boolean(matcher.empty),
};
}
/**
* Splits a path by slashes using Minimatch slashSplit utility.
*
* @param {string} path - Path to split.
* @returns {string[]} Array of path parts.
*/
function splitPathSegments(path) {
const matcher = new Minimatch('*');
return matcher.slashSplit(path);
}
/**
* Evaluates tokenized path parts against pattern parts with optional globstar matching.
*
* @param {string[]} fileParts - Tokenized file path segments.
* @param {(string|RegExp|symbol)[]} patternParts - Tokenized pattern segments.
* @returns {boolean} True if parts match, false otherwise.
*/
function matchPathParts(fileParts, patternParts) {
const matcher = new Minimatch('*');
return matcher.matchOne(fileParts, patternParts);
}
module.exports = {
createMatcher,
matchWithMatcher,
getMatcherRegExp,
getPatternFlags,
splitPathSegments,
matchPathParts,
GLOBSTAR,
sep,
};
const assert = require('node:assert/strict');
const {
createMatcher,
matchWithMatcher,
getMatcherRegExp,
getPatternFlags,
splitPathSegments,
matchPathParts,
GLOBSTAR,
} = require('../src/index.js');
// Contract 1: new Minimatch(pattern, options) compiles a glob pattern into a reusable matcher instance with pattern and options properties
{
const matcher = createMatcher('src/**/*.ts', { dot: true });
assert.strictEqual(matcher.pattern, 'src/**/*.ts');
assert.strictEqual(matcher.options.dot, true);
assert.ok(Array.isArray(matcher.set));
assert.ok(matcher.set.length > 0);
}
// Contract 2: Minimatch.prototype.match tests whether a file path matches the compiled glob pattern
{
const matcher = createMatcher('src/**/*.{js,jsx}');
assert.strictEqual(matchWithMatcher(matcher, 'src/components/Button.jsx'), true);
assert.strictEqual(matchWithMatcher(matcher, 'src/components/Button.tsx'), false);
assert.strictEqual(matchWithMatcher(matcher, 'test/index.js'), false);
}
// Contract 3: Minimatch.prototype.makeRe returns the compiled regular expression representing the glob pattern
{
const matcher = createMatcher('api/v[0-9]/*.json');
const regex = getMatcherRegExp(matcher);
assert.ok(regex instanceof RegExp);
assert.strictEqual(regex.test('api/v1/users.json'), true);
assert.strictEqual(regex.test('api/vA/users.json'), false);
}
// Contract 4: Minimatch instances correctly parse negate, comment, and empty pattern flags
{
const negFlags = getPatternFlags('!dist/**');
assert.strictEqual(negFlags.negate, true);
assert.strictEqual(negFlags.comment, false);
assert.strictEqual(negFlags.empty, false);
const commentFlags = getPatternFlags('# build artifacts');
assert.strictEqual(commentFlags.negate, false);
assert.strictEqual(commentFlags.comment, true);
assert.strictEqual(commentFlags.empty, false);
const emptyFlags = getPatternFlags('');
assert.strictEqual(emptyFlags.negate, false);
assert.strictEqual(emptyFlags.comment, false);
assert.strictEqual(emptyFlags.empty, true);
}
// Contract 5: Minimatch.prototype.slashSplit splits path strings by forward slash ignoring redundant separators
{
const segments = splitPathSegments('packages//core///src/index.ts');
assert.deepStrictEqual(segments, ['packages', 'core', 'src', 'index.ts']);
}
// Contract 6: Minimatch.prototype.matchOne evaluates tokenized path segments against parsed pattern sets including GLOBSTAR symbols
{
const fileParts = ['packages', 'core', 'src', 'index.ts'];
const patternParts = ['packages', GLOBSTAR, 'index.ts'];
assert.strictEqual(matchPathParts(fileParts, patternParts), true);
const nonMatchingParts = ['packages', 'docs', 'readme.md'];
assert.strictEqual(matchPathParts(nonMatchingParts, patternParts), false);
}
Seeder de origen
anónimo