CodeSampleX

Beispiel

bin-links 5.0.0: getPaths

Verifiziertes Beispiel für npm bin-links 5.0.0: getPaths. Der Vertrag lief auf node 22 · linux debian/x64 · docker und bestand.

sha256:25e787b0e55eca3bf127a7c0f30aedc184aa88d7c3386c8d90ffbb11529f71e0

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
1
Signaturschlüssel, die es gebaut haben
1
Deklarierte Umgebung linux 24 · ubuntu · glibc 2.39 x64 npm

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
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-18

Fall

HOW
Ziel
verify bin-links.getPaths in pkg:npm/bin-links@5.0.0
Pakete
Symbole
  • bin-links.getPaths
Erstellt
2026-10-18T14:05:51Z

Contract

  1. binLinks.getPaths({ path, pkg, global: false, top: true }) returns an empty array because non-global top-level packages do not link bins or man pages
  2. binLinks.getPaths({ path, pkg, global: false, top: false }) resolves pkg.bin keys into the parent node_modules/.bin directory (including scoped packages under node_modules/@scope/pkg) and omits man pages
  3. binLinks.getPaths({ path, pkg, global: true, top: true }) resolves pkg.bin keys into <prefix>/bin and valid pkg.man entries (including .gz suffixes) into <prefix>/share/man/man<section>
  4. binLinks.getPaths({ path, pkg, global: true, top: true }) omits all man page paths and returns only bin paths when any pkg.man entry lacks a numeric section suffix

Dateien

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

Quellartefakt herunterladen (tar.gz)

Quelltext

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 bin-links.getPaths in pkg:npm/bin-links@5.0.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/bin-links@5.0.0
Demonstrate these symbols/APIs:
  - bin-links.getPaths

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:aff130ff80d2f717959dca288daa077cb7f6ddb5877c2dd745cdeb65a9da7c0c","contract":["binLinks.getPaths({ path, pkg, global: false, top: true }) returns an empty array because non-global top-level packages do not link bins or man pages","binLinks.getPaths({ path, pkg, global: false, top: false }) resolves pkg.bin keys into the parent node_modules/.bin directory (including scoped packages under node_modules/@scope/pkg) and omits man pages","binLinks.getPaths({ path, pkg, global: true, top: true }) resolves pkg.bin keys into \u003cprefix\u003e/bin and valid pkg.man entries (including .gz suffixes) into \u003cprefix\u003e/share/man/man\u003csection\u003e","binLinks.getPaths({ path, pkg, global: true, top: true }) omits all man page paths and returns only bin paths when any pkg.man entry lacks a numeric section suffix"],"goal":"verify bin-links.getPaths in pkg:npm/bin-links@5.0.0","kind":"HOW","packages":["pkg:npm/bin-links@5.0.0"],"schemaVersion":1,"symbols":["bin-links.getPaths"]},"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/bin-links@5.0.0"],"schemaVersion":1,"subject":"pkg:npm/bin-links@5.0.0","symbols":["bin-links.getPaths"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "bin-links-getpaths-sample",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "bin-links-getpaths-sample",
      "version": "1.0.0",
      "dependencies": {
        "bin-links": "5.0.0"
      }
    },
    "node_modules/bin-links": {
      "version": "5.0.0",
      "resolved": "https://registry.npmjs.org/bin-links/-/bin-links-5.0.0.tgz",
      "integrity": "sha512-sdleLVfCjBtgO5cNjA2HVRvWBJAHs4zwenaCPMNJAJU0yNxpzj80IpjOIimkpkr+mhlA+how5poQtt53PygbHA==",
      "license": "ISC",
      "dependencies": {
        "cmd-shim": "^7.0.0",
        "npm-normalize-package-bin": "^4.0.0",
        "proc-log": "^5.0.0",
        "read-cmd-shim": "^5.0.0",
        "write-file-atomic": "^6.0.0"
      },
      "engines": {
        "node": "^18.17.0 || >=20.5.0"
      }
    },
    "node_modules/cmd-shim": {
      "version": "7.0.0",
      "resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-7.0.0.tgz",
      "integrity": "sha512-rtpaCbr164TPPh+zFdkWpCyZuKkjpAzODfaZCf/SVJZzJN+4bHQb/LP3Jzq5/+84um3XXY8r548XiWKSborwVw==",
      "license": "ISC",
      "engines": {
        "node": "^18.17.0 || >=20.5.0"
      }
    },
    "node_modules/imurmurhash": {
      "version": "0.1.4",
      "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
      "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==",
      "license": "MIT",
      "engines": {
        "node": ">=0.8.19"
      }
    },
    "node_modules/npm-normalize-package-bin": {
      "version": "4.0.0",
      "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-4.0.0.tgz",
      "integrity": "sha512-TZKxPvItzai9kN9H/TkmCtx/ZN/hvr3vUycjlfmH0ootY9yFBzNOpiXAdIn1Iteqsvk4lQn6B5PTrt+n6h8k/w==",
      "license": "ISC",
      "engines": {
        "node": "^18.17.0 || >=20.5.0"
      }
    },
    "node_modules/proc-log": {
      "version": "5.0.0",
      "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-5.0.0.tgz",
      "integrity": "sha512-Azwzvl90HaF0aCz1JrDdXQykFakSSNPaPoiZ9fm5qJIMHioDZEi7OAdRwSm6rSoPtY3Qutnm3L7ogmg3dc+wbQ==",
      "license": "ISC",
      "engines": {
        "node": "^18.17.0 || >=20.5.0"
      }
    },
    "node_modules/read-cmd-shim": {
      "version": "5.0.0",
      "resolved": "https://registry.npmjs.org/read-cmd-shim/-/read-cmd-shim-5.0.0.tgz",
      "integrity": "sha512-SEbJV7tohp3DAAILbEMPXavBjAnMN0tVnh4+9G8ihV4Pq3HYF9h8QNez9zkJ1ILkv9G2BjdzwctznGZXgu/HGw==",
      "license": "ISC",
      "engines": {
        "node": "^18.17.0 || >=20.5.0"
      }
    },
    "node_modules/signal-exit": {
      "version": "4.1.0",
      "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
      "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
      "license": "ISC",
      "engines": {
        "node": ">=14"
      },
      "funding": {
        "url": "https://github.com/sponsors/isaacs"
      }
    },
    "node_modules/write-file-atomic": {
      "version": "6.0.0",
      "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-6.0.0.tgz",
      "integrity": "sha512-GmqrO8WJ1NuzJ2DrziEI2o57jKAVIQNf8a18W3nCYU3H7PNWqCCVTeH6/NQE93CIllIgQS98rrmVkYgTX9fFJQ==",
      "license": "ISC",
      "dependencies": {
        "imurmurhash": "^0.1.4",
        "signal-exit": "^4.0.1"
      },
      "engines": {
        "node": "^18.17.0 || >=20.5.0"
      }
    }
  }
}
package.json
{
  "name": "bin-links-getpaths-sample",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "scripts": {
    "test": "node test/contract.mjs"
  },
  "dependencies": {
    "bin-links": "5.0.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify bin-links.getPaths in pkg:npm/bin-links@5.0.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/bin-links@5.0.0"
  ],
  "symbols": [
    "bin-links.getPaths"
  ]
}
test/contract.mjs
import assert from 'node:assert/strict'
import path from 'node:path'
import binLinks from 'bin-links'

const { getPaths } = binLinks
assert.equal(typeof getPaths, 'function')

const pkg = {
  name: 'demo-pkg',
  version: '1.0.0',
  bin: {
    'demo-cli': './bin/cli.js',
  },
  man: [
    './man/demo-cli.1',
    './man/demo-conf.5.gz',
  ],
}

// 1. Top-level non-global package produces no link paths
const topLocalPaths = getPaths({
  path: path.resolve('workspace-root'),
  pkg,
  global: false,
  top: true,
})
assert.deepEqual(topLocalPaths, [])

// 2. Local dependency (top: false) links bins into node_modules/.bin and ignores man pages
const localPkgPath = path.resolve('project', 'node_modules', 'demo-pkg')
const localPaths = getPaths({
  path: localPkgPath,
  pkg,
  global: false,
  top: false,
})
assert.deepEqual(localPaths, [
  path.resolve('project', 'node_modules', '.bin', 'demo-cli'),
])

// 3. Scoped local dependency resolves parent node_modules/.bin properly
const scopedPkgPath = path.resolve('project', 'node_modules', '@scope', 'demo-pkg')
const scopedPaths = getPaths({
  path: scopedPkgPath,
  pkg,
  global: false,
  top: false,
})
assert.deepEqual(scopedPaths, [
  path.resolve('project', 'node_modules', '.bin', 'demo-cli'),
])

// 4. Global top-level package (top: true, global: true) resolves prefix/bin and prefix/share/man/man<section>
const globalPkgPath = path.resolve('prefix', 'lib', 'node_modules', 'demo-pkg')
const globalPaths = getPaths({
  path: globalPkgPath,
  pkg,
  global: true,
  top: true,
})
assert.deepEqual(globalPaths, [
  path.resolve('prefix', 'bin', 'demo-cli'),
  path.resolve('prefix', 'share', 'man', 'man1', 'demo-cli.1'),
  path.resolve('prefix', 'share', 'man', 'man5', 'demo-conf.5.gz'),
])

// 5. Invalid man page suffix causes getPaths to omit man targets and return only bin targets
const invalidManPaths = getPaths({
  path: globalPkgPath,
  pkg: {
    ...pkg,
    man: ['./man/invalid.txt'],
  },
  global: true,
  top: true,
})
assert.deepEqual(invalidManPaths, [
  path.resolve('prefix', 'bin', 'demo-cli'),
])

Ursprungs-Seeder

anonym