Skip to content

[CLI] Improve arg parsing, list-features output, and add --preferences#203

Merged
juharris merged 6 commits intomainfrom
cli-list-details
Apr 8, 2026
Merged

[CLI] Improve arg parsing, list-features output, and add --preferences#203
juharris merged 6 commits intomainfrom
cli-list-details

Conversation

@juharris
Copy link
Copy Markdown
Owner

@juharris juharris commented Apr 8, 2026

Summary

  • Fix arg parsing: Make key a named option (--key/-k) in get-options to resolve ambiguity with --features greedy num_args
  • Improve list-features: Output a JSON array of metadata objects (aliases, owners, details, etc.) instead of plain names; remove --include-aliases flag since aliases are in the metadata
  • Add --preferences/--prefs: Accept a JSON string on get-options and get-all-options that deserializes to GetOptionsPreferences, supporting constraints, overrides, configurable strings, and feature name conversion control

Closes #193

Changes

  • optify/src/provider/get_options_preferences.rs — Add Deserialize + #[serde(default)]
  • optify/src/provider/constraints.rs — Add Deserialize
  • optify-cli/src/main.rs — Named --key arg, JSON list-features, --preferences flag, parse_preferences helper
  • optify-cli/tests/test_cli.sh — 12 integration tests (up from 6) covering constraints, overrides, skip_feature_name_conversion, invalid JSON
  • optify-cli/README.md — Updated docs for all changes
  • README.md — Updated CLI examples

Test plan

  • cargo test -p optify — all 124 library tests pass
  • bash tests/test_cli.sh — all 12 CLI integration tests pass
  • cargo fmt && cargo clippy — clean
  • Manual testing with real config directory (agent-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.

juharris and others added 4 commits April 7, 2026 18:09
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>
@juharris juharris marked this pull request as ready for review April 8, 2026 00:35
juharris and others added 2 commits April 7, 2026 20:55
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>
@juharris juharris merged commit c6b5383 into main Apr 8, 2026
46 of 47 checks passed
@juharris juharris deleted the cli-list-details branch April 8, 2026 01:18
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.

[CLI] add parameter for preferences

1 participant