Exemple
npm-run-path 4.0.1: default
Échantillon vérifié pour npm npm-run-path 4.0.1: default. Le contrat s'est exécuté sur node 22 · linux debian/x64 · docker et a réussi.
sha256:2cf74171255d41f94d190e156e4a3c65f18085f1d788bbc58e4eb38f8e84ef1b
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 npm-run-path.default in pkg:npm/npm-run-path@4.0.1
- Paquets
- Symboles
-
- npm-run-path.default
- Environnement
- node 22.23.2
- Créé
- 2026-09-06T16:03:15Z
Contrat
- npmRunPath.default is a callable function identical to the main export
- npmRunPath.default returns a string containing local node_modules/.bin directories
- npmRunPath.default with custom cwd and path prepends parent node_modules/.bin directories to custom path
- npmRunPath.default.env returns copy of environment with augmented PATH key
- npmRunPath.default.env with custom env object augments custom PATH without mutating original input
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 npm-run-path.default in pkg:npm/npm-run-path@4.0.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/npm-run-path@4.0.1
Demonstrate these symbols/APIs:
- npm-run-path.default
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:735f5769c3f05563b12b2299b72e7a68c2e153010792da68c857d7ed7470a12f","constraints":{"executionContext":"node"},"contract":["npmRunPath.default is a callable function identical to the main export","npmRunPath.default returns a string containing local node_modules/.bin directories","npmRunPath.default with custom cwd and path prepends parent node_modules/.bin directories to custom path","npmRunPath.default.env returns copy of environment with augmented PATH key","npmRunPath.default.env with custom env object augments custom PATH without mutating original input"],"goal":"verify npm-run-path.default in pkg:npm/npm-run-path@4.0.1","kind":"HOW","packages":["pkg:npm/npm-run-path@4.0.1"],"schemaVersion":1,"symbols":["npm-run-path.default"]},"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/npm-run-path@4.0.1"],"schemaVersion":1,"subject":"pkg:npm/npm-run-path@4.0.1","symbols":["npm-run-path.default"],"verifierAdapter":"node-typescript@1"}
const npmRunPath = require('npm-run-path');
function getAugmentedPathWithDefault(options) {
return npmRunPath.default(options);
}
function getAugmentedEnvWithDefault(options) {
return npmRunPath.default.env(options);
}
module.exports = {
npmRunPath,
getAugmentedPathWithDefault,
getAugmentedEnvWithDefault,
};
{
"name": "sample-npm-run-path-default",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-npm-run-path-default",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"npm-run-path": "4.0.1"
}
},
"node_modules/npm-run-path": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
"integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
"license": "MIT",
"dependencies": {
"path-key": "^3.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/path-key": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
"license": "MIT",
"engines": {
"node": ">=8"
}
}
}
}
{
"name": "sample-npm-run-path-default",
"version": "1.0.0",
"description": "Verify npm-run-path default export and default.env in pkg:npm/npm-run-path@4.0.1",
"main": "index.js",
"license": "MIT-0",
"dependencies": {
"npm-run-path": "4.0.1"
}
}
{
"schemaVersion": 1,
"goal": "verify npm-run-path.default in pkg:npm/npm-run-path@4.0.1",
"kind": "HOW",
"packages": [
"pkg:npm/npm-run-path@4.0.1"
],
"symbols": [
"npm-run-path.default"
],
"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 path from 'node:path';
import npmRunPath from 'npm-run-path';
import {
getAugmentedPathWithDefault,
getAugmentedEnvWithDefault,
} from '../index.js';
// 1. npmRunPath.default is a callable function identical to the main export
assert.strictEqual(typeof npmRunPath, 'function', 'npmRunPath must be a function');
assert.strictEqual(typeof npmRunPath.default, 'function', 'npmRunPath.default must be a function');
assert.strictEqual(npmRunPath.default, npmRunPath, 'npmRunPath.default must refer to the same function for CJS/ESM interop');
// 2. npmRunPath.default returns a string containing local node_modules/.bin directories
const defaultPath = npmRunPath.default();
assert.strictEqual(typeof defaultPath, 'string', 'default npmRunPath.default() must return a string');
assert(defaultPath.includes('node_modules' + path.sep + '.bin'), 'default path must contain node_modules/.bin');
const helperPath = getAugmentedPathWithDefault();
assert.strictEqual(typeof helperPath, 'string', 'helper path must return a string');
assert(helperPath.includes('node_modules' + path.sep + '.bin'), 'helper path must contain node_modules/.bin');
// 3. npmRunPath.default with custom cwd and path prepends parent node_modules/.bin directories to custom path
const fakeCwd = path.resolve('fake-project', 'sub-dir');
const fakeExecPath = path.resolve('fake-bin', 'node');
const customPath = npmRunPath.default({
cwd: fakeCwd,
path: 'fake-custom-bin',
execPath: fakeExecPath,
});
const pathParts = customPath.split(path.delimiter);
assert(pathParts.includes(path.join(fakeCwd, 'node_modules/.bin')), 'must include cwd node_modules/.bin');
assert(pathParts.includes(path.join(path.dirname(fakeCwd), 'node_modules/.bin')), 'must include parent node_modules/.bin');
assert(pathParts.includes('fake-custom-bin'), 'must retain custom input path');
assert(pathParts.includes(path.dirname(fakeExecPath)), 'must include dirname of custom execPath');
// 4. npmRunPath.default.env returns copy of environment with augmented PATH key
const envResult = npmRunPath.default.env();
assert.strictEqual(typeof envResult, 'object', 'npmRunPath.default.env() must return an object');
assert('PATH' in envResult || 'Path' in envResult, 'augmented environment must have a PATH key');
const helperEnv = getAugmentedEnvWithDefault();
assert.strictEqual(typeof helperEnv, 'object', 'helperEnv must return an object');
assert('PATH' in helperEnv || 'Path' in helperEnv, 'helperEnv must have a PATH key');
// 5. npmRunPath.default.env with custom env object augments custom PATH without mutating original input
const originalEnv = {
PATH: 'fake-base-bin',
CUSTOM_VAR: 'csx_test_value',
};
const customEnvCwd = path.resolve('fake-test-app');
const augmentedEnv = npmRunPath.default.env({
env: originalEnv,
cwd: customEnvCwd,
execPath: fakeExecPath,
});
assert.strictEqual(originalEnv.PATH, 'fake-base-bin', 'original env object must not be mutated');
assert.strictEqual(augmentedEnv.CUSTOM_VAR, 'csx_test_value', 'custom environment variables must be preserved');
assert(augmentedEnv.PATH.includes(path.join(customEnvCwd, 'node_modules/.bin')), 'augmented PATH must include node_modules/.bin');
assert(augmentedEnv.PATH.includes('fake-base-bin'), 'augmented PATH must include original base path');
console.log('Contract tests passed successfully.');
Seeder d'origine
anonyme