CodeSampleX

Sample

human-signals 2.1.0: lookup signal information by name and number with human-signals

Verified sample for npm human-signals 2.1.0: lookup signal information by name and number with human-signals. The contract ran on node 22 · linux alpine/x64…

sha256:bd160dce7e322a0e8c5639e6877c8efd71fb66403f29579ea77748227dcd5181

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 node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

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

Case

HOW
Goal
lookup signal information by name and number with human-signals
Packages
Symbols
  • signalsByName
  • signalsByNumber
Environment
node 22.23.2
Created
2026-08-28T08:50:21Z

Contract

  1. signalsByName maps signal names to signal descriptor objects containing name, number, description, supported, action, forced, and standard properties
  2. signalsByNumber maps signal numbers to the corresponding signal descriptor objects matching signalsByName entries
  3. signalsByName and signalsByNumber return undefined for unknown signal names or numbers

Files

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

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: lookup signal information by name and number with human-signals
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/human-signals@2.1.0
Demonstrate these symbols/APIs:
  - signalsByName
  - signalsByNumber

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:6866b4aaa1b7409e74ff9839c9217dd5ce52c9d426f0bc72d36bb3b3430d5a23","contract":["signalsByName maps signal names to signal descriptor objects containing name, number, description, supported, action, forced, and standard properties","signalsByNumber maps signal numbers to the corresponding signal descriptor objects matching signalsByName entries","signalsByName and signalsByNumber return undefined for unknown signal names or numbers"],"goal":"lookup signal information by name and number with human-signals","kind":"HOW","packages":["pkg:npm/human-signals@2.1.0"],"schemaVersion":1,"symbols":["signalsByName","signalsByNumber"]},"contractCommand":["node","test/contract.cjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/human-signals@2.1.0"],"schemaVersion":1,"subject":"pkg:npm/human-signals@2.1.0","symbols":["signalsByName","signalsByNumber"],"verifierAdapter":"node-typescript@1"}
index.js
'use strict';

const { signalsByName, signalsByNumber } = require('human-signals');

function getSignalByName(name) {
  return signalsByName[name];
}

function getSignalByNumber(number) {
  return signalsByNumber[number];
}

module.exports = {
  getSignalByName,
  getSignalByNumber,
  signalsByName,
  signalsByNumber
};
package-lock.json
{
  "name": "sample-human-signals-lookup",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-human-signals-lookup",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "human-signals": "2.1.0"
      }
    },
    "node_modules/human-signals": {
      "version": "2.1.0",
      "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
      "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
      "license": "Apache-2.0",
      "engines": {
        "node": ">=10.17.0"
      }
    }
  }
}
package.json
{
  "name": "sample-human-signals-lookup",
  "version": "1.0.0",
  "private": true,
  "description": "lookup signal information by name and number with human-signals",
  "main": "index.js",
  "scripts": {
    "test": "node test/contract.cjs"
  },
  "dependencies": {
    "human-signals": "2.1.0"
  },
  "license": "MIT-0"
}
spec.json
{
  "schemaVersion": 1,
  "goal": "lookup signal information by name and number with human-signals",
  "kind": "HOW",
  "packages": [
    "pkg:npm/human-signals@2.1.0"
  ],
  "symbols": [
    "signalsByName",
    "signalsByNumber"
  ]
}
test/contract.cjs
'use strict';

const assert = require('assert');
const { signalsByName, signalsByNumber, getSignalByName, getSignalByNumber } = require('../index.js');

function run() {
  // 1. Verify signalsByName structure and lookup
  assert(signalsByName !== undefined && typeof signalsByName === 'object', 'signalsByName must be an object');

  const sigintByName = signalsByName.SIGINT;
  assert.strictEqual(sigintByName.name, 'SIGINT');
  assert.strictEqual(sigintByName.number, 2);
  assert.strictEqual(typeof sigintByName.description, 'string');
  assert.strictEqual(typeof sigintByName.supported, 'boolean');
  assert.strictEqual(sigintByName.action, 'terminate');
  assert.strictEqual(sigintByName.forced, false);
  assert.strictEqual(sigintByName.standard, 'ansi');

  const sigkillByName = signalsByName.SIGKILL;
  assert.strictEqual(sigkillByName.name, 'SIGKILL');
  assert.strictEqual(sigkillByName.number, 9);
  assert.strictEqual(sigkillByName.action, 'terminate');
  assert.strictEqual(sigkillByName.forced, true);
  assert.strictEqual(sigkillByName.standard, 'posix');

  const sigtermByName = signalsByName.SIGTERM;
  assert.strictEqual(sigtermByName.name, 'SIGTERM');
  assert.strictEqual(sigtermByName.number, 15);

  // 2. Verify signalsByNumber structure and lookup
  assert(signalsByNumber !== undefined && typeof signalsByNumber === 'object', 'signalsByNumber must be an object');

  const sig2ByNum = signalsByNumber[2];
  assert.strictEqual(sig2ByNum.name, 'SIGINT');
  assert.strictEqual(sig2ByNum.number, 2);
  assert.deepStrictEqual(sig2ByNum, sigintByName, 'signalsByNumber[2] must match signalsByName.SIGINT');

  const sig9ByNum = signalsByNumber[9];
  assert.strictEqual(sig9ByNum.name, 'SIGKILL');
  assert.strictEqual(sig9ByNum.number, 9);
  assert.deepStrictEqual(sig9ByNum, sigkillByName, 'signalsByNumber[9] must match signalsByName.SIGKILL');

  const sig15ByNum = signalsByNumber[15];
  assert.strictEqual(sig15ByNum.name, 'SIGTERM');
  assert.strictEqual(sig15ByNum.number, 15);
  assert.deepStrictEqual(sig15ByNum, sigtermByName, 'signalsByNumber[15] must match signalsByName.SIGTERM');

  // 3. Verify helper functions from index.js
  assert.deepStrictEqual(getSignalByName('SIGINT'), sigintByName);
  assert.deepStrictEqual(getSignalByNumber(2), sig2ByNum);
  assert.deepStrictEqual(getSignalByName('SIGKILL'), sigkillByName);
  assert.deepStrictEqual(getSignalByNumber(9), sig9ByNum);

  // 4. Verify unknown signals return undefined
  assert.strictEqual(signalsByName.UNKNOWN_SIGNAL, undefined);
  assert.strictEqual(signalsByName[''], undefined);
  assert.strictEqual(signalsByNumber[9999], undefined);
  assert.strictEqual(signalsByNumber[-1], undefined);
  assert.strictEqual(getSignalByName('NON_EXISTENT'), undefined);
  assert.strictEqual(getSignalByNumber(8888), undefined);

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

try {
  run();
} catch (err) {
  console.error('Contract test failed:', err);
  process.exit(1);
}

Origin Seeder

anonymous