Beispiel
ignore 7.0.6
Verifiziertes Beispiel für npm ignore 7.0.6. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand: assert ignore() creates and returns an…
sha256:e1ba547797d265a302bc616ce053600d7ebe8c965f21a91e1d6e5ce920719f79
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
linux 24 · ubuntu · glibc 2.39 x64 npm
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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 |
Fall
HOW- Ziel
- verify pkg:npm/ignore@7.0.6
- Pakete
- Erstellt
- 2026-08-27T20:08:28Z
Contract
- assert ignore() creates and returns an Ignore instance with standard methods
- assert Ignore#add registers gitignore rules from strings, arrays, and objects with mark parameters
- assert Ignore#ignores returns true for ignored paths and false for non-ignored or negated paths
- assert Ignore#filter filters an array of paths and returns only unignored paths
- assert Ignore#createFilter returns a predicate function suitable for Array#filter matching Ignore#filter behavior
- assert Ignore#test returns an object with ignored and unignored boolean flags and matching rule details
- assert Ignore#checkIgnore returns rule match details including pattern and mark for git check-ignore emulation
- assert ignore with ignorecase option controls case sensitivity in rule matching
- assert ignore.isPathValid validates relative paths according to gitignore path conventions
Dateien
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
Quelltext
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/ignore@7.0.6
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/ignore@7.0.6
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:5fbe77fa0442ca0a85d07b5354880f264b4028b895d7de90f1048b10133ee8d3","contract":["assert ignore() creates and returns an Ignore instance with standard methods","assert Ignore#add registers gitignore rules from strings, arrays, and objects with mark parameters","assert Ignore#ignores returns true for ignored paths and false for non-ignored or negated paths","assert Ignore#filter filters an array of paths and returns only unignored paths","assert Ignore#createFilter returns a predicate function suitable for Array#filter matching Ignore#filter behavior","assert Ignore#test returns an object with ignored and unignored boolean flags and matching rule details","assert Ignore#checkIgnore returns rule match details including pattern and mark for git check-ignore emulation","assert ignore with ignorecase option controls case sensitivity in rule matching","assert ignore.isPathValid validates relative paths according to gitignore path conventions"],"goal":"verify pkg:npm/ignore@7.0.6","kind":"HOW","packages":["pkg:npm/ignore@7.0.6"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/ignore@7.0.6"],"schemaVersion":1,"subject":"pkg:npm/ignore@7.0.6","verifierAdapter":"node-typescript@1"}
{
"name": "sample-ignore",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-ignore",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"ignore": "7.0.6"
}
},
"node_modules/ignore": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.6.tgz",
"integrity": "sha512-BAg6QkE8W+TuQLrrw0Ugr7HegXduRuuj8/ti2kSOc+jz1dmx8/WNcjr6XGnq5YpDWxFwwaavqD0+jIUOKelTsw==",
"license": "MIT",
"engines": {
"node": ">= 4"
}
}
}
}
{
"name": "sample-ignore",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of pkg:npm/ignore@7.0.6",
"main": "src/index.js",
"license": "MIT-0",
"dependencies": {
"ignore": "7.0.6"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/ignore@7.0.6",
"kind": "HOW",
"packages": [
"pkg:npm/ignore@7.0.6"
]
}
'use strict';
const ignore = require('ignore');
/**
* Creates an Ignore manager instance initialized with the given patterns and options.
* @param {string|string[]|object|object[]} [patterns] - Pattern(s) or pattern object(s) with mark.
* @param {object} [options] - Options passed to ignore factory.
* @returns {import('ignore').Ignore} Ignore instance.
*/
function createIgnore(patterns, options) {
const ig = ignore(options);
if (patterns) {
ig.add(patterns);
}
return ig;
}
/**
* Filters an array of file path strings against gitignore patterns.
* @param {string[]} paths - File paths to filter.
* @param {string|string[]} patterns - Ignore rules.
* @param {object} [options] - Options passed to ignore factory.
* @returns {string[]} Unignored file paths.
*/
function filterIgnoredPaths(paths, patterns, options) {
const ig = createIgnore(patterns, options);
return ig.filter(paths);
}
/**
* Checks whether a single relative pathname is ignored.
* @param {string} pathname - Relative pathname to test.
* @param {string|string[]} patterns - Ignore rules.
* @param {object} [options] - Options passed to ignore factory.
* @returns {boolean} True if the path is ignored.
*/
function isPathIgnored(pathname, patterns, options) {
const ig = createIgnore(patterns, options);
return ig.ignores(pathname);
}
/**
* Tests a path against gitignore rules and returns match details.
* @param {string} pathname - Relative pathname to test.
* @param {string|string[]} patterns - Ignore rules.
* @param {object} [options] - Options passed to ignore factory.
* @returns {{ ignored: boolean, unignored: boolean, rule?: object }} Match result.
*/
function testPathIgnore(pathname, patterns, options) {
const ig = createIgnore(patterns, options);
return ig.test(pathname);
}
/**
* Debugs gitignore rules for a target path, emulating git check-ignore -v.
* @param {string} target - Path to check.
* @param {string|string[]|object|object[]} patterns - Ignore rules.
* @param {object} [options] - Options passed to ignore factory.
* @returns {{ ignored: boolean, unignored: boolean, rule?: object }} Match result with rule information.
*/
function checkPathIgnore(target, patterns, options) {
const ig = createIgnore(patterns, options);
return ig.checkIgnore(target);
}
module.exports = {
createIgnore,
filterIgnoredPaths,
isPathIgnored,
testPathIgnore,
checkPathIgnore,
ignore,
};
import assert from 'node:assert';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const ignore = require('ignore');
const {
createIgnore,
filterIgnoredPaths,
isPathIgnored,
testPathIgnore,
checkPathIgnore,
} = require('../src/index.js');
async function runContract() {
// 1. Factory and instance creation
const ig = ignore();
assert(ig && typeof ig.add === 'function', 'ignore() should return an Ignore instance with add');
assert(typeof ig.ignores === 'function', 'instance should have ignores method');
assert(typeof ig.filter === 'function', 'instance should have filter method');
assert(typeof ig.createFilter === 'function', 'instance should have createFilter method');
assert(typeof ig.test === 'function', 'instance should have test method');
assert(typeof ig.checkIgnore === 'function', 'instance should have checkIgnore method');
// 2. Ignore#add method chaining, strings, arrays, and pattern object with mark
const chainResult = ig
.add('*.tmp')
.add(['build/*', '!build/keep.json', 'temp/'])
.add({ pattern: 'logs/*.log', mark: 'rule-line-42' });
assert.strictEqual(chainResult, ig, 'Ignore#add should return the instance for method chaining');
// 3. Ignore#ignores method
assert.strictEqual(ig.ignores('cache.tmp'), true, 'Should ignore *.tmp files');
assert.strictEqual(ig.ignores('src/app.js'), false, 'Should not ignore unlisted files');
assert.strictEqual(ig.ignores('build/bundle.js'), true, 'Should ignore files inside build/*');
assert.strictEqual(ig.ignores('build/keep.json'), false, 'Should not ignore negated !build/keep.json');
assert.strictEqual(ig.ignores('temp/nested/file.txt'), true, 'Should ignore paths under temp/ directory');
assert.strictEqual(ig.ignores('logs/app.log'), true, 'Should ignore paths matching object pattern');
// 4. Ignore#filter method
const candidatePaths = [
'src/index.js',
'cache.tmp',
'build/bundle.js',
'build/keep.json',
'logs/app.log',
'docs/readme.md',
];
const filteredPaths = ig.filter(candidatePaths);
assert.deepStrictEqual(
filteredPaths,
['src/index.js', 'build/keep.json', 'docs/readme.md'],
'Ignore#filter should only keep unignored paths'
);
// 5. Ignore#createFilter method
const filterPredicate = ig.createFilter();
assert.strictEqual(typeof filterPredicate, 'function', 'Ignore#createFilter should return a predicate function');
const predicateFiltered = candidatePaths.filter(filterPredicate);
assert.deepStrictEqual(
predicateFiltered,
['src/index.js', 'build/keep.json', 'docs/readme.md'],
'Ignore#createFilter predicate should produce identical results to Ignore#filter'
);
// 6. Ignore#test method
const testIgnored = ig.test('cache.tmp');
assert.strictEqual(testIgnored.ignored, true, 'test() should report ignored=true');
assert.strictEqual(testIgnored.unignored, false, 'test() should report unignored=false');
const testNegated = ig.test('build/keep.json');
assert.strictEqual(testNegated.ignored, false, 'test() should report ignored=false for negated match');
assert.strictEqual(testNegated.unignored, true, 'test() should report unignored=true for negated match');
const testUnmatched = ig.test('src/index.js');
assert.strictEqual(testUnmatched.ignored, false, 'test() should report ignored=false for unmatched');
assert.strictEqual(testUnmatched.unignored, false, 'test() should report unignored=false for unmatched');
// 7. Ignore#checkIgnore method
const checkResult = ig.checkIgnore('logs/app.log');
assert.strictEqual(checkResult.ignored, true, 'checkIgnore should detect ignored target');
assert.ok(checkResult.rule, 'checkIgnore should include matched rule details');
assert.strictEqual(checkResult.rule.pattern, 'logs/*.log', 'rule.pattern should match registered pattern');
assert.strictEqual(checkResult.rule.mark, 'rule-line-42', 'rule.mark should match registered mark');
// 8. Options: ignorecase
const caseSensitive = ignore({ ignorecase: false }).add('*.LOG');
assert.strictEqual(caseSensitive.ignores('error.LOG'), true, 'case-sensitive should match exact case');
assert.strictEqual(caseSensitive.ignores('error.log'), false, 'case-sensitive should not match different case');
const caseInsensitive = ignore({ ignorecase: true }).add('*.LOG');
assert.strictEqual(caseInsensitive.ignores('error.log'), true, 'case-insensitive should match lowercase file');
// 9. static isPathValid method
assert.strictEqual(ignore.isPathValid('src/index.js'), true, 'isPathValid should accept relative path');
assert.strictEqual(ignore.isPathValid('file.txt'), true, 'isPathValid should accept top-level file');
assert.strictEqual(ignore.isPathValid('./file.txt'), false, 'isPathValid should reject ./ prefix');
assert.strictEqual(ignore.isPathValid('../file.txt'), false, 'isPathValid should reject ../ prefix');
assert.strictEqual(ignore.isPathValid('/file.txt'), false, 'isPathValid should reject absolute path');
assert.strictEqual(ignore.isPathValid(''), false, 'isPathValid should reject empty string');
assert.strictEqual(ignore.isPathValid('.'), false, 'isPathValid should reject dot');
// 10. Module wrapper functions verification
const helperIg = createIgnore(['*.bak', 'dist/*']);
assert.strictEqual(isPathIgnored('file.bak', ['*.bak']), true, 'isPathIgnored helper should check path');
assert.strictEqual(isPathIgnored('file.txt', ['*.bak']), false, 'isPathIgnored helper should check unignored path');
const helperFiltered = filterIgnoredPaths(['a.txt', 'b.bak', 'c.md'], ['*.bak']);
assert.deepStrictEqual(helperFiltered, ['a.txt', 'c.md'], 'filterIgnoredPaths helper should filter list');
const helperTest = testPathIgnore('b.bak', ['*.bak']);
assert.strictEqual(helperTest.ignored, true, 'testPathIgnore helper should return test result');
const helperCheck = checkPathIgnore('out.log', [{ pattern: '*.log', mark: 'log-rule' }]);
assert.strictEqual(helperCheck.ignored, true, 'checkPathIgnore helper should return rule details');
assert.strictEqual(helperCheck.rule.mark, 'log-rule', 'checkPathIgnore should preserve mark');
console.log('Contract tests passed successfully.');
}
runContract().catch((err) => {
console.error('Contract test failed:', err);
process.exit(1);
});
Ursprungs-Seeder
anonym