Skip to content

Add --condition-mode option to projects-add-feature-conditionally#99

Merged
ondrajodas merged 3 commits into
mainfrom
ondra/feature-conditionally-condition-mode
Jul 1, 2026
Merged

Add --condition-mode option to projects-add-feature-conditionally#99
ondrajodas merged 3 commits into
mainfrom
ondra/feature-conditionally-condition-mode

Conversation

@ondrajodas

Copy link
Copy Markdown
Contributor

Summary

Adds a --condition-mode option to the manage:projects-add-feature-conditionally command, allowing the condition check to be inverted.

Behavior

--condition-mode (default present) controls how the condition feature is evaluated:

  • present – add the target feature only to projects that have the condition feature (previous behavior)
  • absent – add the target feature only to projects that do not have the condition feature

In both modes, projects that already have the target feature are skipped, and disabled projects are skipped. Invalid --condition-mode values are rejected with a clear error.

Notes

  • Default is present, so the change is backward compatible.
  • Skip and dry-run messages now reflect the actual state of the project's condition feature.
  • The result counter was renamed to projectsSkippedByCondition and the summary line reworded, since in absent mode the skipped projects are the ones that do have the condition feature.
  • README.md updated with the new option and an absent example.

Verification

  • composer phpcs – passes
  • composer phpstan – no errors

Allows inverting the condition check. With --condition-mode=present
(default) the target feature is added to projects that have the
condition feature; with --condition-mode=absent it is added to projects
that do not have it. Invalid values are rejected.
@ondrajodas

Copy link
Copy Markdown
Contributor Author
# Release Notes
The `manage:projects-add-feature-conditionally` command gains a `--condition-mode=present|absent` option (default `present`). With `present` the target feature is added to projects that have the condition feature; with `absent` it is added to projects that do not have it. Behavior without the option is unchanged.

# Plans for Customer Communication
None required. Internal operator/maintenance CLI tool; no customer-facing change.

# Impact Analysis
Affects only the cli-utils tooling. No new API endpoints are used. Backward compatible: the default mode reproduces the previous behavior. Without -f the command only reads and reports. Risk is limited to applying the target feature to an unintended set of projects if the mode/feature names are wrong; mitigated by the default dry run, up-front feature-existence validation, and rejection of invalid --condition-mode values.

# Change Type
Feature (new option on an existing CLI command).

# Justification
Enables the inverse use case: bulk-enabling a feature on projects that are missing a given feature, not only on those that already have it. No Linear issue associated.

# Deployment Plan
No deployment needed. Ships with the cli-utils image and is available once merged. No config changes or migrations.

# Rollback Plan
Revert the PR. The change is additive (a new option) with no persisted state; reverting restores the prior command with no side effects.

# Post-Release Support Plan
Operators should run without -f first to review the dry-run summary (disabled / skipped-by-condition / already-having-target / updatable counts), then re-run with -f. Watch for Manage API rate limits on full-stack runs over large numbers of projects.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the manage:projects-add-feature-conditionally CLI command with a --condition-mode option to control whether projects are selected when the condition feature is present (default, backward compatible) or absent (inverted behavior), and updates user-facing output and documentation accordingly.

Changes:

  • Added --condition-mode (present|absent) input option with validation and plumbing through all processing paths.
  • Updated per-project output and result counters/summary to reflect whether the condition was met.
  • Updated README.md usage and examples to document the new option and inverted mode.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/Keboola/Console/Command/ProjectsAddFeatureConditionally.php Adds --condition-mode option, validates it, applies inverted condition logic, and updates skip/output + summary counters.
README.md Documents the new --condition-mode option and provides an absent mode example.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Keboola/Console/Command/ProjectsAddFeatureConditionally.php
Comment thread src/Keboola/Console/Command/ProjectsAddFeatureConditionally.php Outdated
@ondrajodas ondrajodas marked this pull request as ready for review July 1, 2026 09:34
@ondrajodas ondrajodas requested a review from odinuv July 1, 2026 09:35
The condition-feature argument now accepts a comma-separated list. With
--condition-mode=present the target feature is added to projects that
have all of them; with --condition-mode=absent to projects that have
none of them.

@odinuv odinuv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asi lgbt

@ondrajodas

Copy link
Copy Markdown
Contributor Author

asi jo, mám to vyzkoušený na obou PAYGO stacích

@ondrajodas ondrajodas merged commit f2ae5f5 into main Jul 1, 2026
1 check passed
@ondrajodas ondrajodas deleted the ondra/feature-conditionally-condition-mode branch July 1, 2026 10:44
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.

3 participants