Exemple
@eslint/plugin-kit 0.7.3: VisitNodeStep
Échantillon vérifié pour npm @eslint/plugin-kit 0.7.3: VisitNodeStep. Le contrat s'est exécuté sur node 22 · linux debian/x64 · docker et a réussi.
sha256:2f2d9698ee1b890f45ab1239792a6c77d2ebeb0a14bf09962eda9959ee9f6bbf
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é
linux 24 · ubuntu · glibc 2.39 x64 npm
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-05 |
Cas
HOW- Objectif
- verify VisitNodeStep in pkg:npm/%40eslint/plugin-kit@0.7.3
- Paquets
- Symboles
-
- VisitNodeStep
- Créé
- 2026-09-05T16:43:02Z
Contrat
- instantiates VisitNodeStep with target AST node, traversal phase, and arguments array
- exposes readonly type property set to 'visit' and numeric kind property set to 1
- preserves target node, phase indicator, and argument array references
- differentiates enter and exit traversal phases with phase values 1 and 2
- dispatches enter and exit visitor handler calls based on target node type and step phase
Fichiers
- PROMPT.md
- csx.json
- 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 VisitNodeStep in pkg:npm/%40eslint/plugin-kit@0.7.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40eslint/plugin-kit@0.7.3
Demonstrate these symbols/APIs:
- VisitNodeStep
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:d8e10980fa40ecf8fb5ba1ae26b3395af659e12a990e6e4500a4f35a75e435b3","contract":["instantiates VisitNodeStep with target AST node, traversal phase, and arguments array","exposes readonly type property set to 'visit' and numeric kind property set to 1","preserves target node, phase indicator, and argument array references","differentiates enter and exit traversal phases with phase values 1 and 2","dispatches enter and exit visitor handler calls based on target node type and step phase"],"goal":"verify VisitNodeStep in pkg:npm/%40eslint/plugin-kit@0.7.3","kind":"HOW","packages":["pkg:npm/%40eslint/plugin-kit@0.7.3"],"schemaVersion":1,"symbols":["VisitNodeStep"]},"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/%40eslint/plugin-kit@0.7.3"],"schemaVersion":1,"subject":"pkg:npm/%40eslint/plugin-kit@0.7.3","symbols":["VisitNodeStep"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-eslint-plugin-kit-visit-node-step",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-eslint-plugin-kit-visit-node-step",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@eslint/plugin-kit": "0.7.3"
}
},
"node_modules/@eslint/core": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz",
"integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==",
"license": "Apache-2.0",
"dependencies": {
"@types/json-schema": "^7.0.15"
},
"engines": {
"node": "^20.19.0 || ^22.13.0 || >=24"
}
},
"node_modules/@eslint/plugin-kit": {
"version": "0.7.3",
"resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.3.tgz",
"integrity": "sha512-IkO+/KEUvwbVpiURZg+P7zF74z5Jxe0UgJxVni+RtoHQ6IZieXaO02kmadomap/q+l6bc/jdPGGqTjhuZnuz1Q==",
"license": "Apache-2.0",
"dependencies": {
"@eslint/core": "^1.2.1",
"levn": "^0.4.1"
},
"engines": {
"node": "^20.19.0 || ^22.13.0 || >=24"
}
},
"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-visit-node-step",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"@eslint/plugin-kit": "0.7.3"
}
}
{
"schemaVersion": 1,
"goal": "verify VisitNodeStep in pkg:npm/%40eslint/plugin-kit@0.7.3",
"kind": "HOW",
"packages": [
"pkg:npm/%40eslint/plugin-kit@0.7.3"
],
"symbols": [
"VisitNodeStep"
]
}
import assert from "node:assert/strict";
import { VisitNodeStep } from "@eslint/plugin-kit";
// 1. instantiates VisitNodeStep with target AST node, traversal phase, and arguments array
const mockParent = { type: "Program", body: [] };
const mockNode = { type: "Identifier", name: "foo" };
const stepEnter = new VisitNodeStep({
target: mockNode,
phase: 1,
args: [mockNode, mockParent],
});
assert.ok(stepEnter instanceof VisitNodeStep, "stepEnter must be an instance of VisitNodeStep");
// 2. exposes readonly type property set to 'visit' and numeric kind property set to 1
assert.equal(stepEnter.type, "visit", "stepEnter.type must be 'visit'");
assert.equal(stepEnter.kind, 1, "stepEnter.kind must be numeric 1");
// 3. preserves target node, phase indicator, and argument array references
assert.equal(stepEnter.target, mockNode, "stepEnter.target must match target node reference");
assert.equal(stepEnter.phase, 1, "stepEnter.phase must be 1");
assert.equal(stepEnter.args.length, 2, "stepEnter.args length must be 2");
assert.equal(stepEnter.args[0], mockNode, "stepEnter.args[0] must match mockNode");
assert.equal(stepEnter.args[1], mockParent, "stepEnter.args[1] must match mockParent");
const stepEmptyArgs = new VisitNodeStep({
target: mockNode,
phase: 2,
args: [],
});
assert.equal(stepEmptyArgs.phase, 2);
assert.deepEqual(stepEmptyArgs.args, []);
// 4. differentiates enter and exit traversal phases with phase values 1 and 2
const stepExit = new VisitNodeStep({
target: mockNode,
phase: 2,
args: [mockNode, mockParent],
});
assert.equal(stepEnter.phase, 1, "phase 1 represents enter phase");
assert.equal(stepExit.phase, 2, "phase 2 represents exit phase");
assert.notEqual(stepEnter.phase, stepExit.phase, "enter and exit phases must differ");
// 5. dispatches enter and exit visitor handler calls based on target node type and step phase
const visited = [];
const ruleVisitor = {
Identifier(...args) {
visited.push({ hook: "Identifier:enter", args });
},
"Identifier:exit"(...args) {
visited.push({ hook: "Identifier:exit", args });
},
};
const steps = [
new VisitNodeStep({ target: mockNode, phase: 1, args: [mockNode, mockParent] }),
new VisitNodeStep({ target: mockNode, phase: 2, args: [mockNode, mockParent] }),
];
for (const step of steps) {
assert.equal(step.type, "visit");
assert.equal(step.kind, 1);
const hookName = step.phase === 1 ? step.target.type : `${step.target.type}:exit`;
if (typeof ruleVisitor[hookName] === "function") {
ruleVisitor[hookName](...step.args);
}
}
assert.equal(visited.length, 2, "visitor should have received 2 dispatches");
assert.deepEqual(visited[0], {
hook: "Identifier:enter",
args: [mockNode, mockParent],
});
assert.deepEqual(visited[1], {
hook: "Identifier:exit",
args: [mockNode, mockParent],
});
console.log("VisitNodeStep contract tests passed successfully.");
Seeder d'origine
anonyme