Пример
shebang-regex 3.0.0: source
Проверенный пример — npm shebang-regex 3.0.0: source. Контракт выполнен на node 22 · linux debian/x64 · docker и пройден: shebang-regex.source is a string…
sha256:9973bcbbb33eff70ce4ae47c2a018430d5184b4503e0c1aa88d020e5802f3ada
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
MIT-0
Свидетельства выполнения
Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.
- Основа свидетельства
- Подписанный контракт пройден
- Квитанции проверки
- 1
- Ключи подписи, собравшие его
- 1
Заявленная среда
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Среды запусков проверки
| Окружение | Контракт | Этапы | Запуск |
|---|---|---|---|
| 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 |
Кейс
HOW- Цель
- verify shebang-regex.source in pkg:npm/shebang-regex@3.0.0
- Пакеты
- Символы
-
- shebang-regex.source
- Окружение
- node 22.23.2
- Создан
- 2026-09-05T16:01:06Z
Контракт
- shebang-regex.source is a string returning the raw regular expression pattern
- shebang-regex.source starts with ^#! to anchor matching at the beginning of the line
- shebang-regex.source contains a capturing group (.*) to extract the interpreter path
- shebang-regex.source does not include enclosing slashes or regex flags
- shebang-regex.source can be used to construct a new equivalent RegExp instance
- shebang-regex.source constructed RegExp correctly matches shebang strings and rejects non-shebang strings
Файлы
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- 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 shebang-regex.source in pkg:npm/shebang-regex@3.0.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/shebang-regex@3.0.0
Demonstrate these symbols/APIs:
- shebang-regex.source
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:3e8941a37e1ad2e2d17bbd561ae318ff788a768b3ab3ac8258a0cdcf61d60972","constraints":{"executionContext":"node"},"contract":["shebang-regex.source is a string returning the raw regular expression pattern","shebang-regex.source starts with ^#! to anchor matching at the beginning of the line","shebang-regex.source contains a capturing group (.*) to extract the interpreter path","shebang-regex.source does not include enclosing slashes or regex flags","shebang-regex.source can be used to construct a new equivalent RegExp instance","shebang-regex.source constructed RegExp correctly matches shebang strings and rejects non-shebang strings"],"goal":"verify shebang-regex.source in pkg:npm/shebang-regex@3.0.0","kind":"HOW","packages":["pkg:npm/shebang-regex@3.0.0"],"schemaVersion":1,"symbols":["shebang-regex.source"]},"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/shebang-regex@3.0.0"],"schemaVersion":1,"subject":"pkg:npm/shebang-regex@3.0.0","symbols":["shebang-regex.source"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-shebang-regex",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-shebang-regex",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"shebang-regex": "3.0.0"
}
},
"node_modules/shebang-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
"license": "MIT",
"engines": {
"node": ">=8"
}
}
}
}
{
"name": "sample-shebang-regex",
"version": "1.0.0",
"private": true,
"description": "Clean-room code sample for shebang-regex source",
"main": "src/index.js",
"license": "MIT-0",
"dependencies": {
"shebang-regex": "3.0.0"
}
}
{
"schemaVersion": 1,
"goal": "verify shebang-regex.source in pkg:npm/shebang-regex@3.0.0",
"kind": "HOW",
"packages": [
"pkg:npm/shebang-regex@3.0.0"
],
"symbols": [
"shebang-regex.source"
]
}
'use strict';
const shebangRegex = require('shebang-regex');
module.exports = shebangRegex;
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const shebangRegex = require('../src/index.js');
// 1. shebang-regex.source is a string returning the raw regular expression pattern
assert.equal(typeof shebangRegex.source, 'string', 'shebangRegex.source should be a string');
assert.equal(shebangRegex.source, '^#!(.*)', 'shebangRegex.source should equal ^#!(.*)');
// 2. shebang-regex.source starts with ^#! to anchor matching at the beginning of the line
assert.equal(shebangRegex.source.startsWith('^#!'), true, 'shebangRegex.source should start with ^#!');
// 3. shebang-regex.source contains a capturing group (.*) to extract the interpreter path
assert.equal(shebangRegex.source.includes('(.*)'), true, 'shebangRegex.source should contain capturing group (.*)');
// 4. shebang-regex.source does not include enclosing slashes or regex flags
assert.equal(shebangRegex.source.startsWith('/'), false, 'shebangRegex.source should not start with a slash');
assert.equal(shebangRegex.source.endsWith('/'), false, 'shebangRegex.source should not end with a slash');
// 5. shebang-regex.source can be used to construct a new equivalent RegExp instance
const reconstructed = new RegExp(shebangRegex.source);
assert.equal(reconstructed instanceof RegExp, true, 'new RegExp(shebangRegex.source) should create a RegExp instance');
assert.equal(reconstructed.source, shebangRegex.source, 'reconstructed RegExp should have identical source pattern');
// 6. shebang-regex.source constructed RegExp correctly matches shebang strings and rejects non-shebang strings
const match = reconstructed.exec('#!/usr/bin/env node');
assert.notEqual(match, null, 'reconstructed RegExp should match valid shebang line');
assert.equal(match[0], '#!/usr/bin/env node', 'reconstructed RegExp match[0] should be full shebang');
assert.equal(match[1], '/usr/bin/env node', 'reconstructed RegExp match[1] should be captured interpreter');
assert.equal(reconstructed.test('console.log("hello");'), false, 'reconstructed RegExp should reject non-shebang line');
assert.equal(reconstructed.test(''), false, 'reconstructed RegExp should reject empty string');
console.log('Contract tests passed successfully.');
Исходный сидер
аноним