cli

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 48 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SupportedPHPVersions = []string{"8.1", "8.2", "8.3", "8.4", "8.5"}

SupportedPHPVersions lists the PHP versions lerd can build FPM images for.

Functions

func CollectRunningWorkerNames added in v1.5.0

func CollectRunningWorkerNames(site *config.Site) []string

CollectRunningWorkerNames returns the names of active workers for the site, including stripe. Used to sync .lerd.yaml.

func HorizonStartForSite added in v1.0.0

func HorizonStartForSite(siteName, sitePath, phpVersion string) error

HorizonStartForSite starts Laravel Horizon for the named site as a systemd service. If a queue worker is running for the same site it is stopped first, since Horizon manages queues and the two must not run simultaneously.

func HorizonStopForSite added in v1.0.0

func HorizonStopForSite(siteName string) error

HorizonStopForSite stops and removes the Horizon unit for the named site.

func IsMCPGloballyRegistered added in v1.1.0

func IsMCPGloballyRegistered() bool

IsMCPGloballyRegistered reports whether lerd is already registered at user scope in Claude Code. Used by the install command to skip the prompt if already set up.

func ListVendorBins added in v1.7.0

func ListVendorBins(cwd string) []string

ListVendorBins returns the names of executable files in <cwd>/vendor/bin, sorted alphabetically. Returns an empty slice if the directory doesn't exist.

func NewAboutCmd added in v1.0.0

func NewAboutCmd() *cobra.Command

NewAboutCmd returns the about command.

func NewAutostartCmd added in v0.3.0

func NewAutostartCmd() *cobra.Command

NewAutostartCmd returns the autostart command with enable/disable subcommands.

func NewCheckCmd added in v1.5.0

func NewCheckCmd() *cobra.Command

NewCheckCmd returns the check command.

func NewConsoleCmd added in v1.2.0

func NewConsoleCmd() *cobra.Command

NewConsoleCmd returns the console command — runs framework console in the project's container.

func NewDashboardCmd added in v0.8.0

func NewDashboardCmd() *cobra.Command

NewDashboardCmd returns the dashboard command.

func NewDbCmd added in v0.4.0

func NewDbCmd() *cobra.Command

NewDbCmd returns the db parent command with import/export/create/shell subcommands.

func NewDbCreateCmd added in v0.5.1

func NewDbCreateCmd() *cobra.Command

NewDbCreateCmd returns the standalone db:create command.

func NewDbExportCmd added in v0.4.0

func NewDbExportCmd() *cobra.Command

NewDbExportCmd returns the standalone db:export command.

func NewDbImportCmd added in v0.4.0

func NewDbImportCmd() *cobra.Command

NewDbImportCmd returns the standalone db:import command.

func NewDbShellCmd added in v0.5.1

func NewDbShellCmd() *cobra.Command

NewDbShellCmd returns the standalone db:shell command.

func NewDoctorCmd added in v0.9.0

func NewDoctorCmd() *cobra.Command

NewDoctorCmd returns the doctor command.

func NewDomainCmd added in v1.5.0

func NewDomainCmd() *cobra.Command

NewDomainCmd returns the domain command with add/remove/list subcommands.

func NewEnvCheckCmd added in v1.5.0

func NewEnvCheckCmd() *cobra.Command

NewEnvCheckCmd returns the env:check command.

func NewEnvCmd added in v0.3.0

func NewEnvCmd() *cobra.Command

NewEnvCmd returns the env command.

func NewFetchCmd added in v0.4.0

func NewFetchCmd() *cobra.Command

NewFetchCmd returns the fetch command.

func NewFrameworkCmd added in v1.0.0

func NewFrameworkCmd() *cobra.Command

NewFrameworkCmd returns the framework parent command with subcommands.

func NewHorizonCmd added in v1.0.0

func NewHorizonCmd() *cobra.Command

NewHorizonCmd returns the horizon parent command with start/stop subcommands.

func NewHorizonStartCmd added in v1.0.0

func NewHorizonStartCmd() *cobra.Command

NewHorizonStartCmd returns the standalone horizon:start command.

func NewHorizonStopCmd added in v1.0.0

func NewHorizonStopCmd() *cobra.Command

NewHorizonStopCmd returns the standalone horizon:stop command.

func NewInitCmd added in v1.2.0

func NewInitCmd() *cobra.Command

NewInitCmd returns the init command.

func NewInstallCmd

func NewInstallCmd() *cobra.Command

NewInstallCmd returns the install command.

func NewIsolateCmd

func NewIsolateCmd() *cobra.Command

NewIsolateCmd returns the isolate command.

func NewIsolateNodeCmd

func NewIsolateNodeCmd() *cobra.Command

NewIsolateNodeCmd returns the isolate:node command.

func NewLinkCmd

func NewLinkCmd() *cobra.Command

NewLinkCmd returns the link command.

func NewLogsCmd added in v0.1.17

func NewLogsCmd() *cobra.Command

NewLogsCmd returns the logs command.

func NewMCPCmd added in v0.3.0

func NewMCPCmd() *cobra.Command

NewMCPCmd returns the mcp command — starts the MCP server over stdio.

func NewMCPEnableGlobalCmd added in v1.1.0

func NewMCPEnableGlobalCmd() *cobra.Command

NewMCPEnableGlobalCmd returns the mcp:enable-global command.

func NewMCPInjectCmd added in v0.3.0

func NewMCPInjectCmd() *cobra.Command

NewMCPInjectCmd returns the mcp:inject command.

func NewManCmd added in v1.0.0

func NewManCmd() *cobra.Command

NewManCmd returns the man command.

func NewMinioMigrateCmd added in v1.0.2

func NewMinioMigrateCmd() *cobra.Command

NewMinioMigrateCmd returns the minio:migrate command.

func NewNewCmd added in v1.1.0

func NewNewCmd() *cobra.Command

NewNewCmd returns the new command — scaffold a new PHP project.

func NewNodeCmd added in v0.1.16

func NewNodeCmd() *cobra.Command

NewNodeCmd returns the node command.

func NewNodeInstallCmd added in v0.5.9

func NewNodeInstallCmd() *cobra.Command

NewNodeInstallCmd returns the node:install command.

func NewNodeUninstallCmd added in v0.5.9

func NewNodeUninstallCmd() *cobra.Command

NewNodeUninstallCmd returns the node:uninstall command.

func NewNodeUseCmd added in v0.6.0

func NewNodeUseCmd() *cobra.Command

NewNodeUseCmd returns the node:use command.

func NewNpmCmd added in v0.1.16

func NewNpmCmd() *cobra.Command

NewNpmCmd returns the npm command.

func NewNpxCmd added in v0.1.16

func NewNpxCmd() *cobra.Command

NewNpxCmd returns the npx command.

func NewOpenCmd added in v0.3.0

func NewOpenCmd() *cobra.Command

NewOpenCmd returns the open command.

func NewParkCmd

func NewParkCmd() *cobra.Command

NewParkCmd returns the park command.

func NewPauseCmd added in v1.0.0

func NewPauseCmd() *cobra.Command

NewPauseCmd returns the pause command.

func NewPhpCmd added in v0.1.16

func NewPhpCmd() *cobra.Command

NewPhpCmd returns the php command — runs PHP in the appropriate FPM container.

func NewPhpExtCmd added in v0.5.5

func NewPhpExtCmd() *cobra.Command

NewPhpExtCmd returns the php:ext parent command.

func NewPhpIniCmd added in v0.5.5

func NewPhpIniCmd() *cobra.Command

NewPhpIniCmd returns the php:ini command.

func NewPhpListCmd

func NewPhpListCmd() *cobra.Command

NewPhpListCmd returns the php:list command.

func NewPhpRebuildCmd added in v0.1.17

func NewPhpRebuildCmd() *cobra.Command

NewPhpRebuildCmd returns the php:rebuild command.

func NewPhpShellCmd added in v1.0.1

func NewPhpShellCmd() *cobra.Command

NewPhpShellCmd returns the shell command — opens an interactive sh session in the PHP-FPM container.

func NewQueueCmd added in v0.3.0

func NewQueueCmd() *cobra.Command

NewQueueCmd returns the queue parent command with start/stop subcommands.

func NewQueueStartCmd added in v0.3.0

func NewQueueStartCmd() *cobra.Command

NewQueueStartCmd returns the standalone queue:start command.

func NewQueueStopCmd added in v0.3.0

func NewQueueStopCmd() *cobra.Command

NewQueueStopCmd returns the standalone queue:stop command.

func NewQuitCmd added in v0.7.0

func NewQuitCmd() *cobra.Command

NewQuitCmd returns the quit command.

func NewReverbCmd added in v0.8.0

func NewReverbCmd() *cobra.Command

NewReverbCmd returns the reverb parent command with start/stop subcommands.

func NewReverbStartCmd added in v0.8.0

func NewReverbStartCmd() *cobra.Command

NewReverbStartCmd returns the standalone reverb:start command.

func NewReverbStopCmd added in v0.8.0

func NewReverbStopCmd() *cobra.Command

NewReverbStopCmd returns the standalone reverb:stop command.

func NewScheduleCmd added in v0.8.0

func NewScheduleCmd() *cobra.Command

NewScheduleCmd returns the schedule parent command with start/stop subcommands.

func NewScheduleStartCmd added in v0.8.0

func NewScheduleStartCmd() *cobra.Command

NewScheduleStartCmd returns the standalone schedule:start command.

func NewScheduleStopCmd added in v0.8.0

func NewScheduleStopCmd() *cobra.Command

NewScheduleStopCmd returns the standalone schedule:stop command.

func NewSecureCmd

func NewSecureCmd() *cobra.Command

NewSecureCmd returns the secure command.

func NewServiceCmd

func NewServiceCmd() *cobra.Command

NewServiceCmd returns the service command with subcommands.

func NewSetupCmd added in v0.4.0

func NewSetupCmd() *cobra.Command

NewSetupCmd returns the setup command.

func NewShareCmd added in v0.4.0

func NewShareCmd() *cobra.Command

NewShareCmd returns the share command.

func NewSitesCmd

func NewSitesCmd() *cobra.Command

NewSitesCmd returns the sites command.

func NewStartCmd added in v0.1.11

func NewStartCmd() *cobra.Command

NewStartCmd returns the start command.

func NewStatusCmd

func NewStatusCmd() *cobra.Command

NewStatusCmd returns the status command.

func NewStopCmd added in v0.1.11

func NewStopCmd() *cobra.Command

NewStopCmd returns the stop command.

func NewStripeCmds added in v0.6.0

func NewStripeCmds() []*cobra.Command

NewStripeCmds returns Stripe-related subcommands.

func NewTestCmd added in v1.7.0

func NewTestCmd() *cobra.Command

NewTestCmd returns the `lerd test` command — shortcut for `lerd artisan test`.

func NewTrayCmd added in v0.5.0

func NewTrayCmd() *cobra.Command

NewTrayCmd returns the tray command.

func NewUninstallCmd

func NewUninstallCmd() *cobra.Command

NewUninstallCmd returns the uninstall command.

func NewUnlinkCmd

func NewUnlinkCmd() *cobra.Command

NewUnlinkCmd returns the unlink command.

func NewUnparkCmd added in v0.1.9

func NewUnparkCmd() *cobra.Command

NewUnparkCmd returns the unpark command.

func NewUnpauseCmd added in v1.0.0

func NewUnpauseCmd() *cobra.Command

NewUnpauseCmd returns the unpause command.

func NewUnsecureCmd added in v0.3.0

func NewUnsecureCmd() *cobra.Command

NewUnsecureCmd returns the unsecure command.

func NewUpdateCmd

func NewUpdateCmd(currentVersion string) *cobra.Command

NewUpdateCmd returns the update command.

func NewUseCmd

func NewUseCmd() *cobra.Command

NewUseCmd returns the use command.

func NewVendorBinCmd added in v1.7.0

func NewVendorBinCmd() *cobra.Command

NewVendorBinCmd returns the hidden `lerd vendor-bin <name> [args...]` command used by the top-level fallback in main.go to dispatch composer-installed binaries discovered in the project's vendor/bin directory.

func NewWhatsnewCmd added in v1.3.0

func NewWhatsnewCmd() *cobra.Command

NewWhatsnewCmd returns the whatsnew command.

func NewWhichCmd added in v1.5.0

func NewWhichCmd() *cobra.Command

NewWhichCmd returns the which command.

func NewWorkerCmd added in v1.0.0

func NewWorkerCmd() *cobra.Command

NewWorkerCmd returns the worker parent command with start/stop/list subcommands.

func NewXdebugCmd added in v0.4.0

func NewXdebugCmd() *cobra.Command

NewXdebugCmd returns the xdebug parent command with on/off/status subcommands.

func PauseSite added in v1.0.0

func PauseSite(name string) error

PauseSite stops all running workers for the site, replaces its nginx vhost with a landing page, and marks it paused in the registry.

func QueueRestartForSite added in v0.8.0

func QueueRestartForSite(siteName, sitePath, phpVersion string) error

QueueRestartForSite signals the Laravel queue worker to gracefully restart by running php artisan queue:restart inside the PHP-FPM container. It is a no-op when no queue unit exists for the site. systemd restarts the worker after the graceful exit because the unit uses Restart=always.

func QueueStartForSite added in v0.3.0

func QueueStartForSite(siteName, sitePath, phpVersion string) error

QueueStartForSite starts a queue worker for the given site with default settings.

func QueueStopForSite added in v0.3.0

func QueueStopForSite(siteName string) error

QueueStopForSite stops and removes the queue worker for the named site.

func RegenerateSiteVhost added in v1.5.0

func RegenerateSiteVhost(site *config.Site, oldPrimary string) error

RegenerateSiteVhost regenerates the nginx vhost for a site. If the primary domain changed (oldPrimary != current primary), it removes the old vhost file first.

func RegisterProject added in v0.3.0

func RegisterProject(projectDir string, cfg *config.GlobalConfig) (bool, error)

RegisterProject registers a single project directory as a lerd site if it looks like a PHP project. It detects the framework first; if none matches it falls back to auto-detecting the public directory. Returns true if newly registered.

func ReverbStartForSite added in v0.8.0

func ReverbStartForSite(siteName, sitePath, phpVersion string) error

ReverbStartForSite starts the Reverb WebSocket server for the named site.

func ReverbStopForSite added in v0.8.0

func ReverbStopForSite(siteName string) error

ReverbStopForSite stops and removes the Reverb unit for the named site.

func RunMCPEnableGlobal added in v1.1.0

func RunMCPEnableGlobal() error

RunMCPEnableGlobal registers lerd MCP at user scope for all supported AI tools. It is exported so the install command can call it directly.

func RunPHP added in v1.7.0

func RunPHP(cwd string, args []string) error

RunPHP execs `php <args...>` inside the project's PHP-FPM container, with stdio wired to the current terminal. Used by `lerd php`, the vendor/bin fallback, and other passthrough commands that need a PHP runtime.

func RunParallel added in v0.5.6

func RunParallel(jobs []BuildJob) error

RunParallel executes all jobs concurrently with a compact spinner UI. In a non-TTY environment it falls back to plain sequential output. Returns the first non-nil error, or nil if all jobs succeed.

func RunQuit added in v0.7.0

func RunQuit() error

RunQuit stops all lerd processes and containers (exported for use by the UI server).

func RunStart added in v0.7.0

func RunStart() error

RunStart starts all lerd services (exported for use by the UI server).

func RunStop added in v0.7.0

func RunStop() error

RunStop stops lerd containers (exported for use by the UI server).

func ScheduleStartForSite added in v0.8.0

func ScheduleStartForSite(siteName, sitePath, phpVersion string) error

ScheduleStartForSite starts the Laravel task scheduler for the named site.

func ScheduleStopForSite added in v0.8.0

func ScheduleStopForSite(siteName string) error

ScheduleStopForSite stops and removes the scheduler unit for the named site.

func SiteHasHorizon added in v1.0.0

func SiteHasHorizon(sitePath string) bool

SiteHasHorizon returns true if composer.json lists laravel/horizon as a dependency.

func SiteHasReverb added in v0.8.0

func SiteHasReverb(sitePath string) bool

SiteHasReverb returns true if composer.json lists laravel/reverb as a dependency.

func SiteUsesReverb added in v0.8.0

func SiteUsesReverb(sitePath string) bool

SiteUsesReverb returns true if the site uses Laravel Reverb — either as a composer dependency or with BROADCAST_CONNECTION=reverb in .env or .env.example.

func StripeSecretSet added in v0.6.0

func StripeSecretSet(sitePath string) bool

StripeSecretSet returns true if STRIPE_SECRET is present in the site's .env.

func StripeStartForSite added in v0.6.0

func StripeStartForSite(siteName, sitePath, siteBaseURL string) error

StripeStartForSite starts a Stripe listener for the given site, reading the key from its .env.

func StripeStopForSite added in v0.6.0

func StripeStopForSite(siteName string) error

StripeStopForSite stops and removes the Stripe listener for the named site.

func SyncLerdYAMLDomains added in v1.5.0

func SyncLerdYAMLDomains(projectPath string, fullDomains []string, tld string)

SyncLerdYAMLDomains updates the domains field in .lerd.yaml, stripping the TLD so the file stores portable name-only values.

func SyncLerdYAMLWorkers added in v1.5.0

func SyncLerdYAMLWorkers(site *config.Site)

SyncLerdYAMLWorkers updates the workers list in .lerd.yaml if the file exists. Skips paused sites so that stopping workers during pause does not erase the saved worker list (which is needed to restore them on unpause).

func UnlinkSite added in v0.3.0

func UnlinkSite(name string) error

UnlinkSite removes the nginx vhost for the named site. For sites under a parked directory, the registry entry is kept but marked Ignored so the watcher does not re-register it. For manually-linked sites the entry is removed entirely.

func UnpauseSite added in v1.0.0

func UnpauseSite(name string) error

UnpauseSite restores the site's nginx vhost, restarts any workers that were running when the site was paused, and clears the paused state.

func VendorBinExists added in v1.7.0

func VendorBinExists(cwd, name string) bool

VendorBinExists reports whether the project rooted at cwd has an executable vendor/bin/<name> on disk. Used by the top-level command-not-found fallback to decide whether to dispatch unknown subcommands to a composer binary.

func WorkerStartForSite added in v1.0.0

func WorkerStartForSite(siteName, sitePath, phpVersion, workerName string, w config.FrameworkWorker) error

WorkerStartForSite writes a systemd unit for the given framework worker and starts it. The unit name is lerd-{workerName}-{siteName}.

func WorkerStopForSite added in v1.0.0

func WorkerStopForSite(siteName, workerName string) error

WorkerStopForSite stops and removes the named worker unit for the given site.

Types

type BuildJob added in v0.5.6

type BuildJob struct {
	Label string
	Run   func(w io.Writer) error
}

BuildJob is a labeled build task that writes its output to the provided writer.

type StepRunner added in v0.5.6

type StepRunner struct {
	// contains filtered or unexported fields
}

StepRunner runs labeled steps sequentially with a compact in-place TUI. Each step's output is hidden by default; press Ctrl+O to toggle it. Falls back to plain " --> label ... OK" output when stdout is not a TTY.

func NewStepRunner added in v0.5.6

func NewStepRunner() *StepRunner

NewStepRunner creates and starts a StepRunner. Call Close() when all steps are done to restore the terminal.

func (*StepRunner) Close added in v0.5.6

func (r *StepRunner) Close()

Close stops the render loop, restores the terminal, and prints a final newline.

func (*StepRunner) Run added in v0.5.6

func (r *StepRunner) Run(label string, fn func(w io.Writer) error) error

Run executes fn as a labeled step. In TUI mode the step shows a spinner while running and ✓/✗ when done. Returns fn's error.

func (*StepRunner) RunInteractive added in v0.5.6

func (r *StepRunner) RunInteractive(label string, fn func() error) error

RunInteractive temporarily restores the terminal to cooked mode so that steps which need interactive sudo (password prompts, etc.) work correctly. The spinner pauses, the step runs with full terminal access, then raw mode resumes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL