Skip to content

Conversation

@hwbrzzl
Copy link
Contributor

@hwbrzzl hwbrzzl commented Dec 30, 2025

📑 Description

Closes goravel/goravel#850

image

✅ Checks

  • Added test cases for my code

Copilot AI review requested due to automatic review settings December 30, 2025 08:39
@hwbrzzl hwbrzzl requested a review from a team as a code owner December 30, 2025 08:39
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @hwbrzzl, 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 addresses an issue with the artisan help command by streamlining the command listing functionality. It deprecates the explicit help command, integrating its responsibilities into the list command, and ensures that invoking artisan without arguments correctly displays the available commands. This change simplifies the command-line interface's internal logic and improves consistency.

Highlights

  • Command Default Behavior: The default command executed when artisan is run without any arguments has been changed from help to list.
  • Help Command Removal: The dedicated HelpCommand has been removed, consolidating its functionality into the ListCommand.
  • List Command Refactoring: The ListCommand has been refactored to directly display the application's help using cli.ShowAppHelp, removing its previous dependency on the Artisan facade.
  • Test Updates: Existing test cases have been updated to reflect the removal of the help command and the new behavior of the list command.
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.

Copy link
Contributor

@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 addresses an issue with the artisan help command's behavior. The changes correctly replace the help command with a list command, which is now the default when artisan is run without arguments. The HelpCommand has been removed, and its functionality of displaying the list of all commands has been consolidated into the ListCommand, which now directly calls cli.ShowAppHelp. This refactoring also improves the code by removing a dependency from ListCommand on the Artisan interface. The tests have been updated accordingly to reflect these changes. The overall implementation is clean, correct, and improves the codebase.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an issue with the artisan help command's incorrect behavior by consolidating the help and list commands into a single list command and removing a circular dependency.

  • Removed the separate HelpCommand and its registration
  • Updated ListCommand to directly call cli.ShowAppHelp() instead of using artisan.Call("--help")
  • Changed the default artisan command (when no arguments provided) from help to list

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
console/console/help_command.go Deleted the redundant HelpCommand implementation
console/console/list_command.go Simplified ListCommand by removing artisan dependency and directly using cli.ShowAppHelp()
console/service_provider.go Removed HelpCommand registration and updated ListCommand constructor call
console/application.go Changed default command from "help" to "list" when artisan is invoked without arguments
console/cli_helper_test.go Updated tests to use "list" command instead of "help" command

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (v1.16.x@7eb482e). Learn more about missing BASE report.

Files with missing lines Patch % Lines
console/console/list_command.go 0.00% 3 Missing ⚠️
console/application.go 0.00% 1 Missing ⚠️
console/service_provider.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             v1.16.x    #1329   +/-   ##
==========================================
  Coverage           ?   68.04%           
==========================================
  Files              ?      215           
  Lines              ?    11601           
  Branches           ?        0           
==========================================
  Hits               ?     7894           
  Misses             ?     3327           
  Partials           ?      380           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The help command should be added incorrectly, the list command should be used directly. And the help command is not exposed to users in the document, so it's safe to remove it directly, it's duplicated with the list command.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, they are not redundant, so directly removing the help command is not appropriate. The help command can display help information for a specific command, such as ./artisan help build (which is equivalent to ./artisan build --help), and so on. Laravel also provides this feature, and we also supported this previously.

@almas-x
Copy link
Contributor

almas-x commented Dec 30, 2025

By the way, I noticed that the implementation in

if cliCtx.OptionBool("help") {
return cli.ShowCommandHelp(ctx, cmd, cmd.Name)
}

won’t actually be executed, because the --help flag is handled before the cli action method is called.

@almas-x
Copy link
Contributor

almas-x commented Dec 30, 2025

Alternatively, this PR could just focus on fixing the bug with the artisan list command for now. I can address the help command issue separately later and implement all the help message rendering within the help command itself, rather than using the current Go template approach, which is hard to maintain. I also mentioned this in my previous issue goravel/goravel#761 (Improve Help Message Rendering). In the future, we can make it work like Laravel, supporting features such as displaying help information for a specific group of commands, for example: artisan help make.

@hwbrzzl
Copy link
Contributor Author

hwbrzzl commented Dec 30, 2025

By the way, I noticed that the implementation in

if cliCtx.OptionBool("help") {
return cli.ShowCommandHelp(ctx, cmd, cmd.Name)
}

won’t actually be executed, because the --help flag is handled before the cli action method is called.

--help is normal:

image

The code was optimized in #1243, the global help is disabled due to the concurrent issue.

image

@hwbrzzl
Copy link
Contributor Author

hwbrzzl commented Dec 30, 2025

Yes, it's fine to add the new command artisan help make.

@hwbrzzl hwbrzzl merged commit 5d4c168 into v1.16.x Dec 30, 2025
17 checks passed
@hwbrzzl hwbrzzl deleted the bowen/#850 branch December 30, 2025 09:46
@almas-x
Copy link
Contributor

almas-x commented Dec 30, 2025

By the way, I noticed that the implementation in

if cliCtx.OptionBool("help") {
return cli.ShowCommandHelp(ctx, cmd, cmd.Name)
}

won’t actually be executed, because the --help flag is handled before the cli action method is called.

--help is normal:

image

The code was optimized in #1243, the global help is disabled due to the concurrent issue.

image

I mean this piece of code:

if cliCtx.OptionBool("help") {
	return cli.ShowCommandHelp(ctx, cmd, cmd.Name)
}

won’t execute. You can test it yourself. Also, I didn’t say --help isn’t working—it does work, but that’s solely because the cli package internally handles this flag separately.

@almas-x
Copy link
Contributor

almas-x commented Dec 30, 2025

Yes, it's fine to add the new command artisan help make.

This artisan help make is just an example🥲, not about adding a new command. I’m working on optimizing the help output logic so that it not only supports displaying help information for a single command but also supports displaying help information for a specific category.

@hwbrzzl
Copy link
Contributor Author

hwbrzzl commented Dec 30, 2025

@almas-x if cliCtx.OptionBool("help") should be executed:

image

@almas-x
Copy link
Contributor

almas-x commented Dec 30, 2025

@almas-x if cliCtx.OptionBool("help") should be executed:

image

It won’t execute. Add a print statement before this if to check if it gets printed.

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.

3 participants