Skip to content

Comments

refactor: replace project debug command with doctor command#859

Merged
Soner (shyim) merged 1 commit intomainfrom
refactor/replace-debug-with-doctor
Feb 20, 2026
Merged

refactor: replace project debug command with doctor command#859
Soner (shyim) merged 1 commit intomainfrom
refactor/replace-debug-with-doctor

Conversation

@shyim
Copy link
Member

Summary

  • Replace the project debug command with an improved project doctor command
  • Doctor command provides better project health checks with visual indicators
  • Displays extensions/bundles in a formatted table with relative paths
  • Makes project directory optional (defaults to current working directory)

Test plan

  • Test shopware-cli project doctor in a Shopware project
  • Test shopware-cli project doctor /path/to/project with explicit path
  • Verify project config detection works correctly

Replaces the debug command with an improved doctor command that provides
better project health checks and displays extensions/bundles in a table format.
Copilot AI review requested due to automatic review settings February 20, 2026 08:39
@shyim Soner (shyim) merged commit 2af6d9f into main Feb 20, 2026
5 checks passed
@shyim Soner (shyim) deleted the refactor/replace-debug-with-doctor branch February 20, 2026 08:42
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 pull request replaces the project debug command with an improved project doctor command that provides better project health checks with visual indicators and formatted output.

Changes:

  • Replaced project debug command with project doctor command
  • Added visual indicators (✓ and ⚠) for different status types using the lipgloss library
  • Changed from internal/table to lipgloss/table for improved table formatting
  • Made the project directory argument optional (defaults to current working directory)
  • Displays relative paths for extensions/bundles instead of absolute paths

Reviewed changes

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

File Description
cmd/project/project_doctor.go New command implementation with improved UX, visual indicators, and optional project directory argument
cmd/project/project_debug.go Removed old debug command that required explicit project directory argument

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

fmt.Println(doctorSectionStyle.Render("Project"))
fmt.Println()

shopCfg, err := shop.ReadConfig(cmd.Context(), projectConfigPath, true)
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The config file is being read from the current working directory instead of from the projectDir specified in the arguments. When a user runs shopware-cli project doctor /path/to/project, the command should read the config from /path/to/project/.shopware-project.yml, but currently it reads from the current working directory. To fix this, the config path should be constructed based on projectDir when projectConfigPath is a relative path. Consider using filepath.Join(projectDir, filepath.Base(projectConfigPath)) if projectConfigPath is not an absolute path, or change to the projectDir before reading the config.

Suggested change
shopCfg, err := shop.ReadConfig(cmd.Context(), projectConfigPath, true)
configPath := projectConfigPath
if !filepath.IsAbs(configPath) {
configPath = filepath.Join(projectDir, filepath.Base(configPath))
}
shopCfg, err := shop.ReadConfig(cmd.Context(), configPath, true)

Copilot uses AI. Check for mistakes.
if shopCfg.IsFallback() {
fmt.Printf("%s Project config: %s\n", doctorCheckWarn, color.SecondaryText.Render("not found, using fallback"))
} else {
fmt.Printf("%s Project config: %s\n", doctorCheckOK, color.GreenText.Render(shop.DefaultConfigFileName()))
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

When displaying the project config filename, the code uses shop.DefaultConfigFileName() which returns the default filename in the current working directory. This may not reflect the actual config file that was read, especially if the user specified a custom path via the --project-config flag. Consider using projectConfigPath instead, or better yet, displaying the actual file path that was read to avoid confusion.

Suggested change
fmt.Printf("%s Project config: %s\n", doctorCheckOK, color.GreenText.Render(shop.DefaultConfigFileName()))
configDisplayName := projectConfigPath
if configDisplayName == "" {
configDisplayName = shop.DefaultConfigFileName()
}
fmt.Printf("%s Project config: %s\n", doctorCheckOK, color.GreenText.Render(configDisplayName))

Copilot uses AI. Check for mistakes.
)

var projectDoctor = &cobra.Command{
Use: "doctor",
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The Use field should document the optional project directory argument. Following the pattern used in other commands like admin-build, it should be "doctor [project-dir]" instead of just "doctor" to make it clear that a project directory can be optionally specified.

Suggested change
Use: "doctor",
Use: "doctor [project-dir]",

Copilot uses AI. Check for mistakes.

var projectDoctor = &cobra.Command{
Use: "doctor",
Short: "Check your Shopware project for potential problems",
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The command should explicitly validate the number of arguments using Args field. Since the command accepts an optional project directory (0 or 1 arguments), add Args: cobra.MaximumNArgs(1) to the command definition. This will provide a clear error message if users accidentally provide too many arguments, rather than silently ignoring them.

Suggested change
Short: "Check your Shopware project for potential problems",
Short: "Check your Shopware project for potential problems",
Args: cobra.MaximumNArgs(1),

Copilot uses AI. Check for mistakes.
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.

1 participant