cli icon indicating copy to clipboard operation
cli copied to clipboard

CLI new UI/UX implementation

Open Amzani opened this issue 1 year ago • 8 comments
trafficstars

Problem

After https://github.com/asyncapi/cli/issues/872 completion, we now have a visual direction of what needs to be implemented in the CLI.

Scope

  • [ ] https://github.com/asyncapi/cli/issues/1215
  • [ ] Implement new UI/UX improvements in new command
  • [ ] Implement new UI/UX improvements in config command
  • [ ] Implement new UI/UX improvements in convert command
  • [ ] Implement new UI/UX improvements in generate command
  • [ ] Implement new UI/UX improvements in optimize command
  • [ ] Implement new UI/UX improvements in start command
  • [ ] Implement new UI/UX improvements in validate command

Amzani avatar Mar 07 '24 12:03 Amzani

Great @Amzani, we can make some decisions in parallel too.

There was a great proposal by @fmvilas on clack

Shurtu-gal avatar Mar 07 '24 12:03 Shurtu-gal

Great @Shurtu-gal, I don't know clack, does it replace oclif? In case we need to change Oclif, this might help https://github.com/asyncapi/server-api/issues/485#issuecomment-1961317382

Amzani avatar Mar 07 '24 14:03 Amzani

@Amzani I believe we can take it as a reference, and build our own design system to not face problems down the line.

Some reference https://codecryrepeat.hashnode.dev/learn-how-to-create-a-beautiful-cli-application-with-the-oclif-and-clackprompts

Shurtu-gal avatar Mar 07 '24 14:03 Shurtu-gal

@Shurtu-gal I see that we can just use @clack/prompts https://codecryrepeat.hashnode.dev/learn-how-to-create-a-beautiful-cli-application-with-the-oclif-and-clackprompts So you are not blocked by https://github.com/asyncapi/cli/pull/1200

Amzani avatar Mar 12 '24 08:03 Amzani

Bounty Issue's service comment

Text labels: bounty/2024-Q2, bounty/advanced, bounty/coding First assignment to third-party contributors: 2024-03-22 00:00:00 UTC+12:00 End Of Life: 2024-08-31 23:59:59 UTC-12:00

@asyncapi/bounty_team

aeworxet avatar Mar 18 '24 15:03 aeworxet

@utnim2 @Shurtu-gal already started to work on the foundations, I think once he finish you can be part of it, as we need to implement DX in remaining commands.

Amzani avatar Mar 19 '24 06:03 Amzani

@Amzani Please assign @Shurtu-gal and do not disperse the assignment, as unlike usual GitHub issues, the Bounty Issue can be worked on by only one person.

aeworxet avatar Mar 19 '24 07:03 aeworxet

@Amzani I was looking into this, and I am faced with some doubts:- The current output looks something like:- image

And the updated one is like given here

  • How are we supposed to get the docs link for a specific error?
  • How are we supposed to intelligently pass on next step for the user?

Shurtu-gal avatar Mar 25 '24 07:03 Shurtu-gal

Also clack/prompts is not required I suppose as similar things are there in oclif. Of course I will try it once and see if it provides any benefits and check things out.

Shurtu-gal avatar Mar 25 '24 07:03 Shurtu-gal

@Shurtu-gal

How are we supposed to get the docs link for a specific error?

The warning/errors that you mention are coming from spectral and our custom ruleset @smoya you confirm ?

How are we supposed to intelligently pass on next step for the user?

We can update the rulesets to inject the links, or do some magic with the parser, @smoya could have a better idea.

Amzani avatar Mar 25 '24 08:03 Amzani

@Shurtu-gal

How are we supposed to get the docs link for a specific error?

The warning/errors that you mention are coming from spectral and our custom ruleset @smoya you confirm ?

Validation of v3 is done via some of the rules in https://github.com/asyncapi/parser-js/blob/58ae9387dd3d717af05debf8416deb1cac65bfd9/src/ruleset/ruleset.ts (those that are not filtered to apply exclusively to Spec v2) and https://github.com/asyncapi/parser-js/blob/58ae9387dd3d717af05debf8416deb1cac65bfd9/src/ruleset/v3/ruleset.ts, which are exclusive to Spec v3.

How are we supposed to intelligently pass on next step for the user?

We can update the rulesets to inject the links, or do some magic with the parser, @smoya could have a better idea.

Not trivial at all. We would need to either modify each of the functions that validate to understand the errors and match with some kind of dictionary of links/solutions, or rather parse the final output with some regex or similar and match with link/solutions. ATM, I can't think on a really easy to do stuff. For example, the rule that validates via JSON Schema is just one function, but under the hood uses a JSON Schema validator tool we don't control, so we only get an error message and a path to the error.

smoya avatar Mar 26 '24 07:03 smoya

Bounty Issue's Timeline

Complexity Level Assignment date (by GitHub) Start date (by BP rules) End date (by BP rules) Draft PR submission Final PR submission Final PR merge
Advanced 2024-03-27 2024-04-01 2024-05-24 2024-04-19 2024-05-10 2024-05-24
Please note that the dates given represent deadlines, not specific dates, so if the goal is reached sooner, it's better.
Keep in mind the responsibility for violations of the Timeline.

aeworxet avatar Mar 27 '24 09:03 aeworxet

Hi @Amzani, I would like to work on the issues mentioned above. Can you please assign them to me? (If @Shurtu-gal is not working on them)

helios2003 avatar Apr 24 '24 05:04 helios2003

I had an issue while testing the CLI, whenever I change any code in src/commands/new/file.ts for example build the project and run the asyncapi commands again, why isn't the new command displayed on the terminal? I checked and the correctly transpiled code is present in the ./lib directory as well. Should I do something else as well along with this command?

helios2003 avatar Apr 24 '24 06:04 helios2003

@helios2003, the above issues are atomic tasks of this Bounty Issue which is already assigned to @shurtu-gal, and he IS working on them.

aeworxet avatar Apr 24 '24 07:04 aeworxet

Oh okay, since the issues were opened individually I thought they were open for other contributors as well. Thanks for the clarification @aeworxet

helios2003 avatar Apr 24 '24 08:04 helios2003

I had an issue while testing the CLI, whenever I change any code in src/commands/new/file.ts for example build the project and run the asyncapi commands again, why isn't the new command displayed on the terminal?

@helios2003 Could you be a bit more specific about this issue? Thanks :)

peter-rr avatar Apr 25 '24 09:04 peter-rr

Sure @peter-rr , so the issue I am experiencing is as follows:
When I make any changes in the files in the src directory (like making any changes to the prompts displayed to the user in the terminal) and run the command npm run build, the project builds and the modified transpiled code resides in the ./lib directory. After this when I try to run the required command, my custom prompts do not come appear the default prompts appear on the screen. So is there something I am missing or how do I make it work?
My general point is how do I view the changes I make in the CLI codebase myself?

helios2003 avatar Apr 25 '24 13:04 helios2003

Hey @helios2003 are you using the ./bin/run to run it?

Shurtu-gal avatar Apr 26 '24 18:04 Shurtu-gal

Yes @Shurtu-gal

helios2003 avatar Apr 29 '24 01:04 helios2003

Could you share the link to your branch where the changed code resides?

Would be easier to get to the root from there.

Shurtu-gal avatar Apr 29 '24 17:04 Shurtu-gal

Hey @Shurtu-gal, this is the link to the branch https://github.com/helios2003/cli/tree/check-error. I made a few trivial changes to the prompts (for demonstration purposes) and even after following the steps I mentioned above, the changed prompts weren't visible on screen. Can you please check if you can reproduce the same error on your side?

helios2003 avatar May 03 '24 05:05 helios2003

Hey @Shurtu-gal, this is the link to the branch https://github.com/helios2003/cli/tree/check-error. I made a few trivial changes to the prompts (for demonstration purposes) and even after following the steps I mentioned above, the changed prompts weren't visible on screen. Can you please check if you can reproduce the same error on your side?

@helios2003, sadly I couldn't reproduce it. It's working perfectly fine as can be seen in the picture below.

image

Are you following the requisite steps?

  • npm run build
  • ./bin/run new file

Shurtu-gal avatar May 03 '24 07:05 Shurtu-gal

@Amzani all the commands have been migrated for which designs were provided. I couldn't find designs for optimize, config and start command.

Shurtu-gal avatar May 03 '24 07:05 Shurtu-gal

@Shurtu-gal, I followed the required steps in my originally cloned repo, but the issue persisted. So, I decided to clone the project into a new path, and after setting it up, the problem disappeared, and it worked as expected. I suspect it may have been due to corruption along the particular path in my filesystem. Thanks a lot for the help, and my apologies for any inconvenience caused, as it turned out to be a local issue from my side.

helios2003 avatar May 03 '24 11:05 helios2003

@Mayaleeeee could you please provide the designs for the rest of the commands as well.

Shurtu-gal avatar May 04 '24 11:05 Shurtu-gal

@Shurtu-gal If you have collected enough statistical information while doing PR https://github.com/asyncapi/cli/pull/1302 and PR https://github.com/asyncapi/cli/pull/1398 to understand in what direction the CLI commands' design goes, would you be able to do the rest of commands by yourself? (new commands will be added over time anyway, so process for inheriting the design from the existing one needs to be developed in any case)

@Amzani Would you agree with such an approach?

aeworxet avatar May 07 '24 10:05 aeworxet

@aeworxet yes, that was the initial idea to bootstrap the new DX direction and apply to the rest of commands. We can even flag the remaining issues as first-time-issues

Amzani avatar May 07 '24 10:05 Amzani

@Amzani Decide, please, to what extent this issue should be completed so both

  • this Bounty Issue could be considered completed
  • https://github.com/asyncapi/cli/issues/872 could be closed

aeworxet avatar May 07 '24 10:05 aeworxet

Ok @aeworxet let's close it and consider it done.

Amzani avatar May 07 '24 14:05 Amzani