Sample
pathe 2.0.3: resolve
Verified sample for npm pathe 2.0.3: resolve. The contract ran on node 22 · linux alpine/x64 · docker and passed: pathe.resolve resolves multiple path…
sha256:52a9f5b4160a1ec69563512e658e53ba187df95789245d25ad58a482df5f607e
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 npm
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| 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 |
Case
HOW- Goal
- verify pathe.resolve in pkg:npm/pathe@2.0.3
- Packages
- Symbols
-
- pathe.resolve
- Created
- 2026-08-26T10:49:51Z
Contract
- pathe.resolve resolves multiple path segments into a normalized POSIX path string
- pathe.resolve resolves relative path segments and parent directory navigation (..)
- pathe.resolve processes paths from right to left until an absolute path is constructed
- pathe.resolve strips trailing slashes from resolved paths unless resolving to root directory
- pathe.resolve normalizes redundant slashes and relative dot segments
- pathe.resolve defaults to the current working directory in POSIX format when given empty or no arguments
- pathe.resolve ignores empty string segments between non-empty path arguments
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
Source
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 pathe.resolve in pkg:npm/pathe@2.0.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/pathe@2.0.3
Demonstrate these symbols/APIs:
- pathe.resolve
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:3a2a6c2f7d37c0c0bd325a20386fd774557a8d1794c233fd1ba96e117a194392","contract":["pathe.resolve resolves multiple path segments into a normalized POSIX path string","pathe.resolve resolves relative path segments and parent directory navigation (..)","pathe.resolve processes paths from right to left until an absolute path is constructed","pathe.resolve strips trailing slashes from resolved paths unless resolving to root directory","pathe.resolve normalizes redundant slashes and relative dot segments","pathe.resolve defaults to the current working directory in POSIX format when given empty or no arguments","pathe.resolve ignores empty string segments between non-empty path arguments"],"goal":"verify pathe.resolve in pkg:npm/pathe@2.0.3","kind":"HOW","packages":["pkg:npm/pathe@2.0.3"],"schemaVersion":1,"symbols":["pathe.resolve"]},"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/pathe@2.0.3"],"schemaVersion":1,"subject":"pkg:npm/pathe@2.0.3","symbols":["pathe.resolve"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-pathe-resolve",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-pathe-resolve",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"pathe": "2.0.3"
}
},
"node_modules/pathe": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
"integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==",
"license": "MIT"
}
}
}
{
"name": "sample-pathe-resolve",
"version": "1.0.0",
"private": true,
"description": "Clean-room code sample for pathe.resolve in pathe@2.0.3",
"main": "src/index.js",
"license": "MIT-0",
"dependencies": {
"pathe": "2.0.3"
}
}
{
"schemaVersion": 1,
"goal": "verify pathe.resolve in pkg:npm/pathe@2.0.3",
"kind": "HOW",
"packages": [
"pkg:npm/pathe@2.0.3"
],
"symbols": [
"pathe.resolve"
]
}
const pathe = require('pathe');
const { resolve, normalize } = pathe;
/**
* Resolves a sequence of paths or path segments into an absolute POSIX path.
*
* @param {...string} paths - Path segments to resolve.
* @returns {string} Normalized absolute POSIX path.
*/
function resolvePath(...paths) {
return resolve(...paths);
}
/**
* Resolves path segments relative to a specified base directory.
*
* @param {string} base - Base directory path.
* @param {...string} segments - Additional segments to resolve against the base.
* @returns {string} Resolved POSIX path.
*/
function resolveRelative(base, ...segments) {
return resolve(base, ...segments);
}
module.exports = {
pathe,
resolve,
normalize,
resolvePath,
resolveRelative
};
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const { pathe, resolve, normalize, resolvePath, resolveRelative } = require('../src/index.js');
async function runTests() {
const cwd = normalize(process.cwd());
// 1. pathe.resolve resolves multiple path segments into a normalized POSIX path string
assert.equal(typeof pathe.resolve, 'function', 'pathe.resolve must be a function');
assert.equal(typeof resolve, 'function', 'resolve must be a function');
assert.equal(resolve('/a', 'b', 'c'), '/a/b/c', 'resolve should join and normalize path segments');
assert.equal(resolvePath('/foo', 'bar', 'baz'), '/foo/bar/baz', 'resolvePath helper should resolve segments');
// 2. pathe.resolve resolves relative path segments and parent directory navigation (..)
assert.equal(resolve('/foo/bar', '../baz'), '/foo/baz', 'resolve should handle .. navigation');
assert.equal(resolve('/a/b/c', 'd', '../e'), '/a/b/c/e', 'resolve should traverse relative parent correctly');
assert.equal(resolveRelative('/base/dir', './sub', '../other'), '/base/dir/other', 'resolveRelative helper should resolve ..');
// 3. pathe.resolve processes paths from right to left until an absolute path is constructed
assert.equal(resolve('/first/path', '/second/path'), '/second/path', 'Rightmost absolute path takes precedence');
assert.equal(resolve('/root', 'sub1', '/target', 'file.txt'), '/target/file.txt', 'Absolute segment overrides earlier segments');
// 4. pathe.resolve strips trailing slashes from resolved paths unless resolving to root directory
assert.equal(resolve('/foo/bar/'), '/foo/bar', 'Trailing slash should be removed for non-root paths');
assert.equal(resolve('/'), '/', 'Root slash must be preserved');
// 5. pathe.resolve normalizes redundant slashes and relative dot segments
assert.equal(resolve('/foo//bar///baz'), '/foo/bar/baz', 'Redundant slashes should be normalized');
assert.equal(resolve('/foo/./bar/../baz'), '/foo/baz', 'Dot segments should be resolved');
// 6. pathe.resolve defaults to the current working directory in POSIX format when given empty or no arguments
assert.equal(resolve(''), cwd, 'Empty string should resolve to normalized current working directory');
assert.equal(resolve(), cwd, 'No arguments should resolve to normalized current working directory');
// 7. pathe.resolve ignores empty string segments between non-empty path arguments
assert.equal(resolve('/foo', '', 'bar'), '/foo/bar', 'Empty string segments should be ignored');
assert.equal(resolve('/foo', '', '', 'bar'), '/foo/bar', 'Multiple empty string segments should be ignored');
console.log('All contract assertions for pathe.resolve passed successfully.');
}
runTests().catch((err) => {
console.error('Contract test failed:', err);
process.exit(1);
});
Origin Seeder
anonymous