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

未关闭 适合新手
#58 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@anilonayy 已经在做这个了。

开始于 2026年10月11日。

  • #59 来自 @anilonayy —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
领域
cli

调研方向

阅读 scripts/generate.ts,从 generateOptionLine 开始,检查生成的布尔选项如何传递到请求转换。更新生成的选项,使调用方能够发送 false,同时省略的布尔值仍不包含在部分更新中。完成标准是所示的 --no-autoDeploy 示例会发送 autoDeploy: false,且现有的布尔值行为仍然正常。

由索引模型根据 Issue 内容生成。

描述

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>.

主要语言
TypeScript
星标
175
派生
52
平均合并
2 天 10 小时
30 天内合并 PR
2

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Dokploy/cli 的其他 Issue

查看 Dokploy/cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。