CodeSampleX

Sample

bare-fs 4.8.0

Verified sample for npm bare-fs 4.8.0. The contract ran on node 22 · linux alpine/x64 · docker and passed: package manifest specifies Bare addon…

sha256:b6636085ef0f0661d7ca6c65ddf0181bd8638851990ebe3fe03bdd4be3431bb3

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-23

Case

HOW
Goal
verify pkg:npm/bare-fs@4.8.0
Packages
Created
2026-08-23T15:57:45Z

Contract

  1. package manifest specifies Bare addon configuration, Bare engine requirement, and exports for root, promises, constants, and package subpaths
  2. declares Dir, Dirent, Stats, StatFs, ReadStream, WriteStream, and Watcher interfaces and classes with full filesystem method signatures
  3. declares synchronous and callback filesystem functions including readFile, writeFile, stat, readdir, and mkdir
  4. declares FileHandle interface and promise-based filesystem operations including open, readFile, writeFile, stat, and readdir
  5. declares POSIX open flags, access modes, file mode masks, UV dirent types, and copy/symlink constants
  6. ships native Bare C binding and CMakeLists build files

Files

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • 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/bare-fs@4.8.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/bare-fs@4.8.0

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:3863a5f6448363d39d0b856abd452dbbd4e13a0d31ea5f81b09cfa53fbbc22e5","contract":["package manifest specifies Bare addon configuration, Bare engine requirement, and exports for root, promises, constants, and package subpaths","declares Dir, Dirent, Stats, StatFs, ReadStream, WriteStream, and Watcher interfaces and classes with full filesystem method signatures","declares synchronous and callback filesystem functions including readFile, writeFile, stat, readdir, and mkdir","declares FileHandle interface and promise-based filesystem operations including open, readFile, writeFile, stat, and readdir","declares POSIX open flags, access modes, file mode masks, UV dirent types, and copy/symlink constants","ships native Bare C binding and CMakeLists build files"],"goal":"verify pkg:npm/bare-fs@4.8.0","kind":"HOW","packages":["pkg:npm/bare-fs@4.8.0"],"schemaVersion":1},"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/bare-fs@4.8.0"],"schemaVersion":1,"subject":"pkg:npm/bare-fs@4.8.0","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-bare-fs",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-bare-fs",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "bare-fs": "4.8.0"
      }
    },
    "node_modules/b4a": {
      "version": "1.8.1",
      "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.8.1.tgz",
      "integrity": "sha512-aiqre1Nr0B/6DgE2N5vwTc+2/oQZ4Wh1t4NznYY4E00y8LCt6NqdRv81so00oo27D8MVKTpUa/MwUUtBLXCoDw==",
      "license": "Apache-2.0",
      "peerDependencies": {
        "react-native-b4a": "*"
      },
      "peerDependenciesMeta": {
        "react-native-b4a": {
          "optional": true
        }
      }
    },
    "node_modules/bare-events": {
      "version": "2.9.1",
      "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.9.1.tgz",
      "integrity": "sha512-Z0oHEHAFDZkffN8Qc39zNZjQlMDkPJRyyyZieU1VH7u8c5S+qHZ2S8ixdKIAxEjfHO7FJxXmJWgteOghVanIsg==",
      "license": "Apache-2.0",
      "peerDependencies": {
        "bare-abort-controller": "*"
      },
      "peerDependenciesMeta": {
        "bare-abort-controller": {
          "optional": true
        }
      }
    },
    "node_modules/bare-fs": {
      "version": "4.8.0",
      "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-4.8.0.tgz",
      "integrity": "sha512-fM+MhCvdQhZ7NV6S95a07gPSqjIYKn6mFaXfx266wN3ajZGl/+1AzH+ubkXQ0fFZvOe2nk9VHkzdYkQE5zMV3Q==",
      "license": "Apache-2.0",
      "dependencies": {
        "bare-events": "^2.5.4",
        "bare-path": "^3.0.0",
        "bare-stream": "^2.6.4",
        "bare-url": "^2.2.2",
        "fast-fifo": "^1.3.2"
      },
      "engines": {
        "bare": ">=1.28.0"
      },
      "peerDependencies": {
        "bare-buffer": "*"
      },
      "peerDependenciesMeta": {
        "bare-buffer": {
          "optional": true
        }
      }
    },
    "node_modules/bare-path": {
      "version": "3.1.1",
      "resolved": "https://registry.npmjs.org/bare-path/-/bare-path-3.1.1.tgz",
      "integrity": "sha512-JprUlveX3QjApC1cTpsUOiscADftCGVWkzitbHsRqv84hzYwYHw2mbluddsq5TvI8mH/8Ov1f4BiMAdcB0oYnQ==",
      "license": "Apache-2.0"
    },
    "node_modules/bare-stream": {
      "version": "2.13.3",
      "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.13.3.tgz",
      "integrity": "sha512-Kc+brLqvEqGkjyfiwJmImAOqLZL7OsoLKuavx+hJjgVV3nLTOjloJyPMFxjUPerGGHrNH0fLU06jjykMLWrERQ==",
      "license": "Apache-2.0",
      "dependencies": {
        "b4a": "^1.8.1",
        "streamx": "^2.25.0",
        "teex": "^1.0.1"
      },
      "peerDependencies": {
        "bare-abort-controller": "*",
        "bare-buffer": "*",
        "bare-events": "*"
      },
      "peerDependenciesMeta": {
        "bare-abort-controller": {
          "optional": true
        },
        "bare-buffer": {
          "optional": true
        },
        "bare-events": {
          "optional": true
        }
      }
    },
    "node_modules/bare-url": {
      "version": "2.5.2",
      "resolved": "https://registry.npmjs.org/bare-url/-/bare-url-2.5.2.tgz",
      "integrity": "sha512-L13PCJzKG8RGvx8V1/DdMi12ERhC3tprr7/8a94BxpmnRsFqxh5XZNdhtMxu5HPkRshYOOWRGY8lDP7ZhpG9Cg==",
      "license": "Apache-2.0",
      "dependencies": {
        "bare-path": "^3.0.0"
      }
    },
    "node_modules/events-universal": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/events-universal/-/events-universal-1.0.1.tgz",
      "integrity": "sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==",
      "license": "Apache-2.0",
      "dependencies": {
        "bare-events": "^2.7.0"
      }
    },
    "node_modules/fast-fifo": {
      "version": "1.3.2",
      "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz",
      "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==",
      "license": "MIT"
    },
    "node_modules/streamx": {
      "version": "2.28.0",
      "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.28.0.tgz",
      "integrity": "sha512-1Yowhzjf0ivGMrTIkY9hav5TxobO9qIVqUE41fiCGMGgc3CLlf4MY+9AHmZqBWgDTue0fY9zWjYFVyf6Diuobw==",
      "license": "MIT",
      "dependencies": {
        "events-universal": "^1.0.0",
        "fast-fifo": "^1.3.2",
        "text-decoder": "^1.1.0"
      }
    },
    "node_modules/teex": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/teex/-/teex-1.0.1.tgz",
      "integrity": "sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg==",
      "license": "MIT",
      "dependencies": {
        "streamx": "^2.12.5"
      }
    },
    "node_modules/text-decoder": {
      "version": "1.2.7",
      "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.7.tgz",
      "integrity": "sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ==",
      "license": "Apache-2.0",
      "dependencies": {
        "b4a": "^1.6.4"
      }
    }
  }
}
package.json
{
  "name": "sample-bare-fs",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "license": "MIT-0",
  "dependencies": {
    "bare-fs": "4.8.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/bare-fs@4.8.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/bare-fs@4.8.0"
  ]
}
test/contract.mjs
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
import fs from 'node:fs';
import path from 'node:path';

const require = createRequire(import.meta.url);

// 1. Resolve bare-fs package manifest and verify exports and metadata
const pkgPath = require.resolve('bare-fs/package');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));

assert.equal(pkg.name, 'bare-fs', 'Package name must be bare-fs');
assert.equal(pkg.version, '4.8.0', 'Package version must be 4.8.0');
assert.equal(pkg.license, 'Apache-2.0', 'Package license must be Apache-2.0');
assert.equal(pkg.addon, true, 'Package must be marked as addon');
assert.equal(pkg.engines?.bare, '>=1.28.0', 'Package must specify Bare engine >=1.28.0');

assert.ok(pkg.exports, 'Package must define exports');
assert.equal(pkg.exports['.'].types, './index.d.ts', 'Root export must have index.d.ts types');
assert.equal(pkg.exports['.'].default, './index.js', 'Root export must have index.js default');
assert.equal(pkg.exports['./promises'].types, './promises.d.ts', 'Promises export must have promises.d.ts types');
assert.equal(pkg.exports['./promises'].default, './promises.js', 'Promises export must have promises.js default');
assert.equal(pkg.exports['./constants'].types, './lib/constants.d.ts', 'Constants export must have constants.d.ts types');
assert.equal(pkg.exports['./constants'].default, './lib/constants.js', 'Constants export must have constants.js default');

const pkgDir = path.dirname(pkgPath);
const indexDts = fs.readFileSync(path.join(pkgDir, 'index.d.ts'), 'utf8');
const promisesDts = fs.readFileSync(path.join(pkgDir, 'promises.d.ts'), 'utf8');
const constantsDts = fs.readFileSync(path.join(pkgDir, 'lib', 'constants.d.ts'), 'utf8');

// 2. Verify index.d.ts type definitions and re-exports
assert.ok(indexDts.includes('export { promises, constants }'), 'index.d.ts must re-export promises and constants');
assert.ok(indexDts.includes('export type Path = string | Buffer | URL'), 'index.d.ts must export Path type');
assert.ok(indexDts.includes('export interface Dir<T extends string | Buffer = string | Buffer>'), 'index.d.ts must declare Dir interface');
assert.ok(indexDts.includes('export interface Dirent<T extends string | Buffer = string | Buffer>'), 'index.d.ts must declare Dirent interface');
assert.ok(indexDts.includes('export interface Stats {'), 'index.d.ts must declare Stats interface');
assert.ok(indexDts.includes('export interface StatFs {'), 'index.d.ts must declare StatFs interface');
assert.ok(indexDts.includes('export interface ReadStream extends Readable'), 'index.d.ts must declare ReadStream');
assert.ok(indexDts.includes('export interface WriteStream extends Writable'), 'index.d.ts must declare WriteStream');
assert.ok(indexDts.includes('export interface Watcher<T extends string | Buffer = string | Buffer>'), 'index.d.ts must declare Watcher interface');

// Verify core filesystem functions in index.d.ts
assert.ok(indexDts.includes('export function readFile('), 'index.d.ts must declare readFile');
assert.ok(indexDts.includes('export function readFileSync('), 'index.d.ts must declare readFileSync');
assert.ok(indexDts.includes('export function writeFile('), 'index.d.ts must declare writeFile');
assert.ok(indexDts.includes('export function writeFileSync('), 'index.d.ts must declare writeFileSync');
assert.ok(indexDts.includes('export function stat('), 'index.d.ts must declare stat');
assert.ok(indexDts.includes('export function statSync('), 'index.d.ts must declare statSync');
assert.ok(indexDts.includes('export function readdir('), 'index.d.ts must declare readdir');
assert.ok(indexDts.includes('export function readdirSync('), 'index.d.ts must declare readdirSync');
assert.ok(indexDts.includes('export function mkdir('), 'index.d.ts must declare mkdir');
assert.ok(indexDts.includes('export function mkdirSync('), 'index.d.ts must declare mkdirSync');

// 3. Verify promises.d.ts exports FileHandle and async promise-based filesystem operations
assert.ok(promisesDts.includes('interface FileHandle extends EventEmitter<FileHandleEvents>, AsyncDisposable'), 'promises.d.ts must declare FileHandle interface');
assert.ok(promisesDts.includes('export function open('), 'promises.d.ts must declare open returning FileHandle');
assert.ok(promisesDts.includes('export function readFile('), 'promises.d.ts must declare promise-based readFile');
assert.ok(promisesDts.includes('export function writeFile('), 'promises.d.ts must declare promise-based writeFile');
assert.ok(promisesDts.includes('export function stat('), 'promises.d.ts must declare promise-based stat');
assert.ok(promisesDts.includes('export function readdir('), 'promises.d.ts must declare promise-based readdir');
assert.ok(promisesDts.includes('export function mkdir('), 'promises.d.ts must declare promise-based mkdir');
assert.ok(promisesDts.includes('export function rm('), 'promises.d.ts must declare promise-based rm');
assert.ok(promisesDts.includes('export function unlink('), 'promises.d.ts must declare promise-based unlink');

// 4. Verify constants.d.ts declares POSIX flags, mode masks, and Dirent type constants
assert.ok(constantsDts.includes('O_RDWR: number') && constantsDts.includes('O_RDONLY: number') && constantsDts.includes('O_CREAT: number'), 'constants.d.ts must declare POSIX open flags');
assert.ok(constantsDts.includes('F_OK: number') && constantsDts.includes('R_OK: number') && constantsDts.includes('W_OK: number') && constantsDts.includes('X_OK: number'), 'constants.d.ts must declare access mode constants');
assert.ok(constantsDts.includes('S_IFMT: number') && constantsDts.includes('S_IFREG: number') && constantsDts.includes('S_IFDIR: number'), 'constants.d.ts must declare file mode mask constants');
assert.ok(constantsDts.includes('UV_DIRENT_FILE: number') && constantsDts.includes('UV_DIRENT_DIR: number'), 'constants.d.ts must declare UV Dirent type constants');
assert.ok(constantsDts.includes('COPYFILE_EXCL: number') && constantsDts.includes('UV_FS_SYMLINK_DIR: number'), 'constants.d.ts must declare copy and symlink constants');

// 5. Verify C binding and CMake native build files exist
assert.ok(fs.existsSync(path.join(pkgDir, 'binding.c')), 'binding.c must exist for native Bare addon');
assert.ok(fs.existsSync(path.join(pkgDir, 'CMakeLists.txt')), 'CMakeLists.txt must exist');
assert.ok(fs.existsSync(path.join(pkgDir, 'binding.js')), 'binding.js must exist');

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

Origin Seeder

anonymous