Exemple
@eslint/plugin-kit 0.4.1: CallMethodStep
Échantillon vérifié pour npm @eslint/plugin-kit 0.4.1: CallMethodStep. Le contrat s'est exécuté sur node 22 · linux debian/x64 · docker et a réussi.
sha256:7a70f66a5cae1fed33a094f3e0dc684edfd35df1f720dbed462d87e18ddcde39
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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-09-06 |
Cas
HOW- Objectif
- verify @eslint/plugin-kit.CallMethodStep in pkg:npm/%40eslint/plugin-kit@0.4.1
- Paquets
- Symboles
-
- @eslint/plugin-kit.CallMethodStep
- Environnement
- node 22.23.2
- Créé
- 2026-09-06T10:04:10Z
Contrat
- CallMethodStep constructor sets type property to 'call'
- CallMethodStep constructor sets numeric kind property to 2
- CallMethodStep constructor assigns target method name and args array from options
- CallMethodStep preserves custom arguments array passed in options
- createCallMethodStep helper constructs CallMethodStep instance with target and arguments
- notifyRuleMethod helper constructs CallMethodStep for rule lifecycle events
Fichiers
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Code 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 @eslint/plugin-kit.CallMethodStep in pkg:npm/%40eslint/plugin-kit@0.4.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40eslint/plugin-kit@0.4.1
Demonstrate these symbols/APIs:
- @eslint/plugin-kit.CallMethodStep
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:265d408a9259987a7f76e2768fde455a1bac80e91d090d9877255ace5f57bc37","constraints":{"executionContext":"node"},"contract":["CallMethodStep constructor sets type property to 'call'","CallMethodStep constructor sets numeric kind property to 2","CallMethodStep constructor assigns target method name and args array from options","CallMethodStep preserves custom arguments array passed in options","createCallMethodStep helper constructs CallMethodStep instance with target and arguments","notifyRuleMethod helper constructs CallMethodStep for rule lifecycle events"],"goal":"verify @eslint/plugin-kit.CallMethodStep in pkg:npm/%40eslint/plugin-kit@0.4.1","kind":"HOW","packages":["pkg:npm/%40eslint/plugin-kit@0.4.1"],"schemaVersion":1,"symbols":["@eslint/plugin-kit.CallMethodStep"]},"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/%40eslint/plugin-kit@0.4.1"],"schemaVersion":1,"subject":"pkg:npm/%40eslint/plugin-kit@0.4.1","symbols":["@eslint/plugin-kit.CallMethodStep"],"verifierAdapter":"node-typescript@1"}
const { CallMethodStep } = require('@eslint/plugin-kit');
/**
* Creates a CallMethodStep instance for AST or code-path traversal.
*
* @param {string} target - The name of the method to call.
* @param {Array<any>} args - The arguments to pass to the method.
* @returns {CallMethodStep} Traversal step instance.
*/
function createCallMethodStep(target, args) {
return new CallMethodStep({ target, args });
}
/**
* Creates a CallMethodStep for notifying rules of a lifecycle event.
*
* @param {string} eventName - The lifecycle method name (e.g., 'onCodePathStart').
* @param {Array<any>} eventArgs - Arguments for the lifecycle event.
* @returns {CallMethodStep} Traversal step instance.
*/
function notifyRuleMethod(eventName, eventArgs) {
return new CallMethodStep({
target: eventName,
args: eventArgs,
});
}
module.exports = {
CallMethodStep,
createCallMethodStep,
notifyRuleMethod,
};
{
"name": "sample-eslint-plugin-kit",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-eslint-plugin-kit",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@eslint/plugin-kit": "0.4.1"
}
},
"node_modules/@eslint/core": {
"version": "0.17.0",
"resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz",
"integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==",
"license": "Apache-2.0",
"dependencies": {
"@types/json-schema": "^7.0.15"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
"node_modules/@eslint/plugin-kit": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz",
"integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==",
"license": "Apache-2.0",
"dependencies": {
"@eslint/core": "^0.17.0",
"levn": "^0.4.1"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
"node_modules/@types/json-schema": {
"version": "7.0.15",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
"integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
"license": "MIT"
},
"node_modules/levn": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
"integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
"license": "MIT",
"dependencies": {
"prelude-ls": "^1.2.1",
"type-check": "~0.4.0"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
"integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
"license": "MIT",
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
"integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==",
"license": "MIT",
"dependencies": {
"prelude-ls": "^1.2.1"
},
"engines": {
"node": ">= 0.8.0"
}
}
}
}
{
"name": "sample-eslint-plugin-kit",
"version": "1.0.0",
"description": "Clean-room sample verifying @eslint/plugin-kit CallMethodStep",
"main": "index.js",
"license": "MIT-0",
"dependencies": {
"@eslint/plugin-kit": "0.4.1"
}
}
{
"schemaVersion": 1,
"goal": "verify @eslint/plugin-kit.CallMethodStep in pkg:npm/%40eslint/plugin-kit@0.4.1",
"kind": "HOW",
"packages": [
"pkg:npm/%40eslint/plugin-kit@0.4.1"
],
"symbols": [
"@eslint/plugin-kit.CallMethodStep"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import assert from 'node:assert';
import {
CallMethodStep,
createCallMethodStep,
notifyRuleMethod,
} from '../index.js';
// 1. Verify CallMethodStep constructor sets type property to 'call'
const step1 = new CallMethodStep({
target: 'onCodePathStart',
args: ['codePath_1', { type: 'Program' }],
});
assert.strictEqual(step1.type, 'call');
// 2. Verify CallMethodStep constructor sets numeric kind property to 2
assert.strictEqual(step1.kind, 2);
// 3. Verify CallMethodStep constructor assigns target and args from options
assert.strictEqual(step1.target, 'onCodePathStart');
assert.deepStrictEqual(step1.args, ['codePath_1', { type: 'Program' }]);
// 4. Verify CallMethodStep preserves custom arguments array passed in options
const customArgs = [{ ruleId: 'example-rule' }, true, 123];
const stepCustom = new CallMethodStep({
target: 'onCodePathEnd',
args: customArgs,
});
assert.strictEqual(stepCustom.target, 'onCodePathEnd');
assert.strictEqual(stepCustom.args, customArgs);
assert.strictEqual(stepCustom.type, 'call');
assert.strictEqual(stepCustom.kind, 2);
// 5. Verify createCallMethodStep helper constructs CallMethodStep instance
const step2 = createCallMethodStep('onCodePathStep', ['step_1']);
assert.ok(step2 instanceof CallMethodStep);
assert.strictEqual(step2.type, 'call');
assert.strictEqual(step2.kind, 2);
assert.strictEqual(step2.target, 'onCodePathStep');
assert.deepStrictEqual(step2.args, ['step_1']);
// 6. Verify notifyRuleMethod helper constructs CallMethodStep for lifecycle events
const step3 = notifyRuleMethod('onCodePathSegmentStart', ['segment_1']);
assert.ok(step3 instanceof CallMethodStep);
assert.strictEqual(step3.type, 'call');
assert.strictEqual(step3.kind, 2);
assert.strictEqual(step3.target, 'onCodePathSegmentStart');
assert.deepStrictEqual(step3.args, ['segment_1']);
console.log('CallMethodStep contract assertions passed successfully.');
Seeder d'origine
anonyme