Пример
esquery 1.7.0
Проверенный пример — npm esquery 1.7.0. Контракт выполнен на node 22 · linux alpine/x64 · docker и пройден: query finds AST nodes matching a selector query…
sha256:9a6c7f3651a6544d102d2bec055a69021aafbc236df2a9ef74b0d4d4bfdd176b
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
MIT-0
Свидетельства выполнения
Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.
- Основа свидетельства
- Подписанный контракт пройден
- Квитанции проверки
- 1
- Ключи подписи, собравшие его
- 1
Заявленная среда
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm
Среды запусков проверки
| Окружение | Контракт | Этапы | Запуск |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-20 |
Кейс
HOW- Цель
- verify pkg:npm/esquery@1.7.0
- Пакеты
- Окружение
- node 22.23.2
- Создан
- 2026-08-20T22:59:37Z
Контракт
- query finds AST nodes matching a selector query string
- parse parses a selector string into an AST query selector object
- match finds AST nodes matching a pre-parsed selector object
- matches evaluates whether an individual AST node satisfies a selector object
Файлы
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Исходный код
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/esquery@1.7.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/esquery@1.7.0
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- 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:03ba3fe73a5730d26f710f794279958b5bc55c9f2e405de083c3f18506f201ac","constraints":{"executionContext":"node"},"contract":["query finds AST nodes matching a selector query string","parse parses a selector string into an AST query selector object","match finds AST nodes matching a pre-parsed selector object","matches evaluates whether an individual AST node satisfies a selector object"],"goal":"verify pkg:npm/esquery@1.7.0","kind":"HOW","packages":["pkg:npm/esquery@1.7.0"],"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","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/esquery@1.7.0"],"schemaVersion":1,"subject":"pkg:npm/esquery@1.7.0","verifierAdapter":"node-typescript@1"}
{
"name": "sample-esquery",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-esquery",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"esquery": "1.7.0"
}
},
"node_modules/esquery": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz",
"integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==",
"license": "BSD-3-Clause",
"dependencies": {
"estraverse": "^5.1.0"
},
"engines": {
"node": ">=0.10"
}
},
"node_modules/estraverse": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
"integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
"license": "BSD-2-Clause",
"engines": {
"node": ">=4.0"
}
}
}
}
{
"name": "sample-esquery",
"version": "1.0.0",
"type": "module",
"license": "MIT-0",
"dependencies": {
"esquery": "1.7.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/esquery@1.7.0",
"kind": "HOW",
"packages": [
"pkg:npm/esquery@1.7.0"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"runtime": "node@22.23.2"
}
}
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const esquery = require('esquery');
// Simple AST for:
// function greet(name) {
// let message = "hello";
// return message;
// }
const ast = {
type: 'Program',
body: [
{
type: 'FunctionDeclaration',
id: { type: 'Identifier', name: 'greet' },
params: [{ type: 'Identifier', name: 'name' }],
body: {
type: 'BlockStatement',
body: [
{
type: 'VariableDeclaration',
kind: 'let',
declarations: [
{
type: 'VariableDeclarator',
id: { type: 'Identifier', name: 'message' },
init: { type: 'Literal', value: 'hello', raw: '"hello"' }
}
]
},
{
type: 'ReturnStatement',
argument: { type: 'Identifier', name: 'message' }
}
]
}
}
]
};
// 1. query finds AST nodes matching a selector query string
const identifiers = esquery(ast, 'Identifier');
assert.equal(identifiers.length, 4);
assert.deepEqual(identifiers.map((node) => node.name), ['greet', 'name', 'message', 'message']);
const letDeclarations = esquery.query(ast, 'VariableDeclaration[kind="let"]');
assert.equal(letDeclarations.length, 1);
assert.equal(letDeclarations[0].kind, 'let');
// 2. parse parses a selector string into an AST query selector object
const selector = esquery.parse('FunctionDeclaration > BlockStatement');
assert.equal(typeof selector, 'object');
assert.equal(selector.type, 'child');
assert.equal(selector.left.type, 'identifier');
assert.equal(selector.left.value, 'FunctionDeclaration');
assert.equal(selector.right.type, 'identifier');
assert.equal(selector.right.value, 'BlockStatement');
// 3. match finds AST nodes matching a pre-parsed selector object
const matchedBlocks = esquery.match(ast, selector);
assert.equal(matchedBlocks.length, 1);
assert.equal(matchedBlocks[0].type, 'BlockStatement');
// 4. matches evaluates whether an individual AST node satisfies a selector object
const funcNode = ast.body[0];
const isFunction = esquery.matches(funcNode, esquery.parse('FunctionDeclaration'));
assert.equal(isFunction, true);
const isVariable = esquery.matches(funcNode, esquery.parse('VariableDeclaration'));
assert.equal(isVariable, false);
Исходный сидер
аноним