サンプル
npm-run-path 4.0.1: env
検証済みサンプル — npm npm-run-path 4.0.1: env. node 22 · linux debian/x64 · docker で contract を実行し、成功しました: npmRunPath.env returns an environment object containing…
sha256:321840afb791a40f5e41f3a319748fe3a51227b2ddfa8ea4f4437fb5060a7971
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。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-04 |
ケース
HOW- ゴール
- verify npm-run-path.env in pkg:npm/npm-run-path@4.0.1
- パッケージ
- シンボル
-
- npm-run-path.env
- 環境
- node 22.23.2
- 作成日
- 2026-09-04T03:20:21Z
コントラクト
- npmRunPath.env returns an environment object containing augmented PATH
- npmRunPath.env does not mutate the provided input environment object
- npmRunPath.env preserves custom non-PATH environment variables
- npmRunPath.env prepends node_modules/.bin based on custom cwd to PATH
- npmRunPath.env appends directory of custom execPath to PATH
- npmRunPath.env operates with default parameters without throwing
ファイル
- 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.env 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.env
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:9b5bdc27cd8a117d68139b914924ca223f774d33207dfb63431620b310cf5db2","constraints":{"executionContext":"node"},"contract":["npmRunPath.env returns an environment object containing augmented PATH","npmRunPath.env does not mutate the provided input environment object","npmRunPath.env preserves custom non-PATH environment variables","npmRunPath.env prepends node_modules/.bin based on custom cwd to PATH","npmRunPath.env appends directory of custom execPath to PATH","npmRunPath.env operates with default parameters without throwing"],"goal":"verify npm-run-path.env 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.env"]},"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.env"],"verifierAdapter":"node-typescript@1"}
const npmRunPath = require('npm-run-path');
function getAugmentedEnv(options) {
return npmRunPath.env(options);
}
module.exports = {
getAugmentedEnv,
npmRunPath,
};
{
"name": "sample-npm-run-path-env",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-npm-run-path-env",
"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-env",
"version": "1.0.0",
"description": "Verify npm-run-path.env behavior",
"main": "index.js",
"license": "MIT-0",
"dependencies": {
"npm-run-path": "4.0.1"
}
}
{
"schemaVersion": 1,
"goal": "verify npm-run-path.env in pkg:npm/npm-run-path@4.0.1",
"kind": "HOW",
"packages": [
"pkg:npm/npm-run-path@4.0.1"
],
"symbols": [
"npm-run-path.env"
],
"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 { getAugmentedEnv } from '../index.js';
// 1. npmRunPath.env returns an environment object containing augmented PATH
const defaultEnv = npmRunPath.env();
assert.strictEqual(typeof defaultEnv, 'object', 'npmRunPath.env() must return an object');
assert(defaultEnv !== null, 'npmRunPath.env() must not return null');
assert('PATH' in defaultEnv || 'Path' in defaultEnv, 'augmented environment must have a PATH key');
const pathKey = 'PATH' in defaultEnv ? 'PATH' : 'Path';
assert(typeof defaultEnv[pathKey] === 'string', 'PATH key in environment must be a string');
assert(defaultEnv[pathKey].includes('node_modules' + path.sep + '.bin'), 'augmented PATH must include node_modules/.bin');
const helperEnv = getAugmentedEnv();
assert.strictEqual(typeof helperEnv, 'object', 'getAugmentedEnv helper must return an object');
assert(typeof helperEnv[pathKey] === 'string', 'helper PATH must be a string');
// 2. npmRunPath.env does not mutate the provided input environment object
const originalEnv = {
PATH: 'base-test-path',
CUSTOM_APP_VAR: 'csx_env_test_value'
};
const cwdFake = path.resolve('virtual-project', 'child');
const execFake = path.resolve('virtual-bin', 'node');
const resultEnv = npmRunPath.env({
env: originalEnv,
cwd: cwdFake,
execPath: execFake
});
assert.strictEqual(originalEnv.PATH, 'base-test-path', 'originalEnv.PATH must not be modified');
assert.strictEqual(originalEnv.CUSTOM_APP_VAR, 'csx_env_test_value', 'originalEnv custom variables must not be modified');
assert.notStrictEqual(resultEnv, originalEnv, 'resultEnv must be a new object reference');
// 3. npmRunPath.env preserves custom non-PATH environment variables
assert.strictEqual(resultEnv.CUSTOM_APP_VAR, 'csx_env_test_value', 'custom environment variables must be preserved in result');
// 4. npmRunPath.env prepends node_modules/.bin based on custom cwd to PATH
const augmentedPath = resultEnv[pathKey];
const pathEntries = augmentedPath.split(path.delimiter);
assert(pathEntries.includes(path.join(cwdFake, 'node_modules/.bin')), 'must include child node_modules/.bin');
assert(pathEntries.includes(path.join(path.dirname(cwdFake), 'node_modules/.bin')), 'must include parent node_modules/.bin');
assert(pathEntries.includes('base-test-path'), 'must retain existing base PATH at the end');
// 5. npmRunPath.env appends directory of custom execPath to PATH
assert(pathEntries.includes(path.dirname(execFake)), 'must include dirname of custom execPath');
// 6. npmRunPath.env operates with default parameters without throwing
assert.doesNotThrow(() => {
const env = npmRunPath.env({});
assert.strictEqual(typeof env, 'object');
}, 'calling npmRunPath.env({}) must succeed');
console.log('All contract assertions passed.');
オリジンシーダー
匿名