cli icon indicating copy to clipboard operation
cli copied to clipboard

Generated boolean options can only be set to `true` (no way to send `false`)

Open anilonayy opened this issue 1 month ago • 0 comments

Summary

Every boolean field in the generated commands is registered as a bare commander flag (.option('--autoDeploy', ...)). Passing the flag sends true; there is no way to send false. So you can't turn a setting off from the CLI, e.g. disabling auto-deploy, preview deployments, cleanCache or enabled on a schedule/notification.

For the handful of required boolean inputs (e.g. --isEnabled, --createEnvFile, --enabled), the CLI forces you to pass the flag, so those commands can only ever send true.

Reproduction (@dokploy/cli 0.30.7)

dokploy application update --applicationId <id> --autoDeploy false
# error: too many arguments for 'update'. Expected 0 arguments but got 1.

dokploy application update --applicationId <id> --autoDeploy=false
# error: unknown option '--autoDeploy=false'

dokploy application update --applicationId <id> --no-autoDeploy
# error: unknown option '--no-autoDeploy'

The generated code already converts the string "false" for booleans (opts.x === true || opts.x === "true"), but because the option takes no value, that string can never reach it.

Expected

Some way to send false, e.g. commander's standard negated flag:

dokploy application update --applicationId <id> --no-autoDeploy
# -> {"applicationId":"<id>","autoDeploy":false}

Omitted booleans should still be left out of the request entirely, so a partial update doesn't overwrite unrelated settings.

Root cause

generateOptionLine in scripts/generate.ts emits --<name> for boolean fields and never defines --no-<name>.

anilonayy avatar Oct 11 '26 22:10 anilonayy