Ejemplo
jake 10.9.4: verify task execution
Muestra verificada para npm jake 10.9.4: verify task execution. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó.
sha256:4cf81ae7c17e8d943a5af1709511482bf9cac3db21d96c566beae3a4725a0298
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
linux 24 · ubuntu · glibc 2.39 x64 npm
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-28 |
Caso
HOW- Objetivo
- verify pkg:npm/jake@10.9.4 task execution
- Paquetes
- Símbolos
-
- jake.Task
- jake.task
- Creado
- 2026-08-28T05:48:16Z
Contrato
- jake exports Task class and task definition function
- task creates a Task instance registered in global and namespace registry
- runTask invokes a task and resolves with its return value
- runTask executes prerequisites in order before running the dependent task
- runTask passes positional arguments to task action handlers
- runTask handles asynchronous promise-returning task actions
- executeTask forces re-execution of a previously completed task
- namespace groups tasks under a colon-separated namespace prefix
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
Código fuente
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/jake@10.9.4 task execution
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/jake@10.9.4
Demonstrate these symbols/APIs:
- jake.Task
- jake.task
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:0c99e8e37e1345d61978e6743fcfc9d9b2b317c783162df237c95c685ccc5f7d","contract":["jake exports Task class and task definition function","task creates a Task instance registered in global and namespace registry","runTask invokes a task and resolves with its return value","runTask executes prerequisites in order before running the dependent task","runTask passes positional arguments to task action handlers","runTask handles asynchronous promise-returning task actions","executeTask forces re-execution of a previously completed task","namespace groups tasks under a colon-separated namespace prefix"],"goal":"verify pkg:npm/jake@10.9.4 task execution","kind":"HOW","packages":["pkg:npm/jake@10.9.4"],"schemaVersion":1,"symbols":["jake.Task","jake.task"]},"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/jake@10.9.4"],"schemaVersion":1,"subject":"pkg:npm/jake@10.9.4","symbols":["jake.Task","jake.task"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-jake",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-jake",
"version": "1.0.0",
"dependencies": {
"jake": "10.9.4"
}
},
"node_modules/async": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz",
"integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==",
"license": "MIT"
},
"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/jake": {
"version": "10.9.4",
"resolved": "https://registry.npmjs.org/jake/-/jake-10.9.4.tgz",
"integrity": "sha512-wpHYzhxiVQL+IV05BLE2Xn34zW1S223hvjtqk0+gsPrwd/8JNLXJgZZM/iPFsYc1xyphF+6M6EvdE5E9MBGkDA==",
"license": "Apache-2.0",
"dependencies": {
"async": "^3.2.6",
"filelist": "^1.0.4",
"picocolors": "^1.1.1"
},
"bin": {
"jake": "bin/cli.js"
},
"engines": {
"node": ">=10"
}
},
"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"
}
},
"node_modules/picocolors": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
"license": "ISC"
}
}
}
{
"name": "sample-jake",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of jake task execution",
"main": "src/index.js",
"dependencies": {
"jake": "10.9.4"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/jake@10.9.4 task execution",
"kind": "HOW",
"packages": [
"pkg:npm/jake@10.9.4"
],
"symbols": [
"jake.Task",
"jake.task"
]
}
const jakeModule = require('jake');
// Ensure quiet mode for programmatic execution
if (jakeModule && jakeModule.program && jakeModule.program.opts) {
jakeModule.program.opts.quiet = true;
}
/**
* Define a task in Jake.
* @param {string} name - Task name.
* @param {string[]|Function} [prereqs] - Prerequisite task names or action.
* @param {Function} [action] - Action callback to execute.
* @param {object} [opts] - Additional options.
* @returns {object} The created Task instance.
*/
function defineTask(name, prereqs, action, opts) {
return jakeModule.task(name, prereqs, action, opts);
}
/**
* Retrieve an existing task by name.
* @param {string} name - Task name or namespaced name (e.g. 'ns:task').
* @returns {object|undefined} The task instance if found.
*/
function getTask(name) {
return jakeModule.Task[name];
}
/**
* Run a task and return a promise resolving with its result.
* @param {object|string} taskOrName - Task instance or task name.
* @param {...any} args - Arguments to pass to the task action.
* @returns {Promise<any>}
*/
function runTask(taskOrName, ...args) {
const taskInstance = typeof taskOrName === 'string' ? getTask(taskOrName) : taskOrName;
if (!taskInstance) {
return Promise.reject(new Error(`Task not found: ${taskOrName}`));
}
return new Promise((resolve, reject) => {
taskInstance.once('complete', (val) => resolve(val));
taskInstance.once('error', (err) => reject(err));
taskInstance.invoke(...args);
});
}
/**
* Execute a task directly (forcing re-run) and return a promise resolving with its result.
* @param {object|string} taskOrName - Task instance or task name.
* @param {...any} args - Arguments to pass to the task action.
* @returns {Promise<any>}
*/
function executeTask(taskOrName, ...args) {
const taskInstance = typeof taskOrName === 'string' ? getTask(taskOrName) : taskOrName;
if (!taskInstance) {
return Promise.reject(new Error(`Task not found: ${taskOrName}`));
}
return new Promise((resolve, reject) => {
taskInstance.once('complete', (val) => resolve(val));
taskInstance.once('error', (err) => reject(err));
taskInstance.execute(...args);
});
}
/**
* Define a namespace containing tasks.
* @param {string} name - Namespace name.
* @param {Function} closure - Function inside which tasks are declared.
* @returns {object} The namespace object.
*/
function defineNamespace(name, closure) {
return jakeModule.namespace(name, closure);
}
module.exports = {
jake: jakeModule,
Task: jakeModule.Task,
task: jakeModule.task,
defineTask,
getTask,
runTask,
executeTask,
defineNamespace
};
import assert from 'node:assert';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
jake,
Task,
task,
defineTask,
getTask,
runTask,
executeTask,
defineNamespace
} = require('../src/index.js');
// 1. jake exports Task class and task definition function
assert.strictEqual(typeof Task, 'function', 'Task should be exported as a class / constructor');
assert.strictEqual(typeof task, 'function', 'task should be exported as a function');
assert.strictEqual(typeof defineTask, 'function', 'defineTask should be a helper function');
assert.strictEqual(typeof runTask, 'function', 'runTask should be a helper function');
assert.strictEqual(typeof executeTask, 'function', 'executeTask should be a helper function');
// 2. task creates a Task instance registered in global and namespace registry
const sampleTask = defineTask('contract-sample-task', () => 'sample-output');
assert.ok(sampleTask instanceof Task, 'defineTask should return an instance of Task');
assert.strictEqual(sampleTask.name, 'contract-sample-task');
assert.strictEqual(getTask('contract-sample-task'), sampleTask);
assert.strictEqual(jake.Task['contract-sample-task'], sampleTask);
// 3. runTask invokes a task and resolves with its return value
const basicResult = await runTask(sampleTask);
assert.strictEqual(basicResult, 'sample-output');
assert.strictEqual(sampleTask.value, 'sample-output');
assert.strictEqual(sampleTask.taskStatus, 'done');
// 4. runTask executes prerequisites in order before running the dependent task
const sequence = [];
defineTask('prereq-alpha', () => {
sequence.push('alpha');
});
defineTask('prereq-beta', ['prereq-alpha'], () => {
sequence.push('beta');
});
defineTask('prereq-main', ['prereq-beta'], () => {
sequence.push('main');
return 'chain-complete';
});
const chainResult = await runTask('prereq-main');
assert.strictEqual(chainResult, 'chain-complete');
assert.deepStrictEqual(sequence, ['alpha', 'beta', 'main']);
// 5. runTask passes positional arguments to task action handlers
let capturedArgs = [];
defineTask('args-task', (first, second, multiplier) => {
capturedArgs = [first, second, multiplier];
return (first + second) * multiplier;
});
const computation = await runTask('args-task', 10, 5, 3);
assert.strictEqual(computation, 45);
assert.deepStrictEqual(capturedArgs, [10, 5, 3]);
// 6. runTask handles asynchronous promise-returning task actions
defineTask('async-delay-task', async () => {
return new Promise((resolve) => {
setTimeout(() => resolve({ status: 'ready', code: 200 }), 15);
});
});
const asyncResult = await runTask('async-delay-task');
assert.deepStrictEqual(asyncResult, { status: 'ready', code: 200 });
// 7. executeTask forces re-execution of a previously completed task
let executionCount = 0;
defineTask('rerun-task', () => {
executionCount++;
return executionCount;
});
const firstRun = await runTask('rerun-task');
assert.strictEqual(firstRun, 1);
assert.strictEqual(executionCount, 1);
const secondRun = await executeTask('rerun-task');
assert.strictEqual(secondRun, 2);
assert.strictEqual(executionCount, 2);
// 8. namespace groups tasks under a colon-separated namespace prefix
defineNamespace('builder', () => {
defineTask('compile', () => 'built-target');
});
const namespacedTask = getTask('builder:compile');
assert.ok(namespacedTask, 'builder:compile task should exist in registry');
assert.strictEqual(namespacedTask.fullName, 'builder:compile');
const builtTarget = await runTask(namespacedTask);
assert.strictEqual(builtTarget, 'built-target');
console.log('Contract tests passed successfully.');
Seeder de origen
anónimo