[CLI] Improve arg parsing, list-features output, and add --preferences#203
Merged
[CLI] Improve arg parsing, list-features output, and add --preferences#203
Conversation
The positional `key` argument in `get-options` conflicted with `--features` `num_args = 0..` which greedily consumed all following tokens. Changing `key` to a named option (`--key`/`-k`) eliminates the ambiguity so flags can appear in any order. 🤖 Generated with the help of Claude Code. This commit message was generated by AI, but the user has most likely reviewed all of the code changes. Co-Authored-By: Claude <noreply@anthropic.com>
Replace plain-text feature name output with a JSON array of metadata objects (aliases, owners, details, dependents, etc.) so that AI agents and scripts can consume structured feature information directly. Remove the `--include-aliases` flag since aliases are part of the metadata. 🤖 Generated with the help of Claude Code. This commit message was generated by AI, but the user has most likely reviewed all of the code changes. Co-Authored-By: Claude <noreply@anthropic.com>
Add a `--preferences` (alias `--prefs`) flag to `get-options` and `get-all-options` that accepts a JSON string mapping to `GetOptionsPreferences`. This avoids adding individual CLI flags for each preference field as the struct evolves. Derive `Deserialize` on `GetOptionsPreferences` and `Constraints` in the library crate to support JSON deserialization. Closes #193 🤖 Generated with the help of Claude Code. This commit message was generated by AI, but the user has most likely reviewed all of the code changes. Co-Authored-By: Claude <noreply@anthropic.com>
The dry-run resolves optify from crates.io, not the workspace, so it fails when optify-cli depends on unpublished optify changes. 🤖 Generated with the help of Claude Code. This commit message was generated by AI, but the user has most likely reviewed all of the code changes. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
keya named option (--key/-k) inget-optionsto resolve ambiguity with--featuresgreedynum_argslist-features: Output a JSON array of metadata objects (aliases, owners, details, etc.) instead of plain names; remove--include-aliasesflag since aliases are in the metadata--preferences/--prefs: Accept a JSON string onget-optionsandget-all-optionsthat deserializes toGetOptionsPreferences, supporting constraints, overrides, configurable strings, and feature name conversion controlCloses #193
Changes
optify/src/provider/get_options_preferences.rs— AddDeserialize+#[serde(default)]optify/src/provider/constraints.rs— AddDeserializeoptify-cli/src/main.rs— Named--keyarg, JSONlist-features,--preferencesflag,parse_preferenceshelperoptify-cli/tests/test_cli.sh— 12 integration tests (up from 6) covering constraints, overrides, skip_feature_name_conversion, invalid JSONoptify-cli/README.md— Updated docs for all changesREADME.md— Updated CLI examplesTest plan
cargo test -p optify— all 124 library tests passbash tests/test_cli.sh— all 12 CLI integration tests passcargo fmt && cargo clippy— cleanagent-server/config/options)🤖 Generated with the help of Claude Code. This pull request description and possibly the code was generated by AI, but the user has most likely reviewed all of the code changes.