Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 25, 2025

Enhances manifest add to interactively prompt for missing required and optional properties, improving usability while maintaining automation compatibility.

Changes

  • Interactive prompts for missing values

    • Prompts for --type when omitted, with "boolean" pre-selected as default
    • Prompts for --default-value when omitted, with type-specific input (select for boolean, text for others)
    • Prompts for --description when omitted, skippable with Enter
    • Reuses existing promptForDefaultValue function from pull.go
  • Automation safeguards

    • Respects existing --no-input flag to disable all prompts
    • Auto-detects non-TTY stdin (tests, CI, pipes) and disables prompting automatically
    • Returns error when required flags missing in non-interactive mode
    • Moved TTY detection to shared utility config.ShouldDisableInteractivePrompts() for reuse by other commands
  • Test coverage

    • Tests for --no-input behavior with missing required/optional flags
    • Test for auto-detection of non-interactive environments
    • Updated existing test to use --no-input for missing default-value case
  • Documentation

    • Updated command help text to document interactive mode
    • Auto-generated documentation includes interactive mode examples and usage

Example

# Before: required error
$ openfeature manifest add my-flag
ERROR   --default-value is required

# After: interactive prompts
$ openfeature manifest add my-flag
Select type for flag 'my-flag':
> boolean
  string
  integer
  float
  object
Enter default value for flag 'my-flag' (boolean):
> false
  true
Enter description for flag 'my-flag' (press Enter to skip): 
SUCCESS  Flag 'my-flag' added successfully

# Automation unchanged
$ openfeature manifest add my-flag --no-input
ERROR   --default-value is required
Original prompt

This section details on the original issue you should resolve

<issue_title>Enhance manifest add command: interactive prompting for required and optional properties</issue_title>
<issue_description>### Summary
Improve the manifest add command to prompt users interactively for any required properties (such as --default-value) that are omitted from the initial command invocation. If an optional property (such as --description) is omitted, prompt the user as well but allow them to easily skip (e.g., press Enter).

Requirements

  • When a required property is missing, prompt the user interactively during execution.
  • When an optional property is missing (e.g., description), prompt with a clear way to skip.
  • The CLI respects the existing --no-input flag, which disables all interactive prompts (including for required and optional properties). This is essential for CI and automation workflows.
  • Existing CLI flag behavior remains unchanged when all required flags are provided.

Motivation

  • Improves usability for new and existing users.
  • Encourages best practices and better documentation via optional prompts.
  • Ensures the CLI remains friendly for automation and scripting.

Implementation notes

  • The CLI already supports --no-input at the root level – ensure all new prompting logic respects this flag.
  • Prompt for optional properties (such as description) in a way that makes skipping easy (e.g., pressing Enter for none).
  • Do not change the schema or validation logic for required/optional fields; only improve the prompting/user experience.
  • Edge cases such as piping, redirection, or automation environments must continue to work as they do today.

Example user workflow

If a user runs:

openfeature manifest add my-flag

Prompt for missing required properties (e.g., default-value). Also prompt for optional properties (e.g., description), but allow skipping.

If a user runs:

openfeature manifest add my-flag --default-value true --description "Flag description"

No prompts are shown.

If a user runs:

openfeature manifest add my-flag --no-input

No prompts are shown, even for missing required or optional properties.


No further work is needed to add the --no-input flag, as this already exists.</issue_description>

<agent_instructions>Please use existing libraries and patterns for logging and prompting the user.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Enhance manifest add command with interactive prompts Add interactive prompting to manifest add command Oct 25, 2025
Copilot AI requested a review from beeme1mr October 25, 2025 14:12
Copilot finished work on behalf of beeme1mr October 25, 2025 14:12
@beeme1mr beeme1mr changed the title Add interactive prompting to manifest add command feat: add interactive prompting to manifest add command Oct 25, 2025
Copy link
Member

@beeme1mr beeme1mr left a comment

Choose a reason for hiding this comment

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

@copilot are there any docs that need to be updated?

Copy link
Contributor Author

Copilot AI commented Oct 25, 2025

@copilot are there any docs that need to be updated?

Yes, the documentation has been updated. The docs/commands/openfeature_manifest_add.md file is auto-generated from the command's Long description. I've updated the Long description to include information about interactive mode, and regenerated the docs in commit 6759088. The documentation now explains:

  • How interactive mode works
  • What values are prompted for
  • How to disable prompts with --no-input
  • Examples of both interactive and non-interactive usage

Copilot finished work on behalf of beeme1mr October 25, 2025 14:32
Copilot AI requested a review from beeme1mr October 25, 2025 14:32
@beeme1mr beeme1mr marked this pull request as ready for review October 25, 2025 14:36
@beeme1mr beeme1mr requested a review from kriscoleman October 25, 2025 14:36
Signed-off-by: Michael Beemer <[email protected]>
@beeme1mr beeme1mr merged commit 9d8b2ce into main Oct 28, 2025
6 checks passed
@beeme1mr beeme1mr deleted the copilot/enhance-manifest-add-command branch October 28, 2025 19:00
return errors.New("flag-key argument is required when --no-input is set")
}
// Prompt for flag key
promptText := "Enter flag key (e.g., 'my-feature', 'enable-new-ui')"
Copy link
Collaborator

Choose a reason for hiding this comment

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

@beeme1mr this is a good idea, the prompting will help us in demo, we won't need to remember the cli flags/args as much

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.

Enhance manifest add command: interactive prompting for required and optional properties

3 participants