main.go

 1// Package main is the entry point for the Crush CLI.
 2//
 3//	@title			Crush API
 4//	@version		1.0
 5//	@description	Crush is a terminal-based AI coding assistant. This API is served over a Unix socket (or Windows named pipe) and provides programmatic access to workspaces, sessions, agents, LSP, MCP, and more.
 6//	@contact.name	Charm
 7//	@contact.url	https://charm.sh
 8//	@license.name	MIT
 9//	@license.url	https://github.com/charmbracelet/crush/blob/main/LICENSE
10//	@BasePath		/v1
11package main
12
13import (
14	"log/slog"
15	"net/http"
16	_ "net/http/pprof"
17	"os"
18
19	"github.com/charmbracelet/crush/internal/cmd"
20	_ "github.com/joho/godotenv/autoload"
21)
22
23func main() {
24	if os.Getenv("CRUSH_PROFILE") != "" {
25		go func() {
26			slog.Info("Serving pprof at localhost:6060")
27			if httpErr := http.ListenAndServe("localhost:6060", nil); httpErr != nil {
28				slog.Error("Failed to pprof listen", "error", httpErr)
29			}
30		}()
31	}
32
33	cmd.Execute()
34}