CodeSampleX

Sample

validate-npm-package-name 6.0.2

Verified sample for npm validate-npm-package-name 6.0.2. The contract ran on node 22 · linux debian/x64 · docker and passed: validate('some-package') and…

sha256:a3dd7064db624ed8d0700ae44928a4bfa9ed426dafa58b8dd72e299685b593b0

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 debian/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2…
2026-10-17

Case

HOW
Goal
verify pkg:npm/validate-npm-package-name@6.0.2
Packages
Created
2026-10-17T23:25:50Z

Contract

  1. validate('some-package') and validate('@example/valid-pkg') return { validForNewPackages: true, validForOldPackages: true } with warnings and errors omitted
  2. validate('MixedCase') and validate('http') return validForNewPackages: false, validForOldPackages: true, and a populated warnings array without an errors property
  3. validate('.invalid'), validate('@scope/.pkg'), and validate(null) return validForNewPackages: false, validForOldPackages: false, and a populated errors array

Files

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.mjs
  • 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/validate-npm-package-name@6.0.2
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/validate-npm-package-name@6.0.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:dee80726d29d849561190a989c716aa8d206978c7a24e58c38d78da2105d2057","contract":["validate('some-package') and validate('@example/valid-pkg') return { validForNewPackages: true, validForOldPackages: true } with warnings and errors omitted","validate('MixedCase') and validate('http') return validForNewPackages: false, validForOldPackages: true, and a populated warnings array without an errors property","validate('.invalid'), validate('@scope/.pkg'), and validate(null) return validForNewPackages: false, validForOldPackages: false, and a populated errors array"],"goal":"verify pkg:npm/validate-npm-package-name@6.0.2","kind":"HOW","packages":["pkg:npm/validate-npm-package-name@6.0.2"],"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/validate-npm-package-name@6.0.2"],"schemaVersion":1,"subject":"pkg:npm/validate-npm-package-name@6.0.2","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-validate-npm-package-name",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-validate-npm-package-name",
      "version": "1.0.0",
      "dependencies": {
        "validate-npm-package-name": "6.0.2"
      }
    },
    "node_modules/validate-npm-package-name": {
      "version": "6.0.2",
      "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-6.0.2.tgz",
      "integrity": "sha512-IUoow1YUtvoBBC06dXs8bR8B9vuA3aJfmQNKMoaPG/OFsPmoQvw8xh+6Ye25Gx9DQhoEom3Pcu9MKHerm/NpUQ==",
      "license": "ISC",
      "engines": {
        "node": "^18.17.0 || >=20.5.0"
      }
    }
  }
}
package.json
{
  "name": "sample-validate-npm-package-name",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "scripts": {
    "test": "node test/contract.mjs"
  },
  "dependencies": {
    "validate-npm-package-name": "6.0.2"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/validate-npm-package-name@6.0.2",
  "kind": "HOW",
  "packages": [
    "pkg:npm/validate-npm-package-name@6.0.2"
  ]
}
src/index.mjs
import validate from 'validate-npm-package-name';

export function checkPackageName(name) {
  return validate(name);
}
test/contract.mjs
import assert from 'node:assert/strict';
import validate from 'validate-npm-package-name';
import { checkPackageName } from '../src/index.mjs';

// 1. Valid unscoped and scoped package names
const validUnscoped = checkPackageName('some-package');
assert.deepEqual(validUnscoped, {
  validForNewPackages: true,
  validForOldPackages: true,
});

const validScoped = validate('@example/valid-pkg');
assert.deepEqual(validScoped, {
  validForNewPackages: true,
  validForOldPackages: true,
});

// 2. Legacy names that produce warnings (validForOldPackages: true, validForNewPackages: false)
const capitalWarning = validate('MixedCase');
assert.equal(capitalWarning.validForNewPackages, false);
assert.equal(capitalWarning.validForOldPackages, true);
assert.deepEqual(capitalWarning.warnings, [
  'name can no longer contain capital letters',
]);
assert.equal('errors' in capitalWarning, false);

const builtinWarning = validate('http');
assert.equal(builtinWarning.validForNewPackages, false);
assert.equal(builtinWarning.validForOldPackages, true);
assert.deepEqual(builtinWarning.warnings, [
  'http is a core module name',
]);

// 3. Invalid names that produce errors (validForNewPackages: false, validForOldPackages: false)
const leadingDot = validate('.invalid');
assert.equal(leadingDot.validForNewPackages, false);
assert.equal(leadingDot.validForOldPackages, false);
assert.deepEqual(leadingDot.errors, [
  'name cannot start with a period',
]);
assert.equal('warnings' in leadingDot, false);

const scopedLeadingDot = validate('@scope/.pkg');
assert.equal(scopedLeadingDot.validForNewPackages, false);
assert.equal(scopedLeadingDot.validForOldPackages, false);
assert.deepEqual(scopedLeadingDot.errors, [
  'name cannot start with a period',
]);

const nonString = validate(null);
assert.deepEqual(nonString, {
  validForNewPackages: false,
  validForOldPackages: false,
  errors: ['name cannot be null'],
});

Origin Seeder

anonymous