Skip to content

Conversation

georgesdugue
Copy link

This PR

  • Adds openfeature manifest command group for managing flag manifest files
  • Adds manifest add subcommand to add new flags to manifests with type validation and duplicate detection
  • Adds manifest list subcommand to display all flags in a formatted table view
  • Implements comprehensive type validation for all five flag types (boolean, string, integer, float, object)
  • Automatically creates new manifest files if they don't exist
  • Displays updated flag list after successful additions

Related Issues

Fixes #153

Notes

  • The manifest add command validates default values against the specified flag type before adding to the manifest
  • Long descriptions and values are automatically truncated in the list view for better readability
  • Both commands include extensive unit test coverage with edge case handling

Follow-up Tasks

None

How to test

Testing manifest add:

# Add a boolean flag
openfeature manifest add new-feature --default-value false --description "Enable new feature"

# Add a string flag
openfeature manifest add welcome-message --type string --default-value "Hello!" --description "Welcome message for users"

# Add an integer flag
openfeature manifest add max-retries --type integer --default-value 3

# Add a float flag
openfeature manifest add discount-rate --type float --default-value 0.15

# Add an object flag
openfeature manifest add config --type object --default-value '{"key":"value"}'

# Test error handling - try adding duplicate flag
openfeature manifest add new-feature --default-value true
# Should error: "flag 'new-feature' already exists in the manifest"

Copy link

Summary of Changes

Hello @georgesdugue, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the OpenFeature CLI by introducing a dedicated command group for managing feature flag manifests. It provides users with the ability to easily add new flags to a manifest, complete with type validation and duplicate checks, and to view existing flags in a clear, tabular format. This streamlines the process of defining and maintaining feature flags directly from the command line, improving developer experience and consistency.

Highlights

  • New Manifest Command Group: Introduces a new openfeature manifest command group to centralize feature flag manifest management within the CLI.
  • Add Flags to Manifest: Adds a manifest add subcommand for creating new feature flags, featuring robust type validation (boolean, string, integer, float, object) and detection of duplicate flag names.
  • List Flags in Manifest: Implements a manifest list subcommand to display all flags in a manifest in a user-friendly, formatted table, including automatic truncation for long descriptions and values for better readability.
  • Automatic Manifest Creation: Enables automatic creation of a new manifest file if one does not exist when a flag is added, simplifying initial setup.
  • Comprehensive Testing: Includes extensive unit tests for both the add and list commands, covering various flag types, error handling, and manifest creation scenarios to ensure reliability.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces new manifest commands for managing feature flags, including add and list. The implementation is solid and includes comprehensive tests. My review focuses on improving error handling robustness, code maintainability by removing magic numbers, and adhering to standard Go formatting conventions.

@georgesdugue georgesdugue force-pushed the feat/153-manifest-add-flag branch from 3bb2ab7 to 9d8a674 Compare October 3, 2025 12:07
@georgesdugue georgesdugue changed the title Feat/153 manifest add flag feat: manifest command group for adding and listing flags in manifest Oct 3, 2025
@georgesdugue georgesdugue force-pushed the feat/153-manifest-add-flag branch from 9d8a674 to 531200d Compare October 3, 2025 18:44
@georgesdugue georgesdugue force-pushed the feat/153-manifest-add-flag branch from 531200d to 620af57 Compare October 3, 2025 18:45
"flags": {}
}`,
validateResult: func(t *testing.T, fs afero.Fs) {
content, err := afero.ReadFile(fs, "flags.json")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm loving all of these tests! Very robust testing!

This doesn't have to change, but just some food for thought:
a lot of these values like flags.json, existingManifest, flags: {}, etc. are all repeated in these tests and constant. They may be able to be pulled up into the t.Run below that executes validateResult, and that might reduce the lines of code a bit, but it would trade off the ability to customize those values for different test cases if we ever wanted to.

@beeme1mr beeme1mr self-requested a review October 4, 2025 14:01
Copy link
Collaborator

@kriscoleman kriscoleman left a comment

Choose a reason for hiding this comment

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

UAT

Image

worked very well!

@kriscoleman
Copy link
Collaborator

approved!

we'll just need to address the pr lint and pr test failures @georgesdugue

@georgesdugue
Copy link
Author

approved!

we'll just need to address the pr lint and pr test failures @georgesdugue

Thank you! Will address the failing checks soon.

…' commands and lint fix

Signed-off-by: Georges Dugué <[email protected]>
@georgesdugue georgesdugue force-pushed the feat/153-manifest-add-flag branch from c73190d to f4dcd5f Compare October 7, 2025 12:58
@georgesdugue
Copy link
Author

It looks like @kriscoleman's PR #167 has the fix for the Generator Integration Tests failure. I can wait for it to merge and rebase.

@beeme1mr
Copy link
Member

beeme1mr commented Oct 7, 2025

Hey @georgesdugue, I'll try and take a look at this tonight. Thanks!

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.

feat(cli): manifest command with add flag
3 participants