Пример
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 и…
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.');
Исходный сидер
аноним