ProvenPin Install

pathe POSIX path helpers: working versions (tested 2026-10-16)

Join, normalize, basename, extname, dirname and relative with pathe, asserting consistent POSIX-style results for mixed slash inputs, fully offline.

passed5 passed · 0 failed2026-10-16 17:50 UTC
Status
passed
Last passed
2026-10-16 17:50 UTC
Tests
5 / 5
Language
TypeScript
Runtime
node v22.23.3
pinned versions3
pathe@2.0.3@types/node@26.6.5tsx@4.23.15
run it
npm install --no-audit --no-fund --ignore-scripts=false
npm test
test environment
node v22.23.3
linux 6.17.0-1022-azure
x64
runner: github-actions 38942732901

The code

Exactly the files that passed. Your agent can pull them with get_recipe("pathe-normalize-join") (install), or see them on GitHub.

package.json
{
  "name": "pathe-normalize-join",
  "private": true,
  "type": "module",
  "scripts": {
    "test": "node --import tsx --test test/*.test.ts"
  },
  "dependencies": {
    "pathe": "2.0.3"
  },
  "devDependencies": {
    "@types/node": "26.6.5",
    "tsx": "4.23.15"
  }
}
src/paths.ts
import { join, normalize, basename, extname, dirname, relative } from "pathe";

export function joinPosix(...parts: string[]): string {
  return join(...parts);
}

export function normalizePosix(input: string): string {
  return normalize(input);
}

export function basenamePosix(input: string, suffix?: string): string {
  return suffix === undefined ? basename(input) : basename(input, suffix);
}

export function extnamePosix(input: string): string {
  return extname(input);
}

export function dirnamePosix(input: string): string {
  return dirname(input);
}

export function relativePosix(from: string, to: string): string {
  return relative(from, to);
}
test/paths.test.ts
import { test } from "node:test";
import assert from "node:assert/strict";
import {
  joinPosix,
  normalizePosix,
  basenamePosix,
  extnamePosix,
  dirnamePosix,
  relativePosix,
} from "../src/paths.ts";

test("join returns POSIX-style paths", () => {
  assert.equal(joinPosix("src", "utils", "file.ts"), "src/utils/file.ts");
  assert.equal(joinPosix("/root", "..", "boot"), "/boot");
  assert.equal(joinPosix("a", "", "b"), "a/b");
});

test("mixed slash inputs normalize consistently", () => {
  const variants = [
    "src/utils/file.ts",
    "src//utils//file.ts",
    "src\\utils\\file.ts",
    "src/utils/./file.ts",
  ];
  for (const variant of variants) {
    assert.equal(normalizePosix(variant), "src/utils/file.ts");
  }
});

test("normalize resolves dot segments", () => {
  assert.equal(normalizePosix("src/utils/../lib/index.ts"), "src/lib/index.ts");
});

test("basename, extname and dirname operate on POSIX paths", () => {
  assert.equal(basenamePosix("src/utils/file.ts"), "file.ts");
  assert.equal(basenamePosix("src/utils/file.ts", ".ts"), "file");
  assert.equal(extnamePosix("src/utils/file.ts"), ".ts");
  assert.equal(dirnamePosix("src/utils/file.ts"), "src/utils");
});

test("relative computes POSIX-style traversals", () => {
  assert.equal(relativePosix("/a/b/c", "/a/b/d/e"), "../d/e");
  assert.equal(relativePosix("/app/src", "/app/test/unit"), "../test/unit");
  assert.equal(relativePosix("/a/b/c", "/a/b/c/d"), "d");
});

Connect to ProvenPin

Add the free MCP server so your agent can pull this recipe and others like it. Same setup as the docs.

terminal
claude mcp add --transport http provenpin https://mcp.provenpin.com/mcp

Any other MCP client: Streamable HTTP at https://mcp.provenpin.com/mcp. No API key, no signup.