Skip to content

fix(cli): unshadow -y / -f flags and JSON contract for action-less nodes (#370, #421, #422)#439

Open
PeterGuy326 wants to merge 3 commits into
mainfrom
fix/cli-flag-shadow
Open

fix(cli): unshadow -y / -f flags and JSON contract for action-less nodes (#370, #421, #422)#439
PeterGuy326 wants to merge 3 commits into
mainfrom
fix/cli-flag-shadow

Conversation

@PeterGuy326

Copy link
Copy Markdown
Collaborator

Summary

Fixes three CLI-side flag/output bugs, all verified by build + manual run + unit tests on a fresh open build (v1.0.35 baseline).

#370-y shorthand shadowed on todo task delete / skill setup

Both commands registered a local --yes flag without the -y shorthand, shadowing the global persistent -y/--yes. Result: dws todo task delete -y and dws skill setup -y failed with unknown shorthand flag: 'y'.

Fix: Bool("yes", ...)BoolP("yes", "y", ...), matching the already-correct drive delete pattern.

# before: {"error":{"message":"unknown shorthand flag: 'y' in -y"}}
# after:
$ dws todo task delete -y
{"error":{"category":"validation","message":"--task-id is required"}}   # -y parsed
$ dws todo task delete --help   # shows: -y, --yes

#421 — local --format shadows global -f/--format on aitable export data

aitable export data registered a local --format (export format) with the same long name as the global persistent output flag, dropping the -f shorthand on this command (unknown shorthand flag: 'f').

Fix: rename the export flag to --export-format (aligns with doc.go's existing --export-format). The MCP request param key stays "format"; help/examples/tests updated.

# before: dws aitable export data -f json -> unknown shorthand flag: 'f'
# after:
$ dws aitable export data -f json
{"error":{"category":"validation","message":"--base-id is required"}}   # -f works

#422 — action-less group nodes print usage text under -f json

A group node with no tool of its own (e.g. chat group member-role) printed human usage text even when -f json was requested, breaking JSON-only agent/MCP consumers.

Fix: NewGroupCommand now returns a structured validation error (naming the available subcommands) when the user explicitly selects json/ndjson (checked via Changed("format"), mirroring upgrade.go); a bare invocation still shows help, so human discovery UX is unchanged.

$ dws chat group member-role -f json
{"error":{"category":"validation","message":"\"dws chat group member-role\" requires a subcommand"}}
$ dws chat group -f json
{"error":{"category":"validation","message":"... requires a subcommand; available: bots, create, dismiss, ..."}}
$ dws chat group member-role          # no -f -> still prints help

Out of scope

chat group member-role being an empty shell (its list/add/update/remove tools are orphaned under group name group-role vs the declared member-role in discovery config) is a separate discovery-config issue and will be handled via the discovery release flow, not this code PR.

Testing

  • go build ./...
  • go vet ./internal/...
  • go test ./internal/cobracmd/... ./internal/compat/... ./internal/helpers/...
  • Manual runs as shown above on a local open build.

Both commands registered a local --yes flag without the -y shorthand,
shadowing the global persistent -y/--yes so 'dws todo task delete -y'
and 'dws skill setup -y' failed with 'unknown shorthand flag: y'.
Use BoolP("yes","y",...) to match the working drive delete pattern.
…roup nodes (#421, #422)

#421: aitable export data registered a local --format flag with the same
long name as the global persistent output flag --format/-f, dropping the
-f shorthand on that command. Rename the export flag to --export-format
(aligns with doc.go); the MCP param key stays "format".

#422: action-less group nodes printed human usage text even under -f json,
breaking JSON-only consumers. NewGroupCommand now returns a structured
validation error (with available subcommands) when the user explicitly
requests json/ndjson, while a bare invocation still shows help.
The export flag was renamed from --format to --export-format in
aitable_export_import.go (to unshadow the global -f/--format output flag),
but the skill reference docs still taught the old --format excel form,
which now collides with the global output-format flag. Update the four
mono/multi aitable references to match the code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant