feat: add enum type for positional arguments - #136
Open
nickita-khylkouski wants to merge 8 commits into
Open
Conversation
Member
|
Is there a reason that the |
Author
|
Thanks for the feedback! I've updated the implementation to address your points: Changes made:
Could you take another look when CI completes? |
Implements bloomberg#88 This adds support for enum-constrained positional arguments, similar to how enum flags work. Users can now define positional parameters that only accept specific string values. Features: - BaseEnumPositionalParameter interface for type-safe enum positionals - Runtime validation with typo suggestions using Damerau-Levenshtein distance - Completion support for enum values - Help text formatting showing (value1|value2|value3) format - Support for optional, required, and default value scenarios Example: positional: { kind: "enum", values: ["small", "medium", "large"] as const, parameter: { brief: "Size selection", placeholder: "size", parse: String, }, } Signed-off-by: Nickita Khylkouski <90287684+nickita-khylkouski@users.noreply.github.com>
Addressed maintainer feedback to make enum positionals look identical
to enum flags. The nested `parameter` property has been removed in favor
of a flat structure.
Changes:
- BaseEnumPositionalParameter now has direct properties (brief, placeholder, optional, default)
- Updated scanner.ts to read from flat structure
- Added default value display in help text (matches flag behavior)
- Added completion satisfaction check (stop suggesting after filled)
- Added comprehensive formatting tests
Before:
positional: {
kind: "enum",
values: [...] as const,
parameter: { brief, optional } // nested
}
After:
positional: {
kind: "enum",
values: [...] as const,
brief, optional, placeholder, default // flat
}
Signed-off-by: Nickita Khylkouski <90287684+nickita-khylkouski@users.noreply.github.com>
- Run prettier on modified files - Add missing enum positional snapshots - Fix completion satisfaction check (stop suggesting after filled) Signed-off-by: Nickita Khylkouski <90287684+nickita-khylkouski@users.noreply.github.com>
Signed-off-by: Nickita Khylkouski <90287684+nickita-khylkouski@users.noreply.github.com>
Signed-off-by: Nickita Khylkouski <90287684+nickita-khylkouski@users.noreply.github.com>
- Remove unused CONTEXT generic from BaseEnumPositionalParameter - Add type annotations to fix implicit 'any' type errors - Fix void expression in arrow function for test - Add eslint-disable comments for internal imports - Update PositionalParameters type to match new interface Signed-off-by: Nickita Khylkouski <90287684+nickita-khylkouski@users.noreply.github.com>
Signed-off-by: Nickita Khylkouski <90287684+nickita-khylkouski@users.noreply.github.com>
Signed-off-by: Nickita Khylkouski <90287684+nickita-khylkouski@users.noreply.github.com>
molisani
force-pushed
the
feat/issue-88-enum-positional
branch
from
February 10, 2026 16:28
5951b4c to
3881d07
Compare
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.
Resolves #88
This adds support for enum-constrained positional arguments, similar to how enum flags work.
Features
BaseEnumPositionalParameterinterface for type-safe enum positionals(value1|value2|value3)formatExample
Tests