From b1e79e4641b3325e6bc41f15e8a9684ddf34e629 Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Sat, 1 Aug 2026 14:01:52 +0200 Subject: [PATCH] fix(dev): keep optional tools optional --- .../command-line/development/index.mdx | 2 +- tools/homarr-dev/README.md | 8 ++-- tools/homarr-dev/main.go | 39 +++++++++---------- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/apps/docs/docs/advanced/command-line/development/index.mdx b/apps/docs/docs/advanced/command-line/development/index.mdx index aa1d3c644..a43f58c1a 100644 --- a/apps/docs/docs/advanced/command-line/development/index.mdx +++ b/apps/docs/docs/advanced/command-line/development/index.mdx @@ -2,7 +2,7 @@ The host-side developer CLI builds and runs local Homarr images and pull-request previews. Run it directly from a checkout with `pnpm dev:cli -- ...`; no shell-specific setup script is required. It is separate from the recovery CLI included in production images. -To install an optional `homarr` binary, run `pnpm dev:cli:install` and make your Go bin directory available on `PATH`. +To install an optional `homarr` binary, run `pnpm dev:cli:install` and make your Go bin directory available on `PATH`. GitHub CLI authentication is only needed for pull-request features. ## Browse development images diff --git a/tools/homarr-dev/README.md b/tools/homarr-dev/README.md index 5c120f535..e0ea4489b 100644 --- a/tools/homarr-dev/README.md +++ b/tools/homarr-dev/README.md @@ -5,17 +5,17 @@ Build and launch local Homarr images and GHCR pull-request builds, then manage t ## Requirements - Docker or OrbStack -- GitHub CLI authenticated with `gh auth login` - Go 1.25+ to build from source +- GitHub CLI authenticated with `gh auth login` for pull-request features ## Setup ```sh pnpm install -pnpm db:migration:sqlite:run ``` -The migration command also seeds a new database. Use `pnpm db:seed` explicitly when you need to reseed an existing database. Start Redis separately with `pnpm docker:dev:up` when it is needed. +Create `.env` from `.env.example` and set `DB_URL` to an absolute path for the SQLite file before running the migration. In a POSIX shell, use `cp .env.example .env`; in PowerShell, use `Copy-Item .env.example .env`. +Then run `pnpm db:migration:sqlite:run` to create or update the database. The migration command also seeds a new database. Use `pnpm db:seed` explicitly when you need to seed an existing database. Start Redis separately with `pnpm docker:dev:up` when it is needed. The examples below use `pnpm dev:cli -- ...`, which works from POSIX shells and PowerShell. If you prefer a global command, install it with `pnpm dev:cli:install` and add your Go bin directory to `PATH`. ## Build @@ -57,7 +57,7 @@ homarr open Open in browser homarr stop Stop homarr restart Restart homarr remove Force-remove -homarr doctor Check Docker, GitHub auth, and PATH +homarr doctor Check Docker and optional CLI integrations ``` ## Development Browser diff --git a/tools/homarr-dev/main.go b/tools/homarr-dev/main.go index b103f52fc..0bd295d8b 100644 --- a/tools/homarr-dev/main.go +++ b/tools/homarr-dev/main.go @@ -49,7 +49,7 @@ Examples: homarr build --pr 6390 # build PR #6390 locally as homarr:pr-6390 homarr list # script-friendly instance list homarr logs homarr_pr_6390 # follow logs - homarr doctor # verify dependencies`, + homarr doctor # check Docker and optional integrations`, Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { return cmd.Help() @@ -207,28 +207,27 @@ var listCmd = &cobra.Command{ var doctorCmd = &cobra.Command{ Use: "doctor", - Short: "Check Docker, GitHub CLI, and local installation", + Short: "Check Docker and optional developer CLI integrations", RunE: func(cmd *cobra.Command, args []string) error { - checks := []struct { - name string - command *exec.Cmd - }{ - {name: "Docker daemon", command: exec.Command("docker", "info", "--format", "{{.ServerVersion}}")}, - {name: "GitHub authentication", command: exec.Command("gh", "auth", "status")}, - } failed := false - for _, check := range checks { - output, err := check.command.CombinedOutput() - if err != nil { - failed = true - fmt.Printf("✗ %s: %s\n", check.name, strings.TrimSpace(string(output))) - } else { - fmt.Printf("✓ %s\n", check.name) - } - } - if _, err := exec.LookPath("homarr"); err != nil { + output, err := exec.Command("docker", "info", "--format", "{{.ServerVersion}}").CombinedOutput() + if err != nil { failed = true - fmt.Println("✗ homarr is not on PATH") + fmt.Printf("✗ Docker daemon: %s\n", strings.TrimSpace(string(output))) + } else { + fmt.Printf("✓ Docker daemon: %s\n", strings.TrimSpace(string(output))) + } + + if _, err := exec.LookPath("gh"); err != nil { + fmt.Println("- GitHub CLI not found (optional; required for pull-request features)") + } else if output, err := exec.Command("gh", "auth", "status").CombinedOutput(); err != nil { + fmt.Printf("- GitHub CLI is not authenticated (optional; run `gh auth login` for pull-request features): %s\n", strings.TrimSpace(string(output))) + } else { + fmt.Println("✓ GitHub CLI authentication") + } + + if _, err := exec.LookPath("homarr"); err != nil { + fmt.Println("- homarr is not on PATH (optional; use `pnpm dev:cli -- ...` or run `pnpm dev:cli:install`)") } else { fmt.Println("✓ homarr is on PATH") }