Ejemplo
minimatch 5.1.9
Muestra verificada para npm minimatch 5.1.9. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: matchPath tests if a file path matches a…
sha256:518346c78ff1b82396f1f753ae310b741cc6c50c16dfb141a3bb24c49b2a88e6
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:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-21 |
Caso
HOW- Objetivo
- verify pkg:npm/minimatch@5.1.9
- Paquetes
- Entorno
- node 22.23.2
- Creado
- 2026-08-21T03:52:16Z
Contrato
- matchPath tests if a file path matches a glob pattern with optional flags
- filterPaths filters an array of file paths matching a glob pattern
- createMatcher instantiates a Minimatch object for reusable pattern matching
- compileRegex compiles a glob pattern into a regular expression using makeRe
- supports dotfile matching and case-insensitive options
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
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@5.1.9
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/minimatch@5.1.9
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:bd8c109474c50264fadc71fcb714a29e5eb3f6133c236153c8fa5b5950f3f749","constraints":{"executionContext":"node"},"contract":["matchPath tests if a file path matches a glob pattern with optional flags","filterPaths filters an array of file paths matching a glob pattern","createMatcher instantiates a Minimatch object for reusable pattern matching","compileRegex compiles a glob pattern into a regular expression using makeRe","supports dotfile matching and case-insensitive options"],"goal":"verify pkg:npm/minimatch@5.1.9","kind":"HOW","packages":["pkg:npm/minimatch@5.1.9"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"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@5.1.9"],"schemaVersion":1,"subject":"pkg:npm/minimatch@5.1.9","verifierAdapter":"node-typescript@1"}
{
"name": "sample-minimatch",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-minimatch",
"version": "1.0.0",
"dependencies": {
"minimatch": "5.1.9"
}
},
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"license": "MIT"
},
"node_modules/brace-expansion": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.4.tgz",
"integrity": "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg==",
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/minimatch": {
"version": "5.1.9",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz",
"integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==",
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=10"
}
}
}
}
{
"name": "sample-minimatch",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of minimatch",
"main": "src/index.js",
"dependencies": {
"minimatch": "5.1.9"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/minimatch@5.1.9",
"kind": "HOW",
"packages": [
"pkg:npm/minimatch@5.1.9"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const minimatch = require('minimatch');
/**
* Match a file path against a glob pattern.
* @param {string} path - File path to test
* @param {string} pattern - Glob pattern
* @param {object} [options] - Minimatch options
* @returns {boolean} True if matches
*/
function matchPath(path, pattern, options) {
return minimatch(path, pattern, options);
}
/**
* Filter an array of paths against a glob pattern.
* @param {string[]} paths - Array of file paths
* @param {string} pattern - Glob pattern
* @param {object} [options] - Minimatch options
* @returns {string[]} Filtered matching paths
*/
function filterPaths(paths, pattern, options) {
return minimatch.match(paths, pattern, options);
}
/**
* Create a reusable Minimatch instance for pattern matching.
* @param {string} pattern - Glob pattern
* @param {object} [options] - Minimatch options
* @returns {minimatch.Minimatch} Minimatch instance
*/
function createMatcher(pattern, options) {
return new minimatch.Minimatch(pattern, options);
}
/**
* Compile a glob pattern into a regular expression.
* @param {string} pattern - Glob pattern
* @param {object} [options] - Minimatch options
* @returns {RegExp|false} Compiled RegExp
*/
function compileRegex(pattern, options) {
return minimatch.makeRe(pattern, options);
}
module.exports = {
matchPath,
filterPaths,
createMatcher,
compileRegex,
minimatch
};
import assert from 'node:assert';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
matchPath,
filterPaths,
createMatcher,
compileRegex,
minimatch
} = require('../src/index.js');
// 1. Export verification
assert.strictEqual(typeof minimatch, 'function', 'minimatch should be exported as a function');
assert.strictEqual(typeof matchPath, 'function', 'matchPath should be a function');
assert.strictEqual(typeof filterPaths, 'function', 'filterPaths should be a function');
assert.strictEqual(typeof createMatcher, 'function', 'createMatcher should be a function');
assert.strictEqual(typeof compileRegex, 'function', 'compileRegex should be a function');
// 2. matchPath tests if a file path matches a glob pattern with optional flags
assert.strictEqual(matchPath('foo.js', '*.js'), true, 'foo.js should match *.js');
assert.strictEqual(matchPath('foo.txt', '*.js'), false, 'foo.txt should not match *.js');
assert.strictEqual(matchPath('src/nested/file.js', '**/*.js'), true, 'globstar should match nested files');
// 3. filterPaths filters an array of file paths matching a glob pattern
const fileList = ['index.js', 'styles.css', 'app.js', 'README.md'];
const jsFiles = filterPaths(fileList, '*.js');
assert.deepStrictEqual(jsFiles, ['index.js', 'app.js'], 'filterPaths should match only js files');
// 4. createMatcher instantiates a Minimatch object for reusable pattern matching
const matcher = createMatcher('src/**/*.ts');
assert.strictEqual(matcher.match('src/components/button.ts'), true, 'Minimatch instance match should be true');
assert.strictEqual(matcher.match('docs/readme.md'), false, 'Minimatch instance match should be false');
// 5. compileRegex compiles a glob pattern into a regular expression using makeRe
const regex = compileRegex('*.json');
assert.ok(regex instanceof RegExp, 'compileRegex should return a RegExp');
assert.strictEqual(regex.test('config.json'), true, 'compiled regex should match config.json');
assert.strictEqual(regex.test('config.yaml'), false, 'compiled regex should not match config.yaml');
// 6. Supports dotfile matching and case-insensitive options
assert.strictEqual(matchPath('.env', '*.env'), false, 'dotfiles should be excluded by default');
assert.strictEqual(matchPath('.env', '*.env', { dot: true }), true, 'dotfiles should match when dot is true');
assert.strictEqual(matchPath('FILE.JS', '*.js'), false, 'case matching should be strict by default');
assert.strictEqual(matchPath('FILE.JS', '*.js', { nocase: true }), true, 'nocase option should enable case insensitivity');
console.log('Contract tests passed successfully.');
Seeder de origen
anónimo