Skip to content

feat: auto-register console commands and validation filters/rules when created via CLI#1014

Merged
almas-x merged 2 commits intomasterfrom
almas/feat
Apr 18, 2025
Merged

feat: auto-register console commands and validation filters/rules when created via CLI#1014
almas-x merged 2 commits intomasterfrom
almas/feat

Conversation

@almas-x
Copy link
Contributor

@almas-x almas-x commented Apr 18, 2025

📑 Description

Closes https://github.com/goravel/goravel/issues/

✅ Checks

  • Added test cases for my code

Copilot AI review requested due to automatic review settings April 18, 2025 07:21
@almas-x almas-x requested a review from a team as a code owner April 18, 2025 07:21
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 introduces a feature to auto-register console commands created via make:command. Key changes include:

  • Adding a new error message for console command registration failures.
  • Updating the seeder to pass error objects instead of their string representations.
  • Modifying MakeCommand to accept and use a command signature for stub population and command registration.

Reviewed Changes

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

File Description
errors/list.go Adds a new error message to indicate command registration failure.
database/console/seeder_make_command.go Updates error messaging to pass error objects directly.
console/console/make_command_test.go Adds tests for the new command registration process and adjusts signature expectations.
console/console/make_command.go Updates the command stub generation to include a passed signature and registers the new command.
Comments suppressed due to low confidence (2)

console/console/make_command_test.go:65

  • [nitpick] Ensure that the updated command signature 'app:goravel-clean-cache' aligns with the project's naming conventions and documentation for consistency.
assert.True(t, file.Contain("app/console/commands/Goravel/clean_cache.go", "app:goravel-clean-cache"))

console/console/make_command.go:78

  • [nitpick] Verify that the provided signature via m.GetSignature() is correctly formatted and that the transformation meets the intended command registration format.
stub = strings.ReplaceAll(stub, "DummySignature", str.Of(signature).Kebab().Prepend("app:").String())

@codecov
Copy link

codecov bot commented Apr 18, 2025

Codecov Report

Attention: Patch coverage is 95.45455% with 3 lines in your changes missing coverage. Please review.

Project coverage is 70.90%. Comparing base (86e9312) to head (4a769e8).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
console/console/make_command.go 91.66% 0 Missing and 1 partial ⚠️
validation/console/filter_make_command.go 91.66% 0 Missing and 1 partial ⚠️
validation/console/rule_make_command.go 91.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1014      +/-   ##
==========================================
+ Coverage   70.76%   70.90%   +0.13%     
==========================================
  Files         170      170              
  Lines       11635    11690      +55     
==========================================
+ Hits         8234     8289      +55     
  Misses       3048     3048              
  Partials      353      353              

☔ 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.

@almas-x almas-x changed the title feat: auto-register console commands created via make:command feat: auto-register console commands and validation filters/rules when created via CLI Apr 18, 2025
Copy link
Contributor

@hwbrzzl hwbrzzl left a comment

Choose a reason for hiding this comment

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

Perfect 👍

@almas-x almas-x merged commit 5c85774 into master Apr 18, 2025
13 checks passed
@almas-x almas-x deleted the almas/feat branch April 18, 2025 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants