mirror of
https://github.com/charmbracelet/crush.git
synced 2026-10-28 08:35:13 +08:00
API routes and docs now share one source of truth: a fluent registry
(internal/apigen) whose entries drive both mux registration and the
docs served at /v1/docs/ (plain HTML page plus an OpenAPI 3.1 spec).
Body schemas are derived from the real proto types via a small stdlib
reflection walker, so renamed types break the build and stale
annotation comments can no longer drift from the routes.
Removes the generated internal/swagger artifacts, the task swag
codegen step, and the swaggo dependencies.
💘 Generated with Crush
Assisted-by: Crush:kimi-k3
27 lines
550 B
Go
27 lines
550 B
Go
// Package main is the entry point for the Crush CLI.
|
|
package main
|
|
|
|
import (
|
|
"log/slog"
|
|
"net/http"
|
|
_ "net/http/pprof"
|
|
"os"
|
|
|
|
"github.com/charmbracelet/crush/internal/cmd"
|
|
_ "github.com/charmbracelet/crush/internal/dns"
|
|
_ "github.com/joho/godotenv/autoload"
|
|
)
|
|
|
|
func main() {
|
|
if os.Getenv("CRUSH_PROFILE") != "" {
|
|
go func() {
|
|
slog.Info("Serving pprof at localhost:6060")
|
|
if httpErr := http.ListenAndServe("localhost:6060", nil); httpErr != nil {
|
|
slog.Error("Failed to pprof listen", "error", httpErr)
|
|
}
|
|
}()
|
|
}
|
|
|
|
cmd.Execute()
|
|
}
|