CodeSampleX

Sample

cac 6.7.14: cac

Verified sample for npm cac 6.7.14: cac. The contract ran on node 22 · linux debian/x64 · docker and passed: cac initializes a CAC command-line application…

sha256:1de1e1c6f7e9997a9f2c1038eb45803f2d1e1736be1c871ba50c3f15c6412209

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Verification-run environments

Environment Contract Stages Run
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

Case

HOW
Goal
verify cac.cac in pkg:npm/cac@6.7.14
Packages
Symbols
  • cac.cac
Environment
node 22.23.2
Created
2026-09-06T11:45:42Z

Contract

  1. cac initializes a CAC command-line application instance with an optional program name
  2. cac registers sub-commands and passes parsed arguments and command options to action callbacks
  3. cac registers global options with default values and parses user supplied option values
  4. cac parses negated boolean flags into false boolean option properties
  5. cac parses variadic arguments for sub-commands into an array of strings

Files

  • .npmrc
  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.mjs
  • test/contract.mjs

Download the source artifact (tar.gz)

Source

.npmrc
audit=false
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 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.
csx.json
{"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"}
package-lock.json
{
  "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"
      }
    }
  }
}
package.json
{
  "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"
  }
}
spec.json
{
  "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"
  ]
}
src/index.mjs
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;
test/contract.mjs
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']);
}

Origin Seeder

anonymous