Skip to content

feat(cli)!: Scope project/workspace yargs options per command#1434

Merged
matz3 merged 1 commit into
mainfrom
refactor/scope-cli-options
Jun 26, 2026
Merged

feat(cli)!: Scope project/workspace yargs options per command#1434
matz3 merged 1 commit into
mainfrom
refactor/scope-cli-options

Conversation

@matz3

@matz3 matz3 commented Jun 25, 2026

Copy link
Copy Markdown
Member

The yargs options --config / -c, --dependency-definition, --workspace-config,
and --workspace / -w were previously registered globally in base.js and shown
in --help for every command. Several commands silently ignored them:

  • ui5 config / init / versions did not load a project at all
  • ui5 add / remove / use only operate on ui5.yaml without workspace context

Move the option definitions into a new options.js helper module that exposes
applyProjectConfigOptions() and applyWorkspaceOptions(). Each command builder
now opts in to the option groups it actually consumes, and yargs' existing
strict mode rejects the options on commands that no longer accept them.

The shared last-value-wins dedupe coerce is exported as dedupeArray() so
commands can apply it to their own non-global options (framework-version,
dest, port, etc.) instead of relying on a central coerce list in base.js
that referenced options yargs only sees per-command.

BREAKING CHANGE: ui5 versions, ui5 init, and ui5 config no longer accept
--config, --dependency-definition, --workspace, or --workspace-config.
ui5 add, ui5 remove, and ui5 use no longer accept --workspace or
--workspace-config. Passing any of these to a command that does not
support them now fails with 'Unknown argument: '.

The yargs options --config / -c, --dependency-definition, --workspace-config,
and --workspace / -w were previously registered globally in base.js and shown
in --help for every command. Several commands silently ignored them:

  * ui5 config / init / versions did not load a project at all
  * ui5 add / remove / use only operate on ui5.yaml without workspace context

Move the option definitions into a new options.js helper module that exposes
applyProjectConfigOptions() and applyWorkspaceOptions(). Each command builder
now opts in to the option groups it actually consumes, and yargs' existing
strict mode rejects the options on commands that no longer accept them.

The shared last-value-wins dedupe coerce is exported as dedupeArray() so
commands can apply it to their own non-global options (framework-version,
dest, port, etc.) instead of relying on a central coerce list in base.js
that referenced options yargs only sees per-command.

BREAKING CHANGE: ui5 versions, ui5 init, and ui5 config no longer accept
--config, --dependency-definition, --workspace, or --workspace-config.
ui5 add, ui5 remove, and ui5 use no longer accept --workspace or
--workspace-config. Passing any of these to a command that does not
support them now fails with 'Unknown argument: <option>'.
@matz3 matz3 requested review from a team June 25, 2026 10:35
@RandomByte

Copy link
Copy Markdown
Member

Regarding the commit message, it might be worth explicitly stating that the no longer accepted arguments already didn't have any effect in the past

@matz3

matz3 commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

Regarding the commit message, it might be worth explicitly stating that the no longer accepted arguments already didn't have any effect in the past

"Several commands silently ignored them" and the following bullet points explain that. Do you think that can be misunderstood?

@matz3 matz3 merged commit 06cdf28 into main Jun 26, 2026
59 checks passed
@matz3 matz3 deleted the refactor/scope-cli-options branch June 26, 2026 07:18
@RandomByte

Copy link
Copy Markdown
Member

Sorry, I meant the BREAKING CHANGES paragraph. In the old setup, only that text would be visible right in the release note. Not sure how it is with release please now. But yeah, if you click through to the PR you'll find a good explanation 👍

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.

2 participants