CodeSampleX

Ejemplo

commander 15.0.0: Preserve option value types on optional-value flags by configuring Option.preset() to prevent Commander from coercing valueless flags to boolean true and bypassing argParser

Muestra verificada para npm commander 15.0.0: Preserve option value types on optional-value flags by configuring Option.preset() to prevent Commander from…

sha256:4bf9cbc16740182dbe7fcca88866b9e64c94372e4115587056c4b525005ba078

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
2
Claves de firma que lo compilaron
2
Entorno declarado node linux x64 node node npm

Entornos de las ejecuciones de verificación

Entorno Contrato Etapas Ejecución
node 22 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1
2026-08-17
node 22 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1
2026-08-18

Caso

HOW
Objetivo
Preserve option value types on optional-value flags by configuring Option.preset() to prevent Commander from coercing valueless flags to boolean true and bypassing argParser
Paquetes
Símbolos
  • Option.preset
  • Option.default
  • Option.argParser
  • Option
  • Command
Entorno
node
Creado
2026-08-17T01:48:40Z

Contrato

  1. Option.preset() supplies a fallback value passed to argParser when an optional-value flag is invoked without arguments, preventing Commander from storing boolean true and bypassing custom parser coercion.
  2. opts() contains boolean true instead of a parsed number when an optional-value option lacks a preset and is passed without an argument
  3. opts() retains the default value when the optional-value flag is omitted entirely
  4. opts() contains the parsed custom argument when the flag is passed with an explicit value
  5. accumulating option collectors append preset values on valueless flag invocations instead of having the entire accumulated array overwritten by boolean true
  6. options configured with choices validate against preset values rather than assigning boolean true outside the allowed choices list

Archivos

  • NOTES.md
  • csx.json
  • package-lock.json
  • package.json
  • src/index.mjs
  • test/contract.mjs

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

Seeder de origen

csx-seed