샘플
path-key 3.1.1: pathKey
검증된 샘플 — npm path-key 3.1.1: pathKey. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: assert pathKey returns PATH on POSIX platforms like linux…
sha256:6c7c88e41f1b2bb476199c0a2559af7673c7cc933d89203b3b7bd76219ffe4e9
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-27 |
케이스
HOW- 목표
- verify pathKey in pkg:npm/path-key@3.1.1
- 패키지
- 심벌
-
- pathKey
- 환경
- node 22.23.2
- 생성일
- 2026-08-27T02:19:52Z
컨트랙트
- assert pathKey returns PATH on POSIX platforms like linux and darwin
- assert pathKey returns PATH by default on current POSIX environment
- assert pathKey returns Path on Windows when no PATH environment variable exists
- assert pathKey returns the specific PATH casing present in Windows environment options
- assert pathKey returns the last matching key in reverse order when multiple PATH casings exist on Windows
- assert pathKey accepts custom environment and platform options
파일
- 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 pathKey in pkg:npm/path-key@3.1.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/path-key@3.1.1
Demonstrate these symbols/APIs:
- pathKey
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:fcb7cb1b1d635d5ae4e80a119a448b25dda5c21116e4102d078a3c1cce8e951e","contract":["assert pathKey returns PATH on POSIX platforms like linux and darwin","assert pathKey returns PATH by default on current POSIX environment","assert pathKey returns Path on Windows when no PATH environment variable exists","assert pathKey returns the specific PATH casing present in Windows environment options","assert pathKey returns the last matching key in reverse order when multiple PATH casings exist on Windows","assert pathKey accepts custom environment and platform options"],"goal":"verify pathKey in pkg:npm/path-key@3.1.1","kind":"HOW","packages":["pkg:npm/path-key@3.1.1"],"schemaVersion":1,"symbols":["pathKey"]},"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/path-key@3.1.1"],"schemaVersion":1,"subject":"pkg:npm/path-key@3.1.1","symbols":["pathKey"],"verifierAdapter":"node-typescript@1"}
const pathKey = require('path-key');
/**
* Returns the environment variable key for PATH on cross-platform systems.
*
* @param {object} [options] - Options specifying custom env and platform.
* @returns {string} The PATH environment variable key name.
*/
function getPathKey(options) {
return pathKey(options);
}
/**
* Retrieves the value of the PATH environment variable from the provided environment.
*
* @param {object} [env] - Environment object (defaults to process.env).
* @param {object} [options] - Options passed to pathKey.
* @returns {string|undefined} The PATH environment variable value.
*/
function getPathValue(env = process.env, options = {}) {
const opts = { ...options, env };
const key = pathKey(opts);
return env[key];
}
module.exports = {
pathKey,
getPathKey,
getPathValue,
};
{
"name": "sample-path-key",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-path-key",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"path-key": "3.1.1"
}
},
"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-path-key",
"version": "1.0.0",
"description": "Clean-room sample verifying pathKey in path-key",
"main": "index.js",
"license": "MIT-0",
"dependencies": {
"path-key": "3.1.1"
}
}
{
"schemaVersion": 1,
"goal": "verify pathKey in pkg:npm/path-key@3.1.1",
"kind": "HOW",
"packages": [
"pkg:npm/path-key@3.1.1"
],
"symbols": [
"pathKey"
]
}
import assert from 'node:assert';
import pathKey from 'path-key';
import { getPathKey, getPathValue } from '../index.js';
// 1. Default invocation on current platform
const defaultKey = pathKey();
assert(typeof defaultKey === 'string' && defaultKey.length > 0, 'pathKey() must return a non-empty string');
assert.strictEqual(getPathKey(), defaultKey, 'getPathKey() wrapper must return the same result as pathKey()');
// 2. POSIX platforms always return 'PATH'
const linuxKey = pathKey({ platform: 'linux' });
assert.strictEqual(linuxKey, 'PATH', 'pathKey must return "PATH" on linux platform');
const darwinKey = pathKey({ platform: 'darwin' });
assert.strictEqual(darwinKey, 'PATH', 'pathKey must return "PATH" on darwin platform');
const aixKey = pathKey({ platform: 'aix' });
assert.strictEqual(aixKey, 'PATH', 'pathKey must return "PATH" on aix platform');
// 3. Windows platform with explicit PATH casing in env
const winPathUpper = pathKey({ platform: 'win32', env: { PATH: 'mock-path-entry' } });
assert.strictEqual(winPathUpper, 'PATH', 'pathKey must detect "PATH" in env on win32');
const winPathMixed = pathKey({ platform: 'win32', env: { Path: 'mock-path-entry' } });
assert.strictEqual(winPathMixed, 'Path', 'pathKey must detect "Path" in env on win32');
const winPathLower = pathKey({ platform: 'win32', env: { path: 'mock-path-entry' } });
assert.strictEqual(winPathLower, 'path', 'pathKey must detect "path" in env on win32');
// 4. Windows platform fallback when no PATH key exists
const winFallback = pathKey({ platform: 'win32', env: { FOO: 'bar' } });
assert.strictEqual(winFallback, 'Path', 'pathKey must fallback to "Path" on win32 when no PATH variable exists');
// 5. Windows platform reverse search when multiple keys exist
const winMulti = pathKey({
platform: 'win32',
env: {
Path: 'entry-first',
PATH: 'entry-second',
},
});
assert.strictEqual(winMulti, 'PATH', 'pathKey must return the last matching key in reverse order on win32');
// 6. getPathValue helper verification
const mockEnv = { Path: 'mock-path-value' };
const retrievedValue = getPathValue(mockEnv, { platform: 'win32' });
assert.strictEqual(retrievedValue, 'mock-path-value', 'getPathValue must resolve value using detected key');
const posixEnv = { PATH: 'posix-path-value' };
const retrievedPosix = getPathValue(posixEnv, { platform: 'linux' });
assert.strictEqual(retrievedPosix, 'posix-path-value', 'getPathValue must resolve PATH on POSIX');
console.log('All pathKey contract assertions passed successfully.');
오리진 시더
익명