feat(conga,dev): worker and scheduler reports, summer dev runs serve

- queue:work and schedule:run print a startup summary and a shutdown
  report on a terminal, log them as records otherwise, and return nil
  after a clean stop
- schedule:run --once ends with 'Ran N due entries (M failed)'
- summer dev runs bin/<app> serve with the forwarded global options,
  reports through Output, stops the old server before starting the new
  one and prints a dev report on Ctrl+C (exit 0)
- lagoon.DatabaseLabel describes a DSN without its secrets
- Long help and examples for queue:work, schedule:run, dev, docs:serve
This commit is contained in:
Jakub Zych
2026-10-21 13:04:27 +02:00
parent c38dc1fe48
commit 168d65cd1b
15 changed files with 319 additions and 81 deletions

View File

@@ -89,6 +89,14 @@ func docsServeCommand() bonfire.Command {
return bonfire.Command{
Name: "docs:serve",
Description: "Build the documentation site and preview it on a local address",
Long: `Builds the documentation site like docs:build into a temporary directory and
serves it on a loopback address. It watches the docs sources and the files
their src= references point to, and rebuilds on change; a failed rebuild keeps
the last good site. Ctrl+C stops the server and exits 0.`,
Examples: []bonfire.Example{
{Command: "docs:serve", Description: "Preview the docs of the current repository on " + docsite.DefaultServeAddr},
{Command: "docs:serve --addr 127.0.0.1:4100", Description: "Use another port"},
},
Flags: []bonfire.Flag{
{Name: "root", Description: "Repository root; src= paths and modules/ resolve against it", Default: "."},
{Name: "src", Description: "Docs source directory (default <root>/docs)"},

View File

@@ -4,7 +4,9 @@ import (
"context"
"fmt"
"os"
"os/signal"
"strings"
"syscall"
"git.golem15.com/golem15/summercms/internal/build"
"git.golem15.com/golem15/summercms/internal/dev"
@@ -256,12 +258,27 @@ func devCommand() bonfire.Command {
return bonfire.Command{
Name: "dev",
Description: "Watch sources and rebuild the app binary",
Long: `Builds the application in the current directory, runs bin/<binary> serve and
watches the application's Go, YAML, go.mod, go.work, summer.yaml and .env
files (bin/, tmp/, .git/, main.go and plugins.gen.go excluded). After a change
it rebuilds and restarts serve; a failed build keeps the running server.
The global options summer dev was given (-v, -q, --ansi, --no-ansi, -n,
--env) are passed on to serve. Ctrl+C stops serve, which prints its own
shutdown report, then prints the dev report (rebuilds, failed builds,
restarts, uptime) and exits 0.`,
Examples: []bonfire.Example{
{Command: "dev", Description: "Build, serve and rebuild on every change"},
{Command: "dev -v", Description: "Pass -v on to serve: per-plugin summary lines and info logs of every component"},
},
Run: func(ctx context.Context, in bonfire.Input, out bonfire.Output) error {
dir, err := os.Getwd()
if err != nil {
return err
}
return dev.Watch(ctx, dir, out)
ctx, stop := signal.NotifyContext(ctx, os.Interrupt, syscall.SIGTERM)
defer stop()
return dev.Watch(ctx, dir, out, bonfire.GlobalsOf(out).Args())
},
}
}