Exemplo
glob-parent 6.0.2: glob-parent
Amostra verificada para npm glob-parent 6.0.2: glob-parent. O contrato rodou em node 22 · linux alpine/x64 · docker e passou: assert globParent extracts…
sha256:2e155b669d62e9c4e81e10850bbe6a816557a065a75cd1237b66c481db28fa7d
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-27 |
Caso
HOW- Objetivo
- verify glob-parent in pkg:npm/glob-parent@6.0.2
- Pacotes
- Símbolos
-
- glob-parent
- Ambiente
- node 22.23.2
- Criado
- 2026-08-27T09:58:20Z
Contrato
- assert globParent extracts parent directory from single wildcard pattern
- assert globParent extracts base path from recursive glob pattern
- assert globParent extracts parent directory before brace sets
- assert globParent extracts parent path from extglob patterns
- assert globParent returns enclosing directory for static file path and current directory for root pattern
- assert globParent preserves backslash escape when flipBackslashes is false
Arquivos
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Código-fonte
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-parent in pkg:npm/glob-parent@6.0.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/glob-parent@6.0.2
Demonstrate these symbols/APIs:
- glob-parent
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: esm
- 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:711c5b3bca92fa8918a1fc8fce96e56f121050e5efb06b3de1c531a192c0a1fe","constraints":{"executionContext":"node"},"contract":["assert globParent extracts parent directory from single wildcard pattern","assert globParent extracts base path from recursive glob pattern","assert globParent extracts parent directory before brace sets","assert globParent extracts parent path from extglob patterns","assert globParent returns enclosing directory for static file path and current directory for root pattern","assert globParent preserves backslash escape when flipBackslashes is false"],"goal":"verify glob-parent in pkg:npm/glob-parent@6.0.2","kind":"HOW","packages":["pkg:npm/glob-parent@6.0.2"],"schemaVersion":1,"symbols":["glob-parent"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","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-parent@6.0.2"],"schemaVersion":1,"subject":"pkg:npm/glob-parent@6.0.2","symbols":["glob-parent"],"verifierAdapter":"node-typescript@1"}
import globParent from 'glob-parent';
/**
* Extracts the non-glob parent path from a glob pattern.
*
* @param {string} pattern - Glob pattern string.
* @param {Object} [options] - Options object (e.g. { flipBackslashes: boolean }).
* @returns {string} Non-glob parent directory path.
*/
export function getGlobParent(pattern, options) {
return globParent(pattern, options);
}
export { globParent };
export default globParent;
{
"name": "sample-glob-parent",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-glob-parent",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"glob-parent": "6.0.2"
}
},
"node_modules/glob-parent": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
"integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
"license": "ISC",
"dependencies": {
"is-glob": "^4.0.3"
},
"engines": {
"node": ">=10.13.0"
}
},
"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"
}
}
}
}
{
"name": "sample-glob-parent",
"version": "1.0.0",
"description": "Clean-room sample verifying pkg:npm/glob-parent@6.0.2 functionality",
"type": "module",
"main": "index.js",
"license": "MIT-0",
"dependencies": {
"glob-parent": "6.0.2"
}
}
{
"schemaVersion": 1,
"goal": "verify glob-parent in pkg:npm/glob-parent@6.0.2",
"kind": "HOW",
"packages": [
"pkg:npm/glob-parent@6.0.2"
],
"symbols": [
"glob-parent"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "esm",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import assert from 'node:assert';
import globParent, { getGlobParent } from '../index.js';
// 1. Simple wildcard patterns
assert.strictEqual(
globParent('path/to/*.js'),
'path/to',
'globParent must extract parent directory from single wildcard pattern'
);
assert.strictEqual(
getGlobParent('nested/dir/file?.txt'),
'nested/dir',
'getGlobParent must extract parent directory from single-character wildcard pattern'
);
// 2. Recursive glob patterns
assert.strictEqual(
globParent('src/**/*.ts'),
'src',
'globParent must extract base path from recursive glob pattern'
);
assert.strictEqual(
getGlobParent('app/deep/**/components/*.jsx'),
'app/deep',
'getGlobParent must extract parent path from nested recursive glob'
);
// 3. Brace expansion patterns
assert.strictEqual(
globParent('src/{components,utils}/*.ts'),
'src',
'globParent must extract parent directory before brace sets'
);
assert.strictEqual(
getGlobParent('app/styles/{main,vendor}.css'),
'app/styles',
'getGlobParent must extract parent directory for brace file alternatives'
);
// 4. Extended glob (extglob) patterns
assert.strictEqual(
globParent('lib/@(feature1|feature2)/*.js'),
'lib',
'globParent must extract parent path from @() extglob pattern'
);
assert.strictEqual(
globParent('lib/+(feature1|feature2)/*.js'),
'lib',
'globParent must extract parent path from +() extglob pattern'
);
assert.strictEqual(
globParent('lib/!(feature1|feature2)/*.js'),
'lib',
'globParent must extract parent path from !() extglob pattern'
);
assert.strictEqual(
globParent('lib/?(feature1|feature2)/*.js'),
'lib',
'globParent must extract parent path from ?() extglob pattern'
);
// 5. Static file paths and root-level patterns
assert.strictEqual(
globParent('path/to/file.txt'),
'path/to',
'globParent must return enclosing directory for non-glob file path'
);
assert.strictEqual(
globParent('*.js'),
'.',
'globParent must return current directory for top-level wildcard'
);
assert.strictEqual(
globParent('file.txt'),
'.',
'globParent must return current directory for root-level static file'
);
// 6. Options support (flipBackslashes)
assert.strictEqual(
globParent('foo/bar\\*.js', { flipBackslashes: false }),
'foo',
'globParent must preserve backslash escape when flipBackslashes is false'
);
assert.strictEqual(
globParent('foo/bar/\\[a-z\\].js', { flipBackslashes: false }),
'foo/bar',
'globParent must recognize escaped character class as non-glob when flipBackslashes is false'
);
console.log('All contract assertions passed.');
Seeder de origem
anônimo