CodeSampleX

Beispiel

galactus 1.0.0

Verifiziertes Beispiel für npm galactus 1.0.0. Der Vertrag lief auf node 22 · linux debian/x64 · docker und bestand: DestroyerOfModules constructor throws…

sha256:4538b5c8619d02a4945065132d5640c8869e526f4c3458ffae049c4df314a0e9

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-09-16

Fall

HOW
Ziel
verify pkg:npm/galactus@1.0.0
Pakete
Erstellt
2026-09-16T20:47:53Z

Contract

  1. DestroyerOfModules constructor throws when neither rootDirectory nor walker is provided
  2. DestroyerOfModules collectKeptModules includes production dependencies and excludes devDependencies by default
  3. DestroyerOfModules destroy removes devDependencies while preserving production dependencies on disk
  4. DestroyerOfModules shouldKeepModuleTest custom filter allows preserving devDependencies during prune

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 pkg:npm/galactus@1.0.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/galactus@1.0.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:e1ae9d1e4b81cbaab07ec1ed7f93a4e7fdbb1d29f6e32ffa0a03e67af5756838","contract":["DestroyerOfModules constructor throws when neither rootDirectory nor walker is provided","DestroyerOfModules collectKeptModules includes production dependencies and excludes devDependencies by default","DestroyerOfModules destroy removes devDependencies while preserving production dependencies on disk","DestroyerOfModules shouldKeepModuleTest custom filter allows preserving devDependencies during prune"],"goal":"verify pkg:npm/galactus@1.0.0","kind":"HOW","packages":["pkg:npm/galactus@1.0.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/galactus@1.0.0"],"schemaVersion":1,"subject":"pkg:npm/galactus@1.0.0","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "galactus-sample",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "galactus-sample",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "galactus": "1.0.0"
      }
    },
    "node_modules/debug": {
      "version": "4.4.3",
      "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
      "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
      "license": "MIT",
      "dependencies": {
        "ms": "^2.1.3"
      },
      "engines": {
        "node": ">=6.0"
      },
      "peerDependenciesMeta": {
        "supports-color": {
          "optional": true
        }
      }
    },
    "node_modules/flora-colossus": {
      "version": "2.0.0",
      "resolved": "https://registry.npmjs.org/flora-colossus/-/flora-colossus-2.0.0.tgz",
      "integrity": "sha512-dz4HxH6pOvbUzZpZ/yXhafjbR2I8cenK5xL0KtBFb7U2ADsR+OwXifnxZjij/pZWF775uSCMzWVd+jDik2H2IA==",
      "license": "MIT",
      "dependencies": {
        "debug": "^4.3.4",
        "fs-extra": "^10.1.0"
      },
      "engines": {
        "node": ">= 12"
      }
    },
    "node_modules/fs-extra": {
      "version": "10.1.0",
      "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz",
      "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==",
      "license": "MIT",
      "dependencies": {
        "graceful-fs": "^4.2.0",
        "jsonfile": "^6.0.1",
        "universalify": "^2.0.0"
      },
      "engines": {
        "node": ">=12"
      }
    },
    "node_modules/galactus": {
      "version": "1.0.0",
      "resolved": "https://registry.npmjs.org/galactus/-/galactus-1.0.0.tgz",
      "integrity": "sha512-R1fam6D4CyKQGNlvJne4dkNF+PvUUl7TAJInvTGa9fti9qAv95quQz29GXapA4d8Ec266mJJxFVh82M4GIIGDQ==",
      "license": "MIT",
      "dependencies": {
        "debug": "^4.3.4",
        "flora-colossus": "^2.0.0",
        "fs-extra": "^10.1.0"
      },
      "engines": {
        "node": ">= 12"
      }
    },
    "node_modules/graceful-fs": {
      "version": "4.2.11",
      "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
      "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
      "license": "ISC"
    },
    "node_modules/jsonfile": {
      "version": "6.2.1",
      "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz",
      "integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==",
      "license": "MIT",
      "dependencies": {
        "universalify": "^2.0.0"
      },
      "optionalDependencies": {
        "graceful-fs": "^4.1.6"
      }
    },
    "node_modules/ms": {
      "version": "2.1.3",
      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
      "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
      "license": "MIT"
    },
    "node_modules/universalify": {
      "version": "2.0.1",
      "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
      "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==",
      "license": "MIT",
      "engines": {
        "node": ">= 10.0.0"
      }
    }
  }
}
package.json
{
  "name": "galactus-sample",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification for galactus",
  "license": "MIT-0",
  "dependencies": {
    "galactus": "1.0.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/galactus@1.0.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/galactus@1.0.0"
  ]
}
test/contract.mjs
import assert from 'node:assert';
import fs from 'node:fs/promises';
import path from 'node:path';
import os from 'node:os';
import { DestroyerOfModules } from 'galactus';

// 1. DestroyerOfModules constructor throws when neither rootDirectory nor walker is provided
assert.throws(
  () => {
    new DestroyerOfModules({});
  },
  (err) => {
    return err instanceof Error && err.message.includes('Must either provide rootDirectory or walker argument');
  },
  'DestroyerOfModules constructor throws when neither rootDirectory nor walker is provided'
);

// 2. DestroyerOfModules collectKeptModules includes production dependencies and excludes devDependencies by default
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'galactus-contract-'));
try {
  await fs.writeFile(
    path.join(tempDir, 'package.json'),
    JSON.stringify({
      name: 'sample-app',
      version: '1.0.0',
      dependencies: {
        'prod-pkg': '^1.0.0'
      },
      devDependencies: {
        'dev-pkg': '^1.0.0'
      }
    }, null, 2)
  );

  const prodDir = path.join(tempDir, 'node_modules', 'prod-pkg');
  const devDir = path.join(tempDir, 'node_modules', 'dev-pkg');
  await fs.mkdir(prodDir, { recursive: true });
  await fs.mkdir(devDir, { recursive: true });

  await fs.writeFile(path.join(prodDir, 'package.json'), JSON.stringify({ name: 'prod-pkg', version: '1.0.0' }));
  await fs.writeFile(path.join(devDir, 'package.json'), JSON.stringify({ name: 'dev-pkg', version: '1.0.0' }));

  const destroyer = new DestroyerOfModules({
    rootDirectory: tempDir
  });

  const keptModules = await destroyer.collectKeptModules({ relativePaths: true });
  const keptKeys = Array.from(keptModules.keys());

  assert.ok(
    keptKeys.some((k) => k.endsWith('prod-pkg')),
    'collectKeptModules must include production dependencies'
  );
  assert.ok(
    !keptKeys.some((k) => k.endsWith('dev-pkg')),
    'collectKeptModules must exclude devDependencies by default'
  );

  // 3. DestroyerOfModules destroy removes devDependencies while preserving production dependencies on disk
  await destroyer.destroy();

  const prodExists = await fs.access(prodDir).then(() => true, () => false);
  const devExists = await fs.access(devDir).then(() => true, () => false);

  assert.strictEqual(prodExists, true, 'destroy must keep production dependencies on disk');
  assert.strictEqual(devExists, false, 'destroy must prune devDependencies from disk');
} finally {
  await fs.rm(tempDir, { recursive: true, force: true });
}

// 4. DestroyerOfModules shouldKeepModuleTest custom filter allows preserving devDependencies during prune
const tempDirCustom = await fs.mkdtemp(path.join(os.tmpdir(), 'galactus-contract-custom-'));
try {
  await fs.writeFile(
    path.join(tempDirCustom, 'package.json'),
    JSON.stringify({
      name: 'sample-custom-app',
      version: '1.0.0',
      dependencies: {},
      devDependencies: {
        'custom-dev': '^1.0.0'
      }
    }, null, 2)
  );

  const customDevDir = path.join(tempDirCustom, 'node_modules', 'custom-dev');
  await fs.mkdir(customDevDir, { recursive: true });
  await fs.writeFile(path.join(customDevDir, 'package.json'), JSON.stringify({ name: 'custom-dev', version: '1.0.0' }));

  const customDestroyer = new DestroyerOfModules({
    rootDirectory: tempDirCustom,
    shouldKeepModuleTest: (_module, _isDevDep) => true
  });

  const customKept = await customDestroyer.collectKeptModules({ relativePaths: true });
  const customKeptKeys = Array.from(customKept.keys());

  assert.ok(
    customKeptKeys.some((k) => k.endsWith('custom-dev')),
    'collectKeptModules must retain devDependencies when custom filter returns true'
  );

  await customDestroyer.destroy();

  const customDevExists = await fs.access(customDevDir).then(() => true, () => false);
  assert.strictEqual(customDevExists, true, 'custom filter must prevent devDependencies from being pruned');
} finally {
  await fs.rm(tempDirCustom, { recursive: true, force: true });
}

console.log('Contract passed');

Ursprungs-Seeder

anonym