샘플
path-is-absolute 1.0.1: verify path is absolute with path-is-absolute
검증된 샘플 — npm path-is-absolute 1.0.1: verify path is absolute with path-is-absolute. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다.
sha256:6bff4291f4176e01ec3595dfb1d35dbd98c8176403b1d02cb8373080bce505c3
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 2
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-26 |
| 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-07 |
케이스
HOW- 목표
- verify path is absolute with path-is-absolute
- 심벌
-
- pathIsAbsolute
- pathIsAbsolute.posix
- pathIsAbsolute.win32
- 생성일
- 2026-08-26T09:36:52Z
컨트랙트
- pathIsAbsolute returns true for absolute paths and false for relative paths on the host platform
- pathIsAbsolute.posix returns true for POSIX root paths and false for relative paths or Windows drive paths
- pathIsAbsolute.win32 returns true for Windows drive paths and UNC network share paths
- pathIsAbsolute.win32 returns false for relative paths, empty strings, and drive-relative paths without root slash
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- 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 path is absolute with path-is-absolute
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/path-is-absolute@1.0.1
Demonstrate these symbols/APIs:
- pathIsAbsolute
- pathIsAbsolute.posix
- pathIsAbsolute.win32
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:7a9ec310afde510f559c6553bd87110ee115e8670f7a8ed752676ed2dd824691","contract":["pathIsAbsolute returns true for absolute paths and false for relative paths on the host platform","pathIsAbsolute.posix returns true for POSIX root paths and false for relative paths or Windows drive paths","pathIsAbsolute.win32 returns true for Windows drive paths and UNC network share paths","pathIsAbsolute.win32 returns false for relative paths, empty strings, and drive-relative paths without root slash"],"goal":"verify path is absolute with path-is-absolute","kind":"HOW","packages":["pkg:npm/path-is-absolute@1.0.1"],"schemaVersion":1,"symbols":["pathIsAbsolute","pathIsAbsolute.posix","pathIsAbsolute.win32"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/path-is-absolute@1.0.1"],"schemaVersion":1,"subject":"pkg:npm/path-is-absolute@1.0.1","symbols":["pathIsAbsolute","pathIsAbsolute.posix","pathIsAbsolute.win32"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-path-is-absolute",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-path-is-absolute",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"path-is-absolute": "1.0.1"
}
},
"node_modules/path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
}
}
}
{
"name": "sample-path-is-absolute",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"path-is-absolute": "1.0.1"
}
}
{
"schemaVersion": 1,
"goal": "verify path is absolute with path-is-absolute",
"kind": "HOW",
"packages": [
"pkg:npm/path-is-absolute@1.0.1"
],
"symbols": [
"pathIsAbsolute",
"pathIsAbsolute.posix",
"pathIsAbsolute.win32"
]
}
import pathIsAbsolute from 'path-is-absolute';
/**
* Checks if a given path is an absolute path on the current platform.
*
* @param {string} targetPath - Path string to check.
* @returns {boolean} True if targetPath is absolute on the current platform.
*/
export function isPathAbsolute(targetPath) {
return pathIsAbsolute(targetPath);
}
/**
* Checks if a given path is an absolute POSIX path.
*
* @param {string} targetPath - Path string to check.
* @returns {boolean} True if targetPath starts with a forward slash ('/').
*/
export function isPosixAbsolute(targetPath) {
return pathIsAbsolute.posix(targetPath);
}
/**
* Checks if a given path is an absolute Windows path (drive letter with root or UNC path).
*
* @param {string} targetPath - Path string to check.
* @returns {boolean} True if targetPath is absolute on Windows.
*/
export function isWin32Absolute(targetPath) {
return pathIsAbsolute.win32(targetPath);
}
export { pathIsAbsolute };
export default pathIsAbsolute;
import assert from 'node:assert/strict';
import pathIsAbsolute from 'path-is-absolute';
import {
isPathAbsolute,
isPosixAbsolute,
isWin32Absolute,
} from '../src/index.mjs';
const slash = '/';
const backslash = '\\';
const samplePosixPath = slash + 'alpha' + slash + 'beta';
const samplePosixDir = slash + 'opt' + slash + 'bin';
const sampleWinDrivePath = 'C' + ':' + backslash + 'alpha' + backslash + 'beta';
const sampleWinDriveForward = 'D' + ':' + slash + 'gamma' + slash + 'delta';
const sampleWinUncBackslash = backslash + backslash + 'node' + backslash + 'share' + backslash + 'data';
const sampleWinUncForward = slash + slash + 'node' + slash + 'share' + slash + 'data';
// 1. Contract: pathIsAbsolute returns true for absolute paths and false for relative paths on the host platform
{
if (process.platform === 'win32') {
assert.equal(isPathAbsolute(sampleWinDrivePath), true);
assert.equal(pathIsAbsolute(sampleWinDriveForward), true);
assert.equal(isPathAbsolute('sample' + slash + 'relative'), false);
assert.equal(pathIsAbsolute('C' + ':' + 'relative' + backslash + 'file'), false);
} else {
assert.equal(isPathAbsolute(samplePosixPath), true);
assert.equal(pathIsAbsolute(samplePosixDir), true);
assert.equal(isPathAbsolute('alpha' + slash + 'beta'), false);
assert.equal(pathIsAbsolute('.' + slash + 'alpha'), false);
assert.equal(pathIsAbsolute(''), false);
}
}
// 2. Contract: pathIsAbsolute.posix returns true for POSIX root paths and false for relative paths or Windows drive paths
{
assert.equal(isPosixAbsolute(slash), true);
assert.equal(isPosixAbsolute(samplePosixPath), true);
assert.equal(isPosixAbsolute(samplePosixDir), true);
assert.equal(pathIsAbsolute.posix(slash + 'single'), true);
assert.equal(isPosixAbsolute('alpha' + slash + 'beta'), false);
assert.equal(isPosixAbsolute('.' + slash + 'alpha'), false);
assert.equal(isPosixAbsolute('..' + slash + 'alpha'), false);
assert.equal(isPosixAbsolute(''), false);
assert.equal(isPosixAbsolute(sampleWinDrivePath), false);
assert.equal(pathIsAbsolute.posix('relative-file.txt'), false);
}
// 3. Contract: pathIsAbsolute.win32 returns true for Windows drive paths and UNC network share paths
{
assert.equal(isWin32Absolute('C' + ':' + backslash), true);
assert.equal(isWin32Absolute(sampleWinDrivePath), true);
assert.equal(isWin32Absolute(sampleWinDriveForward), true);
assert.equal(isWin32Absolute('Z' + ':' + backslash + 'archive' + backslash + 'file.json'), true);
assert.equal(pathIsAbsolute.win32(sampleWinUncBackslash), true);
assert.equal(pathIsAbsolute.win32(sampleWinUncForward), true);
assert.equal(isWin32Absolute(slash + 'root' + slash + 'item'), true);
assert.equal(isWin32Absolute(backslash + 'root' + backslash + 'item'), true);
}
// 4. Contract: pathIsAbsolute.win32 returns false for relative paths, empty strings, and drive-relative paths without root slash
{
assert.equal(isWin32Absolute('relative' + backslash + 'item'), false);
assert.equal(isWin32Absolute('.' + backslash + 'relative'), false);
assert.equal(isWin32Absolute('..' + backslash + 'relative'), false);
assert.equal(isWin32Absolute(''), false);
assert.equal(isWin32Absolute('C' + ':' + 'relative' + backslash + 'item'), false);
assert.equal(isWin32Absolute('D' + ':' + 'file.txt'), false);
assert.equal(pathIsAbsolute.win32('filename.txt'), false);
}
console.log('All path-is-absolute contract assertions passed.');
오리진 시더
익명