Beispiel
env-paths 2.2.1
Verifiziertes Beispiel für npm env-paths 2.2.1. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand: Calling envPaths returns standard XDG…
sha256:7cb9d06d647edb45d2d6256d62cd9eb6300e3012c4d1381b32686b718aefc8ef
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 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 |
Fall
HOW- Ziel
- verify pkg:npm/env-paths@2.2.1
- Pakete
- Erstellt
- 2026-08-23T13:29:34Z
Contract
- Calling envPaths returns standard XDG paths on Linux including data, config, cache, log, and temp directories
- Calling envPaths with default options appends the '-nodejs' suffix to the application directory name
- Setting suffix option to false disables the suffix and uses the bare application name
- Setting suffix option to a custom string appends the custom suffix to the application directory name
- Passing a non-string name argument throws a TypeError
Dateien
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Quelltext
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/env-paths@2.2.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/env-paths@2.2.1
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.
{"case":{"caseId":"case:sha256:c192eef179b812cd173899e4a6bd06e84ba93d356d0e04567b3940e01200b438","contract":["Calling envPaths returns standard XDG paths on Linux including data, config, cache, log, and temp directories","Calling envPaths with default options appends the '-nodejs' suffix to the application directory name","Setting suffix option to false disables the suffix and uses the bare application name","Setting suffix option to a custom string appends the custom suffix to the application directory name","Passing a non-string name argument throws a TypeError"],"goal":"verify pkg:npm/env-paths@2.2.1","kind":"HOW","packages":["pkg:npm/env-paths@2.2.1"],"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/env-paths@2.2.1"],"schemaVersion":1,"subject":"pkg:npm/env-paths@2.2.1","verifierAdapter":"node-typescript@1"}
{
"name": "sample-env-paths",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-env-paths",
"version": "1.0.0",
"dependencies": {
"env-paths": "2.2.1"
}
},
"node_modules/env-paths": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz",
"integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==",
"license": "MIT",
"engines": {
"node": ">=6"
}
}
}
}
{
"name": "sample-env-paths",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"env-paths": "2.2.1"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/env-paths@2.2.1",
"kind": "HOW",
"packages": [
"pkg:npm/env-paths@2.2.1"
]
}
import assert from 'node:assert/strict';
import os from 'node:os';
import path from 'node:path';
import process from 'node:process';
import envPaths from 'env-paths';
// 1. envPaths returns an object containing data, config, cache, log, and temp directory paths
{
const paths = envPaths('myapp', { suffix: false });
assert.equal(typeof paths, 'object');
assert.ok(typeof paths.data === 'string' && paths.data.length > 0);
assert.ok(typeof paths.config === 'string' && paths.config.length > 0);
assert.ok(typeof paths.cache === 'string' && paths.cache.length > 0);
assert.ok(typeof paths.log === 'string' && paths.log.length > 0);
assert.ok(typeof paths.temp === 'string' && paths.temp.length > 0);
const homedir = os.homedir();
const tmpdir = os.tmpdir();
const username = path.basename(homedir);
const expectedData = process.env.XDG_DATA_HOME || path.join(homedir, '.local', 'share');
const expectedConfig = process.env.XDG_CONFIG_HOME || path.join(homedir, '.config');
const expectedCache = process.env.XDG_CACHE_HOME || path.join(homedir, '.cache');
const expectedLog = process.env.XDG_STATE_HOME || path.join(homedir, '.local', 'state');
const expectedTemp = path.join(tmpdir, username, 'myapp');
assert.equal(paths.data, path.join(expectedData, 'myapp'));
assert.equal(paths.config, path.join(expectedConfig, 'myapp'));
assert.equal(paths.cache, path.join(expectedCache, 'myapp'));
assert.equal(paths.log, path.join(expectedLog, 'myapp'));
assert.equal(paths.temp, expectedTemp);
}
// 2. envPaths defaults to appending '-nodejs' suffix to the provided application name
{
const paths = envPaths('myapp');
assert.ok(paths.data.endsWith('myapp-nodejs'));
assert.ok(paths.config.endsWith('myapp-nodejs'));
assert.ok(paths.cache.endsWith('myapp-nodejs'));
assert.ok(paths.log.endsWith('myapp-nodejs'));
assert.ok(paths.temp.endsWith('myapp-nodejs'));
}
// 3. envPaths with suffix option set to false disables suffixing and keeps the original application name
{
const paths = envPaths('myapp', { suffix: false });
assert.ok(paths.data.endsWith(path.sep + 'myapp'));
assert.ok(!paths.data.endsWith('myapp-nodejs'));
}
// 4. envPaths with custom suffix option appends the custom suffix string to the application name
{
const paths = envPaths('myapp', { suffix: 'server' });
assert.ok(paths.data.endsWith('myapp-server'));
}
// 5. envPaths validates argument type and throws TypeError when name is not a string
{
assert.throws(
() => {
envPaths(12345);
},
{
name: 'TypeError',
message: 'Expected string, got number',
}
);
}
Ursprungs-Seeder
anonym