CodeSampleX

Ejemplo

filelist 1.0.6

Muestra verificada para npm filelist 1.0.6. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: FileList instance includes string filenames…

sha256:74e0b73db78506aeadb79713c3d4afd6932ce67c833fa0ff110a4b956c4929e7

Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido. Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas. MIT-0

Evidencia de ejecución

El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.

Base de evidencia
Contrato firmado aprobado
Recibos de verificación
1
Claves de firma que lo compilaron
1
Entorno declarado node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Entornos de las ejecuciones de verificación

Entorno Contrato Etapas Ejecución
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-26

Caso

HOW
Objetivo
verify pkg:npm/filelist@1.0.6
Paquetes
Entorno
node 22.23.2
Creado
2026-08-26T07:25:55Z

Contrato

  1. FileList instance includes string filenames and array of filenames
  2. exclude(string) removes exact matching files from the resolved file list
  3. exclude(RegExp) removes pattern matching files from the resolved file list
  4. exclude(Function) removes files that satisfy the predicate function
  5. shouldExclude(filename) returns true for excluded paths and false otherwise
  6. clearInclusions() resets pending additions before resolution
  7. clearExclusions() clears active exclusion patterns
  8. length() returns the number of resolved files in the list
  9. Array methods like map() return a new FileList instance with transformed items
  10. FileList.clone(fl) creates a cloned copy of the FileList

Archivos

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

Descargar el artefacto de código fuente (tar.gz)

Código fuente

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/filelist@1.0.6
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/filelist@1.0.6

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:8e54586697e18c168b6aa6352b1349cd8ff088ef0d304e256912e56fc5f4af42","contract":["FileList instance includes string filenames and array of filenames","exclude(string) removes exact matching files from the resolved file list","exclude(RegExp) removes pattern matching files from the resolved file list","exclude(Function) removes files that satisfy the predicate function","shouldExclude(filename) returns true for excluded paths and false otherwise","clearInclusions() resets pending additions before resolution","clearExclusions() clears active exclusion patterns","length() returns the number of resolved files in the list","Array methods like map() return a new FileList instance with transformed items","FileList.clone(fl) creates a cloned copy of the FileList"],"goal":"verify pkg:npm/filelist@1.0.6","kind":"HOW","packages":["pkg:npm/filelist@1.0.6"],"schemaVersion":1},"contractCommand":["node","test/contract.js"],"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/filelist@1.0.6"],"schemaVersion":1,"subject":"pkg:npm/filelist@1.0.6","verifierAdapter":"node-typescript@1"}
index.js
'use strict';

const { FileList } = require('filelist');

function createFileList(...items) {
  const fl = new FileList();
  if (items.length > 0) {
    fl.include(...items);
  }
  return fl;
}

module.exports = {
  FileList,
  createFileList,
};
package-lock.json
{
  "name": "sample-1138045718",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-1138045718",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "filelist": "1.0.6"
      }
    },
    "node_modules/balanced-match": {
      "version": "1.0.2",
      "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
      "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
      "license": "MIT"
    },
    "node_modules/brace-expansion": {
      "version": "2.1.4",
      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.4.tgz",
      "integrity": "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg==",
      "license": "MIT",
      "dependencies": {
        "balanced-match": "^1.0.0"
      }
    },
    "node_modules/filelist": {
      "version": "1.0.6",
      "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.6.tgz",
      "integrity": "sha512-5giy2PkLYY1cP39p17Ech+2xlpTRL9HLspOfEgm0L6CwBXBTgsK5ou0JtzYuepxkaQ/tvhCFIJ5uXo0OrM2DxA==",
      "license": "Apache-2.0",
      "dependencies": {
        "minimatch": "^5.0.1"
      }
    },
    "node_modules/minimatch": {
      "version": "5.1.9",
      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz",
      "integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==",
      "license": "ISC",
      "dependencies": {
        "brace-expansion": "^2.0.1"
      },
      "engines": {
        "node": ">=10"
      }
    }
  }
}
package.json
{
  "name": "sample-1138045718",
  "version": "1.0.0",
  "description": "Minimal sample verifying filelist@1.0.6",
  "main": "index.js",
  "scripts": {
    "test": "node test/contract.js"
  },
  "keywords": [],
  "author": "",
  "license": "MIT-0",
  "dependencies": {
    "filelist": "1.0.6"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/filelist@1.0.6",
  "kind": "HOW",
  "packages": [
    "pkg:npm/filelist@1.0.6"
  ]
}
test/contract.js
'use strict';

const assert = require('assert');
const { FileList, createFileList } = require('../index.js');

function runContract() {
  // 1. FileList instance includes string filenames and array of filenames
  const fl1 = createFileList('foo.txt', 'bar.js');
  fl1.include(['baz.md', 'temp.tmp']);
  assert.deepStrictEqual(fl1.toArray(), ['foo.txt', 'bar.js', 'baz.md', 'temp.tmp']);

  // 2. exclude(string) removes exact matching files from the resolved file list
  const fl2 = new FileList();
  fl2.include('foo.txt', 'bar.js', 'baz.txt');
  fl2.exclude('bar.js');
  assert.deepStrictEqual(fl2.toArray(), ['foo.txt', 'baz.txt']);

  // 3. exclude(RegExp) removes pattern matching files from the resolved file list
  const fl3 = new FileList();
  fl3.include('app.js', 'app.test.js', 'server.js');
  fl3.exclude(/\.test\.js$/);
  assert.deepStrictEqual(fl3.toArray(), ['app.js', 'server.js']);

  // 4. exclude(Function) removes files that satisfy the predicate function
  const fl4 = new FileList();
  fl4.include('doc.md', 'temp1.tmp', 'temp2.tmp');
  fl4.exclude((item) => item.endsWith('.tmp'));
  assert.deepStrictEqual(fl4.toArray(), ['doc.md']);

  // 5. shouldExclude(filename) returns true for excluded paths and false otherwise
  const fl5 = new FileList();
  fl5.exclude(/\.tmp$/);
  fl5.exclude((item) => item.startsWith('ignore-'));
  assert.strictEqual(fl5.shouldExclude('data.tmp'), true);
  assert.strictEqual(fl5.shouldExclude('ignore-me.txt'), true);
  assert.strictEqual(fl5.shouldExclude('valid.txt'), false);

  // 6. clearInclusions() resets pending additions before resolution
  const fl6 = new FileList();
  fl6.include('first.txt');
  fl6.clearInclusions();
  fl6.include('second.txt');
  assert.deepStrictEqual(fl6.toArray(), ['second.txt']);

  // 7. clearExclusions() clears active exclusion patterns
  const fl7 = new FileList();
  fl7.include('item1.js', 'item2.js');
  fl7.exclude('item1.js');
  fl7.clearExclusions();
  assert.deepStrictEqual(fl7.toArray(), ['item1.js', 'item2.js']);

  // 8. length() returns the number of resolved files in the list
  const fl8 = new FileList();
  fl8.include('a.txt', 'b.txt', 'c.txt');
  fl8.exclude('c.txt');
  assert.strictEqual(fl8.length(), 2);

  // 9. Array methods like map() return a new FileList instance with transformed items
  const fl9 = new FileList();
  fl9.include('a.txt', 'b.txt');
  const mapped = fl9.map((f) => f.toUpperCase());
  assert.ok(mapped instanceof FileList);
  assert.deepStrictEqual(mapped.toArray(), ['A.TXT', 'B.TXT']);

  // 10. FileList.clone(fl) creates a cloned copy of the FileList
  const fl10 = new FileList();
  fl10.include('alpha.txt', 'beta.txt');
  const cloned = FileList.clone(fl10);
  assert.ok(cloned instanceof FileList);
  assert.deepStrictEqual(cloned.toArray(), ['alpha.txt', 'beta.txt']);

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

runContract();

Seeder de origen

anónimo