Exemple
cac 6.7.14: cac
Échantillon vérifié pour npm cac 6.7.14: cac. Le contrat s'est exécuté sur node 22 · linux debian/x64 · docker et a réussi : cac initializes a CAC…
sha256:1de1e1c6f7e9997a9f2c1038eb45803f2d1e1736be1c871ba50c3f15c6412209
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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-06 |
Cas
HOW- Objectif
- verify cac.cac in pkg:npm/cac@6.7.14
- Paquets
- Symboles
-
- cac.cac
- Environnement
- node 22.23.2
- Créé
- 2026-09-06T11:45:42Z
Contrat
- cac initializes a CAC command-line application instance with an optional program name
- cac registers sub-commands and passes parsed arguments and command options to action callbacks
- cac registers global options with default values and parses user supplied option values
- cac parses negated boolean flags into false boolean option properties
- cac parses variadic arguments for sub-commands into an array of strings
Fichiers
- .npmrc
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
Code source
audit=false
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 cac.cac in pkg:npm/cac@6.7.14
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/cac@6.7.14
Demonstrate these symbols/APIs:
- cac.cac
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:5af70f52992c783249849e3a37cb6701e94f437081cf94809b32a9925f3f2e56","contract":["cac initializes a CAC command-line application instance with an optional program name","cac registers sub-commands and passes parsed arguments and command options to action callbacks","cac registers global options with default values and parses user supplied option values","cac parses negated boolean flags into false boolean option properties","cac parses variadic arguments for sub-commands into an array of strings"],"goal":"verify cac.cac in pkg:npm/cac@6.7.14","kind":"HOW","packages":["pkg:npm/cac@6.7.14"],"schemaVersion":1,"symbols":["cac.cac"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/cac@6.7.14"],"schemaVersion":1,"subject":"pkg:npm/cac@6.7.14","symbols":["cac.cac"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-cac",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-cac",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"cac": "6.7.14"
}
},
"node_modules/cac": {
"version": "6.7.14",
"resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz",
"integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==",
"license": "MIT",
"engines": {
"node": ">=8"
}
}
}
}
{
"name": "sample-cac",
"version": "1.0.0",
"type": "module",
"private": true,
"description": "verify cac.cac in pkg:npm/cac@6.7.14",
"main": "src/index.mjs",
"license": "MIT-0",
"dependencies": {
"cac": "6.7.14"
}
}
{
"schemaVersion": 1,
"goal": "verify cac.cac in pkg:npm/cac@6.7.14",
"kind": "HOW",
"packages": [
"pkg:npm/cac@6.7.14"
],
"symbols": [
"cac.cac"
]
}
import { cac, CAC, Command } from 'cac';
/**
* Creates a CAC CLI application instance.
*
* @param {string} [name] - Optional program name
* @returns {CAC} CAC application instance
*/
export function createCli(name) {
return cac(name);
}
export { cac, CAC, Command };
export default cac;
import assert from 'node:assert/strict';
import { cac, CAC, Command, createCli } from '../src/index.mjs';
// 1. cac initializes a CAC command-line application instance with an optional program name
{
const namedCli = cac('sample-app');
assert.equal(namedCli instanceof CAC, true);
assert.equal(namedCli.name, 'sample-app');
const defaultCli = cac();
assert.equal(defaultCli instanceof CAC, true);
assert.equal(defaultCli.name, '');
const helperCli = createCli('helper-app');
assert.equal(helperCli instanceof CAC, true);
assert.equal(helperCli.name, 'helper-app');
}
// 2. cac registers sub-commands and passes parsed arguments and command options to action callbacks
{
const cli = cac();
let actionInvoked = false;
let receivedTarget = null;
let receivedOptions = null;
const command = cli.command('build <target>', 'Build artifact')
.option('--minify', 'Minify output bundle')
.action((target, options) => {
actionInvoked = true;
receivedTarget = target;
receivedOptions = options;
});
assert.equal(command instanceof Command, true);
const parsed = cli.parse(['node', 'cli.js', 'build', 'bundle.js', '--minify']);
assert.equal(actionInvoked, true);
assert.equal(receivedTarget, 'bundle.js');
assert.equal(receivedOptions.minify, true);
assert.deepEqual(parsed.args, ['bundle.js']);
assert.equal(parsed.options.minify, true);
}
// 3. cac registers global options with default values and parses user supplied option values
{
const cli = cac();
cli.option('--format <type>', 'Output format', { default: 'esm' });
const parsedDefault = cli.parse(['node', 'cli.js']);
assert.equal(parsedDefault.options.format, 'esm');
const parsedCustom = cli.parse(['node', 'cli.js', '--format', 'cjs']);
assert.equal(parsedCustom.options.format, 'cjs');
}
// 4. cac parses negated boolean flags into false boolean option properties
{
const cli = cac();
cli.option('--sourcemap', 'Emit source maps', { default: true });
const parsed = cli.parse(['node', 'cli.js', '--no-sourcemap']);
assert.equal(parsed.options.sourcemap, false);
}
// 5. cac parses variadic arguments for sub-commands into an array of strings
{
const cli = cac();
let capturedFiles = null;
cli.command('lint [...files]', 'Lint specified files')
.action((files) => {
capturedFiles = files;
});
cli.parse(['node', 'cli.js', 'lint', 'file1.js', 'file2.js', 'file3.js']);
assert.deepEqual(capturedFiles, ['file1.js', 'file2.js', 'file3.js']);
}
Seeder d'origine
anonyme