refactor(cli): Updated configuration commands and mechanism #310
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.
User description
Description
Changes in command
This PR makes the following changes to the CLI:
configure
commandprofile
commandinit
commandinit command
Architectural changes
base.command.ts
class got a completely new overhaul that now allows you to seamlessly develop the commands by using OOP principles to the fullest.--profile
or the--api-key
and--base-url
in order.PR Type
Enhancement, Other
Description
BaseCommand
class to serve as the base for all CLI commands, providing methods for setting global context fields and handling command options and arguments.configure
command and its related types and implementation.init
command for initializing project configurations, including prompts for user input and configuration file writing.profile
command to manage CLI profiles, with subcommands for creating, updating, listing, using, and deleting profiles.run
command to extendBaseCommand
, updating methods for fetching configurations and connecting to the socket.Configuration
type in HTTP-related files.configure
command and add theprofile
andinit
commands, along with global options for profile, API key, and base URL.Changes walkthrough 📝
14 files
base.command.ts
Introduce BaseCommand class for CLI commands
apps/cli/src/commands/base.command.ts
BaseCommand
class to serve as the base for all CLIcommands.
command options and arguments.
init.command.ts
Add init command for project configuration
apps/cli/src/commands/init.command.ts
init
command for initializing project configurations.profile.command.ts
Add profile command with subcommands
apps/cli/src/commands/profile.command.ts
profile
command to manage CLI profiles.deleting profiles.
create.profile.ts
Add create profile subcommand
apps/cli/src/commands/profile/create.profile.ts
delete.profile.ts
Add delete profile subcommand
apps/cli/src/commands/profile/delete.profile.ts
list.profile.ts
Add list profile subcommand
apps/cli/src/commands/profile/list.profile.ts
update.profile.ts
Add update profile subcommand
apps/cli/src/commands/profile/update.profile.ts
use.profile.ts
Add use profile subcommand
apps/cli/src/commands/profile/use.profile.ts
run.command.ts
Refactor run command to extend BaseCommand
apps/cli/src/commands/run.command.ts
run
command to extendBaseCommand
.socket.
index.ts
Update CLI entry point with new commands
apps/cli/src/index.ts
configure
command and addedprofile
andinit
commands.command.types.d.ts
Add new types for command options and arguments
apps/cli/src/types/command/command.types.d.ts
run.types.d.ts
Add new types for run command
apps/cli/src/types/command/run.types.d.ts
index.types.d.ts
Add new types for project and profile configurations
apps/cli/src/types/index.types.d.ts
configurations.
configuration.ts
Add methods for profile and private key configurations
apps/cli/src/util/configuration.ts
configurations.
4 files
configure.command.ts
Remove configure command from CLI
apps/cli/src/commands/configure/configure.command.ts
configure
command and its implementation.configure.types.d.ts
Remove configure command types
apps/cli/src/commands/configure/configure.types.d.ts
configure
command.secret.ts
Update import paths for Configuration type
apps/cli/src/http/secret.ts
Configuration
type.variable.ts
Update import paths for Configuration type
apps/cli/src/http/variable.ts
Configuration
type.