サンプル
npm-run-path 4.0.1: default
検証済みサンプル — npm npm-run-path 4.0.1: default. node 22 · linux debian/x64 · docker で contract を実行し、成功しました: npmRunPath.default is a callable function identical…
sha256:2cf74171255d41f94d190e156e4a3c65f18085f1d788bbc58e4eb38f8e84ef1b
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
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-06 |
ケース
HOW- ゴール
- verify npm-run-path.default in pkg:npm/npm-run-path@4.0.1
- パッケージ
- シンボル
-
- npm-run-path.default
- 環境
- node 22.23.2
- 作成日
- 2026-09-06T16:03:15Z
コントラクト
- 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
ファイル
- PROMPT.md
- csx.json
- index.js
- 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 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.');
オリジンシーダー
匿名