Skip to content

feat(schema): Enhance argument and option schema with default values, validation, and advanced options#18

Merged
ioncakephper merged 1 commit intomainfrom
docs/readme-order-props
Dec 8, 2025
Merged

feat(schema): Enhance argument and option schema with default values, validation, and advanced options#18
ioncakephper merged 1 commit intomainfrom
docs/readme-order-props

Conversation

@ioncakephper
Copy link
Copy Markdown
Owner

This commit expands the capabilities for defining CLI arguments and options by introducing several new properties and a dedicated default object structure.

The default object is now available for both argument and option definitions. It allows specifying default values using one of three methods: a literal value, a fromConfig path to retrieve a value from a configuration file, or a dynamic fn (JavaScript arrow function).

Key enhancements for option objects include:

  • arguments: Allows defining arguments that can be associated with a specific option.
  • choices: Provides a mechanism to restrict an option's value to a predefined list, aiding in validation.
  • range: Enables specifying a numerical minimum and maximum for an option's value, useful for numeric types.
  • required: A boolean flag to indicate if an option is mandatory.
  • variadic: A boolean flag to allow an option to accept multiple values.

Furthermore, properties within the cli and command object documentation have been reordered for improved clarity and logical grouping.

… validation, and advanced options

This commit expands the capabilities for defining CLI arguments and options by introducing several new properties and a dedicated `default` object structure.

The `default` object is now available for both `argument` and `option` definitions. It allows specifying default values using one of three methods: a literal `value`, a `fromConfig` path to retrieve a value from a configuration file, or a dynamic `fn` (JavaScript arrow function).

Key enhancements for `option` objects include:
- `arguments`: Allows defining arguments that can be associated with a specific option.
- `choices`: Provides a mechanism to restrict an option's value to a predefined list, aiding in validation.
- `range`: Enables specifying a numerical minimum and maximum for an option's value, useful for numeric types.
- `required`: A boolean flag to indicate if an option is mandatory.
- `variadic`: A boolean flag to allow an option to accept multiple values.

Furthermore, properties within the `cli` and `command` object documentation have been reordered for improved clarity and logical grouping.
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @ioncakephper, 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 schema definition capabilities for CLI arguments and options. The primary goal is to provide more robust and flexible ways to define default values, validate inputs, and structure command-line interfaces. These changes empower developers to create more sophisticated and user-friendly CLI tools by offering richer configuration and validation options directly within the schema.

Highlights

  • Enhanced Argument and Option Schema: Introduced a new default object for both argument and option definitions, allowing default values to be specified as a literal value, retrieved fromConfig via a path, or dynamically generated by a fn (JavaScript arrow function).
  • Advanced Option Properties: Expanded the option object with new properties including arguments (to associate arguments with an option), choices (for value validation), range (for numerical min/max), required (to mark as mandatory), and variadic (to accept multiple values).
  • Documentation Clarity: Reordered properties within the cli and command object documentation for improved readability and logical grouping.
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.

@ioncakephper ioncakephper merged commit e96a42c into main Dec 8, 2025
1 check passed
@ioncakephper ioncakephper deleted the docs/readme-order-props branch December 8, 2025 13:47
Copy link
Copy Markdown

@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 does a good job of updating the README.md to document several new schema features. The new documentation is clear, and reordering existing tables alphabetically is a nice improvement for readability. I've left one comment suggesting an improvement for consistency.

However, it's important to note that this PR only contains changes to the README.md file. The actual implementation of the new schema properties and validation logic described in the PR description and the updated README seems to be missing. If this is intended to be a documentation-only PR, it might be better to align the PR title and description accordingly. If the implementation is meant to be included, it appears to have been omitted from the commit.

Comment on lines +187 to +189
| `value` | `string`, `number`, `boolean`, `array`, `object` | A literal value to use as the default. |
| `fromConfig` | `string` | A dot-notation path to retrieve a value from a configuration file (e.g., `user.name`). |
| `fn` | `string` | A JavaScript arrow function that returns the default value. The `program` object is available as an argument. |
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

For consistency with the other property tables in this document (e.g., for cli, command, option), which are sorted alphabetically, it would be best to also sort the properties in the default object table. This improves readability and makes the documentation structure more predictable.

Suggested change
| `value` | `string`, `number`, `boolean`, `array`, `object` | A literal value to use as the default. |
| `fromConfig` | `string` | A dot-notation path to retrieve a value from a configuration file (e.g., `user.name`). |
| `fn` | `string` | A JavaScript arrow function that returns the default value. The `program` object is available as an argument. |
| `fn` | `string` | A JavaScript arrow function that returns the default value. The `program` object is available as an argument. |
| `fromConfig` | `string` | A dot-notation path to retrieve a value from a configuration file (e.g., `user.name`). |
| `value` | `string`, `number`, `boolean`, `array`, `object` | A literal value to use as the default. |

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.

1 participant