-
-
Notifications
You must be signed in to change notification settings - Fork 3
breaking: change the interfaces #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis update systematically renames the type and property for command argument definitions from Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant Command
participant ArgsParser
User->>CLI: Provide argv (arguments array)
CLI->>ArgsParser: Parse argv into args (was options)
ArgsParser-->>CLI: Return parsed args
CLI->>Command: Pass args to command handler
Command-->>CLI: Execute with args
CLI-->>User: Output result
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
commit: |
Deploying gunshi with
|
Latest commit: |
c44a542
|
Status: | ✅ Deploy successful! |
Preview URL: | https://6d710afb.gunshi.pages.dev |
Branch Preview URL: | https://breaking-interface-changing.gunshi.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🔭 Outside diff range comments (2)
src/cli.test.ts (1)
235-240
:⚠️ Potential issueInconsistent property name in command3
While the PR has updated all other command definitions to use
args
instead ofoptions
, command3 (lines 235-240) still uses theoptions
property. This is inconsistent with the rest of the changes and would likely cause runtime errors.const command3 = { name: 'command3', description: 'command3 description', - options: { + args: { qux: { type: 'number', short: 'q' } }, run: vi.fn() }src/renderer.test.ts (1)
68-74
:⚠️ Potential issueOne instance of
options
property not renamed in lazy commandThe lazy command for command2 still uses the
options
property instead ofargs
. This needs to be updated for consistency.- options: { + args: { bar: { type: 'boolean', short: 'b', description: 'The bar option' } },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (19)
package.json
(1 hunks)src/cli.test.ts
(20 hunks)src/cli.ts
(9 hunks)src/constants.ts
(2 hunks)src/context.test.ts
(20 hunks)src/context.ts
(11 hunks)src/definition.test.ts
(3 hunks)src/definition.ts
(2 hunks)src/generator.ts
(2 hunks)src/index.ts
(1 hunks)src/renderer.test.ts
(18 hunks)src/renderer/header.ts
(1 hunks)src/renderer/usage.ts
(16 hunks)src/renderer/validation.ts
(2 hunks)src/types.test-d.ts
(2 hunks)src/types.ts
(13 hunks)src/utils.ts
(4 hunks)test/fixtures/register.ts
(2 hunks)test/fixtures/show.ts
(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (6)
src/types.test-d.ts (2)
src/definition.ts (2)
Args
(20-20)define
(27-29)src/types.ts (1)
KeyOfArgOptions
(23-31)
src/renderer/header.ts (1)
src/types.ts (1)
CommandContext
(221-300)
src/generator.ts (1)
src/types.ts (2)
Command
(305-334)CommandOptions
(151-215)
src/renderer/usage.ts (3)
src/definition.ts (2)
Args
(20-20)ArgSchema
(20-20)src/types.ts (2)
CommandContext
(221-300)Command
(305-334)src/utils.ts (1)
resolveBuiltInKey
(63-67)
src/utils.ts (3)
src/definition.ts (1)
Args
(20-20)src/types.ts (6)
Commandable
(445-445)Command
(305-334)CommandBuiltinOptionsKeys
(44-44)CommandBuiltinResourceKeys
(49-50)GenerateNamespacedKey
(36-39)KeyOfArgOptions
(23-31)src/constants.ts (3)
BUILT_IN_PREFIX
(14-14)BUILT_IN_KEY_SEPARATOR
(18-18)OPTION_PREFIX
(16-16)
src/context.ts (2)
src/types.ts (5)
Command
(305-334)CommandContext
(221-300)CommandEnvironment
(74-146)CommandBuiltinKeys
(56-60)CommandResource
(339-350)src/utils.ts (1)
create
(85-87)
🪛 Biome (1.9.4)
src/utils.ts
[error] 70-70: Don't use '{}' as a type.
Prefer explicitly define the object shape. '{}' means "any non-nullable value".
(lint/complexity/noBannedTypes)
🪛 GitHub Check: Spell check with Typos
src/cli.ts
[warning] 36-36:
"Argments" should be "Arguments".
[warning] 86-86:
"Argments" should be "Arguments".
🪛 GitHub Actions: Typos
src/cli.ts
[error] 36-36: Typo detected: Argments
should be Arguments
at usage in code.
[error] 86-86: Typo detected: Argments
should be Arguments
in function name.
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (98)
package.json (1)
112-112
: Dependency update matches interface changesThe version update from "^0.16.2" to "^0.17.0" aligns with the breaking changes mentioned in the PR objectives, supporting the renaming of interfaces from
ArgOptions
toArgs
.src/constants.ts (2)
6-6
: Updated import to reflect new interface namingThe import has been correctly changed from
ArgOptions
toArgs
to align with the breaking changes in the args-tokens package.
48-48
: Updated type annotation for consistencyThe type annotation for
COMMAND_OPTIONS_DEFAULT
has been properly updated to useArgs
instead ofArgOptions
, maintaining type safety with the new interface.src/index.ts (1)
18-18
: Updated exported types to match new interface namesThe type exports have been correctly updated to use the new interface names (
Args
,ArgSchema
) from the args-tokens package while maintainingArgValues
. This change is consistent with the breaking changes described in the PR objectives.test/fixtures/show.ts (3)
3-16
: Renamed constant for consistent terminologyThe object has been correctly renamed from
options
toargs
while maintaining the same structure and functionality.
18-18
: Updated type reference in Command definitionThe Command type parameter has been properly updated to reference the renamed constant.
21-21
: Updated property name for consistencyThe property name has been changed from
options
toargs
to match the new naming convention throughout the codebase.src/definition.test.ts (3)
10-10
: Property name updated correctly toargs
The property has been updated from
options
toargs
in line with the breaking change to rename interfaces in the entire codebase. This change is consistent with the PR objectives.
29-29
: Property name updated correctly toargs
The property name has been correctly changed from
options
toargs
in this command definition, maintaining consistency with the rest of the codebase.
46-46
: Assertion updated to match new property nameThe assertion has been properly updated to check for
args
instead ofoptions
, ensuring the test reflects the new interface naming.src/renderer/header.ts (2)
6-6
: Import updated to useArgs
typeThe import has been correctly updated to use
Args
from 'args-tokens' instead of the previousArgOptions
type, aligning with the breaking change.
14-16
: Generic type parameter renamed consistentlyThe generic type parameter has been renamed from
Options extends ArgOptions
toA extends Args
, and the function parameter type has been updated accordingly. This change is consistent with the naming pattern used in theCommandContext
interface.src/types.test-d.ts (3)
5-5
: Import updated to useArgs
typeThe import has been correctly updated to use
Args
from 'args-tokens' instead of the previousArgOptions
type.
9-9
: Variable name and type assertion updatedThe variable name has been changed from
_options
to_args
, and the type assertion has been updated to useArgs
instead ofArgOptions
. These changes maintain consistency with the new interface naming.Also applies to: 20-21
28-28
: Property name updated toargs
in command definitionThe property key has been correctly changed from
options
toargs
in the command definition, ensuring the test uses the new interface naming convention.src/renderer/validation.ts (2)
6-6
: Import updated to useArgs
typeThe import has been correctly updated to use
Args
from 'args-tokens' instead of the previousArgOptions
type.
15-17
: Generic type parameter renamed consistentlyThe generic type parameter has been renamed from
Options extends ArgOptions
toA extends Args
, and the function parameter type has been updated accordingly. This change maintains consistency with the naming pattern used throughout the codebase.test/fixtures/register.ts (1)
3-3
: Naming update looks good and is consistent with new interfacesThe renaming from
options
toargs
throughout this file (variable declaration, type parameter, and property reference) is consistent with the PR objective to update interface naming conventions.Also applies to: 25-28
src/generator.ts (1)
20-20
: Type parameter renaming is consistent and follows proper generic naming conventionsThe update from
ArgOptions
toArgs
type import and the generic type parameter change fromOptions extends ArgOptions
toA extends Args
is well implemented. Using a short single-letter genericA
is a common convention for the primary type parameter, which improves readability in this context.Also applies to: 30-33
src/cli.test.ts (7)
7-7
: Type import update is consistent with interface changesThe import change from
ArgOptions
toArgs
correctly aligns with the package interface updates.
42-47
: Command argument property renamed correctlyThe property rename from
options
toargs
is properly implemented for the command definition structure.
74-79
: Consistent property renaming in sub-commandsThe property rename from
options
toargs
is consistently applied across sub-command definitions.Also applies to: 84-89
201-206
: Type parameter update in lazy command definitionThe lazy command's
args
property is correctly updated fromoptions
, maintaining consistent terminology throughout the codebase.
214-219
: Command object property rename applied correctlyThe remote command's property is correctly updated from
options
toargs
, ensuring consistency with the new interface.
273-278
: Updated property access in renderUsage functionThe property access in the renderUsage function is correctly updated from
ctx.options
toctx.args
, aligning with the other interface changes.Also applies to: 493-493
320-325
: Type declarations consistently updatedAll type declarations and property definitions are consistently updated to use
args
instead ofoptions
throughout the test cases, including complex test scenarios, edge cases, and type assertions.Also applies to: 357-364, 371-378, 470-545, 528-545, 600-609, 620-625, 635-647, 660-665, 687-693
src/context.test.ts (5)
14-14
: Type import update is consistent with interface changesThe import change from
ArgOptions
toArgs
correctly aligns with the package interface updates.
18-40
: Variable declaration and type assertion updatesVariable declarations and type assertions have been consistently updated from
options
toargs
throughout the test file.Also applies to: 45-48
57-61
: Parameter naming clarification in createCommandContextThe parameter name has been updated from
options
toargs
, and the CLI arguments parameter fromargs
toargv
, which provides better clarity about the purpose of each property.
87-87
: Property access and frozen object checks updatedAll property accesses and object validation checks have been correctly updated to use the new
args
property name instead ofoptions
.Also applies to: 123-125, 135-138
226-242
: Test assertions and resource declarations consistently updatedAll test assertions, resource fetchers, and command declarations throughout the file have been consistently updated to use
args
instead ofoptions
.Also applies to: 246-250, 267-269, 275-295, 306-306, 310-324, 350-356, 367-372, 379-379, 383-397, 422-428, 435-435, 439-453
src/renderer/usage.ts (8)
9-9
: Updated type imports to use the new interface namingThe import statement is now using
Args
andArgSchema
types from 'args-tokens' instead of the previousArgOptions
andArgOptionSchema
, aligning with the breaking interface changes.
19-20
: Type parameter renamed fromOptions extends ArgOptions
toA extends Args
The generic type parameter has been updated to use the new
Args
type, with a shorter nameA
that's more concise while maintaining the same functionality.
196-196
: Updated property reference fromctx.options
toctx.args
The property reference has been updated to use
ctx.args
instead ofctx.options
, consistent with the interface renaming throughout the codebase.
205-205
: Updated property reference fromctx.options
toctx.args
The property reference has been updated to use
ctx.args
instead ofctx.options
for checking if all options have default values.
235-235
: Updated property reference in object iteration fromctx.options
toctx.args
The property reference in the
Object.entries()
call has been updated to usectx.args
instead ofctx.options
, aligning with the renamed interface.
251-251
: Updated property reference in negatable type resolution fromctx.options
toctx.args
The property reference in
resolveNegatableType
function has been updated to usectx.args
instead ofctx.options
.
269-269
: Updated property reference in display value resolution fromctx.options
toctx.args
The property reference in
resolveDisplayValue
function has been updated to usectx.args
instead ofctx.options
.
313-313
: Updated property reference in negatable key handling fromctx.options
toctx.args
The property reference when retrieving schema for a negatable key has been updated to use
ctx.args
instead ofctx.options
.src/renderer.test.ts (16)
5-5
: Updated type import to useArgs
instead ofArgOptions
The import statement now uses the
Args
type from 'args-tokens', aligning with the breaking interface changes.
15-15
: Renamed property fromoptions
toargs
in test fixtureThe test fixture SHOW is now using the
args
property instead ofoptions
to align with the interface changes.
49-49
: Updated type assertion to useCommand<Args>
instead ofCommand<ArgOptions>
The type assertion for the SHOW fixture has been updated to use the new
Args
type.
51-51
: Updated Map generic type parameters to useArgs
The type parameter for the COMMANDS Map has been updated to use the new
Args
type.
55-55
: Renamed property fromoptions
toargs
in command definitionThe command1 definition now uses the
args
property instead ofoptions
to align with the interface changes.
85-85
: Updated type assertions and property names in test context creationThe type assertion now uses
Command<Args>
and the context creation uses theargs
property instead ofoptions
. Also,args
property in createCommandContext has been renamed toargv
to be consistent with the new terminology.Also applies to: 89-94
110-114
: Renamed properties in context creation consistentlyThe context creation function calls have been updated to use
args
instead ofoptions
andargv
instead ofargs
across all test cases, ensuring consistency.
130-134
: Renamed properties in context creationThe test for "no name & no description" has been updated to use the new property names consistently.
146-150
: Renamed properties in context creationThe test for "no version" has been updated to use the new property names consistently.
168-168
: Renamed property fromoptions
toargs
in test fixtureThe command definition in "renderUsage" test now uses the
args
property instead ofoptions
.
195-201
: Updated type assertion and property referencesThe type assertion now uses
Command<Args>
and the context creation accesses theargs
property with the non-null assertion operator.
245-245
: Renamed property fromoptions
toargs
in test fixtureThe command definition in "no required options" test now uses the
args
property instead ofoptions
.
287-287
: Renamed property fromoptions
toargs
in test fixtureThe command definition in "no examples" test now uses the
args
property instead ofoptions
.
335-335
: Renamed property fromoptions
toargs
in test fixtureThe command definition in "enable usageOptionType" test now uses the
args
property instead ofoptions
.
387-392
: Updated property references in context creation for sub commands testThe context creation now accesses the
args
property with the non-null assertion operator and usesargv
instead ofargs
for the command line arguments.
409-413
: Updated property references in context creation for validation errors testThe context creation for the validation errors test now uses the new property names consistently.
src/definition.ts (5)
17-17
: Updated type import to useArgs
instead ofArgOptions
The import statement now uses the
Args
type from 'args-tokens', aligning with the breaking interface changes.
20-20
: Updated re-export to useArgs, ArgSchema
instead ofArgOptions, ArgOptionSchema
The re-export statement now uses the new type names, ensuring consumers of this module will use the new terminology.
27-27
: Updated function signature to useA extends Args
instead of previous typeThe
define
function now uses the new generic type parameter name and constraint.
37-40
: Updated function signature to useA extends Args
in lazy functionThe
lazy
function now uses the new generic type parameter name and constraint for all parameters.
42-46
: Renamed property assignments in lazy function from.options
to.args
The property assignments in the
lazy
function have been updated to use.args
instead of.options
when adding metadata to the loader function.src/types.ts (14)
6-6
: Updated type imports to useArgs
instead ofArgOptions
The import statement now uses the
Args
type from 'args-tokens', aligning with the breaking interface changes.
23-31
: UpdatedKeyOfArgOptions
type to useA extends Args
The utility type has been renamed from
KeyOfArgOptions
to use the newArgs
type parameter, while maintaining the same functionality for extracting keys including negatable boolean options.
66-68
: UpdatedCommandOptionKeys
type to useA extends Args
The utility type now uses the new
Args
type parameter, maintaining the same functionality for generating namespaced option keys.
74-74
: UpdatedCommandEnvironment
interface to useA extends Args
The interface now uses the new
Args
type parameter.
134-138
: Updated render function signatures inCommandEnvironment
to use new type parameterThe render function types now use the updated
CommandContext<A>
with the new type parameter.
142-145
: Updated validation errors render function signatureThe validation errors render function type now uses the updated
CommandContext<A>
with the new type parameter.
151-151
: UpdatedCommandOptions
interface to useA extends Args
The interface now uses the new
Args
type parameter.
200-209
: Updated render function signatures inCommandOptions
to use new type parameterThe render function types now use the updated
CommandContext<A>
with the new type parameter.
221-245
: UpdatedCommandContext
interface to useA extends Args
The interface now uses the new
Args
type parameter, and the property has been renamed fromoptions
toargs
with updated documentation comments to reflect this change.
285-299
: Updated function signatures and type parameters inCommandContext
The
loadCommands
return type andtranslate
function type parameters now use the updatedA extends Args
type parameter.
305-320
: UpdatedCommand
interface to useA extends Args
The interface now uses the new
Args
type parameter, and the property has been renamed fromoptions
toargs
with updated documentation comments to reflect this change.
329-333
: Updated function signatures inCommand
interfaceThe
run
andresource
property types now use the updatedA extends Args
type parameter.
339-359
: UpdatedCommandResource
andCommandResourceFetcher
typesThese types now use the updated
A extends Args
type parameter, maintaining the same functionality.
421-445
: Updated remaining command-related typesThe
CommandRunner
,CommandLoader
,LazyCommand
, andCommandable
types now use the updatedA extends Args
type parameter.src/utils.ts (5)
8-8
: LGTM! Nice update to the imports.The import statement for
Args
from 'args-tokens' correctly reflects the package's newer type system.
19-23
: Correct type parameter renaming.The generic type parameter has been appropriately renamed from
Options extends ArgOptions
toA extends Args
to align with the new type system from args-tokens.
29-29
: Property access update is consistent.Properly renamed property access from
options
toargs
to maintain consistency with the new type naming convention.
45-45
: Property access update is consistent.Properly renamed property access from
options
toargs
to maintain consistency with the new type naming convention.
63-67
: Generic parameter update is correct.The type signature for
resolveBuiltInKey
has been updated to align with the new type system.src/context.ts (10)
30-30
: LGTM! Updated imports align with new type system.The import statement correctly brings in the new types from args-tokens.
45-50
: Interface properly updated with new type parameter and property name.The
CommandContextParams
interface has been correctly updated to useA extends Args
and renamed theoptions
property toargs
.
65-65
: Parameter renamed for clarity.Appropriately renamed from
args
toargv
to better distinguish between command-line arguments and the typed argument schema.
89-102
: Function signature updated to use new generic type.The
createCommandContext
function's signature has been correctly updated to useA extends Args
andV extends ArgValues<A>
instead of the previousOptions
andValues
types.
107-110
: Variable and type update is consistent.Properly updated variable from accessing
args as Args
and creating a newArgs
type.
158-161
: Translation function type parameters updated correctly.The
translate
function's type parameters have been properly updated to usekeyof A
instead of the previous type.
181-182
: Cached commands type update is consistent.The type for
cachedCommands
and the return type ofloadCommands
have been properly updated to useCommand<A>[]
.
198-209
: Context creation uses correct property names.The context creation now correctly uses
args
instead ofoptions
and assignsargv
to the_
property.
222-226
: Renamed variable and property access is appropriate.The variable access has been renamed from
options
toargs
and property access updated accordingly.
236-269
: Function signatures updated properly.The
loadCommandResource
function signature has been appropriately updated to use the new generic type parameters.src/cli.ts (9)
12-12
: LGTM! Updated imports align with new type system.The import statement correctly brings in the new types from args-tokens.
22-26
: Function signature properly updated.The
cli
function signature has been correctly updated to useA extends Args
instead of the previous type.
90-106
: Type parameters and return type properly updated.The
resolveCommandOptions
function has been correctly updated to use the new type parameters.
120-129
: Function signature properly updated.The
showUsage
function has been correctly updated to useA extends Args
instead of the previous type.
131-133
: Function signature properly updated.The
showVersion
function has been correctly updated to useA extends Args
instead of the previous type.
135-145
: Function signature properly updated.The
showHeader
function has been correctly updated to useA extends Args
instead of the previous type.
147-156
: Function signature properly updated.The
showValidationErrors
function has been correctly updated to useA extends Args
instead of the previous type.
158-186
: Function signature and parameters properly updated.The
resolveCommand
function has been correctly updated to use the new type parameters.
188-190
: Function signature properly updated.The
resolveEntryName
function has been correctly updated to useA extends Args
instead of the previous type.
export function resolveOptionKey< | ||
Options extends ArgOptions = {}, | ||
Key extends string = KeyOfArgOptions<RemovedIndex<Options>> | ||
>(key: Key): GenerateNamespacedKey<Key, typeof OPTION_PREFIX> { | ||
A extends Args = {}, | ||
K extends string = KeyOfArgOptions<RemovedIndex<A>> | ||
>(key: K): GenerateNamespacedKey<K, typeof OPTION_PREFIX> { | ||
return `${OPTION_PREFIX}${BUILT_IN_KEY_SEPARATOR}${key}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generic parameter update needs improvement.
The empty object type {}
used as a default generic parameter should be avoided.
-export function resolveOptionKey<
- A extends Args = {},
- K extends string = KeyOfArgOptions<RemovedIndex<A>>
->(key: K): GenerateNamespacedKey<K, typeof OPTION_PREFIX> {
+export function resolveOptionKey<
+ A extends Args = Args,
+ K extends string = KeyOfArgOptions<RemovedIndex<A>>
+>(key: K): GenerateNamespacedKey<K, typeof OPTION_PREFIX> {
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
export function resolveOptionKey< | |
Options extends ArgOptions = {}, | |
Key extends string = KeyOfArgOptions<RemovedIndex<Options>> | |
>(key: Key): GenerateNamespacedKey<Key, typeof OPTION_PREFIX> { | |
A extends Args = {}, | |
K extends string = KeyOfArgOptions<RemovedIndex<A>> | |
>(key: K): GenerateNamespacedKey<K, typeof OPTION_PREFIX> { | |
return `${OPTION_PREFIX}${BUILT_IN_KEY_SEPARATOR}${key}` | |
export function resolveOptionKey< | |
A extends Args = Args, | |
K extends string = KeyOfArgOptions<RemovedIndex<A>> | |
>(key: K): GenerateNamespacedKey<K, typeof OPTION_PREFIX> { | |
return `${OPTION_PREFIX}${BUILT_IN_KEY_SEPARATOR}${key}` | |
} |
🧰 Tools
🪛 Biome (1.9.4)
[error] 70-70: Don't use '{}' as a type.
Prefer explicitly define the object shape. '{}' means "any non-nullable value".
(lint/complexity/noBannedTypes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🔭 Outside diff range comments (2)
docs/guide/essentials/declarative-configuration.md (2)
16-18
:⚠️ Potential issueNote: Missed property rename in basic structure example
The property name in the basic declarative structure example still uses
options
instead ofargs
. This should be updated to maintain consistency with the interface changes.Apply this diff to fix the inconsistency:
// Command options - options: { + args: { // Option definitions },
140-142
: 🛠️ Refactor suggestionUpdate section title to match new terminology
The section titled "Command Options" should be updated to "Command Arguments" to maintain consistency with the interface changes.
Apply this diff to update the section title:
-### Command Options +### Command Arguments
🧹 Nitpick comments (2)
docs/guide/essentials/internationalization.md (1)
250-251
: Consider updating the terminology in documentation textThe documentation text still refers to "Option Descriptions" and mentions that keys for descriptions of command options must be prefixed with
Option:
. Since the property has been renamed fromoptions
toargs
, consider updating this terminology for complete consistency.- **Option Descriptions**: Keys for the descriptions of command options **must** be prefixed with `Option:`. For example, if you have an option named `target`, its description key must be `Option:target`. - **Negatable Option Descriptions**: For boolean options (e.g., `--verbose`), Gunshi automatically generates a description for the negatable version (e.g., `--no-verbose`) using the built-in `NEGATABLE` key (e.g., "Negatable of --verbose"). To provide a custom translation for a specific negatable option, use the pattern `Option:no-<optionName>`, for example, `Option:no-verbose`. + **Argument Descriptions**: Keys for the descriptions of command arguments **must** be prefixed with `Option:`. For example, if you have an argument named `target`, its description key must be `Option:target`. + **Negatable Argument Descriptions**: For boolean arguments (e.g., `--verbose`), Gunshi automatically generates a description for the negatable version (e.g., `--no-verbose`) using the built-in `NEGATABLE` key (e.g., "Negatable of --verbose"). To provide a custom translation for a specific negatable argument, use the pattern `Option:no-<optionName>`, for example, `Option:no-verbose`.docs/guide/essentials/declarative-configuration.md (1)
175-175
: Interface update: renamed 'options' to 'args' in context object descriptionThe context object property description has been updated from
options
toargs
to align with the breaking interface changes.There appears to be a formatting issue here. Add a colon after "with" to match the style of other list items:
-The `run` function receives a command context object (`ctx`) with: +The `run` function receives a command context object (`ctx`) with:🧰 Tools
🪛 LanguageTool
[uncategorized] ~175-~175: Loose punctuation mark.
Context: ...d context object (ctx
) with: -args
: The command arguments configuration - `...(UNLIKELY_OPENING_PUNCTUATION)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
playground/deno/deno.lock
is excluded by!**/*.lock
📒 Files selected for processing (25)
.vscode/settings.json
(1 hunks)docs/guide/advanced/custom-usage-generation.md
(8 hunks)docs/guide/advanced/documentation-generation.md
(6 hunks)docs/guide/advanced/translation-adapter.md
(3 hunks)docs/guide/essentials/auto-usage-generation.md
(2 hunks)docs/guide/essentials/composable.md
(2 hunks)docs/guide/essentials/declarative-configuration.md
(2 hunks)docs/guide/essentials/getting-started.md
(1 hunks)docs/guide/essentials/internationalization.md
(6 hunks)docs/guide/essentials/lazy-async.md
(5 hunks)docs/guide/essentials/type-safe.md
(3 hunks)playground/auto-usage/index.js
(1 hunks)playground/bun/index.ts
(2 hunks)playground/composable/index.js
(4 hunks)playground/custom-usage/index.js
(2 hunks)playground/declarative/index.js
(2 hunks)playground/deno/deno.json
(1 hunks)playground/deno/main.ts
(2 hunks)playground/docs-gen/index.js
(1 hunks)playground/i18n/index.js
(1 hunks)playground/lazy-async/index.js
(2 hunks)playground/modularization-lazy-async/commands/bar/meta.js
(1 hunks)playground/modularization-lazy-async/commands/foo/meta.js
(1 hunks)playground/type-safe-lazy-async/index.ts
(2 hunks)playground/type-safe/index.ts
(1 hunks)
✅ Files skipped from review due to trivial changes (8)
- playground/deno/deno.json
- .vscode/settings.json
- docs/guide/essentials/type-safe.md
- docs/guide/advanced/documentation-generation.md
- docs/guide/advanced/translation-adapter.md
- docs/guide/advanced/custom-usage-generation.md
- docs/guide/essentials/lazy-async.md
- docs/guide/essentials/composable.md
🧰 Additional context used
🪛 LanguageTool
docs/guide/essentials/declarative-configuration.md
[uncategorized] ~175-~175: Loose punctuation mark.
Context: ...d context object (ctx
) with: - args
: The command arguments configuration - `...
(UNLIKELY_OPENING_PUNCTUATION)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (33)
playground/modularization-lazy-async/commands/foo/meta.js (1)
4-4
: Breaking change: Renamedoptions
toargs
This is part of the PR's intended breaking change to standardize the naming convention for command argument definitions. The rename from
options
toargs
is more appropriate for supporting positional arguments as mentioned in the PR objectives.playground/i18n/index.js (1)
11-11
: Breaking change: Renamedoptions
toargs
This property rename aligns with the PR's breaking changes to support positional arguments. The command's functionality remains intact as all argument references in the
run
function (viactx.values
) are unchanged.playground/docs-gen/index.js (1)
9-9
: Breaking change: Renamedoptions
toargs
This property rename is consistent with the standardization effort across the codebase to support positional arguments. The implementation details in the
run
function remain unaffected as arguments are still accessed viactx.values
.playground/modularization-lazy-async/commands/bar/meta.js (1)
4-4
: Breaking change: Renamedoptions
toargs
This property rename completes the standardization of command argument definitions. The command definition remains functionally identical, with only the property name changing from
options
toargs
.docs/guide/essentials/getting-started.md (1)
70-70
: Property name updated to align with the new API.The change from
options
toargs
is part of a breaking change to support positional arguments, as mentioned in the PR objectives. This update correctly reflects the new API in the documentation example.playground/type-safe/index.ts (1)
9-9
: Property name updated to align with the new API.The change from
options
toargs
is consistent with the breaking changes being introduced to support positional arguments. This ensures the type-safe example remains compatible with the updated API.playground/bun/index.ts (2)
8-8
: Property name updated for createCommand definition.The renaming from
options
toargs
in the createCommand definition aligns with the breaking changes being implemented across the codebase.
34-34
: Property name updated for mainCommand definition.The renaming from
options
toargs
in the mainCommand definition maintains consistency with the API changes.playground/lazy-async/index.js (2)
14-14
: Property name updated in lazyCommandDefinition.The change from
options
toargs
in the lazyCommandDefinition is part of the consistent renaming across the codebase to support the new positional arguments feature.
53-53
: Property name updated in asyncDataDefinition.The change from
options
toargs
in the asyncDataDefinition aligns with the breaking changes being introduced to the API.playground/custom-usage/index.js (3)
11-11
: Property rename fromoptions
toargs
looks goodThis change is part of a breaking change to rename the property for command argument definitions from
options
toargs
throughout the codebase. The change is consistent with the PR objectives.
102-102
: Property reference updated correctlyThe context property reference has been updated from
ctx.options
toctx.args
to align with the renamed property.
105-105
: Object.entries iteration updated correctlyThe iteration over command arguments has been properly updated to use
ctx.args
instead ofctx.options
.playground/auto-usage/index.js (1)
11-12
: Comment and property renamed consistentlyBoth the comment describing arguments and the property name have been updated from
options
toargs
. This maintains consistency with the breaking change throughout the codebase.playground/declarative/index.js (2)
12-13
: Comment and property renamed consistentlyBoth the comment and property have been updated from "options" to "args", maintaining consistency with the breaking change.
52-52
: Console log statement updated correctlyThe console.log statement has been updated to reflect the property rename from
ctx.options
toctx.args
, and the label has been updated from 'Options:' to 'Args:' for consistency.docs/guide/essentials/internationalization.md (2)
23-23
: Documentation examples updated consistentlyAll code examples in the internationalization documentation have been updated to use the
args
property instead ofoptions
. This ensures the documentation remains in sync with the code changes.Also applies to: 118-118, 182-182, 262-262, 324-324, 385-385
1-467
:✅ Verification successful
Verify if the
Option:
prefix needs to be renamedThe codebase has been updated to rename
options
toargs
, but the translation key prefix remainsOption:
in all documentation examples (lines 40-41, 50-51, 156-157, 168-169, 272-273, 450-451, 462-463). Verify if this prefix should also be renamed for consistency, or if it should remain asOption:
despite the property rename.
🏁 Script executed:
#!/bin/bash # Check if the Option: prefix is used in the actual code # Look for translation keys with Option: prefix rg -A 1 "Option:" --type ts src/Length of output: 1732
No change needed for
Option:
prefix
The codebase (e.g.resolveOptionKey
and its tests insrc/context.test.ts
) still expects translation keys to be prefixed withOption:
. The documentation examples are already correct and should remain as-is.🧰 Tools
🪛 LanguageTool
[uncategorized] ~151-~151: Loose punctuation mark.
Context: ...mple locale files:locales/en-US.json
: ```json { "description": "Greeting a...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~163-~163: Loose punctuation mark.
Context: ...: "Good day" }`locales/ja-JP.json`:
json { "description": "挨拶アプリケーション...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~445-~445: Loose punctuation mark.
Context: ...With locale files:locales/en-US.json
: ```json { "description": "Greeting a...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~457-~457: Loose punctuation mark.
Context: ...: "Good day" }`locales/ja-JP.json`:
json { "description": "挨拶アプリケーション...(UNLIKELY_OPENING_PUNCTUATION)
docs/guide/essentials/auto-usage-generation.md (2)
16-17
: Interface update: replaced 'options' property with 'args'This change is part of the breaking interface update mentioned in the PR description. The command argument definition property has been renamed from
options
toargs
to better support positional arguments.
119-119
: Interface update: renamed property in createCommand from 'options' to 'args'Consistent renaming of the command argument definition property from
options
toargs
in the subcommand example.playground/composable/index.js (4)
10-10
: Interface update: renamed 'options' to 'args' in createCommandThe property for defining command arguments has been renamed from
options
toargs
to align with the breaking interface changes.
34-34
: Interface update: renamed 'options' to 'args' in listCommandThe property for defining command arguments has been renamed from
options
toargs
to align with the breaking interface changes.
63-63
: Interface update: renamed 'options' to 'args' in deleteCommandThe property for defining command arguments has been renamed from
options
toargs
to align with the breaking interface changes.
98-99
: Interface update: renamed 'options' to 'args' in mainCommandThe property for defining command arguments has been renamed from
options
toargs
to align with the breaking interface changes. The comment has also been updated accordingly.playground/deno/main.ts (2)
11-11
: Interface update: renamed 'options' to 'args' in createCommandConsistent renaming of the command argument definition property from
options
toargs
to align with the breaking interface changes in the Deno TypeScript implementation.
48-48
: Interface update: renamed 'options' to 'args' in mainCommandConsistent renaming of the command argument definition property from
options
toargs
to align with the breaking interface changes in the Deno TypeScript implementation.docs/guide/essentials/declarative-configuration.md (1)
43-44
: Interface update: renamed 'options' to 'args' in command definitionThe property for defining command arguments has been renamed from
options
toargs
to align with the breaking interface changes. The comment has also been updated accordingly.playground/type-safe-lazy-async/index.ts (6)
9-9
: Interface updated fromoptions
toargs
as described in PRThe property has been correctly renamed from
options
toargs
in this command definition, aligning with the breaking change mentioned in the PR objectives.
19-19
: Type alias renamed fromHelloOptions
toHelloArgs
The type alias has been properly renamed and its reference to
helloDefinition.args
has been updated to match the new property name.
22-24
: Comments updated to reflect new type namingThe documentation comments have been updated to correctly reference the new type naming convention using
HelloArgs
.
24-24
: Return type updated fromCommandRunner<HelloOptions>
toCommandRunner<HelloArgs>
The loader function's return type has been properly updated to maintain type consistency with the renamed interfaces.
32-33
: Parameter type updated for context objectThe context parameter type and associated comment have been correctly updated to reflect the new type system.
1-63
:✅ Verification successful
Verify the version compatibility with updated args-tokens dependency
The code changes properly reflect the interface renaming from "options" to "args" to support positional arguments. Since this integrates with the updated args-tokens dependency (from ^0.16.2 to ^0.17.0 as mentioned in the AI summary), make sure your package.json is also updated accordingly.
🏁 Script executed:
#!/bin/bash # Check if package.json has been updated with the correct args-tokens version grep -r "args-tokens" --include="package*.json" .Length of output: 93
args-tokens dependency version confirmed
The package.json specifies
"args-tokens": "^0.17.0"
, matching the required update for the renamed “args” interface. No further changes are needed.
Description
This PR is related to breaking changes in args-tokens.
About details, below issue links and copilot reviews
This PR is necessary to support positional arguments
Linked Issues
Additional context
Summary by CodeRabbit