CodeSampleX

Sample

path-exists 4.0.0

Verified sample for npm path-exists 4.0.0. The contract ran on node 22 · linux alpine/x64 · docker and passed: pathExists returns a promise resolving to true…

sha256:4f1920349a7f7da921ea7463e7aae179af05225360f9d9b6ad958340a4fc0635

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
2
Signing keys that built it
1
Declared environment node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript 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@1
2026-08-20
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

Case

HOW
Goal
verify pkg:npm/path-exists@4.0.0
Packages
Environment
node 22.23.2
Created
2026-08-20T18:06:37Z

Contract

  1. pathExists returns a promise resolving to true for an existing file or directory and false for a non-existent path
  2. pathExists.sync synchronously returns true for an existing file or directory and false for a non-existent path
  3. pathExists handles non-existent paths gracefully returning false without throwing exceptions

Files

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.js
  • test/contract.mjs

Download the source artifact (tar.gz)

Source

PROMPT.md
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 pkg:npm/path-exists@4.0.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/path-exists@4.0.0
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - runtime: node@22.23.2

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.
csx.json
{"case":{"caseId":"case:sha256:133bab411ff7b224db68f8d6e0be2383dd6ca351dec4766c54ed3f9ed39e9faf","constraints":{"executionContext":"node"},"contract":["pathExists returns a promise resolving to true for an existing file or directory and false for a non-existent path","pathExists.sync synchronously returns true for an existing file or directory and false for a non-existent path","pathExists handles non-existent paths gracefully returning false without throwing exceptions"],"goal":"verify pkg:npm/path-exists@4.0.0","kind":"HOW","packages":["pkg:npm/path-exists@4.0.0"],"schemaVersion":1},"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","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/path-exists@4.0.0"],"schemaVersion":1,"subject":"pkg:npm/path-exists@4.0.0","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-path-exists",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-path-exists",
      "version": "1.0.0",
      "dependencies": {
        "path-exists": "4.0.0"
      }
    },
    "node_modules/path-exists": {
      "version": "4.0.0",
      "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
      "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
      "license": "MIT",
      "engines": {
        "node": ">=8"
      }
    }
  }
}
package.json
{
  "name": "sample-path-exists",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification of path-exists",
  "main": "src/index.js",
  "dependencies": {
    "path-exists": "4.0.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/path-exists@4.0.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/path-exists@4.0.0"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "runtime": "node@22.23.2"
  }
}
src/index.js
const pathExists = require('path-exists');

/**
 * Checks whether a path exists asynchronously.
 * @param {string} filePath
 * @returns {Promise<boolean>}
 */
async function checkPathExistsAsync(filePath) {
  return await pathExists(filePath);
}

/**
 * Checks whether a path exists synchronously.
 * @param {string} filePath
 * @returns {boolean}
 */
function checkPathExistsSync(filePath) {
  return pathExists.sync(filePath);
}

module.exports = {
  pathExists,
  checkPathExistsAsync,
  checkPathExistsSync
};
test/contract.mjs
import assert from 'node:assert';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);
const { pathExists, checkPathExistsAsync, checkPathExistsSync } = require('../src/index.js');

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

// 1. Export verification
assert.strictEqual(typeof pathExists, 'function', 'pathExists should be a function');
assert.strictEqual(typeof pathExists.sync, 'function', 'pathExists.sync should be a function');
assert.strictEqual(typeof checkPathExistsAsync, 'function', 'checkPathExistsAsync should be a function');
assert.strictEqual(typeof checkPathExistsSync, 'function', 'checkPathExistsSync should be a function');

// 2. Existing file & directory verification (asynchronous)
const existingFilePath = __filename;
const existingDirPath = __dirname;
const nonExistentPath = path.join(__dirname, 'non_existent_file_fixture_12345.tmp');

const fileExistsAsync = await pathExists(existingFilePath);
assert.strictEqual(fileExistsAsync, true, 'existing file should return true asynchronously');

const dirExistsAsync = await pathExists(existingDirPath);
assert.strictEqual(dirExistsAsync, true, 'existing directory should return true asynchronously');

const wrapperFileExistsAsync = await checkPathExistsAsync(existingFilePath);
assert.strictEqual(wrapperFileExistsAsync, true, 'wrapper existing file should return true asynchronously');

const nonExistentResultAsync = await pathExists(nonExistentPath);
assert.strictEqual(nonExistentResultAsync, false, 'non-existent path should return false asynchronously');

// 3. Existing file & directory verification (synchronous)
const fileExistsSync = pathExists.sync(existingFilePath);
assert.strictEqual(fileExistsSync, true, 'existing file should return true synchronously');

const dirExistsSync = pathExists.sync(existingDirPath);
assert.strictEqual(dirExistsSync, true, 'existing directory should return true synchronously');

const wrapperFileExistsSync = checkPathExistsSync(existingFilePath);
assert.strictEqual(wrapperFileExistsSync, true, 'wrapper existing file should return true synchronously');

const nonExistentResultSync = pathExists.sync(nonExistentPath);
assert.strictEqual(nonExistentResultSync, false, 'non-existent path should return false synchronously');

console.log('Contract tests passed successfully.');

Origin Seeder

anonymous